IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 6, 2011, 11:00:22 AM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110710/ippToPsps/jython
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/ippToPsps/jython

    • Property svn:ignore set to
      *.class
  • branches/eam_branches/ipp-20110710/ippToPsps/jython/mysql.py

    r31844 r32337  
    3636        # set up JDBC connection
    3737        self.url = "jdbc:mysql://"+self.dbHost+"/"+self.dbName+"?user="+self.dbUser+"&password="+self.dbPass
    38         self.con = DriverManager.getConnection(self.url)
    39         self.connectionID = self.getLastConnectionID()
    40         self.logger.debug("MySQL connection to %s with ID %d" % (dbType, self.connectionID))
    41 
    42         #self.stmt = self.con.createStatement()
     38        try:
     39            self.con = DriverManager.getConnection(self.url)
     40            self.connectionID = self.getLastConnectionID()
     41            self.logger.debug("MySQL connection to %s with ID %d" % (dbType, self.connectionID))
     42        except:
     43            self.logger.error("Unable to connect to " + self.url)
     44            self.everythingOK = False
     45            return
     46
     47        self.everythingOK = True
    4348
    4449
     
    210215        nBad = rs.getInt(1)
    211216
    212         sql="DELETE from " + tableName + " WHERE " + columnName + " = " + value
    213         self.execute(sql)
    214         self.logger.info("%s '%s' values in %s    %5d deleted" % (columnName, value, tableName, nBad))
     217        sql="DELETE FROM " + tableName + " WHERE " + columnName + " = " + value
     218        self.execute(sql)
     219        self.logger.debugPair("%s rows with %s" % (columnName, value), "%d deleted" % nBad)
     220
     221        return nBad
    215222
    216223    '''
     
    224231        nBad = rs.getInt(1)
    225232
    226         sql="DELETE from " + tableName + " WHERE " + columnName + " IS NULL"
    227         self.execute(sql)
    228         self.logger.infoPair("NULLs deleted from %s" % tableName, "%-5d %s" % (nBad, columnName))
     233        sql="DELETE FROM " + tableName + " WHERE " + columnName + " IS NULL"
     234        self.execute(sql)
     235        self.logger.debugPair("NULL %s values" % columnName, "%d deleted" % nBad)
     236
     237        return nBad
    229238
    230239    '''
Note: See TracChangeset for help on using the changeset viewer.