diff options
author | jfd <jfd@lance> | 2012-08-25 02:27:43 +0200 |
---|---|---|
committer | jfd <jfd@lance> | 2012-08-25 02:27:43 +0200 |
commit | e8ffd5c04249f84770e618eeb57f39c2e93afe35 (patch) | |
tree | 367f12d4c4f22ea9fcf82c61743c31f8fe182d2f /apps/contacts/lib | |
parent | 1bfe26bb097d163ff1a6e7e1a1aee5dd9c628f79 (diff) | |
download | nextcloud-server-e8ffd5c04249f84770e618eeb57f39c2e93afe35.tar.gz nextcloud-server-e8ffd5c04249f84770e618eeb57f39c2e93afe35.zip |
use limit parameter instead of LIMIT SQL for vcard
Diffstat (limited to 'apps/contacts/lib')
-rw-r--r-- | apps/contacts/lib/vcard.php | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 042ad1e990b..91a5b806b10 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -48,31 +48,23 @@ class OC_Contacts_VCard { * ['carddata'] */ public static function all($id, $start=null, $num=null){ - //FIXME jfd: use limit & offset as OC_DB::prepare parameters for oracle support - $limitsql = ''; - if(!is_null($num)) { - $limitsql = ' LIMIT '.$num; - } - if(!is_null($start) && !is_null($num)) { - $limitsql .= ' OFFSET '.$start.' '; - } $result = null; if(is_array($id) && count($id)) { $id_sql = join(',', array_fill(0, count($id), '?')); - $prep = 'SELECT * FROM `*PREFIX*contacts_cards` WHERE `addressbookid` IN ('.$id_sql.') ORDER BY `fullname`'.$limitsql; + $sql = 'SELECT * FROM `*PREFIX*contacts_cards` WHERE `addressbookid` IN ('.$id_sql.') ORDER BY `fullname`'; try { - $stmt = OCP\DB::prepare( $prep ); + $stmt = OCP\DB::prepare( $sql, $num, $start ); $result = $stmt->execute($id); } catch(Exception $e) { OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR); OCP\Util::writeLog('contacts', __METHOD__.', ids: '.join(',', $id), OCP\Util::DEBUG); - OCP\Util::writeLog('contacts', __METHOD__.'SQL:'.$prep, OCP\Util::DEBUG); + OCP\Util::writeLog('contacts', __METHOD__.'SQL:'.$sql, OCP\Util::DEBUG); return false; } } elseif(is_int($id) || is_string($id)) { try { - $sql = 'SELECT * FROM `*PREFIX*contacts_cards` WHERE `addressbookid` = ? ORDER BY `fullname`'.$limitsql; - $stmt = OCP\DB::prepare( $sql ); + $sql = 'SELECT * FROM `*PREFIX*contacts_cards` WHERE `addressbookid` = ? ORDER BY `fullname`'; + $stmt = OCP\DB::prepare( $sql, $num, $start ); $result = $stmt->execute(array($id)); } catch(Exception $e) { OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR); |