Fix if database hasn't been created yet.

Still broken on my setup, but at least fpdb now starts
This commit is contained in:
Worros 2009-07-15 23:32:17 +08:00
parent 83f21e822d
commit ec9ce544ca

View File

@ -71,20 +71,23 @@ class Database:
# a new session) # a new session)
cur = self.connection.cursor() cur = self.connection.cursor()
self.hand_1day_ago = 0 if self.fdb.wrongDbVersion == False:
cur.execute(self.sql.query['get_hand_1day_ago']) self.hand_1day_ago = 0
row = cur.fetchone() cur.execute(self.sql.query['get_hand_1day_ago'])
if row and row[0]: row = cur.fetchone()
self.hand_1day_ago = row[0] if row and row[0]:
#print "hand 1day ago =", self.hand_1day_ago self.hand_1day_ago = row[0]
#print "hand 1day ago =", self.hand_1day_ago
d = timedelta(days=self.hud_days) d = timedelta(days=self.hud_days)
now = datetime.utcnow() - d now = datetime.utcnow() - d
self.date_ndays_ago = "d%02d%02d%02d" % (now.year-2000, now.month, now.day) self.date_ndays_ago = "d%02d%02d%02d" % (now.year-2000, now.month, now.day)
self.hand_nhands_ago = 0 # todo self.hand_nhands_ago = 0 # todo
#cur.execute(self.sql.query['get_table_name'], (hand_id, )) #cur.execute(self.sql.query['get_table_name'], (hand_id, ))
#row = cur.fetchone() #row = cur.fetchone()
else:
print "Bailing on DB query, not sure it exists yet"
self.saveActions = False if self.import_options['saveActions'] == False else True self.saveActions = False if self.import_options['saveActions'] == False else True
def do_connect(self, c): def do_connect(self, c):