Change db access function to always get the latest committed transactions.

Fixes graph updating, so i made the label a bit prettier, and a bit better behaved.
This commit is contained in:
Worros 2008-11-07 18:12:48 +13:00
parent b32745c28a
commit 2b9eed8958
2 changed files with 9 additions and 5 deletions

View File

@ -64,19 +64,22 @@ class GuiGraphViewer (threading.Thread):
#Set graph properties
self.ax = self.fig.add_subplot(111)
#
#Get graph data from DB
line = self.getRingProfitGraph(name, site)
self.ax.set_title("Profit graph for ring games")
#Set axis labels and grid overlay properites
self.ax.set_xlabel("Hands", fontsize = 12)
self.ax.set_ylabel("$", fontsize = 12)
self.ax.grid(color='g', linestyle=':', linewidth=0.2)
text = "All Hands, " + sitename + str(name)
text = "All Hands, " + sitename + str(name) + "\nProfit: $" + str(line[-1]) + "\nTotal Hands: " + str(len(line))
self.ax.annotate (text, (61,25), xytext =(0.1, 0.9) , textcoords ="axes fraction" ,)
self.ax.annotate(text, xy=(10, -10),
xycoords='axes points',
horizontalalignment='left', verticalalignment='top',
fontsize=10)
#Get graph data from DB
line = self.getRingProfitGraph(name, site)
#Draw plot
self.ax.plot(line,)

View File

@ -47,6 +47,7 @@ class fpdb_db:
else:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
self.cursor.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')
# Set up query dictionary as early in the connection process as we can.
self.sql = FpdbSQLQueries.FpdbSQLQueries(self.get_backend_name())
self.wrongDbVersion=False