Ejemplo n.º 1
0
 public function testAllCommonWhere()
 {
     $query = new CM_Db_Query_SelectMultiple(self::$_client, 't`est', array('f`oo', 'bar'), array(array('foo' => 'foo1'), array('foo' => 'foo1'), array('foo' => 'foo1')));
     $this->assertSame('SELECT `f``oo`,`bar` FROM `t``est` WHERE `foo` = ?', $query->getSqlTemplate());
     $this->assertSame(array('foo1'), $query->getParameters());
     $query = new CM_Db_Query_SelectMultiple(self::$_client, 't`est', array('f`oo', 'bar'), array(array('foo' => 'foo1', 'poo' => 'poo1'), array('foo' => 'foo1', 'poo' => 'poo1')));
     $this->assertSame('SELECT `f``oo`,`bar` FROM `t``est` WHERE `foo` = ? AND `poo` = ?', $query->getSqlTemplate());
     $this->assertSame(array('foo1', 'poo1'), $query->getParameters());
 }
Ejemplo n.º 2
0
 /**
  * @param string          $table
  * @param string|string[] $fields    Column-name OR Column-names array
  * @param array[]         $whereList Outer array-entries are combined using OR, inner arrays using AND
  * @param string|null     $order
  * @return CM_Db_Result
  */
 public static function selectMultiple($table, $fields, array $whereList, $order = null)
 {
     $client = self::getClient();
     $query = new CM_Db_Query_SelectMultiple($client, $table, $fields, $whereList, $order);
     return $query->execute();
 }