summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/oci8')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index e78091614..67bb0403b 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -66,6 +66,8 @@ class CI_DB_oci8_driver extends CI_DB {
protected $_count_string = 'SELECT COUNT(1) AS ';
protected $_random_keyword = ' ASC'; // not currently supported
+ protected $_reserved_identifiers = array('*', 'rownum');
+
// Set "auto commit" by default
public $commit_mode = OCI_COMMIT_ON_SUCCESS;
@@ -464,11 +466,12 @@ class CI_DB_oci8_driver extends CI_DB {
*/
protected function _list_tables($prefix_limit = FALSE)
{
- $sql = 'SELECT TABLE_NAME FROM ALL_TABLES';
+ $sql = 'SELECT "TABLE_NAME" FROM "ALL_TABLES"';
if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
- return $sql." WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
+ return $sql.' WHERE "TABLE_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' "
+ .sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
return $sql;
@@ -486,7 +489,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
protected function _list_columns($table = '')
{
- return 'SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = \''.$table.'\'';
+ return 'SELECT "COLUMN_NAME" FROM "all_tab_columns" WHERE "TABLE_NAME" = '.$this->escape($table);
}
// --------------------------------------------------------------------
@@ -501,7 +504,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
protected function _field_data($table)
{
- return 'SELECT * FROM '.$table.' WHERE rownum = 1';
+ return 'SELECT * FROM '.$this->protect_identifiers($table).' WHERE rownum = 1';
}
// --------------------------------------------------------------------
@@ -634,7 +637,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$this->limit_used = TRUE;
return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($offset + $limit).')'
- .($offset !== 0 ? ' WHERE rnum >= '.$offset : '');
+ .($offset ? ' WHERE rnum >= '.$offset : '');
}
// --------------------------------------------------------------------