IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 31, 2014, 10:59:37 AM (12 years ago)
Author:
eugene
Message:

adding stack mags to dvopsps detection output; adding option to reset the dvoDetections table; adding makeEquals to sqlUtilities; intelligently(?) select photcode ranges for dvopsps; massive re-work of stackbatch.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140717/ippToPsps/jython/mysql.py

    r37129 r37156  
    8383    '''
    8484    def lockTable(self, table):
     85        print "Locking table: " + table
    8586        self.execute("LOCK TABLES " + table + " WRITE")
    8687
     
    8990    '''
    9091    def unlockTables(self):
     92        print "Unlocking tables"
    9193        self.execute("UNLOCK TABLES")
    9294
     
    280282        except: pass
    281283            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
     284
     285    def addPrimaryKeyWithIgnore(self, table, column)
     286        # note that in mysql versions later than 5.1, this fails
     287        # unless the following is called first:
     288        # "set session old_alter_table=1"
     289
     290        # follow the command with
     291        # "set session old_alter_table=0"
     292
     293        # OF COURSE, this fails for mysql version <= 5.1...
     294        if self.scratchDb.version > 5.1:
     295            self.scratchDb.execute("set session old_alter_table=1")
     296
     297        # I should probably do this before the whole table is built, right?
     298        sql = "ALTER IGNORE TABLE " + table + " ADD PRIMARY KEY (" + column + ")"
     299        self.scratchDb.execute(sql)
     300       
     301        if self.scratchDb.version > 5.1:
     302            self.scratchDb.execute("set session old_alter_table=0")
    282303
    283304    '''
Note: See TracChangeset for help on using the changeset viewer.