From 606f99c043272f96f21911d89c21cd36c2ef59e4 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 11 Oct 2006 23:48:41 +0000 Subject: --- system/codeigniter/CodeIgniter.php | 2 +- system/database/DB_driver.php | 3 ++- system/database/DB_result.php | 6 +++--- system/database/drivers/mssql/mssql_result.php | 8 +++++++- system/database/drivers/mysql/mysql_result.php | 8 +++++++- system/database/drivers/mysqli/mysqli_result.php | 8 +++++++- system/database/drivers/oci8/oci8_result.php | 8 +++++++- system/database/drivers/odbc/odbc_result.php | 8 +++++++- system/database/drivers/postgre/postgre_result.php | 8 +++++++- system/database/drivers/sqlite/sqlite_result.php | 8 +++++++- system/libraries/Loader.php | 11 +++-------- system/libraries/Table.php | 4 ++-- 12 files changed, 60 insertions(+), 22 deletions(-) diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php index 611b1a621..49347715f 100644 --- a/system/codeigniter/CodeIgniter.php +++ b/system/codeigniter/CodeIgniter.php @@ -241,7 +241,7 @@ $EXT->_call_hook('post_system'); /* * ------------------------------------------------------ - * Close the DB connection of one exists + * Close the DB connection if one exists * ------------------------------------------------------ */ if (class_exists('CI_DB')) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 22f91ed4c..a4131fd73 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -172,6 +172,7 @@ class CI_DB_driver { $CI =& get_instance(); $CI->dbutil = new $class(); + $CI->_ci_assign_to_models(); } // -------------------------------------------------------------------- @@ -629,7 +630,7 @@ class CI_DB_driver { */ function primary($table = '') { - $fields = $this->field_names($table); + $fields = $this->list_fields($table); if ( ! is_array($fields)) { diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 1c8ad6be0..b163bb5ea 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -261,14 +261,14 @@ class CI_DB_result { */ function num_rows() { return $this->num_rows; } function num_fields() { return 0; } - function field_names() { return array(); } + function list_fields() { return array(); } + function field_names() { return array(); } // Deprecated function field_data() { return array(); } function free_result() { return TRUE; } function _data_seek() { return TRUE; } function _fetch_assoc() { return array(); } function _fetch_object() { return array(); } - - + } // END DB_result class ?> \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 498deae09..0ba0b8c57 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -60,7 +60,7 @@ class CI_DB_mssql_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -70,6 +70,12 @@ class CI_DB_mssql_result extends CI_DB_result { return $field_names; } + + // Deprecated + function field_names() + { + return $this->list_fields(); + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 3fdfc8183..1cf6ff188 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -60,7 +60,7 @@ class CI_DB_mysql_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); while ($field = mysql_fetch_field($this->result_id)) @@ -70,6 +70,12 @@ class CI_DB_mysql_result extends CI_DB_result { return $field_names; } + + // Deprecated + function field_names() + { + return $this->list_fields(); + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index 08db13f10..215403e9d 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -60,7 +60,7 @@ class CI_DB_mysqli_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); while ($field = mysql_fetch_field($this->result_id)) @@ -71,6 +71,12 @@ class CI_DB_mysqli_result extends CI_DB_result { return $field_names; } + // Deprecated + function field_names() + { + return $this->list_fields(); + } + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index a3da80026..ab13a3935 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -84,7 +84,7 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); $fieldCount = $this->num_fields(); @@ -95,6 +95,12 @@ class CI_DB_oci8_result extends CI_DB_result { return $field_names; } + // Deprecated + function field_names() + { + return $this->list_fields(); + } + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index 9204d8680..ea834f9b4 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -60,7 +60,7 @@ class CI_DB_odbc_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -71,6 +71,12 @@ class CI_DB_odbc_result extends CI_DB_result { return $field_names; } + // Deprecated + function field_names() + { + return $this->list_fields(); + } + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index 8c25c5d4c..e792544ae 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -60,7 +60,7 @@ class CI_DB_postgre_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -71,6 +71,12 @@ class CI_DB_postgre_result extends CI_DB_result { return $field_names; } + // Deprecated + function field_names() + { + return $this->list_fields(); + } + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index a3e94b471..55364bb24 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -60,7 +60,7 @@ class CI_DB_sqlite_result extends CI_DB_result { * @access public * @return array */ - function field_names() + function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -71,6 +71,12 @@ class CI_DB_sqlite_result extends CI_DB_result { return $field_names; } + // Deprecated + function field_names() + { + return $this->list_fields(); + } + // -------------------------------------------------------------------- /** diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 96ec0c919..7a6637ac0 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -171,10 +171,7 @@ class CI_Loader { $CI->$name = new $model(); foreach (get_object_vars($CI) as $key => $var) { - if ( ! isset($CI->$name->$key)) - { - $CI->$name->$key =& $CI->$key; - } + $CI->$name->$key =& $CI->$key; } } else @@ -182,14 +179,12 @@ class CI_Loader { $this->$name = new $model(); foreach (get_object_vars($this) as $key => $var) { - if ( ! isset($this->$name->$key)) - { - $this->$name->$key =& $CI->$key; - } + $this->$name->$key =& $this->$key; } } $this->_ci_models[] = $name; + $this->_ci_assign_to_models(); } diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 61d04eef5..758676e27 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -202,12 +202,12 @@ class CI_Table { // First generate the headings from the table column names if (count($this->heading) == 0) { - if ( ! method_exists($query, 'field_names')) + if ( ! method_exists($query, 'list_fields')) { return FALSE; } - $this->heading = $query->field_names(); + $this->heading = $query->list_fields(); } // Next blast through the result array and build out the rows -- cgit v1.2.3-24-g4f1b