Index: trunk/ippToPsps/jython/batch.py
===================================================================
--- trunk/ippToPsps/jython/batch.py	(revision 31305)
+++ trunk/ippToPsps/jython/batch.py	(revision 31322)
@@ -63,5 +63,5 @@
 
             # get survey ID from init table
-            sql = "SELECT surveyID from Survey WHERE name = '" + self.survey + "'"
+            sql = "SELECT surveyID FROM Survey WHERE name = '" + self.survey + "'"
             try:
                 rs = self.localStmt.executeQuery(sql)  
@@ -109,5 +109,24 @@
 
         # create DVO table
-        self.createDvoTable()
+        self.createDvoTables()
+
+
+    '''
+    Gets photcode (aka photoCalID from dvo table)
+    '''
+    def getPhotoCalID(self):
+
+        photcode = -1
+
+        sql = "SELECT photcode FROM dvoMeta"
+        try:
+            rs = self.localStmt.executeQuery(sql)  
+            rs.first()
+            photcode = rs.getInt(1)
+        except:
+            self.logger.exception("Unable to get photcode from dvo table")
+
+
+        return photcode
 
     '''
@@ -367,6 +386,6 @@
         try:
             self.localStmt.execute(sql)
-        except:
-            self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
+        except: pass
+            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
 
 
@@ -399,6 +418,4 @@
           table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
           table = stilts.tpipe(table, cmd='replaceval Infinity null *')
-          #params = table.parameters()
-          #print params
 
           try:
@@ -533,24 +550,39 @@
     def updateDvoIDs(self, table):
 
-        self.logger.info("Updating table '" + table + "' with DVO IDs...")
-        sql = "UPDATE " + table + " AS a, dvo AS b SET \
-               a.ippObjID = b.ippObjID, \
-               a.objID = b.objID \
-               WHERE a.ippDetectID = b.ippDetectID"
-        self.localStmt.execute(sql)
-        self.logger.info("...done")
-
+        self.logger.info("Not implemented in base-class")
 
     '''
     Creates a table for for ID matching
     '''
-    def createDvoTable(self):
-
-        self.logger.info("Creating DVO table for ID matching")
-        sql = "DROP TABLE dvo"
-        self.localStmt.execute(sql)
-        sql = "CREATE TABLE dvo (ippDetectID BIGINT PRIMARY KEY, detectID BIGINT, ippObjID BIGINT, objID BIGINT)"
-        self.localStmt.execute(sql)
-
+    def createDvoTables(self):
+
+        self.logger.info("Creating DVO meta and detection tables")
+        sql = "DROP TABLE dvoMeta"
+        try: self.localStmt.execute(sql)
+        except: pass
+        
+        sql = "DROP TABLE dvoDetection"
+        try: self.localStmt.execute(sql)
+        except: pass
+
+        sql = "CREATE TABLE dvoMeta ( \
+               flags INT, \
+               photcode INT \
+               )"
+
+        try: self.localStmt.execute(sql)
+        except: 
+            self.logger.error("Unable to create DVO meta-data database tablei")
+
+        sql = "CREATE TABLE dvoDetection ( \
+               ippDetectID BIGINT PRIMARY KEY, \
+               detectID BIGINT, \
+               ippObjID BIGINT, \
+               objID BIGINT \
+               )"
+
+        try: self.localStmt.execute(sql)
+        except: 
+            self.logger.error("Unable to create DVO detection database table")
 
     '''
@@ -582,2 +614,8 @@
         self.logger.info("...done")
 
+        if self.getRowCount("dvoDetection") < 1:
+            self.logger.error("No DVO IDs found")
+            return False
+            
+        return True
+
