aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-03-19 17:04:01 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-03-19 17:04:01 +0100
commit3765af4edf6662b29881f0b430e4080301c1b2fc (patch)
tree201fdbfbc9e8c146e0316c085eb6941bce3016d1 /lib/public
parent73874ca27f102b40f40df70367e01a4045a17b3e (diff)
parentf77ae37f23b16996ae6b33c5d6b9188e33435b55 (diff)
downloadnextcloud-server-3765af4edf6662b29881f0b430e4080301c1b2fc.tar.gz
nextcloud-server-3765af4edf6662b29881f0b430e4080301c1b2fc.zip
Merge pull request #14986 from owncloud/fixmapperbackw
Fix backwards compatibility for mapper execute method
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/appframework/db/mapper.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php
index 5143547c8e8..aaef0f79d27 100644
--- a/lib/public/appframework/db/mapper.php
+++ b/lib/public/appframework/db/mapper.php
@@ -26,7 +26,8 @@
namespace OCP\AppFramework\Db;
-use \OCP\IDBConnection;
+use OCP\IDBConnection;
+use OCP\IDb;
/**
@@ -193,7 +194,11 @@ abstract class Mapper {
* @return \PDOStatement the database query result
*/
protected function execute($sql, array $params=[], $limit=null, $offset=null){
- $query = $this->db->prepare($sql, $limit, $offset);
+ if ($this->db instanceof IDb) {
+ $query = $this->db->prepareQuery($sql, $limit, $offset);
+ } else {
+ $query = $this->db->prepare($sql, $limit, $offset);
+ }
$index = 1; // bindParam is 1 indexed
foreach($params as $param) {
@@ -217,7 +222,16 @@ abstract class Mapper {
$index++;
}
- $query->execute();
+ $result = $query->execute();
+
+ // this is only for backwards compatibility reasons and can be removed
+ // in owncloud 10. IDb returns a StatementWrapper from execute, PDO,
+ // Doctrine and IDbConnection don't so this needs to be done in order
+ // to stay backwards compatible for the things that rely on the
+ // StatementWrapper being returned
+ if ($result instanceof \OC_DB_StatementWrapper) {
+ return $result;
+ }
return $query;
}