summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-20 15:39:16 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-20 15:39:16 +0100
commitc082292f0678b71b8c3d323ea74f847ed4da100e (patch)
tree0fa0426f288e8f929ff50849e3c54f723ac52bcc /system/database/drivers/sqlsrv
parent56c879a870600b3e3ffce586c849d53e85f93674 (diff)
parent4d1167149a9bad94bdc6a6947525d4c610f0e3aa (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers/sqlsrv')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php72
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php8
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_result.php6
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_utility.php4
4 files changed, 32 insertions, 58 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 0cdeae40c..2c45183b9 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -46,7 +46,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
protected $_escape_char = '';
// clause and character used for LIKE escape sequences
- protected $_like_escape_str = ' ESCAPE \'%s\' ';
+ protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';
/**
@@ -62,7 +62,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*
* @return resource
*/
- public function db_connect($pooling = TRUE)
+ public 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;
@@ -147,23 +147,11 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
protected function _execute($sql)
{
- return sqlsrv_query($this->conn_id, $this->_prep_query($sql), NULL,
- array('Scrollable' => SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => TRUE));
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Prep the query
- *
- * If needed, each database adapter can prep the query string
- *
- * @param string an SQL query
- * @return string
- */
- protected function _prep_query($sql)
- {
- return $sql;
+ return sqlsrv_query($this->conn_id,
+ $sql,
+ NULL,
+ array('Scrollable'=> SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => TRUE)
+ );
}
// --------------------------------------------------------------------
@@ -255,12 +243,12 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Insert ID
- *
- * Returns the last id created in the Identity column.
- *
- * @return int
- */
+ * Insert ID
+ *
+ * Returns the last id created in the Identity column.
+ *
+ * @return string
+ */
public function insert_id()
{
$query = $this->query('SELECT @@IDENTITY AS insert_id');
@@ -346,7 +334,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
protected function _list_columns($table = '')
{
- return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'";
+ return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";
}
// --------------------------------------------------------------------
@@ -357,11 +345,11 @@ class CI_DB_sqlsrv_driver extends CI_DB {
* Generates a platform-specific query so that the column data can be retrieved
*
* @param string the table name
- * @return object
+ * @return string
*/
protected function _field_data($table)
{
- return 'SELECT TOP 1 * FROM '.$this->_escape_table($table);
+ return 'SELECT TOP 1 * FROM '.$table;
}
// --------------------------------------------------------------------
@@ -405,20 +393,6 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Escape Table Name
- *
- * This function adds backticks if the table name has a period
- * in it. Some DBs will get cranky unless periods are escaped
- *
- * @param string the table name
- * @return string
- */
- protected function _escape_table($table)
- {
- return $table;
- }
-
- /**
* Escape the SQL Identifiers
*
* This function escapes column and table names
@@ -466,7 +440,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
protected function _insert($table, $keys, $values)
{
- return 'INSERT INTO '.$this->_escape_table($table).' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')';
+ return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')';
}
// --------------------------------------------------------------------
@@ -490,7 +464,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
$valstr[] = $key.' = '.$val;
}
- return 'UPDATE '.$this->_escape_table($table).' SET '.implode(', ', $valstr).' WHERE '.implode(' ', $where);
+ return 'UPDATE '.$table.' SET '.implode(', ', $valstr).' WHERE '.implode(' ', $where);
}
// --------------------------------------------------------------------
@@ -524,7 +498,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
protected function _delete($table, $where)
{
- return 'DELETE FROM '.$this->_escape_table($table).' WHERE '.implode(' ', $where);
+ return 'DELETE FROM '.$table.' WHERE '.implode(' ', $where);
}
// --------------------------------------------------------------------
@@ -535,8 +509,8 @@ class CI_DB_sqlsrv_driver extends CI_DB {
* Generates a platform-specific LIMIT clause
*
* @param string the sql query string
- * @param integer the number of rows to limit the query to
- * @param integer the offset value
+ * @param int the number of rows to limit the query to
+ * @param int the offset value
* @return string
*/
protected function _limit($sql, $limit, $offset)
@@ -560,4 +534,4 @@ class CI_DB_sqlsrv_driver extends CI_DB {
}
/* 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
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index d8b3af8fc..d331f6023 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -162,9 +162,9 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
* @param string the table name
* @param string the column definition
* @param string the default value
- * @param boolean should 'NOT NULL' be added
+ * @param bool should 'NOT NULL' be added
* @param string the field after which we should add the new field
- * @return object
+ * @return string
*/
public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
{
@@ -202,4 +202,4 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
}
/* End of file sqlsrv_forge.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */
+/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ \ No newline at end of file
diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php
index c5f9093db..1adce7325 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_result.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -126,7 +126,7 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
/**
* Data Seek
*
- * Moves the internal pointer to the desired offset. We call
+ * Moves the internal pointer to the desired offset. We call
* this internally before fetching results to make sure the
* result set starts at zero
*
@@ -168,4 +168,4 @@ class CI_DB_sqlsrv_result extends CI_DB_result {
}
/* End of file sqlsrv_result.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_result.php */
+/* Location: ./system/database/drivers/sqlsrv/sqlsrv_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 d2a421208..2ef6b240e 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -92,4 +92,4 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility {
}
/* End of file sqlsrv_utility.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_utility.php */
+/* Location: ./system/database/drivers/sqlsrv/sqlsrv_utility.php */ \ No newline at end of file