Commit d4106c032d69531bf6ea57467ab40ae4bffeb668

Authored by nbm
1 parent 3e3f90c1

Allow getBy to receive an arrays as a value for IN (1,2,3) SQL

expressions.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3555 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 6 additions and 1 deletions
lib/ktentity.inc
... ... @@ -323,7 +323,12 @@ class KTEntityUtil {
323 323 } else {
324 324 $aWhere = array();
325 325 foreach ($aField as $k => $sField) {
326   - $aWhere[] = array("$sField = ?", array($mValue[$k]));
  326 + if (is_array($mValue[$k])) {
  327 + $sParam = DBUtil::paramArray($mValue[$k]);
  328 + $aWhere[] = array("$sField IN ($sParam)", array($mValue[$k]));
  329 + } else {
  330 + $aWhere[] = array("$sField = ?", array($mValue[$k]));
  331 + }
327 332 }
328 333 $sWhereClause = KTUtil::whereToString($aWhere);
329 334 }
... ...