public function testOnDatabaseWithWhere()
 {
     // fill database with some dummy data
     $q = new ezcQueryInsert(ezcDbInstance::get());
     // insert some data we can update
     $company = 'eZ systems';
     $section = 'Norway';
     $q->insertInto('query_test')->set('id', 1)->set('company', $q->bindParam($company))->set('section', $q->bindParam($section))->set('employees', 20);
     $stmt = $q->prepare();
     $stmt->execute();
     $q->insertInto('query_test');
     $q->set('id', 2);
     $q->set('employees', 70);
     $company = 'trolltech';
     $section = 'Norway';
     $stmt = $q->prepare();
     $stmt->execute();
     // delete one
     $this->q->deleteFrom('query_test')->where($this->q->expr->eq('id', 1));
     $stmt = $this->q->prepare();
     $stmt->execute();
     // test that table has one row
     $db = ezcDbInstance::get();
     $q = $db->createSelectQuery();
     // get select query
     $q->select('*')->from('query_test');
     $stmt = $q->prepare();
     $stmt->execute();
     $result = $stmt->fetchAll();
     $this->assertEquals(1, count($result));
 }
 public function testOnDatabaseWithWhere()
 {
     $q = new ezcQueryInsert(ezcDbInstance::get());
     $company = 'eZ systems';
     $section = 'Norway';
     // insert some data we can update
     $q->insertInto('query_test')->set('id', 1)->set('company', $q->bindParam($company))->set('section', $q->bindParam($section))->set('employees', 20);
     $stmt = $q->prepare();
     $stmt->execute();
     $q->insertInto('query_test');
     $q->set('id', 2);
     $q->set('employees', 70);
     $company = 'trolltech';
     $section = 'Norway';
     $stmt = $q->prepare();
     $stmt->execute();
     $this->q->update('query_test')->set('employees', 50)->where($this->q->expr->eq('id', 1));
     $stmt = $this->q->prepare();
     $stmt->execute();
     // check that entry 1 was updated correctly
     // but not two
     $db = ezcDbInstance::get();
     $q = $db->createSelectQuery();
     // get select query
     $q->select('*')->from('query_test')->orderBy('company');
     $stmt = $q->prepare();
     $stmt->execute();
     $result = $stmt->fetchAll();
     $this->assertEquals(50, (int) $result[0][3]);
     $this->assertEquals(70, (int) $result[1][3]);
 }