示例#1
0
 /**
  * @see Gacela\DataSource\iDataSource::delete()
  * @throws \Exception
  * @param  $name
  * @param \Gacela\DataSource\Query\Sql $where
  * @return bool
  */
 public function delete($name, \Gacela\DataSource\Query\Query $where)
 {
     $this->_setLastQuery($where->delete($name));
     $query = $this->_adapter->prepare($this->_lastQuery['query']);
     if ($query->execute($this->_lastQuery['args'])) {
         if ($query->rowCount() == 0) {
             return false;
         }
         return true;
     } else {
         throw new \Exception('Update failed with errors: <pre>' . print_r($query->errorInfo(), true) . print_r($query, true) . '</pre>');
     }
 }
示例#2
0
 /**
  * @abstract
  * @param  $name
  * @param \Gacela\Criteria $where
  * @return bool
  */
 public function delete($name, \Gacela\DataSource\Query\Query $where)
 {
     list($query, $args) = $where->delete($name)->assemble();
     $rs = $this->_adapter->delete($args['Ids']);
     if (is_object($rs)) {
         $rs = array($rs);
     }
     $success = true;
     foreach ($rs as $r) {
         if (!$r->success) {
             $success = false;
         }
     }
     return $success;
 }