From 2b9eed8958ab0ab32b35a78ec65e7220169aadbb Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 7 Nov 2008 18:12:48 +1300 Subject: [PATCH] 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. --- pyfpdb/GuiGraphViewer.py | 13 ++++++++----- pyfpdb/fpdb_db.py | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 7385e9fe..49a00d20 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -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,) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 92a5ed86..b5fd53c9 100755 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -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