[turba] [patch] Fix sql driver's use of SQL "IN ()"

Jason M. Felice jfelice at cronosys.com
Mon Dec 1 17:49:45 PST 2003


PostgreSQL throws a parse error when it sees an SQL IN expression with an
empty value list.  It probably shouldn't, but we should save a trip to the
database in any case.

-------------- next part --------------
epm diff turba/lib/Driver/sql.php
--- turba/lib/Driver/sql.php	2003-12-01 20:23:24.000000000 -0500
+++ turba/lib/Driver/sql.php	2003-12-01 20:23:38.000000000 -0500
@@ -153,6 +153,9 @@
     {
         $in = '';
         if (is_array($id)) {
+            if (count($id) == 0) {
+                return array();
+            }
             foreach ($id as $key) {
                 $in .= empty($in) ? $this->_db->quote($this->_convertToDriver($key)) 
                                     : ', ' . $this->_db->quote($this->_convertToDriver($key));


More information about the turba mailing list