Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ocsms.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-04-10 09:26:34 +0300
committerLoic Blot <loic.blot@unix-experience.fr>2018-04-10 09:26:43 +0300
commit80d025d023dcee900929dc69519a0d40dc879f11 (patch)
treee9d9a78e97b5e3f2a991b90523ec41f0344984ee /db
parentb86026759945bf7026a2f1c03b269642239706a6 (diff)
Migrate one function to the new querybuilder for NC 14
Diffstat (limited to 'db')
-rw-r--r--db/smsmapper.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/db/smsmapper.php b/db/smsmapper.php
index 6f2a1b0..13b0cc0 100644
--- a/db/smsmapper.php
+++ b/db/smsmapper.php
@@ -39,12 +39,14 @@ class SmsMapper extends Mapper {
}
public function getAllIds ($userId) {
- $query = \OCP\DB::prepare('SELECT sms_id, sms_mailbox FROM ' .
- '*PREFIX*ocsms_smsdatas WHERE user_id = ?');
- $result = $query->execute(array($userId));
+ $qb = $this->db->getQueryBuilder();
+ $qb->select('sms_id, sms_mailbox')
+ ->from('ocsms_smsdatas')
+ ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
+ $result = $qb->execute();
$smsList = array();
- while($row = $result->fetchRow()) {
+ while($row = $result->fetch()) {
// This case may not arrive, but we test if the DB is consistent
if (!in_array((int) $row["sms_mailbox"], SmsMapper::$mailboxNames)) {
continue;
@@ -58,6 +60,7 @@ class SmsMapper extends Mapper {
array_push($smsList[$mbox], $row["sms_id"]);
}
}
+ $result->closeCursor();
return $smsList;
}