Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 9179)
+++ trunk/psLib/src/db/psDB.c	(revision 9396)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.95 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-10-04 03:16:17 $
+ *  @version $Revision: 1.96 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-10-07 05:12:33 $
  *
  *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
@@ -1635,21 +1635,24 @@
 
     // if tableName is specified prepend it to the item name
+    psString itemName = NULL;
     if (tableName) {
-        psStringAppend(&query, "%s.", tableName);
+        psStringAppend(&itemName, "%s.%s", tableName, itemName);
+    } else {
+        psStringAppend(&itemName, "%s", itemName);
     }
 
     if ((item->type == PS_DATA_S32) || (item->type == PS_TYPE_S32)) {
-        psStringAppend(&query, "%s=%d", item->name, (int)(item->data.S32));
+        psStringAppend(&query, "%s=%d", itemName, (int)(item->data.S32));
     } else if ((item->type == PS_DATA_F32) || (item->type == PS_TYPE_F32)) {
-        psStringAppend(&query, "(ABS(%s - %.8f) < %.8f)", item->name, (float)(item->data.F32), FLT_EPSILON * 10);
+        psStringAppend(&query, "(ABS(%s - %.8f) < %.8f)", itemName, (float)(item->data.F32), FLT_EPSILON * 10);
     } else if ((item->type == PS_DATA_F64) || (item->type == PS_TYPE_F64)) {
-        psStringAppend(&query, "(ABS(%s - %.17f) < %.17f)", item->name, (double)(item->data.F64), DBL_EPSILON * 10);
+        psStringAppend(&query, "(ABS(%s - %.17f) < %.17f)", itemName, (double)(item->data.F64), DBL_EPSILON * 10);
     } else if ((item->type == PS_DATA_BOOL) || (item->type == PS_TYPE_BOOL)) {
-        psStringAppend(&query, "%s=%d", item->name, (int)(item->data.B));
+        psStringAppend(&query, "%s=%d", itemName, (int)(item->data.B));
     } else if (item->type == PS_DATA_STRING) {
         // + column name + _ + like + _ + ' + value + '
         // check for NULL and empty ("") strings
         if (item->data.V == NULL || *item->data.str == '\0') {
-            psStringAppend(&query, "%s IS NULL", item->name);
+            psStringAppend(&query, "%s IS NULL", itemName);
         } else {
             if (item->comment && strstr(item->comment, "LIKE")) {
@@ -1658,7 +1661,7 @@
                 // very large TEXT columns that really shouldn't be
                 // used in a where clause...
-                psStringAppend(&query, "%s LIKE '%s'", item->name, item->data.str);
+                psStringAppend(&query, "%s LIKE '%s'", itemName, item->data.str);
             } else {
-                psStringAppend(&query, "%s = '%s'", item->name, item->data.str);
+                psStringAppend(&query, "%s = '%s'", itemName, item->data.str);
             }
         }
