Index: trunk/ippTools/src/pxadmin.c
===================================================================
--- trunk/ippTools/src/pxadmin.c	(revision 17855)
+++ trunk/ippTools/src/pxadmin.c	(revision 17856)
@@ -28,4 +28,5 @@
 #include "pxadmin.h"
 
+bool createMode(pxConfig *config);
 bool deleteMode(pxConfig *config);
 static bool runMultipleStatments(pxConfig *config, const char *query);
@@ -48,5 +49,5 @@
             // fall through
         case PXADMIN_MODE_CREATE:
-            if (!pxCreateTables(config)) {
+            if (!createMode(config)) {
                 goto FAIL;
             }
@@ -79,7 +80,74 @@
 }
 
+
+bool createMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psString query = pxDataGet("pxadmin_create_tables.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
+        return false;
+    }
+
+    // BEGIN
+    if (!psDBTransaction(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+
+    if (!runMultipleStatments(config, query)) {
+        if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+        }
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    // COMMIT
+    if (!psDBCommit(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+
+    return true;
+}
+
+
 bool deleteMode(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
+
+    {
+        bool status;
+        char line[128], answer[128];
+
+        // XXX use the values defined in config->dbh?
+        psString dbName = psMetadataLookupStr(&status, config->modules->complete, "DBNAME");
+
+        fprintf (stdout, "*** delete the chip tables from database %s? ***\n", dbName);
+        fprintf (stdout, "*** to delete the tables, answer YES, and give password ***\n");
+        fprintf (stdout, "*** WARNING: this action is permanent ***\n\n");
+
+        fprintf (stdout, "delete the chip tables (YES/[n]): ");
+        fgets (line, 128, stdin);
+        sscanf (line, "%s", answer);
+        if (strcmp (answer, "YES"))  {
+            psError(PS_ERR_UNKNOWN, true, "tables NOT deleleted");
+            return false;
+        }
+
+        fprintf (stdout, "enter dbh connection password: ");
+        fgets (line, 128, stdin);
+        sscanf (line, "%s", answer);
+
+        psString dbPassword = psMetadataLookupStr(&status, config->modules->complete, "DBPASSWORD");
+        if (strcmp (answer, dbPassword)) {
+            psError(PS_ERR_UNKNOWN, true, "invalid passwd - tables NOT deleleted");
+            return false;
+        }
+    }
 
     psString query = pxDataGet("pxadmin_drop_tables.sql");
@@ -113,4 +181,5 @@
     return true;
 }
+
 
 static bool runMultipleStatments(pxConfig *config, const char *query)
