From 5078eb5062457c1eef2fab0c58fa27f249616b78 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 2 Dec 2014 01:11:54 +0200 Subject: Regressions ... #3380 #3194 ab9217e316a79bc8fab2840c8f5bd2b9bc7a4dc0 --- system/database/DB_driver.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 0b4707370..7c3df42b8 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1461,7 +1461,7 @@ abstract class CI_DB_driver { */ protected function _has_operator($str) { - return (bool) preg_match('/(<|>|!|=|\sIS\s|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', trim($str)); + return (bool) preg_match('/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', trim($str)); } // -------------------------------------------------------------------- @@ -1485,7 +1485,8 @@ abstract class CI_DB_driver { '\s*(?:<|>|!)?=\s*', // =, <=, >=, != '\s*<>?\s*', // <, <> '\s*>\s*', // > - '\s+IS(?:\sNOT)?(?:\sNULL)?', // IS[ NOT] NULL + '\s+IS NULL', // IS NULL + '\s+IS NOT NULL', // IS NOT NULL '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql) '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql) '\s+BETWEEN\s+\S+\s+AND\s+\S+', // BETWEEN value AND value -- cgit v1.2.3-24-g4f1b From 7830173a28dc8e3959ea9a78a334ad10c668f13f Mon Sep 17 00:00:00 2001 From: James L Parry Date: Tue, 16 Dec 2014 02:14:52 -0800 Subject: User Guide - DB Driver Reference First stab at DB driver reference. Methods are listed in order encountered in the source file. Parameter or return types in DB_driver updated as needed, and reflected here. TOC entry added to bottom of database index page. Signed-off-by:James L Parry --- system/database/DB_driver.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 7c3df42b8..fdd99167f 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -964,7 +964,7 @@ abstract class CI_DB_driver { * Calculate the aggregate query elapsed time * * @param int The number of decimal places - * @return int + * @return string */ public function elapsed_time($decimals = 6) { @@ -1034,7 +1034,7 @@ abstract class CI_DB_driver { /** * Escape String * - * @param string $str + * @param string|string[] $str * @param bool $like Whether or not the string will be used in a LIKE condition * @return string */ @@ -1103,7 +1103,7 @@ abstract class CI_DB_driver { * position is the primary key * * @param string the table name - * @return string + * @return mixed */ public function primary($table = '') { @@ -1146,7 +1146,7 @@ abstract class CI_DB_driver { * Returns an array of table names * * @param string $constrain_by_prefix = FALSE - * @return array + * @return mixed */ public function list_tables($constrain_by_prefix = FALSE) { @@ -1214,7 +1214,7 @@ abstract class CI_DB_driver { * Fetch Field Names * * @param string the table name - * @return array + * @return mixed */ public function list_fields($table = '') { -- cgit v1.2.3-24-g4f1b From 0d3fde261bd538dd5f9468a407db74a066bc11a4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 5 Jan 2015 16:56:41 +0200 Subject: Polish changes following PR #3416 --- system/database/DB_driver.php | 48 +++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index fdd99167f..9ef197cd1 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -455,10 +455,24 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- + /** + * DB connect + * + * This is just a dummy method that all drivers will override. + * + * @return mixed + */ + public function db_connect() + { + return TRUE; + } + + // -------------------------------------------------------------------- + /** * Persistent database connection * - * @return resource + * @return mixed */ public function db_pconnect() { @@ -1034,7 +1048,7 @@ abstract class CI_DB_driver { /** * Escape String * - * @param string|string[] $str + * @param string|string[] $str Input string * @param bool $like Whether or not the string will be used in a LIKE condition * @return string */ @@ -1102,10 +1116,10 @@ abstract class CI_DB_driver { * Retrieves the primary key. It assumes that the row in the first * position is the primary key * - * @param string the table name - * @return mixed + * @param string $table Table name + * @return string */ - public function primary($table = '') + public function primary($table) { $fields = $this->list_fields($table); return is_array($fields) ? current($fields) : FALSE; @@ -1146,7 +1160,7 @@ abstract class CI_DB_driver { * Returns an array of table names * * @param string $constrain_by_prefix = FALSE - * @return mixed + * @return array */ public function list_tables($constrain_by_prefix = FALSE) { @@ -1214,9 +1228,9 @@ abstract class CI_DB_driver { * Fetch Field Names * * @param string the table name - * @return mixed + * @return array */ - public function list_fields($table = '') + public function list_fields() { // Is there a cached result? if (isset($this->data_cache['field_names'][$table])) @@ -1224,11 +1238,6 @@ abstract class CI_DB_driver { return $this->data_cache['field_names'][$table]; } - if ($table === '') - { - return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; - } - if (FALSE === ($sql = $this->_list_columns($table))) { return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; @@ -1282,18 +1291,13 @@ abstract class CI_DB_driver { /** * Returns an object with field data * - * @param string the table name - * @return object + * @param string $table the table name + * @return array */ - public function field_data($table = '') + public function field_data($table) { - if ($table === '') - { - return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; - } - $query = $this->query($this->_field_data($this->protect_identifiers($table, TRUE, NULL, FALSE))); - return $query->field_data(); + return ($query) ? $query->field_data() : FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 358b088aa9f288593f2af5af43e1b7d0028a2c8c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 5 Jan 2015 21:00:18 +0200 Subject: Fix #3460 --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 9ef197cd1..5ea1fb8e1 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1230,7 +1230,7 @@ abstract class CI_DB_driver { * @param string the table name * @return array */ - public function list_fields() + public function list_fields($table) { // Is there a cached result? if (isset($this->data_cache['field_names'][$table])) -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/database/DB_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 5ea1fb8e1..185f930bf 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b