IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 1, 2011, 3:59:16 PM (15 years ago)
Author:
rhenders
Message:

new method that gets an updatable result set. we use this to update the likelihoods; new method to make a column the primary key

File:
1 edited

Legend:

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

    r31807 r31820  
    112112        except: pass
    113113            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
     114
     115    '''
     116    Alters a column to be the primary key
     117    '''
     118    def makeColumnPrimaryKey(self, table, column):
     119
     120        self.logger.debug("Making '"+column+"' the primary key on table '"+table+"'")
     121
     122        sql = "ALTER TABLE " + table + " ADD PRIMARY KEY (" + column + ")"
     123        try:
     124            self.execute(sql)
     125        except: pass
     126            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
    114127    '''
    115128    Adds an index to the supplied table and column
     
    143156        return rs
    144157
     158    '''
     159    TODO
     160    '''
     161    def executeUpdatableQuery(self, sql):
     162
     163        stmt = self.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)
     164        rs = stmt.executeQuery(sql)
     165        #stmt.close()
     166        return rs
    145167    '''
    146168    Returns a list of column names for this table
Note: See TracChangeset for help on using the changeset viewer.