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