Revert "Firebird refactoring"

This reverts commit 46771a7725.
This commit is contained in:
Timothy Warren 2012-03-06 16:20:59 -05:00
parent 4b8dd18ed8
commit 6fc5d5d9db
6 changed files with 11 additions and 23 deletions

View File

@ -105,7 +105,7 @@ abstract class DB_PDO extends PDO {
*/ */
public function get_query_data($statement) public function get_query_data($statement)
{ {
$this->statement =& $statement; $this->statement = $statement;
// Execute the query // Execute the query
$this->statement->execute(); $this->statement->execute();

View File

@ -64,14 +64,7 @@ class Query_Builder {
break; break;
case "firebird": case "firebird":
if(in_array('firebird', pdo_drivers())) $this->db = new $dbtype("{$params->host}:{$params->file}", $params->user, $params->pass);
{
$this->db = new $dbtype("host={$params->host};dbname={$params->file}", $params->user, $params->pass);
}
else
{
$this->db = new $dbtype("{$params->host}:{$params->file}", $params->user, $params->pass);
}
break; break;
} }
} }

View File

@ -21,7 +21,7 @@ class Firebird extends DB_PDO {
*/ */
public function __construct($dbpath, $user='sysdba', $pass='masterkey') public function __construct($dbpath, $user='sysdba', $pass='masterkey')
{ {
parent::__construct("firebird:dbname={$dbpath}", $user, $pass); parent::__construct("firebird:{$dbpath}", $user, $pass);
$class = __CLASS__."_sql"; $class = __CLASS__."_sql";
$this->sql = new $class; $this->sql = new $class;
@ -60,7 +60,7 @@ SQL;
$tables = array(); $tables = array();
while($row = $this->statement->fetch(PDO::FETCH_ASSOC)) while($row = $this->fetch(PDO::FETCH_ASSOC))
{ {
$tables[] = $row['RDB$RELATION_NAME']; $tables[] = $row['RDB$RELATION_NAME'];
} }
@ -87,7 +87,7 @@ SQL;
$tables = array(); $tables = array();
while($row = $this->statement->fetch(PDO::FETCH_ASSOC)) while($row = $this->fetch(PDO::FETCH_ASSOC))
{ {
$tables[] = $row['RDB$RELATION_NAME']; $tables[] = $row['RDB$RELATION_NAME'];
} }
@ -111,7 +111,7 @@ SQL;
} }
//Fetch all the rows for the result //Fetch all the rows for the result
$this->result = $this->statement->fetchAll(); $this->result = $this->fetchAll();
return count($this->result); return count($this->result);
} }
@ -163,7 +163,7 @@ SQL;
{ {
$sql = 'SELECT * FROM "'.trim($t).'"'; $sql = 'SELECT * FROM "'.trim($t).'"';
$res = $this->query($sql); $res = $this->query($sql);
$obj_res = $res->fetchAll(PDO::FETCH_ASSOC); $obj_res = $this->fetchAll(PDO::FETCH_ASSOC);
unset($res); unset($res);

View File

@ -38,7 +38,7 @@ class FirebirdTest extends UnitTestCase {
function tearDown() function tearDown()
{ {
//unset($this->db); unset($this->db);
unset($this->tables); unset($this->tables);
} }
@ -98,8 +98,8 @@ class FirebirdTest extends UnitTestCase {
INSERT INTO "create_test" ("id", "key", "val") INSERT INTO "create_test" ("id", "key", "val")
VALUES (?,?,?) VALUES (?,?,?)
SQL; SQL;
$query = $this->db->prepare($sql); $this->db->prepare($sql);
$query->execute(array(1,"booger's", "Gross")); $this->db->execute(array(1,"booger's", "Gross"));
} }

View File

@ -41,11 +41,6 @@ $test_path = "./databases/";
foreach(pdo_drivers() as $d) foreach(pdo_drivers() as $d)
{ {
if($d === 'firebird')
{
continue;
}
$src_file = "{$src_path}{$d}.php"; $src_file = "{$src_path}{$d}.php";
if(is_file($src_file)) if(is_file($src_file))
@ -57,7 +52,7 @@ foreach(pdo_drivers() as $d)
} }
// Load Firebird if there is support // Load Firebird if there is support
if(function_exists('ibase_connect'))// && ! in_array('firebird', pdo_drivers())) if(function_exists('ibase_connect') && ! in_array('firebird', pdo_drivers()))
{ {
require_once("{$src_path}firebird-ibase.php"); require_once("{$src_path}firebird-ibase.php");
require_once("{$src_path}firebird_sql.php"); require_once("{$src_path}firebird_sql.php");

Binary file not shown.