Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 4279)
+++ trunk/psLib/src/db/psDB.c	(revision 4297)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-16 01:48:18 $
+ *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-17 21:33:46 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -513,13 +513,19 @@
     psArray         *rowSet;            // psArray of row to insert
 
+    // Check for null row
+    if(row == NULL) {
+        psError(PS_ERR_UNKNOWN,true,PS_ERRORTEXT_psDB_INSERT_ROW_FAIL);
+        return false;
+    }
+
+    // Create array to store single row
     rowSet = psArrayAlloc(1);
     rowSet->n = 0;
     psArrayAdd(rowSet, 0, row);
 
+    // Execute function to insert rows
     if (!psDBInsertRows(dbh, tableName, rowSet)) {
-        psError(PS_ERR_UNKNOWN, false, "Insert failed.");
-
+        psError(PS_ERR_UNKNOWN, false, PS_ERRORTEXT_psDB_INSERT_ROW_FAIL);
         psFree(rowSet);
-
         return false;
     }
@@ -539,26 +545,30 @@
     psU64           j;                  // row index
 
+    // Verify database connections is set up
+    if(dbh == NULL) {
+        psError(PS_ERR_UNEXPECTED_NULL,true,PS_ERRORTEXT_psDB_INVALID_PSDB);
+        return false;
+    }
+
     // we are assuming that all rows in the set have an identical with reguard
     // to field count and type
     row = rowSet->data[0];
 
+    // Generate SQL query string
     query = psDBGenerateInsertRowSQL(tableName, row);
     if (!query) {
-        psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed.");
-
-        return NULL;
-    }
-
+        psError(PS_ERR_UNEXPECTED_NULL, false, PS_ERRORTEXT_psDB_QUERY_GEN_FAIL);
+        return false;
+    }
+
+    // Prepare SQL statement
     stmt = mysql_stmt_init(dbh->mysql);
     if (!stmt) {
         psAbort(__func__, "mysql_stmt_init(), out of memory.");
     }
-
     if (mysql_stmt_prepare(stmt, query, (unsigned long)strlen(query))) {
         psError(PS_ERR_UNKNOWN, true, "Failed to prepare query.  Error: %s", mysql_stmt_error(stmt));
-
         mysql_stmt_close(stmt);
         psFree(query);
-
         return false;
     }
