summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-05 16:04:40 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-12 08:24:08 +0100
commit9f4b296685d0dc14b586aa936eb713113b9c3ef5 (patch)
treeb801392ac7f735df796ff4257df1cc458b03fc47 /lib
parent9e322828f259c8cebb9953a5a315c2eacfa26ac2 (diff)
downloadnextcloud-server-9f4b296685d0dc14b586aa936eb713113b9c3ef5.tar.gz
nextcloud-server-9f4b296685d0dc14b586aa936eb713113b9c3ef5.zip
Properly close cursors
Diffstat (limited to 'lib')
-rw-r--r--lib/private/group/database.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/private/group/database.php b/lib/private/group/database.php
index b85cb72d859..1aa821db087 100644
--- a/lib/private/group/database.php
+++ b/lib/private/group/database.php
@@ -91,12 +91,15 @@ class OC_Group_Database extends OC_Group_Backend {
} else {
// Check for existence in DB
$qb = $this->dbConn->getQueryBuilder();
- $result = $qb->select('gid')
+ $cursor = $qb->select('gid')
->from('groups')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
->execute();
- if( $result->fetch() ) {
+ $result = $cursor->fetch();
+ $cursor->closeCursor();
+
+ if($result) {
// Can not add an existing group
// Add to cache
@@ -169,13 +172,16 @@ class OC_Group_Database extends OC_Group_Backend {
// check
$qb = $this->dbConn->getQueryBuilder();
- $result = $qb->select('uid')
+ $cursor = $qb->select('uid')
->from('group_user')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
->execute();
- return $result->fetch() ? true : false;
+ $result = $cursor->fetch();
+ $cursor->closeCursor();
+
+ return $result ? true : false;
}
/**
@@ -235,16 +241,17 @@ class OC_Group_Database extends OC_Group_Backend {
// No magic!
$qb = $this->dbConn->getQueryBuilder();
- $result = $qb->select('gid')
+ $cursor = $qb->select('gid')
->from('group_user')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
->execute();
$groups = [];
- while( $row = $result->fetch()) {
+ while( $row = $cursor->fetch()) {
$groups[] = $row["gid"];
$this->groupCache[$row['gid']] = $row['gid'];
}
+ $cursor->closeCursor();
return $groups;
}