Allow sqln driver to take an array of 'attribute' filters as well
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 17 Jan 2011 21:58:42 +0000 (16:58 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 17 Jan 2011 21:58:42 +0000 (16:58 -0500)
framework/Share/lib/Horde/Share/Sqlng.php

index 9efc14b..e729fd5 100644 (file)
@@ -339,7 +339,12 @@ class Horde_Share_Sqlng extends Horde_Share_Sql
             // Build attribute/key filter.
             $where = '(' . $where . ') ';
             foreach ($attributes as $key => $value) {
-                $where .= ' AND ' . $key . ' = ' . $this->_db->quote($value);
+                if (is_array($value)) {
+                    $value = array_map(array($this->_db, 'quote'), $value);
+                    $where .= ' AND ' . $key . ' IN (' . implode(', ', $value) . ')';
+                } else {
+                    $where .= ' AND ' . $key . ' = ' . $this->_db->quote($value);
+                }
             }
         } elseif (!empty($attributes)) {
             // Restrict to shares owned by the user specified in the