diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-01-16 19:04:50 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-01-16 19:04:50 +0100 |
commit | 5445b94416f50bb040e7426cadfa458607893f07 (patch) | |
tree | 337b12362333030e0ebda37acb7f25073723a7af /lib/db.php | |
parent | 7debfac0dc8f602168d8db480cfd4757b4d612b0 (diff) | |
parent | 1d57a2e2a9d5e392bb1061479543cd1dec860c4b (diff) | |
download | nextcloud-server-5445b94416f50bb040e7426cadfa458607893f07.tar.gz nextcloud-server-5445b94416f50bb040e7426cadfa458607893f07.zip |
merge master into filesystem
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 16 |
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 |