示例#1
0
 public function testSelectKey()
 {
     $this->assertEquals("SELECT a FROM test", DfSql::selectKey($this->table, 'a'));
     $this->assertEquals("SELECT a FROM test WHERE b = 'c'", DfSql::selectKey($this->table, 'a', ['b' => 'c']));
     $this->assertEquals("SELECT a FROM test WHERE b = 'c' AND d = 'e'", DfSql::selectKey($this->table, 'a', ['b' => 'c', 'd' => 'e']));
     $this->assertEquals("SELECT a FROM test WHERE b = 'c' OR d = 'e'", DfSql::selectKey($this->table, 'a', ['b' => 'c', 'd' => 'e'], 'OR'));
     $this->assertEquals("SELECT a FROM test WHERE (b = 'c' OR d = 'e') AND f = 'g'", DfSql::selectKey($this->table, 'a', [], '', "WHERE (b = 'c' OR d = 'e') AND f = 'g'"));
     $this->assertEquals("SELECT a FROM test WHERE (b = 'c' OR d = 'e') AND f = 'g'", DfSql::selectKey($this->table, 'a', [], '', "WHERE (b = 'c' OR d = 'e') AND f = 'g'"));
 }