summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r--system/database/DB_query_builder.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 296a2eed5..5480ed44f 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
abstract class CI_DB_query_builder extends CI_DB_driver {
@@ -526,7 +526,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
public function join($table, $cond, $type = '', $escape = NULL)
{
$type = trim(strtoupper($type).' JOIN');
- preg_match('#^(NATURAL\s+)?((LEFT|RIGHT)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
+ preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
// Extract any aliases that might exist. We use this information
// in the protect_identifiers to know whether to add a table prefix
@@ -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,18 +870,18 @@ 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 (empty($key) OR ! is_string($key))
{
- return $this;
+ throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
}
- if ( ! is_array($values))
+ if (empty($values))
{
- $values = array($values);
+ throw new InvalidArgumentException(sprintf('%s() expects $values to be a non-empty array', debug_backtrace(0, 2)[1]['function']));
}
is_bool($escape) OR $escape = $this->_protect_identifiers;
@@ -1191,7 +1191,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
/**
* GROUP BY
*
- * @param string $by
+ * @param mixed $by
* @param bool $escape
* @return CI_DB_query_builder
*/
@@ -1484,7 +1484,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$qb_cache_orderby = $this->qb_cache_orderby;
$this->qb_orderby = $this->qb_cache_orderby = array();
- $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset)
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR ! empty($this->qb_having) OR $this->qb_limit OR $this->qb_offset)
? $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')));