Horde_Db_Adapter_Base::update PHP Method

update() public method

Executes the update statement and returns the number of rows affected.
public update ( 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 update($sql, $arg1 = null, $arg2 = null)
    {
        $this->execute($sql, $arg1, $arg2);
        return $this->_rowCount;
    }

Usage Example

示例#1
0
文件: Horde.php 项目: raz0rsdge/horde
 /**
  * Creates a map entry to map between server and client IDs.
  *
  * If an entry already exists, it is overwritten.
  *
  * @param string $databaseURI  URI of database to sync. Like calendar,
  *                             tasks, contacts or notes. May include
  *                             optional parameters:
  *                             tasks?options=ignorecompleted.
  * @param string $cuid         Client ID of the entry.
  * @param string $suid         Server ID of the entry.
  * @param integer $timestamp   Optional timestamp. This can be used to
  *                             'tag' changes made in the backend during the
  *                             sync process. This allows to identify these,
  *                             and ensure that these changes are not
  *                             replicated back to the client (and thus
  *                             duplicated). See key concept "Changes and
  *                             timestamps".
  */
 public function createUidMap($databaseURI, $cuid, $suid, $timestamp = 0)
 {
     $database = $this->normalize($databaseURI);
     $values = array($suid, (int) $timestamp, $this->_syncDeviceID, $database, $this->_user, $cuid);
     // Check if entry exists. If not insert, otherwise update.
     if (!$this->_getSuid($databaseURI, $cuid)) {
         $query = 'INSERT INTO horde_syncml_map ' . '(syncml_suid, syncml_timestamp, syncml_syncpartner, ' . 'syncml_db, syncml_uid, syncml_cuid) ' . 'VALUES (?, ?, ?, ?, ?, ?)';
         $this->_db->insert($query, $values);
     } else {
         $query = 'UPDATE horde_syncml_map ' . 'SET syncml_suid = ?, syncml_timestamp = ? ' . 'WHERE syncml_syncpartner = ? AND syncml_db = ? AND ' . 'syncml_uid = ? AND syncml_cuid = ?';
         $this->_db->update($query, $values);
     }
 }
All Usage Examples Of Horde_Db_Adapter_Base::update