summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-03-20 00:06:46 +0100
committerTimothy Warren <tim@timshomepage.net>2012-03-20 00:06:46 +0100
commit9e560a4c4828901a562f5459157ba0f76612c34f (patch)
tree4d6a3562f8262013c2e33def2e0d21a14ef0c1aa /system/database
parent667c9feadee8ef5ea8c1859e7c79c2d116469051 (diff)
Revert "ODBC access modifiers"
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/odbc/odbc_driver.php96
-rw-r--r--system/database/drivers/odbc/odbc_forge.php20
-rw-r--r--system/database/drivers/odbc/odbc_result.php19
-rw-r--r--system/database/drivers/odbc/odbc_utility.php12
4 files changed, 92 insertions, 55 deletions
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 78acd2ce9..58da07818 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -48,35 +48,32 @@ class CI_DB_odbc_driver extends CI_DB {
var $_escape_char = '';
// clause and character used for LIKE escape sequences
- protected $_like_escape_str = " {escape '%s'} ";
- protected $_like_escape_chr = '!';
+ var $_like_escape_str = " {escape '%s'} ";
+ var $_like_escape_chr = '!';
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
- * used for the count_all() and count_all_results() public functions.
+ * used for the count_all() and count_all_results() functions.
*/
- protected $_count_string = "SELECT COUNT(*) AS ";
- protected $_random_keyword;
+ var $_count_string = "SELECT COUNT(*) AS ";
+ var $_random_keyword;
- /**
- * Constructor, to define random keyword
- */
- public function __construct($params)
+
+ function __construct($params)
{
parent::__construct($params);
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}
-
- // --------------------------------------------------------------------------
/**
* Non-persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_connect()
+ function db_connect()
{
return @odbc_connect($this->hostname, $this->username, $this->password);
}
@@ -86,9 +83,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_pconnect()
+ function db_pconnect()
{
return @odbc_pconnect($this->hostname, $this->username, $this->password);
}
@@ -101,9 +99,10 @@ class CI_DB_odbc_driver extends CI_DB {
* Keep / reestablish the db connection if no queries have been
* sent for a length of time exceeding the server's idle timeout
*
+ * @access public
* @return void
*/
- public function reconnect()
+ function reconnect()
{
// not implemented in odbc
}
@@ -113,9 +112,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Select the database
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_select()
+ function db_select()
{
// Not needed for ODBC
return TRUE;
@@ -126,10 +126,11 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Execute the query
*
+ * @access private called by the base class
* @param string an SQL query
* @return resource
*/
- protected function _execute($sql)
+ function _execute($sql)
{
return @odbc_exec($this->conn_id, $sql);
}
@@ -139,9 +140,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Begin Transaction
*
+ * @access public
* @return bool
*/
- public function trans_begin($test_mode = FALSE)
+ function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
@@ -167,9 +169,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Commit Transaction
*
+ * @access public
* @return bool
*/
- public function trans_commit()
+ function trans_commit()
{
if ( ! $this->trans_enabled)
{
@@ -192,9 +195,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Rollback Transaction
*
+ * @access public
* @return bool
*/
- public function trans_rollback()
+ function trans_rollback()
{
if ( ! $this->trans_enabled)
{
@@ -217,11 +221,12 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Escape String
*
+ * @access public
* @param string
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
- public function escape_str($str, $like = FALSE)
+ function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
@@ -252,9 +257,10 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Affected Rows
*
+ * @access public
* @return integer
*/
- public function affected_rows()
+ function affected_rows()
{
return @odbc_num_rows($this->conn_id);
}
@@ -279,10 +285,11 @@ class CI_DB_odbc_driver extends CI_DB {
* Generates a platform-specific query string that counts all records in
* the specified database
*
+ * @access public
* @param string
* @return string
*/
- public function count_all($table = '')
+ function count_all($table = '')
{
if ($table == '')
{
@@ -308,10 +315,11 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific query string so that the table names can be fetched
*
+ * @access private
* @param boolean
* @return string
*/
- protected function _list_tables($prefix_limit = FALSE)
+ function _list_tables($prefix_limit = FALSE)
{
$sql = "SHOW TABLES FROM `".$this->database."`";
@@ -331,10 +339,11 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific query string so that the column names can be fetched
*
+ * @access public
* @param string the table name
* @return string
*/
- public function _list_columns($table = '')
+ function _list_columns($table = '')
{
return "SHOW COLUMNS FROM ".$table;
}
@@ -346,10 +355,11 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific query so that the column data can be retrieved
*
+ * @access public
* @param string the table name
* @return object
*/
- public function _field_data($table)
+ function _field_data($table)
{
return "SELECT TOP 1 FROM ".$table;
}
@@ -374,12 +384,13 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Escape the SQL Identifiers
*
- * This public function escapes column and table names
+ * This function escapes column and table names
*
+ * @access private
* @param string
* @return string
*/
- protected function _escape_identifiers($item)
+ function _escape_identifiers($item)
{
if ($this->_escape_char == '')
{
@@ -415,13 +426,14 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* From Tables
*
- * This public function implicitly groups FROM tables so there is no confusion
+ * This function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
+ * @access public
* @param type
* @return type
*/
- public function _from_tables($tables)
+ function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -438,12 +450,13 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific insert string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
- public function _insert($table, $keys, $values)
+ function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
@@ -455,6 +468,7 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific update string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the update data
* @param array the where clause
@@ -462,7 +476,7 @@ class CI_DB_odbc_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- public function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
{
foreach ($values as $key => $val)
{
@@ -490,12 +504,13 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific truncate string from the supplied data
* If the database does not support the truncate() command
- * This public function maps to "DELETE FROM table"
+ * This function maps to "DELETE FROM table"
*
+ * @access public
* @param string the table name
* @return string
*/
- public function _truncate($table)
+ function _truncate($table)
{
return $this->_delete($table);
}
@@ -507,12 +522,13 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific delete string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the where clause
* @param string the limit clause
* @return string
*/
- public function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -540,12 +556,13 @@ class CI_DB_odbc_driver extends CI_DB {
*
* Generates a platform-specific LIMIT clause
*
+ * @access public
* @param string the sql query string
* @param integer the number of rows to limit the query to
* @param integer the offset value
* @return string
*/
- public function _limit($sql, $limit, $offset)
+ function _limit($sql, $limit, $offset)
{
// Does ODBC doesn't use the LIMIT clause?
return $sql;
@@ -556,14 +573,19 @@ class CI_DB_odbc_driver extends CI_DB {
/**
* Close DB Connection
*
+ * @access public
* @param resource
* @return void
*/
- public function _close($conn_id)
+ function _close($conn_id)
{
@odbc_close($conn_id);
}
+
+
}
+
+
/* End of file odbc_driver.php */
-/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/odbc/odbc_driver.php */
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 121c09606..acc2cadee 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -39,10 +39,11 @@ class CI_DB_odbc_forge extends CI_DB_forge {
/**
* Create database
*
+ * @access private
* @param string the database name
* @return bool
*/
- protected function _create_database()
+ function _create_database()
{
// ODBC has no "create database" command since it's
// designed to connect to an existing database
@@ -58,10 +59,11 @@ class CI_DB_odbc_forge extends CI_DB_forge {
/**
* Drop database
*
+ * @access private
* @param string the database name
* @return bool
*/
- protected function _drop_database($name)
+ function _drop_database($name)
{
// ODBC has no "drop database" command since it's
// designed to connect to an existing database
@@ -77,6 +79,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
/**
* Create Table
*
+ * @access private
* @param string the table name
* @param array the fields
* @param mixed primary key(s)
@@ -84,7 +87,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
* @param boolean should 'IF NOT EXISTS' be added to the SQL
* @return bool
*/
- protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
@@ -183,9 +186,10 @@ class CI_DB_odbc_forge extends CI_DB_forge {
/**
* Drop Table
*
+ * @access private
* @return bool
*/
- protected function _drop_table($table)
+ function _drop_table($table)
{
// Not a supported ODBC feature
if ($this->db->db_debug)
@@ -203,6 +207,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
* Generates a platform-specific query so that a table can be altered
* Called by add_column(), drop_column(), and column_alter(),
*
+ * @access private
* @param string the ALTER type (ADD, DROP, CHANGE)
* @param string the column name
* @param string the table name
@@ -212,7 +217,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
* @param string the field after which we should add the new field
* @return object
*/
- protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+ function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
{
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
@@ -255,11 +260,12 @@ class CI_DB_odbc_forge extends CI_DB_forge {
*
* Generates a platform-specific query so that a table can be renamed
*
+ * @access private
* @param string the old table name
* @param string the new table name
* @return string
*/
- protected function _rename_table($table_name, $new_table_name)
+ function _rename_table($table_name, $new_table_name)
{
return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name);
}
@@ -267,4 +273,4 @@ class CI_DB_odbc_forge extends CI_DB_forge {
}
/* End of file odbc_forge.php */
-/* Location: ./system/database/drivers/odbc/odbc_forge.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/odbc/odbc_forge.php */
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 0b74871e0..d19fa247e 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -130,7 +130,7 @@ class CI_DB_odbc_result extends CI_DB_result {
*
* @return null
*/
- public function free_result()
+ function free_result()
{
if (is_resource($this->result_id))
{
@@ -148,9 +148,10 @@ class CI_DB_odbc_result extends CI_DB_result {
* this internally before fetching results to make sure the
* result set starts at zero
*
+ * @access private
* @return array
*/
- protected function _data_seek($n = 0)
+ function _data_seek($n = 0)
{
return FALSE;
}
@@ -162,9 +163,10 @@ class CI_DB_odbc_result extends CI_DB_result {
*
* Returns the result set as an array
*
+ * @access private
* @return array
*/
- protected function _fetch_assoc()
+ function _fetch_assoc()
{
if (function_exists('odbc_fetch_object'))
{
@@ -183,9 +185,10 @@ class CI_DB_odbc_result extends CI_DB_result {
*
* Returns the result set as an object
*
+ * @access private
* @return object
*/
- protected function _fetch_object()
+ function _fetch_object()
{
if (function_exists('odbc_fetch_object'))
{
@@ -204,9 +207,10 @@ class CI_DB_odbc_result extends CI_DB_result {
* subsititutes the odbc_fetch_object function when
* not available (odbc_fetch_object requires unixODBC)
*
+ * @access private
* @return object
*/
- protected function _odbc_fetch_object(& $odbc_result) {
+ function _odbc_fetch_object(& $odbc_result) {
$rs = array();
$rs_obj = FALSE;
if (odbc_fetch_into($odbc_result, $rs)) {
@@ -225,9 +229,10 @@ class CI_DB_odbc_result extends CI_DB_result {
* subsititutes the odbc_fetch_array function when
* not available (odbc_fetch_array requires unixODBC)
*
+ * @access private
* @return array
*/
- protected function _odbc_fetch_array(& $odbc_result) {
+ function _odbc_fetch_array(& $odbc_result) {
$rs = array();
$rs_assoc = FALSE;
if (odbc_fetch_into($odbc_result, $rs)) {
@@ -313,4 +318,4 @@ class CI_DB_odbc_result extends CI_DB_result {
}
/* End of file odbc_result.php */
-/* Location: ./system/database/drivers/odbc/odbc_result.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/odbc/odbc_result.php */
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index d663da1ad..c146c1785 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -39,9 +39,10 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* List databases
*
+ * @access private
* @return bool
*/
- protected function _list_databases()
+ function _list_databases()
{
// Not sure if ODBC lets you list all databases...
if ($this->db->db_debug)
@@ -58,10 +59,11 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*
* Generates a platform-specific query so that a table can be optimized
*
+ * @access private
* @param string the table name
* @return object
*/
- protected function _optimize_table($table)
+ function _optimize_table($table)
{
// Not a supported ODBC feature
if ($this->db->db_debug)
@@ -78,10 +80,11 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*
* Generates a platform-specific query so that a table can be repaired
*
+ * @access private
* @param string the table name
* @return object
*/
- protected function _repair_table($table)
+ function _repair_table($table)
{
// Not a supported ODBC feature
if ($this->db->db_debug)
@@ -96,10 +99,11 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* ODBC Export
*
+ * @access private
* @param array Preferences
* @return mixed
*/
- protected function _backup($params = array())
+ function _backup($params = array())
{
// Currently unsupported
return $this->db->display_error('db_unsuported_feature');