示例#1
0
文件: abstract.php 项目: nouphet/rata
 /**
  * Delete record
  *
  * @param mixed $key
  * @return boolean
  */
 function delete($key)
 {
     $format = 'DELETE FROM `%s` WHERE `%s`=%s';
     $sql = sprintf($format, $this->_tableName, $this->_keyField, $this->_key4sql($key));
     if ($this->_query($sql)) {
         if ($this->_db->getAffectedRows() > 0) {
             return true;
         } else {
             $this->_error .= ' No record was deleted.';
             return false;
         }
     } else {
         return false;
     }
 }