summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-01-18 23:31:06 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-01-18 23:31:06 -0500
commit9e28f924c23294a531e4fd15932abd0416d3eb84 (patch)
tree760c113cce3958558cbd8c343d6064163835f4ac /lib/db.php
parentda34e58589152f0c696f4eb802f8a4e3b900de0d (diff)
parenta17ca3a69aae0dde9aaf24f23aeffdd8658829f0 (diff)
downloadnextcloud-server-9e28f924c23294a531e4fd15932abd0416d3eb84.tar.gz
nextcloud-server-9e28f924c23294a531e4fd15932abd0416d3eb84.zip
Merge branch 'master' into move-datadirectory-checks
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/db.php b/lib/db.php
index 74e7ca5b0e0..5224d5ee7da 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -41,6 +41,8 @@ class OC_DB {
const BACKEND_PDO=0;
const BACKEND_MDB2=1;
+ static private $preparedQueries = array();
+
/**
* @var MDB2_Driver_Common
*/
@@ -121,6 +123,7 @@ class OC_DB {
return true;
}
}
+ self::$preparedQueries = array();
// The global data we need
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
@@ -201,6 +204,7 @@ class OC_DB {
return true;
}
}
+ self::$preparedQueries = array();
// The global data we need
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
@@ -321,7 +325,12 @@ class OC_DB {
$query.=$limitsql;
}
}
+ } else {
+ if (isset(self::$preparedQueries[$query])) {
+ return self::$preparedQueries[$query];
+ }
}
+ $rawQuery = $query;
// Optimize the query
$query = self::processQuery( $query );
@@ -343,6 +352,9 @@ class OC_DB {
}
$result=new PDOStatementWrapper($result);
}
+ if (is_null($limit) || $limit == -1) {
+ self::$preparedQueries[$rawQuery] = $result;
+ }
return $result;
}
@@ -588,7 +600,7 @@ class OC_DB {
error_log('DB error: '.$entry);
OC_Template::printErrorPage( $entry );
}
-
+
if($result->numRows() == 0) {
$query = 'INSERT INTO "' . $table . '" ("'
. implode('","', array_keys($input)) . '") VALUES("'
@@ -623,7 +635,7 @@ class OC_DB {
return $result->execute();
}
-
+
/**
* @brief does minor changes to query
* @param string $query Query string