summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/db.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/db.php b/lib/db.php
index 74e7ca5b0e0..c5908afe69b 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
*/
@@ -321,7 +323,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 +350,9 @@ class OC_DB {
}
$result=new PDOStatementWrapper($result);
}
+ if (is_null($limit) || $limit == -1) {
+ self::$preparedQueries[$rawQuery] = $result;
+ }
return $result;
}