p102 - moved initial data INSERTs for mysql to separate method for future unification with pgsql table creation code

This commit is contained in:
steffen123 2008-09-24 05:22:17 +01:00
parent 7bd16311b1
commit c19c933942
3 changed files with 11 additions and 6 deletions

View File

@ -97,7 +97,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC no rush but before 1.0RC
======================== ========================
improve handling of dead hand before BB, see git101/ improve handling of dead hand before BB, see git101/7bd1631
make DB version error offer reimport, recreation and continue. make DB version error offer reimport, recreation and continue.
In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. Optimise this In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. Optimise this
multi-select in bulk importer multi-select in bulk importer

View File

@ -420,7 +420,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha4+, p93 or higher") self.window.set_title("Free Poker DB - version: alpha4+, p102 or higher")
self.window.set_border_width(1) self.window.set_border_width(1)
self.window.set_size_request(1020,400) self.window.set_size_request(1020,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

@ -151,6 +151,13 @@ class fpdb_db:
return (self.host, self.database, self.user, self.password) return (self.host, self.database, self.user, self.password)
#end def get_db_info #end def get_db_info
def fillDefaultData(self):
self.cursor.execute("INSERT INTO Settings VALUES (76);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.cursor.execute("INSERT INTO TourneyTypes VALUES (DEFAULT, 1, 0, 0, 0, False);")
#end def fillDefaultData
def recreate_tables(self): def recreate_tables(self):
"""(Re-)creates the tables of the current DB""" """(Re-)creates the tables of the current DB"""
@ -167,6 +174,7 @@ class fpdb_db:
if sql == '': if sql == '':
continue continue
curse.execute(sql) curse.execute(sql)
#self.fillDefaultData()
self.db.commit() self.db.commit()
curse.close() curse.close()
return return
@ -379,10 +387,7 @@ class fpdb_db:
street4CheckCallRaiseChance INT NOT NULL, street4CheckCallRaiseChance INT NOT NULL,
street4CheckCallRaiseDone INT NOT NULL)""") street4CheckCallRaiseDone INT NOT NULL)""")
self.cursor.execute("INSERT INTO Settings VALUES (76);") self.fillDefaultData()
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.cursor.execute("INSERT INTO TourneyTypes VALUES (DEFAULT, 1, 0, 0, 0, False);")
self.db.commit() self.db.commit()
print "finished recreating tables" print "finished recreating tables"
#end def recreate_tables #end def recreate_tables