Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 8334)
+++ /trunk/psLib/src/db/psDB.c	(revision 8335)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-12 03:33:15 $
+ *  @version $Revision: 1.82 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-15 02:26:50 $
  *
  *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
@@ -86,5 +86,6 @@
 static char    *psDBGenerateSetSQL(const psMetadata *set
                                   );
-static char    *psDBGenerateConditionalSQL(const psMetadataItem *item);
+static char *psDBGenerateConditionalSQL(const psMetadataItem *item, const char *tableName);
+
 // lookup table functions
 static psElemType psDBMySQLToPType(enum enum_field_types type, unsigned int flags);
@@ -1348,5 +1349,5 @@
     // select all rows if where is NULL
     if (where) {
-        whereSQL = psDBGenerateWhereSQL(where);
+        whereSQL = psDBGenerateWhereSQL(where, tableName);
         if (!whereSQL) {
             psError(PS_ERR_UNEXPECTED_NULL, false, "SQL substring generation failed.");
@@ -1437,5 +1438,5 @@
 
     // Create where SQL substring
-    whereSQL = psDBGenerateWhereSQL(where);
+    whereSQL = psDBGenerateWhereSQL(where, tableName);
     if (!whereSQL) {
         psError(PS_ERR_UNEXPECTED_NULL, false, _("SQL substring generation failed."));
@@ -1468,5 +1469,5 @@
 
     // Generate where SQL substring
-    whereSQL = psDBGenerateWhereSQL(where);
+    whereSQL = psDBGenerateWhereSQL(where, tableName);
     if (!whereSQL) {
         psError(PS_ERR_UNEXPECTED_NULL, false, _("SQL substring generation failed."));
@@ -1488,9 +1489,9 @@
 }
 
-char *psDBGenerateWhereSQL(const psMetadata *where)
+char *psDBGenerateWhereSQL(const psMetadata *where, const char *tableName)
 {
     PS_ASSERT_PTR_NON_NULL(where, NULL);
 
-    psString search = psDBGenerateWhereConditionSQL(where);
+    psString search = psDBGenerateWhereConditionSQL(where, tableName);
     if (search) {
         psStringPrepend(&search, "WHERE ");
@@ -1500,5 +1501,5 @@
 }
 
-char *psDBGenerateWhereConditionSQL(const psMetadata *where)
+char *psDBGenerateWhereConditionSQL(const psMetadata *where, const char *tableName)
 {
     PS_ASSERT_PTR_NON_NULL(where, NULL);
@@ -1536,5 +1537,5 @@
             psStringAppend(&query, "(");
             while ((mItem = psListGetAndIncrement(mCursor))) {
-                char *conditional = psDBGenerateConditionalSQL(mItem);
+                char *conditional = psDBGenerateConditionalSQL(mItem, tableName);
                 if (!conditional) {
                     psError(PS_ERR_UNKNOWN, false,
@@ -1560,5 +1561,5 @@
             psStringAppend(&query, ")");
         } else {
-            char *conditional = psDBGenerateConditionalSQL(item);
+            char *conditional = psDBGenerateConditionalSQL(item, tableName);
             if (!conditional) {
                 psError(PS_ERR_UNKNOWN, false,
@@ -1614,5 +1615,5 @@
 }
 
-static char *psDBGenerateConditionalSQL(const psMetadataItem *item)
+static char *psDBGenerateConditionalSQL(const psMetadataItem *item, const char *tableName)
 {
     PS_ASSERT_PTR_NON_NULL(item, NULL);
@@ -1627,4 +1628,10 @@
     // the comparison to be done on the server provides some consistency
     // between clients on different archs.
+
+    // if tableName is specified prepend it to the item name
+    if (tableName) {
+        psStringAppend(&query, "%s.", tableName);
+    }
+
     if ((item->type == PS_DATA_S32) || (item->type == PS_TYPE_S32)) {
         psStringAppend(&query, "%s=%d", item->name, (int)(item->data.S32));
Index: /trunk/psLib/src/db/psDB.h
===================================================================
--- /trunk/psLib/src/db/psDB.h	(revision 8334)
+++ /trunk/psLib/src/db/psDB.h	(revision 8335)
@@ -10,6 +10,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-12 03:33:15 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-15 02:26:50 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -362,5 +362,5 @@
  * @return psString:   A psString or NULL on failure
  */
-char    *psDBGenerateWhereSQL(const psMetadata *where);
+char    *psDBGenerateWhereSQL(const psMetadata *where, const char *tableName);
 
 /** Generates an SQL "where conditon" statement
@@ -372,5 +372,5 @@
  * @return psString:   A psString or NULL on failure
  */
-char *psDBGenerateWhereConditionSQL(const psMetadata *where);
+char *psDBGenerateWhereConditionSQL(const psMetadata *where, const char *tableName);
 
 
