* @return insertid
*/
public static function add($uid,$name,$description=''){
- $all = self::all($uid);
+ try {
+ $stmt = OCP\DB::prepare( 'SELECT uri FROM *PREFIX*contacts_addressbooks WHERE userid = ? ' );
+ $result = $stmt->execute(array($uid));
+ } catch(Exception $e) {
+ OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' uid: '.$uid,OCP\Util::DEBUG);
+ return false;
+ }
$uris = array();
- foreach($all as $i){
- $uris[] = $i['uri'];
+ while($row = $result->fetchRow()){
+ $uris[] = $row['uri'];
}
$uri = self::createURI($name, $uris );