diff --git a/sys/db/query_builder.php b/sys/db/query_builder.php
index 73e8884..fa88a4f 100644
--- a/sys/db/query_builder.php
+++ b/sys/db/query_builder.php
@@ -18,8 +18,7 @@
*/
class Query_Builder {
- private $table,
- $sql,
+ private $sql,
$select_string,
$from_string,
$where_array,
@@ -475,7 +474,7 @@ class Query_Builder {
$this->set($data);
}
- $sql = 'UPDATE '.$this->quote_ident($table). ' SET '. $this->set_string;
+ $sql = $this->_compile('update', $table);
$params = array_values($this->set_array);
@@ -485,8 +484,6 @@ class Query_Builder {
// the set string
if ( ! empty($this->where_string))
{
- $sql .= $this->where_string;
-
$where_params = array_values($this->where_array);
foreach($where_params as $w)
@@ -513,6 +510,8 @@ class Query_Builder {
// @todo implement delete method
}
+ // --------------------------------------------------------------------------
+ // ! Miscellaneous Methods
// --------------------------------------------------------------------------
/**
@@ -577,7 +576,7 @@ class Query_Builder {
}
// Set the limit via the class variables
- if (is_numeric($this->limit))
+ if (isset($this->limit) && is_numeric($this->limit))
{
$sql = $this->sql->limit($sql, $this->limit, $this->offset);
}
@@ -591,12 +590,21 @@ class Query_Builder {
') VALUES ('.implode(', ', $params).')';
break;
+ case "update":
+ $sql = 'UPDATE '.$this->db->quote_ident($table). ' SET '. $this->set_string;
+
+ if ( ! empty($this->where_string))
+ {
+ $sql .= $this->where_string;
+ }
+ break;
+
case "delete":
// @todo Implement delete statements
break;
}
- echo $sql.'
';
+ //echo $sql.'
';
return $sql;
}
diff --git a/tests/databases/firebird-qb.php b/tests/databases/firebird-qb.php
index 929ad6d..25b17fb 100644
--- a/tests/databases/firebird-qb.php
+++ b/tests/databases/firebird-qb.php
@@ -20,10 +20,7 @@ class FirebirdQBTest extends UnitTestCase {
function __construct()
{
parent::__construct();
- }
-
- function setUp()
- {
+
$dbpath = TEST_DIR.DS.'test_dbs'.DS.'FB_TEST_DB.FDB';
// Test the query builder
@@ -34,11 +31,8 @@ class FirebirdQBTest extends UnitTestCase {
$params->user = 'sysdba';
$params->pass = 'masterkey';
$this->qb = new Query_Builder($params);
- }
-
- function tearDown()
- {
- unset($this->qb);
+
+ //echo '