summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class2
-rwxr-xr-xtests/it_dbi.t20
2 files changed, 21 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 4e033b4..66f75a6 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -324,7 +324,7 @@ function _where($params = "", $link = null, $omit_where = false)
$query .= "$sep$field $op ('" . join("','", $qvals) . "')"; # null is mapped to ''
}
else
- $query .= $sep . "0";
+ $query .= $sep . (($op == 'IN') ? "0" : "1");
break;
}
diff --git a/tests/it_dbi.t b/tests/it_dbi.t
index 9ffadc7..934e965 100755
--- a/tests/it_dbi.t
+++ b/tests/it_dbi.t
@@ -50,6 +50,26 @@ is(
"bar",
"select with multiple parameters (foo part)"
);
+is(
+ $record->select(array('ID IN' => array(2,3))),
+ 2,
+ "select with IN",
+);
+is(
+ $record->select(array('ID NOT IN' => array(2,3))),
+ 1,
+ "select with NOT IN",
+);
+is(
+ $record->select(array('ID IN' => array())),
+ 0,
+ "select with empty IN",
+);
+is(
+ $record->select(array('ID NOT IN' => array())),
+ 3,
+ "select with empty NOT IN",
+);
it_dbi::createclass(array('table' => "it_dbi_test", 'forcecreate' => true));