예제 #1
0
 /**
  * Tests act()
  * 
  * @test
  */
 public function testAct()
 {
     // inserting
     $inserted_id = DBQuery::insert('tests')->set('foo', 'bar', 'bar', 'foo')->act();
     $this->assertSame(mysql_insert_id(), $inserted_id);
     // selecting
     $foo = DBQuery::select('tests')->where('id', $inserted_id)->act()->fetch();
     $this->assertEquals($inserted_id, $foo->id);
     $this->assertEquals('bar', $foo->foo);
     $this->assertEquals('foo', $foo->bar);
     // updating
     $this->assertSame(1, DBQuery::update('tests')->set('foo', 1, 'bar', 2)->where('id', $inserted_id)->act());
     // deleting
     $this->assertSame(1, DBQuery::delete('tests')->where('id', $inserted_id)->act());
     $this->assertFalse(DBQuery::select('tests')->where('id', $inserted_id)->act()->exists);
 }
예제 #2
0
파일: DB.php 프로젝트: radex/Watermelon
 public static function delete($table, $condition)
 {
     $query = DBQuery::delete($table);
     $query = self::applyCondition($query, $condition);
     return $query->act();
 }