Index: /trunk/psLib/src/dataIO/psDB.c
===================================================================
--- /trunk/psLib/src/dataIO/psDB.c	(revision 4388)
+++ /trunk/psLib/src/dataIO/psDB.c	(revision 4389)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-24 21:29:41 $
+ *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-25 01:16:50 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -783,33 +783,35 @@
 {
     char            *query;
-
+    psS64           rows = 0;
+
+    // Verify database is not NULL
+    if(dbh == NULL) {
+        psError(PS_ERR_UNEXPECTED_NULL, true, PS_ERRORTEXT_psDB_INVALID_PSDB);
+        return -1;
+    }
+
+    // Create SQL statement string
     query = psDBGenerateDeleteRowSQL(tableName, where);
     if (!query) {
         psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed.");
-
         return -1;
     }
 
+    // Run SQL query
     if (!p_psDBRunQuery(dbh, query)) {
         psError(PS_ERR_UNKNOWN, false, "Delete failed.");
-
         mysql_rollback(dbh->mysql);
-
         psFree(query);
-
         return -1;
     }
-
     psFree(query);
 
-    if (!where) {
-        // we truncated the table so mysql_affected_rows() won't work
-        return 1;
-    }
+    // Get the number of affected row for the delete command
+    rows = (psS64)mysql_affected_rows(dbh->mysql);
 
     // point of no return
     mysql_commit(dbh->mysql);
 
-    return (psS64)mysql_affected_rows(dbh->mysql);
+    return rows;
 }
 
@@ -1138,15 +1140,15 @@
     if (!where) {
         psStringAppend(&query, "TRUNCATE TABLE %s", tableName);
-
         return query;
     }
 
+    // Generate where SQL substring
     whereSQL = psDBGenerateWhereSQL(where);
     if (!whereSQL) {
-        psError(PS_ERR_UNEXPECTED_NULL, false, "SQL substring generation failed.");
-
-        return NULL;
-    }
-
+        psError(PS_ERR_UNEXPECTED_NULL, false, PS_ERRORTEXT_psDB_SQL_SUBSTR_FAIL);
+        return NULL;
+    }
+
+    // Complete delete SQL command string
     psStringAppend(&query, "DELETE FROM %s %s", tableName, whereSQL);
     psFree(whereSQL);
@@ -1163,5 +1165,4 @@
     if (!where) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true, "where param may not be NULL.");
-
         return NULL;
     }
Index: /trunk/psLib/src/dataIO/psFileUtilsErrors.dat
===================================================================
--- /trunk/psLib/src/dataIO/psFileUtilsErrors.dat	(revision 4388)
+++ /trunk/psLib/src/dataIO/psFileUtilsErrors.dat	(revision 4389)
@@ -72,4 +72,5 @@
 psDB_UPDATE_ROW_FAIL                   Update row SQL generate fail: values and where params may not be NULL.
 psDB_SQL_SUBSTR_FAIL                   SQL substring generation failed.
+psDB_WHERE_SUBSTR_FAIL                 WHERE parameter my not be NULL.
 #
 
Index: /trunk/psLib/src/dataIO/psFileUtilsErrors.h
===================================================================
--- /trunk/psLib/src/dataIO/psFileUtilsErrors.h	(revision 4388)
+++ /trunk/psLib/src/dataIO/psFileUtilsErrors.h	(revision 4389)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-24 21:29:41 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-25 01:16:50 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -91,4 +91,5 @@
 #define PS_ERRORTEXT_psDB_UPDATE_ROW_FAIL "Update row SQL generate fail: values and where params may not be NULL."
 #define PS_ERRORTEXT_psDB_SQL_SUBSTR_FAIL "SQL substring generation failed."
+#define PS_ERRORTEXT_psDB_WHERE_SUBSTR_FAIL "WHERE parameter my not be NULL."
 //~End
 
Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 4388)
+++ /trunk/psLib/src/db/psDB.c	(revision 4389)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-24 21:29:41 $
+ *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-25 01:16:50 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -783,33 +783,35 @@
 {
     char            *query;
-
+    psS64           rows = 0;
+
+    // Verify database is not NULL
+    if(dbh == NULL) {
+        psError(PS_ERR_UNEXPECTED_NULL, true, PS_ERRORTEXT_psDB_INVALID_PSDB);
+        return -1;
+    }
+
+    // Create SQL statement string
     query = psDBGenerateDeleteRowSQL(tableName, where);
     if (!query) {
         psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed.");
-
         return -1;
     }
 
+    // Run SQL query
     if (!p_psDBRunQuery(dbh, query)) {
         psError(PS_ERR_UNKNOWN, false, "Delete failed.");
-
         mysql_rollback(dbh->mysql);
-
         psFree(query);
-
         return -1;
     }
-
     psFree(query);
 
-    if (!where) {
-        // we truncated the table so mysql_affected_rows() won't work
-        return 1;
-    }
+    // Get the number of affected row for the delete command
+    rows = (psS64)mysql_affected_rows(dbh->mysql);
 
     // point of no return
     mysql_commit(dbh->mysql);
 
-    return (psS64)mysql_affected_rows(dbh->mysql);
+    return rows;
 }
 
@@ -1138,15 +1140,15 @@
     if (!where) {
         psStringAppend(&query, "TRUNCATE TABLE %s", tableName);
-
         return query;
     }
 
+    // Generate where SQL substring
     whereSQL = psDBGenerateWhereSQL(where);
     if (!whereSQL) {
-        psError(PS_ERR_UNEXPECTED_NULL, false, "SQL substring generation failed.");
-
-        return NULL;
-    }
-
+        psError(PS_ERR_UNEXPECTED_NULL, false, PS_ERRORTEXT_psDB_SQL_SUBSTR_FAIL);
+        return NULL;
+    }
+
+    // Complete delete SQL command string
     psStringAppend(&query, "DELETE FROM %s %s", tableName, whereSQL);
     psFree(whereSQL);
@@ -1163,5 +1165,4 @@
     if (!where) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true, "where param may not be NULL.");
-
         return NULL;
     }
