summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-02 17:37:16 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-02 17:37:16 +0100
commit00df2e3183dc1cbef82dafe6cc432d73fe659ae9 (patch)
treef185ac0798b8c28e509cc209d9c955ae9d19f4d0 /system/database/drivers
parent06400c0397793132e7517a1e414d104800e16667 (diff)
Replace Interbase _error_message(), _error_number() with the new error() method
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/interbase/interbase_driver.php48
1 files changed, 19 insertions, 29 deletions
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 4dca7c8a9..17fcffa65 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -58,7 +58,7 @@ class CI_DB_interbase_driver extends CI_DB {
*/
protected $_count_string = "SELECT COUNT(*) AS ";
protected $_random_keyword = ' Random()'; // database specific random keyword
-
+
// Keeps track of the resource for the current transaction
protected $trans;
@@ -139,12 +139,12 @@ class CI_DB_interbase_driver extends CI_DB {
if (($service = ibase_service_attach($this->hostname, $this->username, $this->password)))
{
$version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
-
+
// Don't keep the service open
ibase_service_detach($service);
return $version;
}
-
+
return FALSE;
}
@@ -203,7 +203,7 @@ class CI_DB_interbase_driver extends CI_DB {
$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
$this->trans = @ibase_trans($this->conn_id);
-
+
return TRUE;
}
@@ -226,7 +226,7 @@ class CI_DB_interbase_driver extends CI_DB {
{
return TRUE;
}
-
+
return @ibase_commit($this->trans);
}
@@ -398,7 +398,7 @@ SQL;
protected function _field_data($table)
{
// Need to find a more efficient way to do this
- // but Interbase/Firebird seems to lack the
+ // but Interbase/Firebird seems to lack the
// limit clause
return "SELECT * FROM {$table}";
}
@@ -406,25 +406,16 @@ SQL;
// --------------------------------------------------------------------
/**
- * The error message string
+ * Error
*
- * @return string
- */
- protected function _error_message()
- {
- return ibase_errmsg();
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message number
+ * Returns an array containing code and message of the last
+ * database error that has occured.
*
- * @return integer
+ * @return array
*/
- protected function _error_number()
+ public function error()
{
- return ibase_errcode();
+ return array('code' => ibase_errcode(), 'message' => ibase_errmsg());
}
// --------------------------------------------------------------------
@@ -603,12 +594,12 @@ SQL;
{
// Keep the current sql string safe for a moment
$orig_sql = $sql;
-
+
// Limit clause depends on if Interbase or Firebird
if (stripos($this->_version(), 'firebird') !== FALSE)
{
$sql = 'FIRST '. (int) $limit;
-
+
if ($offset > 0)
{
$sql .= ' SKIP '. (int) $offset;
@@ -617,16 +608,14 @@ SQL;
else
{
$sql = 'ROWS ' . (int) $limit;
-
+
if ($offset > 0)
{
$sql = 'ROWS '. (int) $offset . ' TO ' . ($limit + $offset);
}
}
-
- $sql = preg_replace("`SELECT`i", "SELECT {$sql}", $orig_sql);
-
- return $sql;
+
+ return preg_replace('`SELECT`i', "SELECT {$sql}", $orig_sql);
}
// --------------------------------------------------------------------
@@ -641,7 +630,8 @@ SQL;
{
@ibase_close($conn_id);
}
+
}
/* End of file interbase_driver.php */
-/* Location: ./system/database/drivers/interbase/interbase_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/interbase/interbase_driver.php */