IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2012, 10:04:47 AM (14 years ago)
Author:
rhenders
Message:

method to change database engine for a particular table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/mysql.py

    r33357 r33491  
    1919    '''
    2020    Constructor
    21 
    2221    '''
    2322    def __init__(self, logger, config, dbType, dbName=None):
     
    184183        except: pass
    185184            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
     185    '''
     186    Changes the database engine for this table to InnoDb
     187    '''
     188    def changeEngineToInnoDB(self, table):
     189        self.changeEngine(table, "InnoDB")
     190
     191    '''
     192    Changes the database engine for this table
     193    '''
     194    def changeEngine(self, table, engine):
     195
     196        sql = "ALTER TABLE " + table + " ENGINE=" + engine
     197        try:
     198            self.execute(sql)
     199        except:
     200            self.logger.errorPair("Could not change table engine", sql)
     201            return False
     202
     203        return True
     204
    186205    '''
    187206    Adds an index to the supplied table and column
Note: See TracChangeset for help on using the changeset viewer.