Example #1
0
 public function testAll()
 {
     $query = new CM_Db_Query_Update(self::$_client, 't`est', array('f`oo' => 2, 'b`ar' => null), array('f`oo' => '1'));
     $this->assertSame('UPDATE `t``est` SET `f``oo` = ?, `b``ar` = NULL WHERE `f``oo` = ?', $query->getSqlTemplate());
     $this->assertEquals(array(2, '1'), $query->getParameters());
 }
Example #2
0
 /**
  * @param string            $table
  * @param array             $values Associative array field=>value
  * @param string|array|null $where  Associative array field=>value OR string
  * @return int
  */
 public static function updateIgnore($table, array $values, $where = null)
 {
     $client = self::getClient();
     $query = new CM_Db_Query_Update($client, $table, $values, $where, 'UPDATE IGNORE');
     return $query->execute()->getAffectedRows();
 }