예제 #1
0
파일: MysqlTest.php 프로젝트: vtk13/lib-sql
 public function testSelect()
 {
     $data = $this->db->select('SELECT * FROM test_users');
     $this->assertEquals(3, count($data));
     $row = $this->db->selectRow('SELECT * FROM test_users WHERE id=1');
     $this->assertEquals(1, $row['id']);
     $this->assertEquals('user1', $row['username']);
     $this->assertEquals('pass', $row['password']);
     $count = $this->db->selectValue('SELECT COUNT(*) FROM test_users');
     $this->assertEquals(3, $count);
 }
 public function selectList($where)
 {
     return Utils::map($this->db->select("SELECT * FROM {$this->table} WHERE {$where}"), $this->class);
 }
예제 #3
0
 /**
  * @expectedException \Vtk13\LibSql\SqlException
  * @expectedExceptionMessage You have an error in your SQL syntax;
  */
 public function testMisspelledSelect()
 {
     $this->db->select('S E');
 }