summaryrefslogtreecommitdiffstats
path: root/lib/MDB2
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-06-17 16:09:43 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-06-17 16:09:43 +0200
commit51420a75228d10c803f102eefa3264484675616e (patch)
tree212628d15ec4864781d292460177f0b482adff8b /lib/MDB2
parentc4e7761ee814f18ff6dca4e88f13b3bf05959290 (diff)
downloadnextcloud-server-51420a75228d10c803f102eefa3264484675616e.tar.gz
nextcloud-server-51420a75228d10c803f102eefa3264484675616e.zip
only create one connection to a sqlite3 database, fixes 'Database locked' errors with webdav
Diffstat (limited to 'lib/MDB2')
-rw-r--r--lib/MDB2/Driver/sqlite3.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php
index abd2b16ad4b..a569da187aa 100644
--- a/lib/MDB2/Driver/sqlite3.php
+++ b/lib/MDB2/Driver/sqlite3.php
@@ -348,6 +348,9 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
**/
function connect()
{
+ if($this->connection instanceof SQLite3){
+ return MDB2_OK;
+ }
global $SERVERROOT;
$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
$database_file = $this->_getDatabaseFile($this->database_name);
@@ -409,6 +412,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
$php_errormsg = '';
$this->connection = new SQLite3($database_file);
+ $this->connection->busyTimeout(100);
$this->_lasterror = $this->connection->lastErrorMsg();
if (!$this->connection) {
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);
return $result;
}
+
+ function __destruct() {
+ $this->free();
+ }
}
?> \ No newline at end of file