summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php109
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php20
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_result.php24
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_utility.php12
4 files changed, 104 insertions, 61 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 95ab61b9f..ea9f9483b 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -42,29 +42,30 @@
*/
class CI_DB_sqlsrv_driver extends CI_DB {
- public $dbdriver = 'sqlsrv';
+ var $dbdriver = 'sqlsrv';
// The character used for escaping
- protected $_escape_char = '';
+ 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 = ' ASC'; // not currently supported
+ var $_count_string = "SELECT COUNT(*) AS ";
+ var $_random_keyword = ' ASC'; // not currently supported
/**
* Non-persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_connect($pooling = false)
+ function db_connect($pooling = false)
{
// Check for a UTF-8 charset being passed as CI's default 'utf8'.
$character_set = (0 === strcasecmp('utf8', $this->char_set)) ? 'UTF-8' : $this->char_set;
@@ -92,9 +93,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_pconnect()
+ function db_pconnect()
{
return $this->db_connect(TRUE);
}
@@ -107,9 +109,10 @@ class CI_DB_sqlsrv_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 MSSQL
}
@@ -143,10 +146,11 @@ class CI_DB_sqlsrv_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 sqlsrv_query($this->conn_id, $sql, null, array(
'Scrollable' => SQLSRV_CURSOR_STATIC,
@@ -159,9 +163,10 @@ class CI_DB_sqlsrv_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)
{
@@ -187,9 +192,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Commit Transaction
*
+ * @access public
* @return bool
*/
- public function trans_commit()
+ function trans_commit()
{
if ( ! $this->trans_enabled)
{
@@ -210,9 +216,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Rollback Transaction
*
+ * @access public
* @return bool
*/
- public function trans_rollback()
+ function trans_rollback()
{
if ( ! $this->trans_enabled)
{
@@ -233,11 +240,12 @@ class CI_DB_sqlsrv_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)
{
// Escape single quotes
return str_replace("'", "''", $str);
@@ -248,9 +256,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Affected Rows
*
+ * @access public
* @return integer
*/
- public function affected_rows()
+ function affected_rows()
{
return @sqlrv_rows_affected($this->conn_id);
}
@@ -262,9 +271,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*
* Returns the last id created in the Identity column.
*
+ * @access public
* @return integer
*/
- public function insert_id()
+ function insert_id()
{
return $this->query('select @@IDENTITY as insert_id')->row('insert_id');
}
@@ -277,10 +287,11 @@ class CI_DB_sqlsrv_driver extends CI_DB {
* Grabs the major version number from the
* database server version string passed in.
*
+ * @access private
* @param string $version
* @return int16 major version number
*/
- protected function _parse_major_version($version)
+ function _parse_major_version($version)
{
preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info);
return $ver_info[1]; // return the major version b/c that's all we're interested in.
@@ -316,10 +327,11 @@ class CI_DB_sqlsrv_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 == '')
return '0';
@@ -341,10 +353,11 @@ class CI_DB_sqlsrv_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)
{
return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
}
@@ -356,10 +369,11 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*
* Generates a platform-specific query string so that the column names can be fetched
*
+ * @access private
* @param string the table name
* @return string
*/
- protected function _list_columns($table = '')
+ function _list_columns($table = '')
{
return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'";
}
@@ -371,10 +385,11 @@ class CI_DB_sqlsrv_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 " . $this->_escape_table($table);
}
@@ -422,44 +437,46 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Escape Table Name
*
- * This public function adds backticks if the table name has a period
+ * This function adds backticks if the table name has a period
* in it. Some DBs will get cranky unless periods are escaped
*
+ * @access private
* @param string the table name
* @return string
*/
- protected function _escape_table($table)
+ function _escape_table($table)
{
return $table;
- }
-
- // --------------------------------------------------------------------------
+ }
+
/**
* 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)
{
return $item;
}
- // --------------------------------------------------------------------------
+ // --------------------------------------------------------------------
/**
* 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
*
- * @param string the table name
- * @return string
+ * @access public
+ * @param type
+ * @return type
*/
- public function _from_tables($tables)
+ function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -476,12 +493,13 @@ class CI_DB_sqlsrv_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 ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
@@ -493,6 +511,7 @@ class CI_DB_sqlsrv_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
@@ -500,7 +519,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- public function _update($table, $values, $where)
+ function _update($table, $values, $where)
{
foreach($values as $key => $val)
{
@@ -517,12 +536,13 @@ class CI_DB_sqlsrv_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 "TRUNCATE ".$table;
}
@@ -534,12 +554,13 @@ class CI_DB_sqlsrv_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)
+ function _delete($table, $where)
{
return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
}
@@ -551,12 +572,13 @@ class CI_DB_sqlsrv_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)
{
$i = $limit + $offset;
@@ -568,15 +590,18 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Close DB Connection
*
+ * @access public
* @param resource
* @return void
*/
- public function _close($conn_id)
+ function _close($conn_id)
{
@sqlsrv_close($conn_id);
}
}
+
+
/* End of file mssql_driver.php */
-/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/mssql/mssql_driver.php */
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 645274232..cd061dd23 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -39,10 +39,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
/**
* Create database
*
+ * @access private
* @param string the database name
* @return bool
*/
- protected function _create_database($name)
+ function _create_database($name)
{
return "CREATE DATABASE ".$name;
}
@@ -52,10 +53,11 @@ class CI_DB_sqlsrv_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)
{
return "DROP DATABASE ".$name;
}
@@ -65,9 +67,10 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
/**
* Drop Table
*
+ * @access private
* @return bool
*/
- protected function _drop_table($table)
+ function _drop_table($table)
{
return "DROP TABLE ".$this->db->_escape_identifiers($table);
}
@@ -77,6 +80,7 @@ class CI_DB_sqlsrv_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 +88,7 @@ class CI_DB_sqlsrv_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 ';
@@ -186,6 +190,7 @@ class CI_DB_sqlsrv_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
@@ -195,7 +200,7 @@ class CI_DB_sqlsrv_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);
@@ -237,11 +242,12 @@ class CI_DB_sqlsrv_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)
{
// I think this syntax will work, but can find little documentation on renaming tables in MSSQL
return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name);
@@ -250,4 +256,4 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
}
/* End of file sqlsrv_forge.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */
diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php
index 095e3440a..52d338a30 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_result.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_result.php
@@ -41,9 +41,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
/**
* Number of rows in the result set
*
+ * @access public
* @return integer
*/
- public function num_rows()
+ function num_rows()
{
return @sqlsrv_num_rows($this->result_id);
}
@@ -53,9 +54,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
/**
* Number of fields in the result set
*
+ * @access public
* @return integer
*/
- pubilc function num_fields()
+ function num_fields()
{
return @sqlsrv_num_fields($this->result_id);
}
@@ -67,9 +69,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
*
* Generates an array of column names
*
+ * @access public
* @return array
*/
- public function list_fields()
+ function list_fields()
{
$field_names = array();
foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field)
@@ -87,9 +90,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
*
* Generates an array of objects containing field meta-data
*
+ * @access public
* @return array
*/
- public function field_data()
+ function field_data()
{
$retval = array();
foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field)
@@ -114,7 +118,7 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
*
* @return null
*/
- public function free_result()
+ function free_result()
{
if (is_resource($this->result_id))
{
@@ -132,9 +136,10 @@ class CI_DB_sqlsrv_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)
{
// Not implemented
}
@@ -146,9 +151,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
*
* Returns the result set as an array
*
+ * @access private
* @return array
*/
- protected function _fetch_assoc()
+ function _fetch_assoc()
{
return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC);
}
@@ -160,14 +166,16 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
*
* Returns the result set as an object
*
+ * @access private
* @return object
*/
- protected function _fetch_object()
+ function _fetch_object()
{
return sqlsrv_fetch_object($this->result_id);
}
}
+
/* End of file mssql_result.php */
/* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file
diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php
index 9e9dde32e..44e6fafeb 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -39,9 +39,10 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility {
/**
* List databases
*
+ * @access private
* @return bool
*/
- protected function _list_databases()
+ function _list_databases()
{
return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases
}
@@ -53,10 +54,11 @@ class CI_DB_sqlsrv_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)
{
return FALSE; // Is this supported in MS SQL?
}
@@ -68,10 +70,11 @@ class CI_DB_sqlsrv_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)
{
return FALSE; // Is this supported in MS SQL?
}
@@ -81,10 +84,11 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility {
/**
* MSSQL 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');