Permalink
Browse files

Allow to use array with dq->where('a in',array());

  • Loading branch information...
1 parent 119248b commit 0686443822df61353d4d2e2b4f643895c210d8db @romaninsh romaninsh committed Mar 14, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/DBlite/dsql.php
View
9 lib/DBlite/dsql.php
@@ -272,10 +272,15 @@ function where($where,$equals=false,$escape=true,$cond='where'){
$where.=" '".$this->db->escape($equals)."'";
}elseif(substr($where,-3,3)==' in'){
if($escape){
- if(strtolower(substr($equals,0,6))=='select'){
+ if(is_string($equals) && strtolower(substr($equals,0,6))=='select'){
throw new BaseException("use 3rd argument if you pass sub-queries to where()");
}
- $eq=explode(',',$equals);$eq2=array();
+ if(is_array($equals)){
+ $eq=$equals;
+ }else{
+ $eq=explode(',',$equals);
+ }
+ $eq2=array();
foreach($eq as $eq3){
$eq2[]="'".$this->db->escape($eq3)."'";
}

0 comments on commit 0686443

Please sign in to comment.