Merge branch 'master' of git://git.assembla.com/mctfpdb.git
This commit is contained in:
commit
364a25773e
|
@ -197,8 +197,8 @@ class GuiBulkImport():
|
|||
self.load_button.show()
|
||||
|
||||
# see how many hands are in the db and adjust accordingly
|
||||
tcursor = db.db.cursor()
|
||||
tcursor.execute("Select count(1) from Hands;")
|
||||
tcursor = self.importer.fdb.db.cursor()
|
||||
tcursor.execute("Select count(1) from Hands")
|
||||
row = tcursor.fetchone()
|
||||
tcursor.close()
|
||||
self.n_hands_in_db = row[0]
|
||||
|
@ -210,11 +210,9 @@ class GuiBulkImport():
|
|||
def main(argv=None):
|
||||
"""main can also be called in the python interpreter, by supplying the command line as the argument.
|
||||
>>>import GuiBulkImport
|
||||
>>>GuiBulkImport.main("-f ~/data/hands")"""
|
||||
>>>GuiBulkImport.main(['-f'.'~/data/hands'])"""
|
||||
if argv is None:
|
||||
argv = sys.argv[1:]
|
||||
else:
|
||||
argv = argv.split(" ")
|
||||
|
||||
def destroy(*args): # call back for terminating the main eventloop
|
||||
gtk.main_quit()
|
||||
|
@ -233,8 +231,8 @@ def main(argv=None):
|
|||
(options, sys.argv) = parser.parse_args(args = argv)
|
||||
|
||||
config = Configuration.Config()
|
||||
db = fpdb_db.fpdb_db()
|
||||
|
||||
db = None
|
||||
|
||||
settings = {}
|
||||
settings['minPrint'] = options.minPrint
|
||||
if os.name == 'nt': settings['os'] = 'windows'
|
||||
|
|
|
@ -178,7 +178,6 @@ class Importer:
|
|||
tmpcursor = self.fdb.db.cursor()
|
||||
tmpcursor.execute("Select count(1) from Hands;")
|
||||
self.settings['handsInDB'] = tmpcursor.fetchone()[0]
|
||||
tmpcursor.close()
|
||||
except:
|
||||
pass # if this fails we're probably doomed anyway
|
||||
if self.settings['handsInDB'] < 5000: return "drop"
|
||||
|
|
|
@ -52,7 +52,7 @@ indexes = [
|
|||
, [ # indexes for postgres (list index 3)
|
||||
{'tab':'Boardcards', 'col':'handId', 'drop':0}
|
||||
, {'tab':'Gametypes', 'col':'siteId', 'drop':0}
|
||||
, {'tab':'Hands', 'col':'gametypeId', 'drop':1}
|
||||
, {'tab':'Hands', 'col':'gametypeId', 'drop':0} # mct 22/3/09
|
||||
, {'tab':'Hands', 'col':'siteHandNo', 'drop':0}
|
||||
, {'tab':'HandsActions', 'col':'handplayerId', 'drop':0}
|
||||
, {'tab':'HandsPlayers', 'col':'handId', 'drop':1}
|
||||
|
@ -161,12 +161,13 @@ def prepareBulkImport(fdb):
|
|||
pass
|
||||
elif fdb.backend == PGSQL:
|
||||
# DON'T FORGET TO RECREATE THEM!!
|
||||
print "dropping pg fk", fk['fktab'], fk['fkcol']
|
||||
#print "dropping pg fk", fk['fktab'], fk['fkcol']
|
||||
try:
|
||||
fdb.cursor.execute("alter table " + fk['fktab'] + " drop constraint "
|
||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey')
|
||||
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
|
||||
fdb.cursor.execute("alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']))
|
||||
print "dropped pg fk pg fk %s_%s_fkey" % (fk['fktab'], fk['fkcol'])
|
||||
except:
|
||||
pass
|
||||
print "! failed drop pg fk %s_%s_fkey" % (fk['fktab'], fk['fkcol'])
|
||||
else:
|
||||
print "Only MySQL and Postgres supported so far"
|
||||
return -1
|
||||
|
@ -181,15 +182,15 @@ def prepareBulkImport(fdb):
|
|||
pass
|
||||
elif fdb.backend == PGSQL:
|
||||
# DON'T FORGET TO RECREATE THEM!!
|
||||
print "Index dropping disabled for postgresql."
|
||||
print "dropping pg index ", idx['tab'], idx['col']
|
||||
#print "Index dropping disabled for postgresql."
|
||||
#print "dropping pg index ", idx['tab'], idx['col']
|
||||
# mod to use tab_col for index name?
|
||||
try:
|
||||
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
|
||||
fdb.cursor.execute( "drop index %s_%s_idx" % (idx['tab'],idx['col']) )
|
||||
print "dropped pg index ", idx['tab'], idx['col']
|
||||
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
|
||||
#print "dropped pg index ", idx['tab'], idx['col']
|
||||
except:
|
||||
pass
|
||||
print "! failed drop index %s_%s_idx" % (idx['tab'],idx['col'])
|
||||
else:
|
||||
print "Only MySQL and Postgres supported so far"
|
||||
return -1
|
||||
|
|
Loading…
Reference in New Issue
Block a user