Index: trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- trunk/ippToPsps/jython/ipptopspsdb.py	(revision 35311)
+++ trunk/ippToPsps/jython/ipptopspsdb.py	(revision 35605)
@@ -785,5 +785,6 @@
                    survey, \
                    dvo_db, \
-                   datastore_product \
+                   datastore_product, \
+                   comment \
                    ) VALUES ( \
                        '" + batchType + "', \
@@ -791,5 +792,6 @@
                        '" + self.skychunk.survey + "', \
                        '" + self.skychunk.dvoLabel + "', \
-                       '" + self.skychunk.datastoreProduct + "' \
+                       '" + self.skychunk.datastoreProduct + "', \
+                       '" + self.skychunk.name + "' \
                        )"
             self.logger.infoPair("heather:","sql")
@@ -1215,4 +1217,6 @@
                    ('" + self.skychunk.name + "', " + str(ra) + ", " + str(dec) + ", " + str(self.skychunk.boxSize) + ")"
 
+            # print "insertBox: ", sql
+
             self.execute(sql)
             id = self.getBoxId(ra, dec)
@@ -1556,6 +1560,6 @@
 
         sql = "SELECT id, ra_center, dec_center \
-               FROM box \
-               WHERE skychunk = '" + self.skychunk.name + "' \
+               FROM box join skychunk on box.skychunk = skychunk.name \
+               WHERE dvo_label = '" + self.skychunk.dvoLabel + "' \
                ORDER BY ra_center, dec_center"
 
@@ -1599,4 +1603,5 @@
                 sql = "INSERT INTO all_pending (stage_id, ra_bore, dec_bore) \
                        VALUES (%d, %f, %f)" % (row[0], row[1], row[2]) 
+                # print "sql 1: ", sql
                 self.execute(sql)
             except: continue
@@ -1604,4 +1609,21 @@
         count = self.getRowCount("all_pending")
         self.logger.infoPair("Items written to Db", "%d" % count)
+
+        # try:
+        #     self.execute("DROP TABLE all_pending_alt")
+        # except:
+        #     pass
+        # 
+        # self.execute("CREATE TABLE all_pending_alt (stage_id bigint(20), ra_bore float, dec_bore float)")
+        # for row in rows:
+        #     try:
+        #         sql = "INSERT INTO all_pending_alt (stage_id, ra_bore, dec_bore) \
+        #                VALUES (%d, %f, %f)" % (row[0], row[1], row[2]) 
+        #         print "sql 2: ", sql
+        #         self.execute(sql)
+        #     except: continue
+        # 
+        # count = self.getRowCount("all_pending_alt")
+        # self.logger.infoPair("Items written to alt Db", "%d" % count)
 
     '''
@@ -1624,4 +1646,6 @@
                AND dec_bore BETWEEN " + str(minDEC) + " AND " + str(maxDEC)
 
+        print "items: ", sql
+
         try:
             rs = self.executeQuery(sql)
