Index: trunk/ippToPsps/jython/batch.py
===================================================================
--- trunk/ippToPsps/jython/batch.py	(revision 31105)
+++ trunk/ippToPsps/jython/batch.py	(revision 31109)
@@ -16,6 +16,7 @@
     Constructor
     '''
-    def __init__(self, batchType, inputFitsPath, outputFitsPath, dbHost, dbName, dbUser, dbPass):
+    def __init__(self, batchType, inputFitsPath, outputFitsPath, dbHost, dbName, dbUser, dbPass, survey):
 
+        # set up class variables
         self.pspsVoTableFilePath = "../config/" + batchType + "/tables.vot"
         self.inputFitsPath = inputFitsPath
@@ -25,12 +26,23 @@
         self.dbUser = dbUser
         self.dbPass = dbPass
+        self.survey = survey
+
+        # set up JDBC connection
         self.url = "jdbc:mysql://"+self.dbHost+"/"+self.dbName+"?user="+self.dbUser+"&password="+self.dbPass
         self.con = DriverManager.getConnection(self.url)
+        self.stmt = self.con.createStatement()
 
+        # get survey ID from init table
+        sql = "SELECT surveyID from Survey WHERE name = '" + survey + "'"
+        rs = self.stmt.executeQuery(sql)  
+        rs.first()
+        self.surveyID = rs.getInt(1)
+    
         # store today's date
         now = datetime.datetime.now();
         self.dateStr = now.strftime("%Y-%m-%d")
 
-        self.parseFitsHeader()
+        if self.inputFitsPath != "": 
+            self.parseFitsHeader()
 
     '''
@@ -38,7 +50,24 @@
     '''
     def __del__(self):
+
         print "Batch destructor"
+        self.stmt.close()
         self.con.close()
 
+    '''
+    Updates a table with surveyID
+    '''
+    def updateSurveyID(self, table):
+
+        sql = "UPDATE " + table + "  SET surveyID=%d" % self.surveyID
+        self.stmt.execute(sql)
+
+    '''
+    Updates a table with filterID grabbed from Filter init table
+    '''
+    def updateFilterID(self, table):
+
+        sql = "UPDATE "+table+" AS a, Filter AS b SET a.filterID=b.filterID WHERE b.filterType = '" + self.filter + "'"
+        self.stmt.execute(sql)
 
     '''
@@ -87,4 +116,34 @@
              table.write(self.url + '#' + table.name)
 
+         self.indexPspsTables()
+
+    '''
+    Subclass should implement this to index IPP tables
+    '''   
+    def indexIppTables(self):
+        print "indexIppTables not implemented"
+
+
+    '''
+    Adds an index to the supplied table and column
+    '''
+    def createIndex(self, table, column):
+
+        print "Creating index on column '"+column+"' for table '"+table+"'"
+
+        sql = "CREATE INDEX "+table+"_index ON "+table+" ("+column+")"
+        try:
+            self.stmt.execute(sql)
+        except:
+            print "Index already in place on '" + column + "' for table '" + table + "'"
+
+
+    '''
+    Subclass should implement this to index PSPS tables
+    '''   
+    def indexPspsTables(self):
+        print "indexPspsTables not implemented"
+
+
     '''
     Imports IPP tables from FITS file
@@ -101,4 +160,6 @@
           except:
               print "ERROR table " + table.name + " is busted"
+
+          self.indexIppTables()
 
     '''
