Fix tests
This commit is contained in:
parent
6bd17a2150
commit
913993c963
@ -162,10 +162,7 @@ abstract class DB_PDO extends PDO {
|
||||
{
|
||||
if (is_array($ident))
|
||||
{
|
||||
for($i = 0, $count = count($ident); $i < $count; $i++)
|
||||
{
|
||||
$ident[$i] = $this->quote_ident($ident[$i]);
|
||||
}
|
||||
return array_map(array($this, 'quote_ident'), $ident);
|
||||
}
|
||||
|
||||
// Split each identifier by the period
|
||||
|
@ -136,10 +136,7 @@ class MySQL extends DB_PDO {
|
||||
{
|
||||
if (is_array($ident))
|
||||
{
|
||||
for($i = 0, $count = count($ident); $i < $count; $i++)
|
||||
{
|
||||
$ident[$i] = $this->quote_ident($ident[$i]);
|
||||
}
|
||||
return array_map(array($this, 'quote_ident'), $ident);
|
||||
}
|
||||
|
||||
// Split each identifier by the period
|
||||
|
@ -79,7 +79,9 @@ class Query_Builder {
|
||||
{
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
elseif ( ! empty($this->select_string))
|
||||
|
||||
// Set the select string
|
||||
if ( ! empty($this->select_string))
|
||||
{
|
||||
// Replace the star with the selected fields
|
||||
$sql = str_replace('*', $this->select_string, $sql);
|
||||
@ -91,6 +93,8 @@ class Query_Builder {
|
||||
$sql = $this->sql->limit($sql, $limit, $offset);
|
||||
}
|
||||
|
||||
//echo $sql."<br />";
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
@ -114,6 +118,7 @@ class Query_Builder {
|
||||
if (stripos($field, 'as') !== FALSE)
|
||||
{
|
||||
$fields_array[$key] = preg_split('`as`i', $field);
|
||||
$fields_array[$key] = array_map('trim', $fields_array[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +126,7 @@ class Query_Builder {
|
||||
$safe_array = array_map(array($this->db, 'quote_ident'), $fields_array);
|
||||
|
||||
// Join the strings back together
|
||||
for($i = 0, $c = count($safe_array); $i < $count; $i++)
|
||||
for($i = 0, $c = count($safe_array); $i < $c; $i++)
|
||||
{
|
||||
if (is_array($safe_array[$i]))
|
||||
{
|
||||
@ -131,6 +136,8 @@ class Query_Builder {
|
||||
|
||||
$this->select_string = implode(', ', $safe_array);
|
||||
|
||||
//echo $this->select_string."<br />";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,14 @@ class FirebirdTest extends UnitTestCase {
|
||||
$this->assertTrue(is_resource($query));
|
||||
}
|
||||
|
||||
function TestQBSelectGet()
|
||||
{
|
||||
$query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1);
|
||||
|
||||
$this->assertTrue(is_resource($query));
|
||||
|
||||
}
|
||||
|
||||
function TestPreparedStatements()
|
||||
{
|
||||
$sql = <<<SQL
|
||||
|
@ -154,7 +154,7 @@ SQL;
|
||||
|
||||
function TestQBSelectGet()
|
||||
{
|
||||
$query = $this->qb->select('id, key as k, val')->get('create_test');
|
||||
$query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1);
|
||||
|
||||
$this->assertIsA($query, 'PDOStatement');
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user