- Timestamp:
- Apr 3, 2012, 4:40:01 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/mysql.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/mysql.py
r33491 r33683 35 35 36 36 # set up JDBC connection 37 self.url = "jdbc:mysql://"+self.dbHost+"/"+self.dbName+"? user="+self.dbUser+"&password="+self.dbPass37 self.url = "jdbc:mysql://"+self.dbHost+"/"+self.dbName+"?autoReconnect=true&user="+self.dbUser+"&password="+self.dbPass 38 38 try: 39 39 self.con = DriverManager.getConnection(self.url) … … 148 148 149 149 return name 150 151 ''' 152 Drops a column from a table 153 ''' 154 def dropColumn(self, table, column): 155 156 sql = "ALTER TABLE " + table + " DROP " + column 157 try: self.execute(sql) 158 except: return 150 159 151 160 ''' … … 355 364 return -1 356 365 357 366 ''' 367 Adds a column to this table which contains a row count 368 ''' 369 def addRowCountColumn(self, table, colName): 370 371 self.execute("ALTER TABLE " + table + " ADD COLUMN " + colName + " INTEGER FIRST") 372 self.execute("SET @i = 0") 373 self.execute("UPDATE " + table + " SET " + colName + "=(@i:=@i+1)") 374 self.execute("ALTER TABLE " + table + " ADD PRIMARY KEY (" + colName + ")") 375
Note:
See TracChangeset
for help on using the changeset viewer.
