exec() public method

Executes an SQL statement and return the number of affected rows
public exec ( mixed $sql ) : integer
$sql mixed The SQL statement with placeholders. May be a string or Zend_Db_Select.
return integer Number of rows that were modified or deleted by the SQL statement
Esempio n. 1
0
 /**
  * 执行SQL语句
  * 
  * @param string|Zend_Db_Select $sql
  * @param boolean $commit
  * @return integer
  */
 protected function _exec($sql, $commit = true)
 {
     $affected = $this->_db->exec($sql);
     if ($commit) {
         $this->_db->exec('COMMIT');
     }
     return $affected;
 }