diff options
author | Christian Weber | 2012-05-18 14:48:00 +0000 |
---|---|---|
committer | Christian Weber | 2012-05-18 14:48:00 +0000 |
commit | 6829130db749903ca012e09bc0ba19aaca000449 (patch) | |
tree | d8f6ff5b101e7c8323857108bdc800dd2124959a /it_dbi.class | |
parent | 4e7764843f21338aa2f9e80c2c16b30bad005108 (diff) | |
download | itools-6829130db749903ca012e09bc0ba19aaca000449.tar.gz itools-6829130db749903ca012e09bc0ba19aaca000449.tar.bz2 itools-6829130db749903ca012e09bc0ba19aaca000449.zip |
use IN instead of = if value is an array
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class index 06e1d1e..328e63c 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -264,6 +264,7 @@ function _set($tags, $allfields = false) * Example: * $sql = $table->_where(array('Type' => 'bar', * 'Date >=' => '1999-01-01', '-Date <' => 'NOW()', + * 'Status' => array('foo', 'bar', 'qux'), # same as 'Status IN' => ... * 'User NI' => 'chris'), 'ORDER BY Date'); * * @param $params optional array of fieldname => value tupels. These are ANDed to form a WHERE clause. @@ -309,7 +310,7 @@ function _where($params = "", $dummy_link = null, $omit_where = false) $op = strtoupper($regs[2]); } else - $op = '='; + $op = is_array($value) ? 'IN' : '='; # If field name starts with '-', the raw value is taken, no escaping is done and no quotes are put around it. if (substr($field, 0, 1) == '-') |