Indentation fixes

This commit is contained in:
Worros 2008-10-08 01:50:43 +08:00
parent 3d43e8167c
commit dc81ca854a

View File

@ -122,27 +122,29 @@ class fpdb_db:
self.cursor.execute(self.sql.query['drop_table'] + table[0]) self.cursor.execute(self.sql.query['drop_table'] + table[0])
elif(self.get_backend_name() == 'PostgreSQL'): elif(self.get_backend_name() == 'PostgreSQL'):
#todo: postgres version here #todo: postgres version here
print "Empty function here"
elif(self.get_backend_name() == 'SQLite'): elif(self.get_backend_name() == 'SQLite'):
#todo: sqlite version here #todo: sqlite version here
print "Empty function here"
#end def drop_tables #end def drop_tables
def drop_referencial_integrity(self): def drop_referencial_integrity(self):
"""Update all tables to remove foreign keys""" """Update all tables to remove foreign keys"""
self.cursor.execute('SHOW TABLES') # todo: move to FpdbSQLQueries self.cursor.execute('SHOW TABLES') # todo: move to FpdbSQLQueries
result = self.cursor.fetchall() result = self.cursor.fetchall()
for i in range(len(result)): for i in range(len(result)):
self.cursor.execute("SHOW CREATE TABLE " + result[i][0]) self.cursor.execute("SHOW CREATE TABLE " + result[i][0])
inner = self.cursor.fetchall() inner = self.cursor.fetchall()
for j in range(len(inner)): for j in range(len(inner)):
# result[i][0] - Table name # result[i][0] - Table name
# result[i][1] - CREATE TABLE parameters # result[i][1] - CREATE TABLE parameters
#Searching for CONSTRAINT `tablename_ibfk_1` #Searching for CONSTRAINT `tablename_ibfk_1`
for m in re.finditer('(ibfk_[0-9]+)', inner[j][1]): for m in re.finditer('(ibfk_[0-9]+)', inner[j][1]):
key = "`" + inner[j][0] + "_" + m.group() + "`" key = "`" + inner[j][0] + "_" + m.group() + "`"
self.cursor.execute("ALTER TABLE " + inner[j][0] + " DROP FOREIGN KEY " + key) self.cursor.execute("ALTER TABLE " + inner[j][0] + " DROP FOREIGN KEY " + key)
self.db.commit() self.db.commit()
#end drop_referencial_inegrity #end drop_referencial_inegrity