Query builder firebird tests

This commit is contained in:
Timothy Warren 2012-03-08 09:15:42 -05:00
parent 5e9bd131d1
commit 1cbfb0a0e3
2 changed files with 23 additions and 2 deletions

View File

@ -18,7 +18,7 @@
*/
class Query_Builder {
private $table;
private $table, $where_array;
/**
* Constructor
@ -107,10 +107,19 @@ class Query_Builder {
*/
public function get($table='', $limit=FALSE, $offset=FALSE)
{
$sql = 'SELECT * FROM ' . $this->quote_ident($table);
if ( ! empty($table) && $limit === FALSE && $offset === FALSE)
{
return $this->query('SELECT * FROM ' . $this->quote_ident($table));
$result = $this->query($sql);
}
else
{
$result = $this->query($this->sql->limit($sql, $limit, $offset));
}
// For the firebird class, return $this so you can act on the result
return (is_resource($result)) ? $this : $result;
}
// --------------------------------------------------------------------------

View File

@ -33,7 +33,19 @@ class FirebirdTest extends UnitTestCase {
function setUp()
{
$dbpath = TEST_DIR.DS.'test_dbs'.DS.'FB_TEST_DB.FDB';
// Test the db driver directly
$this->db = new Firebird('localhost:'.$dbpath);
// Test the query builder
$params = new Stdclass();
$params->type = 'firebird';
$params->file = $dbpath;
$params->host = 'localhost';
$params->user = 'sysdba';
$params->pass = 'masterkey';
$this->qb = new Query_Builder($params);
$this->tables = $this->db->get_tables();
}