transaction isolation code suggested by sql_coder on the forums
This commit is contained in:
parent
a41aec44dd
commit
cf1efb8d27
|
@ -59,6 +59,10 @@ class Database:
|
|||
user = c.supported_databases[db_name].db_user,
|
||||
passwd = c.supported_databases[db_name].db_pass,
|
||||
db = c.supported_databases[db_name].db_name)
|
||||
cur_iso = self.connection.cursor()
|
||||
cur_iso.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')
|
||||
cur_iso.close()
|
||||
|
||||
except:
|
||||
print "Error opening database connection %s. See error log file." % (file)
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
|
|
|
@ -89,6 +89,7 @@ def update_HUD(new_hand_id, table_name, config, stat_dict):
|
|||
def read_stdin(): # This is the thread function
|
||||
global hud_dict
|
||||
|
||||
db_connection = Database.Database(config, db_name, 'temp')
|
||||
while True: # wait for a new hand number on stdin
|
||||
new_hand_id = sys.stdin.readline()
|
||||
new_hand_id = string.rstrip(new_hand_id)
|
||||
|
@ -101,10 +102,8 @@ def read_stdin(): # This is the thread function
|
|||
del(hud_dict[h])
|
||||
|
||||
# connect to the db and get basic info about the new hand
|
||||
db_connection = Database.Database(config, db_name, 'temp')
|
||||
(table_name, max, poker_game) = db_connection.get_table_name(new_hand_id)
|
||||
stat_dict = db_connection.get_stats_from_hand(new_hand_id)
|
||||
db_connection.close_connection()
|
||||
|
||||
# if a hud for this table exists, just update it
|
||||
if hud_dict.has_key(table_name):
|
||||
|
|
Loading…
Reference in New Issue
Block a user