Fix get-where tests
This commit is contained in:
parent
6b6660585c
commit
c61df13fbc
@ -137,6 +137,8 @@ class Query_Builder {
|
|||||||
|
|
||||||
// Quote the identifiers
|
// Quote the identifiers
|
||||||
$safe_array = array_map(array($this->db, 'quote_ident'), $fields_array);
|
$safe_array = array_map(array($this->db, 'quote_ident'), $fields_array);
|
||||||
|
|
||||||
|
unset($fields_array);
|
||||||
|
|
||||||
// Join the strings back together
|
// Join the strings back together
|
||||||
for($i = 0, $c = count($safe_array); $i < $c; $i++)
|
for($i = 0, $c = count($safe_array); $i < $c; $i++)
|
||||||
@ -149,7 +151,7 @@ class Query_Builder {
|
|||||||
|
|
||||||
$this->select_string = implode(', ', $safe_array);
|
$this->select_string = implode(', ', $safe_array);
|
||||||
|
|
||||||
//echo $this->select_string."<br />";
|
unset($safe_array);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -207,8 +209,10 @@ class Query_Builder {
|
|||||||
|
|
||||||
// Create the where portion of the string
|
// Create the where portion of the string
|
||||||
$this->where_string = ' WHERE '.implode(', ', $kv_array);
|
$this->where_string = ' WHERE '.implode(', ', $kv_array);
|
||||||
|
|
||||||
|
unset($kv_array);
|
||||||
|
unset($fields);
|
||||||
|
|
||||||
// @todo Implement where method
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,21 @@ class FirebirdTest extends UnitTestCase {
|
|||||||
$this->assertTrue(is_resource($query));
|
$this->assertTrue(is_resource($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TestQBSelectWhereGet()
|
||||||
|
{
|
||||||
|
$query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test', 2, 1);
|
||||||
|
|
||||||
|
$this->assertTrue(is_resource($query));
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestQBSelectWhereGet2()
|
||||||
|
{
|
||||||
|
$query = $this->qb->select('id, key as k, val')->where(' id ', 1)->get('create_test', 2, 1);
|
||||||
|
|
||||||
|
$this->assertTrue(is_resource($query));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function TestQBSelectGet()
|
function TestQBSelectGet()
|
||||||
{
|
{
|
||||||
$query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1);
|
$query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1);
|
||||||
|
@ -154,7 +154,14 @@ SQL;
|
|||||||
|
|
||||||
function TestQBSelectWhereGet()
|
function TestQBSelectWhereGet()
|
||||||
{
|
{
|
||||||
$query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test, 2, 1');
|
$query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test', 2, 1);
|
||||||
|
|
||||||
|
$this->assertIsA($query, 'PDOStatement');
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestQBSelectWhereGet2()
|
||||||
|
{
|
||||||
|
$query = $this->qb->select('id, key as k, val')->where('id', 1)->get('create_test', 2, 1);
|
||||||
|
|
||||||
$this->assertIsA($query, 'PDOStatement');
|
$this->assertIsA($query, 'PDOStatement');
|
||||||
}
|
}
|
||||||
@ -179,7 +186,7 @@ SQL;
|
|||||||
|
|
||||||
//Check
|
//Check
|
||||||
$dbs = $this->db->get_tables();
|
$dbs = $this->db->get_tables();
|
||||||
$this->assertTrue(empty($dbs['create_test']));
|
$this->assertFalse(in_array('create_test', $dbs));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user