示例#1
0
文件: WhereTest.php 项目: avz/php-b2
 public function testIsEmpty()
 {
     $where = new Where(new Identifier('hello'));
     $this->assertSame(false, $where->isEmpty());
     $where = new Where();
     $this->assertSame(true, $where->isEmpty());
     $where->addAnd(new Identifier('hello'));
     $this->assertSame(false, $where->isEmpty());
 }
示例#2
0
文件: HasJoin.php 项目: avz/php-b2
 /**
  *
  * @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;
 }