diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-25 16:48:49 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-25 16:48:49 +0200 |
commit | 5029305c030158aebac7df231f4bef38c30b3616 (patch) | |
tree | 96e25ca4e489f0849468119e6a87c817213f19c9 /system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php | |
parent | df8894f0bd819bd4f9692abf9b95b692d37f3188 (diff) |
Add pdo_odbc subdriver
Diffstat (limited to 'system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php')
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php index 3a2679f41..a3e118149 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -85,6 +85,32 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver { // -------------------------------------------------------------------- /** + * Non-persistent database connection + * + * @param bool + * @return object + */ + public function db_connect($persistent = FALSE) + { + $pdo_obj = parent::db_connect($persistent); + + if ( ! is_object($pdo_obj)) + { + return $pdo_obj; + } + + // Determine how identifiers are escaped + $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi'); + $query = $query->row_array(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + + return $pdo_obj; + } + + // -------------------------------------------------------------------- + + /** * Show table query * * Generates a platform-specific query string so that the table names can be fetched @@ -119,22 +145,9 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver { */ protected function _list_columns($table = '') { - return 'SELECT "column_name" FROM "information_schema"."columns" WHERE "table_name" = '.$this->escape($table); - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @param string the table name - * @return string - */ - protected function _field_data($table) - { - return 'SELECT TOP 1 * FROM '.$this->protect_identifiers($table); + return 'SELECT '.$this->escape_identifiers('column_name') + .' FROM '.$this->escape_identifiers('information_schema.columns') + .' WHERE '.$this->escape_identifiers('table_name').' = '.$this->escape($table); } // -------------------------------------------------------------------- |