? src/db/.foo.txt.swp
? src/db/foo.txt
Index: src/db/psDB.c
===================================================================
RCS file: /usr/local/cvs/repositories/pan-starrs/datasys/IPP/psLib/src/db/psDB.c,v
retrieving revision 1.45
diff -u -r1.45 psDB.c
--- src/db/psDB.c	24 Dec 2005 00:33:15 -0000	1.45
+++ src/db/psDB.c	31 Jan 2006 00:48:30 -0000
@@ -307,6 +307,12 @@
 
     // Get number of rows returned in result
     rowCount = mysql_num_rows(result);
+    // XXX has mysql's semantics changed?  If this is zero then why was a
+    // result set returned?
+    if (!rowCount) {
+        mysql_free_result(result);
+        return NULL;
+    }
 
     // pre-allocate enough elements to hold the complete result set
     // then reset n to 0 so elements are added from the beginning of
@@ -475,6 +481,12 @@
     }
 
     rowCount = mysql_num_rows(result);
+    // XXX has mysql's semantics changed?  If this is zero then why was a
+    // result set returned?
+    if (rowCount == 0) {
+        mysql_free_result(result);
+        return NULL;
+    }
 
     // pre-allocate enough elements to hold the complete result set
     // then reset n to 0 so elements are added from the beginning of
@@ -1257,7 +1269,8 @@
             psStringAppend(&query, "%s=%d", item->name, (int)(item->data.B));
         } else if (item->type == PS_DATA_STRING) {
             // + column name + _ + like + _ + ' + value + '
-            if (*(char *)item->data.V == '\0') {
+            // check for NULL and empty ("") strings
+            if (item->data.V == NULL || *(char *)item->data.V == '\0') {
                 psStringAppend(&query, "%s IS NULL", item->name);
             } else {
                 // XXX ASC NOTE: we should have a better match for
