summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_driver.php35
-rw-r--r--system/database/DB_result.php12
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php9
-rw-r--r--system/database/drivers/interbase/interbase_driver.php5
-rw-r--r--system/database/drivers/mssql/mssql_driver.php7
-rw-r--r--system/database/drivers/mysql/mysql_driver.php7
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php6
-rw-r--r--system/database/drivers/oci8/oci8_driver.php7
-rw-r--r--system/database/drivers/odbc/odbc_driver.php7
-rw-r--r--system/database/drivers/pdo/pdo_driver.php15
-rw-r--r--system/database/drivers/postgre/postgre_driver.php5
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php7
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php3
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php7
14 files changed, 75 insertions, 57 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index ef77b594e..a0812d4c7 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1152,7 +1152,7 @@ abstract class CI_DB_driver {
{
if ($this->conn_id)
{
- $this->_close($this->conn_id);
+ $this->_close();
$this->conn_id = FALSE;
}
}
@@ -1160,6 +1160,20 @@ abstract class CI_DB_driver {
// --------------------------------------------------------------------
/**
+ * Close DB Connection
+ *
+ * This method would be overriden by most of the drivers.
+ *
+ * @return void
+ */
+ protected function _close()
+ {
+ $this->conn_id = FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Display an error message
*
* @param string the error message
@@ -1390,7 +1404,24 @@ abstract class CI_DB_driver {
{
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Destructor
+ *
+ * Closes the database connection, if needed.
+ *
+ * @return void
+ */
+ public function __destruct()
+ {
+ if ( ! $this->pconnect)
+ {
+ $this->close();
+ }
+ }
+
}
/* End of file DB_driver.php */
-/* Location: ./system/database/DB_driver.php */
+/* Location: ./system/database/DB_driver.php */ \ No newline at end of file
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 196febe2c..690734b08 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -371,6 +371,18 @@ class CI_DB_result {
// --------------------------------------------------------------------
/**
+ * Returns an unbuffered row and move pointer to next row
+ *
+ * @return mixed either a result object or array
+ */
+ public function unbuffered_row($type = 'object')
+ {
+ return ($type !== 'array') ? $this->_fetch_object() : $this->_fetch_assoc();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* The following functions are normally overloaded by the identically named
* methods in the platform-specific driver -- except when query caching
* is used. When caching is enabled we do not load the other driver.
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 1373faa88..944df99b5 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -485,7 +485,7 @@ class CI_DB_cubrid_driver extends CI_DB {
}
// --------------------------------------------------------------------
-
+
/**
* Limit string
*
@@ -506,15 +506,14 @@ class CI_DB_cubrid_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @cubrid_close($conn_id);
+ @cubrid_close($this->conn_id);
}
}
/* End of file cubrid_driver.php */
-/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */
+/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 1b18de803..c457f6340 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -472,12 +472,11 @@ class CI_DB_interbase_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @ibase_close($conn_id);
+ @ibase_close($this->conn_id);
}
}
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index f60ec8168..914de499f 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -523,15 +523,14 @@ class CI_DB_mssql_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @mssql_close($conn_id);
+ @mssql_close($this->conn_id);
}
}
/* End of file mssql_driver.php */
-/* Location: ./system/database/drivers/mssql/mssql_driver.php */
+/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 32c51865d..161f99541 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -520,15 +520,14 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @mysql_close($conn_id);
+ @mysql_close($this->conn_id);
}
}
/* End of file mysql_driver.php */
-/* Location: ./system/database/drivers/mysql/mysql_driver.php */
+/* Location: ./system/database/drivers/mysql/mysql_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index e2684e4f2..9261883f5 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -523,16 +523,14 @@ class CI_DB_mysqli_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param object
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
$this->conn_id->close();
- $this->conn_id = FALSE;
}
}
/* End of file mysqli_driver.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
+/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 33a89df94..e2fa51349 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -671,15 +671,14 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @oci_close($conn_id);
+ @oci_close($this->conn_id);
}
}
/* End of file oci8_driver.php */
-/* Location: ./system/database/drivers/oci8/oci8_driver.php */
+/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index e36f2d233..e3172117a 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -402,15 +402,14 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @odbc_close($conn_id);
+ @odbc_close($this->conn_id);
}
}
/* End of file odbc_driver.php */
-/* Location: ./system/database/drivers/odbc/odbc_driver.php */
+/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 89e69676d..e38c1145c 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -667,20 +667,7 @@ class CI_DB_pdo_driver extends CI_DB {
}
}
- // --------------------------------------------------------------------
-
- /**
- * Close DB Connection
- *
- * @param object
- * @return void
- */
- protected function _close($conn_id)
- {
- $this->conn_id = NULL;
- }
-
}
/* End of file pdo_driver.php */
-/* Location: ./system/database/drivers/pdo/pdo_driver.php */
+/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 17bd37b38..0ddfd0abe 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -653,12 +653,11 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @pg_close($conn_id);
+ @pg_close($this->conn_id);
}
}
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 551704f83..d710b945d 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -450,15 +450,14 @@ class CI_DB_sqlite_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @sqlite_close($conn_id);
+ @sqlite_close($this->conn_id);
}
}
/* End of file sqlite_driver.php */
-/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index d22f6a442..ad2848ed8 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -417,10 +417,9 @@ class CI_DB_sqlite3_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param object (ignored)
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
$this->conn_id->close();
}
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 8cc500f55..3e9fa7b1a 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -510,15 +510,14 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @sqlsrv_close($conn_id);
+ @sqlsrv_close($this->conn_id);
}
}
/* End of file sqlsrv_driver.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */
+/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */ \ No newline at end of file