only create one connection to a sqlite3 database, fixes 'Database locked' errors with webdav
This commit is contained in:
parent
c4e7761ee8
commit
51420a7522
|
@ -348,6 +348,9 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
|
||||||
**/
|
**/
|
||||||
function connect()
|
function connect()
|
||||||
{
|
{
|
||||||
|
if($this->connection instanceof SQLite3){
|
||||||
|
return MDB2_OK;
|
||||||
|
}
|
||||||
global $SERVERROOT;
|
global $SERVERROOT;
|
||||||
$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
|
$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
|
||||||
$database_file = $this->_getDatabaseFile($this->database_name);
|
$database_file = $this->_getDatabaseFile($this->database_name);
|
||||||
|
@ -409,6 +412,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
|
||||||
|
|
||||||
$php_errormsg = '';
|
$php_errormsg = '';
|
||||||
$this->connection = new SQLite3($database_file);
|
$this->connection = new SQLite3($database_file);
|
||||||
|
$this->connection->busyTimeout(100);
|
||||||
$this->_lasterror = $this->connection->lastErrorMsg();
|
$this->_lasterror = $this->connection->lastErrorMsg();
|
||||||
if (!$this->connection) {
|
if (!$this->connection) {
|
||||||
return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
|
return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
|
||||||
|
@ -1346,6 +1350,10 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
|
||||||
$result =$this->_execute($result_class, $result_wrap_class);
|
$result =$this->_execute($result_class, $result_wrap_class);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __destruct() {
|
||||||
|
$this->free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue