Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 5841)
+++ trunk/psLib/src/db/psDB.c	(revision 6296)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-12-24 00:33:15 $
+ *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-02 04:48:47 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -308,4 +308,10 @@
     // 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
@@ -476,4 +482,10 @@
 
     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
@@ -1258,5 +1270,6 @@
         } 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 {
