Index: trunk/ippTools/src/pxtables.c
===================================================================
--- trunk/ippTools/src/pxtables.c	(revision 6341)
+++ trunk/ippTools/src/pxtables.c	(revision 6658)
@@ -1,3 +1,15 @@
 #include "pxtools.h"
+
+#define CREATE_TABLE(createFunc) \
+    if (!createFunc(config->dbh)) { \
+        psError(PS_ERR_UNKNOWN, false, "dbh access failed"); \
+        status = false; \
+    }
+
+#define DROP_TABLE(dropFunc) \
+    if (!dropFunc(config->dbh)) { \
+        psError(PS_ERR_UNKNOWN, false, "dbh access failed"); \
+        status = false; \
+    }
 
 bool pxCreateTables(pxConfig *config) {
@@ -6,56 +18,20 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    if (!newExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!newImfileCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawScienceExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawImfileCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawDetrendExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p1PendingExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2PendingExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2PendingImfileCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2DoneExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2DoneImfileCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p3PendingExpCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!masterDetrendFramesCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!masterDetrendImfileCreateTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
+    CREATE_TABLE(summitExpCreateTable);
+    CREATE_TABLE(pzPendingExpCreateTable);
+    CREATE_TABLE(pzPendingImfilesCreateTable);
+    CREATE_TABLE(newExpCreateTable);
+    CREATE_TABLE(newImfileCreateTable);
+    CREATE_TABLE(rawScienceExpCreateTable);
+    CREATE_TABLE(rawImfileCreateTable);
+    CREATE_TABLE(rawDetrendExpCreateTable);
+    CREATE_TABLE(p1PendingExpCreateTable);
+    CREATE_TABLE(p2PendingExpCreateTable);
+    CREATE_TABLE(p2PendingImfileCreateTable);
+    CREATE_TABLE(p2DoneExpCreateTable);
+    CREATE_TABLE(p2DoneImfileCreateTable);
+    CREATE_TABLE(p3PendingExpCreateTable);
+    CREATE_TABLE(masterDetrendFramesCreateTable);
+    CREATE_TABLE(masterDetrendImfileCreateTable);
 
     return true;
@@ -88,56 +64,20 @@
     }
 
-    if (!newExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!newImfileDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawScienceExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawImfileDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!rawDetrendExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p1PendingExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2PendingExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2PendingImfileDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2DoneExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p2DoneImfileDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!p3PendingExpDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!masterDetrendFramesDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
-    if (!masterDetrendImfileDropTable(config->dbh)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        status = false;
-    }
+    DROP_TABLE(summitExpDropTable);
+    DROP_TABLE(pzPendingExpDropTable);
+    DROP_TABLE(pzPendingImfilesDropTable);
+    DROP_TABLE(newExpDropTable);
+    DROP_TABLE(newImfileDropTable);
+    DROP_TABLE(rawScienceExpDropTable);
+    DROP_TABLE(rawImfileDropTable);
+    DROP_TABLE(rawDetrendExpDropTable);
+    DROP_TABLE(p1PendingExpDropTable);
+    DROP_TABLE(p2PendingExpDropTable);
+    DROP_TABLE(p2PendingImfileDropTable);
+    DROP_TABLE(p2DoneExpDropTable);
+    DROP_TABLE(p2DoneImfileDropTable);
+    DROP_TABLE(p3PendingExpDropTable);
+    DROP_TABLE(masterDetrendFramesDropTable);
+    DROP_TABLE(masterDetrendImfileDropTable);
 
     return status;
