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.
Ejemplo n.º 1
0
 /**
  * Erases all mapping entries for one combination of user, device ID.
  *
  * This is used during SlowSync so that we really sync everything properly
  * and no old mapping entries remain.
  *
  * @param string $databaseURI  URI of database to sync. Like calendar,
  *                             tasks, contacts or notes. May include
  *                             optional parameters:
  *                             tasks?options=ignorecompleted.
  */
 public function eraseMap($databaseURI)
 {
     $database = $this->normalize($databaseURI);
     $query = 'DELETE FROM horde_syncml_map ' . 'WHERE syncml_syncpartner = ? AND syncml_db = ? AND ' . 'syncml_uid = ?';
     $values = array($this->_syncDeviceID, $database, $this->_user);
     $this->_db->delete($query, $values);
 }
Ejemplo n.º 2
0
Archivo: Sql.php Proyecto: horde/horde
 /**
  */
 public function deleteStory($channel_id, $story_id)
 {
     $sql = 'DELETE FROM jonah_stories' . ' WHERE channel_id = ? AND story_id = ?';
     $values = array((int) $channel_id, (int) $story_id);
     Horde::log('SQL Query by Jonah_Driver_sql::deleteStory(): ' . $sql, 'DEBUG');
     try {
         $this->_db->delete($sql, $values);
     } catch (Horde_Db_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         throw new Jonah_Exception($e);
     }
 }
Ejemplo n.º 3
0
 /**
  * Save an attribute value.
  *
  * @param integer $ticket_id       A ticket ID.
  * @param integer $attribute_id    An attribute ID.
  * @param string $attribute_value  An attribute value.
  *
  * @throws Whups_Exception
  */
 protected function _setAttributeValue($ticket_id, $attribute_id, $attribute_value)
 {
     $db_attribute_value = $this->_toBackend($attribute_value);
     $this->_db->beginDbTransaction();
     try {
         $this->_db->delete('DELETE FROM whups_attributes WHERE ticket_id = ? ' . 'AND attribute_id = ?', array($ticket_id, $attribute_id));
         if (strlen($attribute_value)) {
             $this->_db->insert('INSERT INTO whups_attributes (ticket_id, attribute_id, attribute_value) VALUES (?, ?, ?)', array($ticket_id, $attribute_id, $db_attribute_value));
         }
         $this->_db->commitDbTransaction();
     } catch (Horde_Db_Exception $e) {
         $this->_db->rollbackDbTransaction();
         throw new Whups_Exception($e);
     }
 }