4 usage: %(progname)s [args] 8 import os, sys, string, time, getopt
16 return self.cursor.insert_id()
20 odb.Connection.__init__(self)
21 self.
_conn = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
27 return Cursor(self._conn.cursor())
30 if str
is None:
return None 31 return MySQLdb.escape_string(str)
34 cursor.execute(
"show tables")
35 rows = cursor.fetchall()
42 cursor.execute(
"show index from %s" % tableName)
43 rows = cursor.fetchall()
44 tables = map(
lambda row: row[2], rows)
48 sql =
"show columns from %s" % table_name
50 rows = cursor.fetchall()
55 columns[colname] = row
60 invalidAppCols, invalidDBCols = table.checkTable()
61 if not invalidAppCols:
return 64 for colname
in invalidAppCols.keys():
65 col = table.getColumnDef(colname)
69 defs.append(table._colTypeToSQLType(colname, coltype, options))
71 defs = string.join(defs,
", ")
73 sql =
"alter table %s add column " % table.getTableName()
74 sql = sql +
"(" + defs +
")" 81 sql = sql +
" TYPE=INNODB" def insert_id(self, tablename, colname)
def alterTableToMatch(self, table, cursor)
def listTables(self, cursor)
def supportsTriggers(self)
def __init__(self, host, user, passwd, db)
def listFieldsDict(self, table_name, cursor)
def createTable(self, sql, cursor)
def listIndices(self, tableName, cursor)