Esempio n. 1
0
 public function set($fieldNameOrPrepared, $valueOrBinds = null)
 {
     $expressions = \b2\ability\WhereUpdateCommon::extractExpressions(func_get_args());
     $this->sets = array_merge($this->sets, $expressions);
     return $this;
 }
Esempio n. 2
0
 public function testList()
 {
     $r = WhereUpdateCommon::extractExpressions(['? = ??', [1, [2, 3]]]);
     $this->assertEquals([new PlainSql('? = ??', [new Constant(1), new \b2\literal\AnyList([new Constant(2), new Constant(3)])])], $r);
 }
Esempio n. 3
0
 /**
  *
  * @param mixed $type
  * @param Literal|string $table
  * @param mixed $condition
  * @return $this
  * @throws Exception
  */
 private function join($type, $table, $condition)
 {
     $tableExpression = null;
     if ($table instanceof Literal) {
         $tableExpression = $table;
     } elseif (is_string($table)) {
         $tableExpression = new Identifier($table);
     } else {
         throw new Exception('Table name or Literal expected');
     }
     $condArgs = array_slice(func_get_args(), 2);
     $joinCondition = WhereUpdateCommon::extractExpressions($condArgs);
     $where = new Where();
     foreach ($joinCondition as $jc) {
         $where->addAnd($jc);
     }
     $info = new JoinInfo($type, $tableExpression, $where->getExpression());
     $this->joins[] = $info;
     return $this;
 }