summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv/sqlsrv_driver.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-03-19 23:34:11 +0100
committerTimothy Warren <tim@timshomepage.net>2012-03-19 23:34:11 +0100
commitb4172695910bf8c0c07933e9baf536d22c9e097a (patch)
treecd156950dffe64bb4848ebc622cef8ab51941a08 /system/database/drivers/sqlsrv/sqlsrv_driver.php
parent1ed5995be34f499aec8cd7b6d4d525a33017fd94 (diff)
Sqlsrv driver visibility declarations
Diffstat (limited to 'system/database/drivers/sqlsrv/sqlsrv_driver.php')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php109
1 files changed, 42 insertions, 67 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index ea9f9483b..95ab61b9f 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -42,30 +42,29 @@
*/
class CI_DB_sqlsrv_driver extends CI_DB {
- var $dbdriver = 'sqlsrv';
+ public $dbdriver = 'sqlsrv';
// The character used for escaping
- var $_escape_char = '';
+ protected $_escape_char = '';
// clause and character used for LIKE escape sequences
- var $_like_escape_str = " ESCAPE '%s' ";
- var $_like_escape_chr = '!';
+ protected $_like_escape_str = " ESCAPE '%s' ";
+ protected $_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() functions.
+ * used for the count_all() and count_all_results() public functions.
*/
- var $_count_string = "SELECT COUNT(*) AS ";
- var $_random_keyword = ' ASC'; // not currently supported
+ protected $_count_string = "SELECT COUNT(*) AS ";
+ protected $_random_keyword = ' ASC'; // not currently supported
/**
* Non-persistent database connection
*
- * @access private called by the base class
* @return resource
*/
- function db_connect($pooling = false)
+ protected 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;
@@ -93,10 +92,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Persistent database connection
*
- * @access private called by the base class
* @return resource
*/
- function db_pconnect()
+ protected function db_pconnect()
{
return $this->db_connect(TRUE);
}
@@ -109,10 +107,9 @@ 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
*/
- function reconnect()
+ public function reconnect()
{
// not implemented in MSSQL
}
@@ -146,11 +143,10 @@ 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
*/
- function _execute($sql)
+ protected function _execute($sql)
{
return sqlsrv_query($this->conn_id, $sql, null, array(
'Scrollable' => SQLSRV_CURSOR_STATIC,
@@ -163,10 +159,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Begin Transaction
*
- * @access public
* @return bool
*/
- function trans_begin($test_mode = FALSE)
+ public function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
@@ -192,10 +187,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Commit Transaction
*
- * @access public
* @return bool
*/
- function trans_commit()
+ public function trans_commit()
{
if ( ! $this->trans_enabled)
{
@@ -216,10 +210,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Rollback Transaction
*
- * @access public
* @return bool
*/
- function trans_rollback()
+ public function trans_rollback()
{
if ( ! $this->trans_enabled)
{
@@ -240,12 +233,11 @@ 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
*/
- function escape_str($str, $like = FALSE)
+ public function escape_str($str, $like = FALSE)
{
// Escape single quotes
return str_replace("'", "''", $str);
@@ -256,10 +248,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Affected Rows
*
- * @access public
* @return integer
*/
- function affected_rows()
+ public function affected_rows()
{
return @sqlrv_rows_affected($this->conn_id);
}
@@ -271,10 +262,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*
* Returns the last id created in the Identity column.
*
- * @access public
* @return integer
*/
- function insert_id()
+ public function insert_id()
{
return $this->query('select @@IDENTITY as insert_id')->row('insert_id');
}
@@ -287,11 +277,10 @@ 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
*/
- function _parse_major_version($version)
+ protected 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.
@@ -327,11 +316,10 @@ 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
*/
- function count_all($table = '')
+ public function count_all($table = '')
{
if ($table == '')
return '0';
@@ -353,11 +341,10 @@ 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
*/
- function _list_tables($prefix_limit = FALSE)
+ protected function _list_tables($prefix_limit = FALSE)
{
return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
}
@@ -369,11 +356,10 @@ 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
*/
- function _list_columns($table = '')
+ protected function _list_columns($table = '')
{
return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'";
}
@@ -385,11 +371,10 @@ 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
*/
- function _field_data($table)
+ public function _field_data($table)
{
return "SELECT TOP 1 * FROM " . $this->_escape_table($table);
}
@@ -437,46 +422,44 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Escape Table Name
*
- * This function adds backticks if the table name has a period
+ * This public 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
*/
- function _escape_table($table)
+ protected function _escape_table($table)
{
return $table;
- }
-
+ }
+
+ // --------------------------------------------------------------------------
/**
* Escape the SQL Identifiers
*
- * This function escapes column and table names
+ * This public function escapes column and table names
*
- * @access private
* @param string
* @return string
*/
- function _escape_identifiers($item)
+ protected function _escape_identifiers($item)
{
return $item;
}
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------------
/**
* From Tables
*
- * This function implicitly groups FROM tables so there is no confusion
+ * This public function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
- * @access public
- * @param type
- * @return type
+ * @param string the table name
+ * @return string
*/
- function _from_tables($tables)
+ public function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -493,13 +476,12 @@ 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
*/
- function _insert($table, $keys, $values)
+ public function _insert($table, $keys, $values)
{
return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
@@ -511,7 +493,6 @@ 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
@@ -519,7 +500,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- function _update($table, $values, $where)
+ public function _update($table, $values, $where)
{
foreach($values as $key => $val)
{
@@ -536,13 +517,12 @@ 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 function maps to "DELETE FROM table"
+ * This public function maps to "DELETE FROM table"
*
- * @access public
* @param string the table name
* @return string
*/
- function _truncate($table)
+ public function _truncate($table)
{
return "TRUNCATE ".$table;
}
@@ -554,13 +534,12 @@ 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
*/
- function _delete($table, $where)
+ public function _delete($table, $where)
{
return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
}
@@ -572,13 +551,12 @@ 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
*/
- function _limit($sql, $limit, $offset)
+ public function _limit($sql, $limit, $offset)
{
$i = $limit + $offset;
@@ -590,18 +568,15 @@ class CI_DB_sqlsrv_driver extends CI_DB {
/**
* Close DB Connection
*
- * @access public
* @param resource
* @return void
*/
- function _close($conn_id)
+ public function _close($conn_id)
{
@sqlsrv_close($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