Horde_Db_Adapter::delete PHP Method

delete() public method

Executes the delete statement and returns the number of rows affected.
public delete ( string $sql, mixed $arg1 = null, string $arg2 = null ) : integer
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return integer Number of rows affected.
    public function delete($sql, $arg1 = null, $arg2 = null);

Usage Example

示例#1
0
文件: Db.php 项目: horde/horde
 public function getMany($num = 50)
 {
     $tasks = array();
     $values = array();
     $query = 'SELECT * FROM horde_queue_tasks where task_queue = ? ORDER BY task_id LIMIT ?';
     $values[] = $this->_queue;
     $values[] = $num;
     try {
         $rows = $this->_db->select($query, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Horde_Queue_Exception($e);
     }
     $query = 'DELETE FROM horde_queue_tasks WHERE task_id = ?';
     foreach ($rows as $row) {
         $tasks[] = unserialize($row['task_fields']);
         // TODO: Evaluate if a single call for all IDs is faster for
         // various scenarios
         try {
             $this->_db->delete($query, array($row['task_id']));
         } catch (Horde_Db_Exception $e) {
             throw new Horde_Queue_Exception($e);
         }
     }
     return $tasks;
 }
All Usage Examples Of Horde_Db_Adapter::delete