diff --git a/sys/db/query_builder.php b/sys/db/query_builder.php index a1025ac..1745ce0 100644 --- a/sys/db/query_builder.php +++ b/sys/db/query_builder.php @@ -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; } // -------------------------------------------------------------------------- diff --git a/tests/databases/firebird.php b/tests/databases/firebird.php index c6c342a..08cde46 100644 --- a/tests/databases/firebird.php +++ b/tests/databases/firebird.php @@ -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(); }