diff options
author | tianhe1986 <w1s2j3229@163.com> | 2017-02-13 09:58:24 +0100 |
---|---|---|
committer | tianhe1986 <w1s2j3229@163.com> | 2017-02-13 09:58:24 +0100 |
commit | 975d5cfca6248c55496b3e15b37fb2c81fb85f4c (patch) | |
tree | ede75fee4b3250d62cf879287cddd989dc00cb86 /system/database/DB_query_builder.php | |
parent | 0b7ff8cb5b3242d402785a82db2f9821bed74f8f (diff) |
Adding having_in(), or_having_in(), having_not_in() and or_having_not_in().
Signed-off-by: tianhe1986 <w1s2j3229@163.com>
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r-- | system/database/DB_query_builder.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 0ae132c19..1daee99a8 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -785,6 +785,78 @@ abstract class CI_DB_query_builder extends CI_DB_driver { // -------------------------------------------------------------------- /** + * HAVING IN + * + * Generates a HAVING field IN('item', 'item') SQL query, + * joined with 'AND' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function having_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_wh_in('qb_having', $key, $values, FALSE, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR HAVING IN + * + * Generates a HAVING field IN('item', 'item') SQL query, + * joined with 'OR' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_having_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_wh_in('qb_having', $key, $values, FALSE, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * HAVING NOT IN + * + * Generates a HAVING field NOT IN('item', 'item') SQL query, + * joined with 'AND' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function having_not_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_wh_in('qb_having', $key, $values, TRUE, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR HAVING NOT IN + * + * Generates a HAVING field NOT IN('item', 'item') SQL query, + * joined with 'OR' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_having_not_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_wh_in('qb_having', $key, $values, TRUE, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** * Internal WHERE/HAVING IN * * @used-by where_in() |