summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_query_builder.php25
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 11 insertions, 15 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 296a2eed5..eca9fb38b 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -717,7 +717,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function where_in($key = NULL, $values = NULL, $escape = NULL)
+ public function where_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_where', $key, $values, FALSE, 'AND ', $escape);
}
@@ -735,7 +735,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_where_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_where_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_where', $key, $values, FALSE, 'OR ', $escape);
}
@@ -753,7 +753,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function where_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function where_not_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_where', $key, $values, TRUE, 'AND ', $escape);
}
@@ -771,7 +771,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_where_not_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_where', $key, $values, TRUE, 'OR ', $escape);
}
@@ -789,7 +789,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function having_in($key = NULL, $values = NULL, $escape = NULL)
+ public function having_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_having', $key, $values, FALSE, 'AND ', $escape);
}
@@ -807,7 +807,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_having_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_having_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_having', $key, $values, FALSE, 'OR ', $escape);
}
@@ -825,7 +825,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function having_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function having_not_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_having', $key, $values, TRUE, 'AND ', $escape);
}
@@ -843,7 +843,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_having_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_having_not_in($key, array $values, $escape = NULL)
{
return $this->_wh_in('qb_having', $key, $values, TRUE, 'OR ', $escape);
}
@@ -870,20 +870,15 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- protected function _wh_in($qb_key, $key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL)
+ protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
{
$qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
- if ($key === NULL OR $values === NULL)
+ if ($key === NULL)
{
return $this;
}
- if ( ! is_array($values))
- {
- $values = array($values);
- }
-
is_bool($escape) OR $escape = $this->_protect_identifiers;
$not = ($not) ? ' NOT' : '';
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5a99dfe9c..7fcd72e8a 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -87,6 +87,7 @@ Release Date: Not Released
- :doc:`Query Builder <database/query_builder>`:
- Added methods ``having_in()``, ``or_having_in()``, ``not_having_in()``, ``or_not_having_in()``.
+ - Updated methods ``where_in()``, ``or_where_in()``, ``not_where_in()``, ``or_not_where_in()`` to reject non-array inputs for the second parameter.
- Updated method ``join()`` to allow accepting ``NATURAL`` clauses in its third parameter.
- Updated logic to allow dots in alias names.