| @@ 133-137 (lines=5) @@ | ||
| 130 | ||
| 131 | $stmt = \OCP\DB::prepare($query); |
|
| 132 | $result = $stmt->execute($params); |
|
| 133 | if (\OCP\DB::isError($result)) { |
|
| 134 | \OCP\Util::writeLog('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), |
|
| 135 | \OCP\Util::ERROR); |
|
| 136 | return false; |
|
| 137 | } |
|
| 138 | while ($row = $result->fetchRow()) { |
|
| 139 | $id = $row['contactid']; |
|
| 140 | $addressbookKey = $row['addressbookid']; |
|
| @@ 219-223 (lines=5) @@ | ||
| 216 | $query = 'SELECT COUNT(*) as `count` FROM `*PREFIX*contacts_cards` WHERE `id` = ? AND `addressbookid` = ?'; |
|
| 217 | $stmt = \OCP\DB::prepare($query); |
|
| 218 | $result = $stmt->execute(array($id, $this->id)); |
|
| 219 | if (\OCP\DB::isError($result)) { |
|
| 220 | \OCP\Util::writeLog('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), |
|
| 221 | \OCP\Util::ERROR); |
|
| 222 | return false; |
|
| 223 | } |
|
| 224 | if((int)$result['count'] === 0) { |
|
| 225 | \OCP\Util::writeLog('contacts', __METHOD__ |
|
| 226 | . 'Contact with id ' . $id . 'doesn\'t belong to addressbook with id ' . $this->id, |
|
| @@ 101-105 (lines=5) @@ | ||
| 98 | $result = $this->getPreparedQuery('getaddressbooksforuser') |
|
| 99 | ->execute(array($this->userid)); |
|
| 100 | ||
| 101 | if (\OCP\DB::isError($result)) { |
|
| 102 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' |
|
| 103 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 104 | return $this->addressBooks; |
|
| 105 | } |
|
| 106 | ||
| 107 | } catch(\Exception $e) { |
|
| 108 | \OCP\Util::writeLog('contacts', __METHOD__.' exception: ' |
|
| @@ 153-157 (lines=5) @@ | ||
| 150 | try { |
|
| 151 | $result = $this->getPreparedQuery('getaddressbook')->execute(array($addressBookId, $owner)); |
|
| 152 | ||
| 153 | if (\OCP\DB::isError($result)) { |
|
| 154 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' |
|
| 155 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 156 | return null; |
|
| 157 | } |
|
| 158 | ||
| 159 | $row = $result->fetchRow(); |
|
| 160 | ||
| @@ 244-249 (lines=6) @@ | ||
| 241 | $stmt = \OCP\DB::prepare($query); |
|
| 242 | $result = $stmt->execute($updates); |
|
| 243 | ||
| 244 | if (\OCP\DB::isError($result)) { |
|
| 245 | \OCP\Util::writeLog('contacts', |
|
| 246 | __METHOD__. 'DB error: ' |
|
| 247 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 248 | return false; |
|
| 249 | } |
|
| 250 | ||
| 251 | } catch(\Exception $e) { |
|
| 252 | \OCP\Util::writeLog('contacts', |
|
| @@ 289-292 (lines=4) @@ | ||
| 286 | try { |
|
| 287 | $result = $this->getPreparedQuery('createaddressbook')->execute($updates); |
|
| 288 | ||
| 289 | if (\OCP\DB::isError($result)) { |
|
| 290 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 291 | return false; |
|
| 292 | } |
|
| 293 | ||
| 294 | } catch(\Exception $e) { |
|
| 295 | \OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR); |
|
| @@ 327-331 (lines=5) @@ | ||
| 324 | $result = $this->getPreparedQuery('getcontactids') |
|
| 325 | ->execute(array($addressBookId)); |
|
| 326 | ||
| 327 | if (\OCP\DB::isError($result)) { |
|
| 328 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' |
|
| 329 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 330 | return false; |
|
| 331 | } |
|
| 332 | ||
| 333 | } catch(\Exception $e) { |
|
| 334 | \OCP\Util::writeLog('contacts', __METHOD__. |
|
| @@ 426-429 (lines=4) @@ | ||
| 423 | ||
| 424 | $result = $this->getPreparedQuery('numcontacts')->execute(array($addressBookId)); |
|
| 425 | ||
| 426 | if (\OCP\DB::isError($result)) { |
|
| 427 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 428 | return null; |
|
| 429 | } |
|
| 430 | ||
| 431 | return (int)$result->fetchOne(); |
|
| 432 | } |
|
| @@ 447-450 (lines=4) @@ | ||
| 444 | ||
| 445 | $result = $this->getPreparedQuery($queryIdentifier, $options)->execute(array($addressBookId)); |
|
| 446 | ||
| 447 | if (\OCP\DB::isError($result)) { |
|
| 448 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 449 | return $cards; |
|
| 450 | } |
|
| 451 | ||
| 452 | } catch(\Exception $e) { |
|
| 453 | \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); |
|
| @@ 527-530 (lines=4) @@ | ||
| 524 | //\OCP\Util::writeLog('contacts', __METHOD__.', identifier: '. $queryIdentifier . ', queries: ' . implode(',', $queries), \OCP\Util::DEBUG); |
|
| 525 | $result = $this->getPreparedQuery($queryIdentifier)->execute($queries); |
|
| 526 | ||
| 527 | if (\OCP\DB::isError($result)) { |
|
| 528 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 529 | return null; |
|
| 530 | } |
|
| 531 | ||
| 532 | } catch (\Exception $e) { |
|
| 533 | \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); |
|
| @@ 625-628 (lines=4) @@ | ||
| 622 | ) |
|
| 623 | ); |
|
| 624 | ||
| 625 | if (\OCP\DB::isError($result)) { |
|
| 626 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 627 | return false; |
|
| 628 | } |
|
| 629 | ||
| 630 | } catch(\Exception $e) { |
|
| 631 | \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); |
|
| @@ 711-714 (lines=4) @@ | ||
| 708 | ||
| 709 | $result = $this->getPreparedQuery('updatecontact')->execute($updates); |
|
| 710 | ||
| 711 | if (\OCP\DB::isError($result)) { |
|
| 712 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 713 | return false; |
|
| 714 | } |
|
| 715 | ||
| 716 | } catch(\Exception $e) { |
|
| 717 | \OCP\Util::writeLog('contacts', __METHOD__.', exception: ' |
|
| @@ 793-797 (lines=5) @@ | ||
| 790 | $result = $this->getPreparedQuery('deletecontact') |
|
| 791 | ->execute(array($id, $addressBookId)); |
|
| 792 | ||
| 793 | if (\OCP\DB::isError($result)) { |
|
| 794 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' |
|
| 795 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 796 | return false; |
|
| 797 | } |
|
| 798 | ||
| 799 | } catch(\Exception $e) { |
|
| 800 | \OCP\Util::writeLog('contacts', __METHOD__. |
|
| @@ 839-842 (lines=4) @@ | ||
| 836 | $stmt = $this->getPreparedQuery('contactidfromuri'); |
|
| 837 | $result = $stmt->execute(array($addressBookId,$uri)); |
|
| 838 | ||
| 839 | if (\OCP\DB::isError($result)) { |
|
| 840 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 841 | return null; |
|
| 842 | } |
|
| 843 | ||
| 844 | $one = $result->fetchOne(); |
|
| 845 | ||
| @@ 868-874 (lines=7) @@ | ||
| 865 | $stmt = $this->getPreparedQuery('addressbookuris'); |
|
| 866 | $result = $stmt->execute(array($this->userid)); |
|
| 867 | ||
| 868 | if (\OCP\DB::isError($result)) { |
|
| 869 | \OCP\Util::writeLog('contacts', |
|
| 870 | __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), |
|
| 871 | \OCP\Util::ERROR |
|
| 872 | ); |
|
| 873 | return $name; |
|
| 874 | } |
|
| 875 | ||
| 876 | } catch(\Exception $e) { |
|
| 877 | \OCP\Util::writeLog('contacts', __METHOD__ . ' exception: ' . $e->getMessage(), \OCP\Util::ERROR); |
|
| @@ 293-297 (lines=5) @@ | ||
| 290 | $preferred, |
|
| 291 | ) |
|
| 292 | ); |
|
| 293 | if (\OCP\DB::isError($result)) { |
|
| 294 | \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' |
|
| 295 | . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); |
|
| 296 | return false; |
|
| 297 | } |
|
| 298 | } catch(\Exception $e) { |
|
| 299 | \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); |
|
| 300 | return false; |
|