Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 37763)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 37917)
@@ -611,8 +611,9 @@
 
     def updatePspsUniqueIDs(self,table, ota):
-        sql = "UPDATE "+table+" join (select @r:=@r+1 rownum, objID from \
-        (select @r:=0) r, "+table+" t) as foo using (objID) set \
-        uniquePspsP2id = ((" +str(self.batchID)+ "*1000000000 ) \
-        + (" +str(ota) + "*10000000  )+rownum)"
+        #sql = "UPDATE "+table+" join (select @r:=@r+1 rownum, objID from \
+        #(select @r:=0) r, "+table+" t) as foo using (objID) set \
+        #uniquePspsP2id = ((" +str(self.batchID)+ "*1000000000 ) \
+        #+ (" +str(ota) + "*10000000  )+rownum)"
+        sql = "UPDATE "+table+" set uniquePspsP2id = (("+str(self.batchID)+"*1000000000 ) + (" +str(ota) + "*10000000  )+ row)"
         try: self.scratchDb.execute(sql)
         except:
@@ -647,11 +648,19 @@
         #self.logger.info("successful populate ");
         # now add DVO IDs
+        self.logger.infoPair("Adding 'row' column to ", "Detection_"+chipname)
+        #detection has a primary index, so don't add, use this one
+        self.scratchDb.addRowCountColumnNoKey("Detection_"+chipname, "row")
         self.updateDvoIDs("Detection_" + chipname, self.imageIDs[chipname])
         #self.logger.info("updated dvoids")
         results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + chipname, "objID")
         #self.logger.info("deleted nulls")
+
+        ota = x*10+y
+
+
         self.logger.info("add psps unique p2 ids")
-        ota = x*10+y
         self.updatePspsUniqueIDs("Detection_" + chipname, ota)
+        self.logger.infoPair("Dropping 'row' column from ", "Detection_"+chipname)
+        self.scratchDb.dropColumn("Detection_"+chipname,"row")
         self.updateImageID("Detection_" + chipname, x, y)
         #self.logger.info("updateImageId")
