diff options
author | Andrey Andreev <narf@devilix.net> | 2015-12-14 15:42:29 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-12-14 15:42:29 +0100 |
commit | 788fb4aa823179e7c4401f5384207d916697bb7e (patch) | |
tree | 551fd91834cc4f259d44d2355638552130ca2749 /system/database | |
parent | 97ecf2fcce8e3133e286e16de1b49612235a8dcf (diff) | |
parent | bc05b84995d5425d6bdc28c43174e70b720840ce (diff) |
Merge branch '3.0-stable' into develop
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/DB_driver.php | 12 | ||||
-rw-r--r-- | system/database/DB_forge.php | 4 | ||||
-rw-r--r-- | system/database/DB_query_builder.php | 2 | ||||
-rw-r--r-- | system/database/drivers/mssql/mssql_driver.php | 2 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 8 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_oci_driver.php | 23 |
6 files changed, 43 insertions, 8 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 418de27c8..885a814be 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -499,6 +499,18 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- /** + * Last error + * + * @return array + */ + public function error() + { + return array('code' => NULL, 'message' => NULL); + } + + // -------------------------------------------------------------------- + + /** * Set client character set * * @param string diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index f9cf76a14..1546e40c0 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -780,10 +780,6 @@ abstract class CI_DB_forge { case 'ENUM': case 'SET': $attributes['CONSTRAINT'] = $this->db->escape($attributes['CONSTRAINT']); - $field['length'] = is_array($attributes['CONSTRAINT']) - ? "('".implode("','", $attributes['CONSTRAINT'])."')" - : '('.$attributes['CONSTRAINT'].')'; - break; default: $field['length'] = is_array($attributes['CONSTRAINT']) ? '('.implode(',', $attributes['CONSTRAINT']).')' diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index cf1100d27..7a3d2f594 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1379,7 +1379,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $this->from($table); } - $result = ($this->qb_distinct === TRUE) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_orderby)) ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 883973ae1..b9e310a3a 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -267,7 +267,7 @@ class CI_DB_mssql_driver extends CI_DB { */ protected function _version() { - return 'SELECT @@VERSION AS ver'; + return "SELECT SERVERPROPERTY('ProductVersion') AS ver"; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 916ddeb90..206924d06 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -252,12 +252,16 @@ class CI_DB_oci8_driver extends CI_DB { return $this->data_cache['version']; } - if ( ! $this->conn_id OR ($version = oci_server_version($this->conn_id)) === FALSE) + if ( ! $this->conn_id OR ($version_string = oci_server_version($this->conn_id)) === FALSE) { return FALSE; } + elseif (preg_match('#Release\s(\d+(?:\.\d+)+)#', $version_string, $match)) + { + return $this->data_cache['version'] = $match[1]; + } - return $this->data_cache['version'] = $version; + return FALSE; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php index d17e311f7..4791ab157 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php @@ -130,6 +130,29 @@ class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver { // -------------------------------------------------------------------- /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + $version_string = parent::version(); + if (preg_match('#Release\s(?<version>\d+(?:\.\d+)+)#', $version_string, $match)) + { + return $this->data_cache['version'] = $match[1]; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** * Show table query * * Generates a platform-specific query string so that the table names can be fetched |