Revert changes to firebird-ibase driver

This commit is contained in:
Timothy Warren 2012-03-06 16:18:50 -05:00
parent 46771a7725
commit 4b8dd18ed8

View File

@ -19,8 +19,7 @@
*/ */
class firebird extends DB_PDO { class firebird extends DB_PDO {
protected $statement, $trans, $count, $result; protected $conn, $statement, $trans, $count, $result;
public static $conn;
/** /**
* Open the link to the database * Open the link to the database
@ -31,13 +30,7 @@ class firebird extends DB_PDO {
*/ */
public function __construct($dbpath, $user='sysdba', $pass='masterkey') public function __construct($dbpath, $user='sysdba', $pass='masterkey')
{ {
self::$conn = ibase_connect($dbpath, $user, $pass, 'utf-8'); $this->conn = ibase_connect($dbpath, $user, $pass, 'utf-8');
if ( ! self::$conn)
{
throw new PDOException(ibase_errmsg());
}
$class = __CLASS__."_sql"; $class = __CLASS__."_sql";
$this->sql = new $class; $this->sql = new $class;
@ -50,7 +43,7 @@ class firebird extends DB_PDO {
*/ */
public function __destruct() public function __destruct()
{ {
@ibase_close(self::$conn); @ibase_close($this->conn);
@ibase_free_result($this->statement); @ibase_free_result($this->statement);
} }
@ -80,7 +73,7 @@ class firebird extends DB_PDO {
public function query($sql) public function query($sql)
{ {
$this->count = 0; $this->count = 0;
$this->statement = ibase_query(self::$conn, $sql); $this->statement = ibase_query($this->conn, $sql);
return $this->statement; return $this->statement;
} }
@ -142,7 +135,7 @@ class firebird extends DB_PDO {
*/ */
public function prepare($query, $options=NULL) public function prepare($query, $options=NULL)
{ {
$this->statement = ibase_prepare(self::$conn, $query); $this->statement = ibase_prepare($this->conn, $query);
return $this->statement; return $this->statement;
} }
@ -209,7 +202,7 @@ SQL;
*/ */
public function affected_rows($statement="") public function affected_rows($statement="")
{ {
return ibase_affected_rows(self::$conn); return ibase_affected_rows($this->conn);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -242,7 +235,7 @@ SQL;
*/ */
public function beginTransaction() public function beginTransaction()
{ {
if(($this->trans =& ibase_trans(self::$conn)) !== NULL) if(($this->trans =& ibase_trans($this->conn)) !== NULL)
{ {
return TRUE; return TRUE;
} }