remove test for msql drivers

This commit is contained in:
sqlcoder 2009-08-06 21:12:50 +01:00
parent 0850721ecc
commit c0ddaad2e5
3 changed files with 264 additions and 280 deletions

View File

@ -22,25 +22,11 @@ import gtk
import os import os
import fpdb_simple import fpdb_simple
try:
import MySQLdb
except:
diaSQLLibMissing = gtk.Dialog(title="Fatal Error - SQL interface library missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
label = gtk.Label("Please note that the table viewer only works with MySQL, if you use PostgreSQL this error is expected.")
diaSQLLibMissing.vbox.add(label)
label.show()
label = gtk.Label("Since the HUD now runs on all supported plattforms I do not see any point in table viewer anymore, if you disagree please send a message to steffen@sycamoretest.info")
diaSQLLibMissing.vbox.add(label)
label.show()
response = diaSQLLibMissing.run()
#sys.exit(1)
import fpdb_import import fpdb_import
import fpdb_db import fpdb_db
class GuiTableViewer (threading.Thread): class GuiTableViewer (threading.Thread):
def hudDivide (self, a, b): def hudDivide (self, a, b):
if b==0: if b==0:
@ -196,25 +182,25 @@ class GuiTableViewer (threading.Thread):
"""runs when user clicks read names""" """runs when user clicks read names"""
#print "start of table_viewer.read_names_clicked" #print "start of table_viewer.read_names_clicked"
self.db.reconnect() self.db.reconnect()
self.cursor=self.db.cursor self.cursor=self.db.get_cursor()
#self.hands_id=self.last_read_hand_id #self.hands_id=self.last_read_hand_id
self.db.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, )) self.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0] self.gametype_id=self.cursor.fetchone()[0]
self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, )) self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0] self.category=self.cursor.fetchone()[0]
#print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id #print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
self.db.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers self.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId=Players.id INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE handId=%s""", (self.hands_id, )) WHERE handId=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall() self.player_ids=self.cursor.fetchall()
#print "self.player_ids:",self.player_ids #print "self.player_ids:",self.player_ids
self.db.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers self.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId=Players.id INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE handId=%s""", (self.hands_id, )) WHERE handId=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall() self.player_names=self.cursor.fetchall()
#print "self.player_names:",self.player_names #print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked #end def table_viewer.read_names_clicked
@ -223,12 +209,7 @@ class GuiTableViewer (threading.Thread):
#print "start of table_viewer.import_clicked" #print "start of table_viewer.import_clicked"
self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter()) self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
self.server=self.db.host self.importer = fpdb_import.Importer(self, self.settings, self.config)
self.database=self.db.database
self.user=self.db.user
self.password=self.db.password
self.importer = fpdb_import.Importer(self, self.settings)
self.importer.setMinPrint(0) self.importer.setMinPrint(0)
self.importer.setQuiet(False) self.importer.setQuiet(False)
self.importer.setFailOnError(False) self.importer.setFailOnError(False)
@ -252,13 +233,14 @@ class GuiTableViewer (threading.Thread):
return self.main_vbox return self.main_vbox
#end def get_vbox #end def get_vbox
def __init__(self, db, settings, debug=True): def __init__(self, db, settings, config=None, debug=True):
"""Constructor for table_viewer""" """Constructor for table_viewer"""
self.debug=debug self.debug=debug
#print "start of table_viewer constructor" #print "start of table_viewer constructor"
self.db=db self.db = db
self.cursor=db.cursor self.cursor = db.get_cursor()
self.settings=settings self.settings = settings
self.config = config
self.main_vbox = gtk.VBox(False, 0) self.main_vbox = gtk.VBox(False, 0)
self.main_vbox.show() self.main_vbox.show()

View File

@ -531,7 +531,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
def tab_table_viewer(self, widget, data=None): def tab_table_viewer(self, widget, data=None):
"""opens a table viewer tab""" """opens a table viewer tab"""
#print "start of tab_table_viewer" #print "start of tab_table_viewer"
new_tv_thread=GuiTableViewer.GuiTableViewer(self.db.fdb, self.settings) new_tv_thread = GuiTableViewer.GuiTableViewer(self.db, self.settings, self.config)
self.threads.append(new_tv_thread) self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox() tv_tab=new_tv_thread.get_vbox()
self.add_and_display_tab(tv_tab, "Table Viewer") self.add_and_display_tab(tv_tab, "Table Viewer")

View File

@ -85,6 +85,8 @@ class Importer:
#self.settings.setdefault("forceThreads", 2) # NOT USED NOW #self.settings.setdefault("forceThreads", 2) # NOT USED NOW
self.settings.setdefault("writeQSize", 1000) # no need to change self.settings.setdefault("writeQSize", 1000) # no need to change
self.settings.setdefault("writeQMaxWait", 10) # not used self.settings.setdefault("writeQMaxWait", 10) # not used
self.settings.setdefault("dropIndexes", "don't drop")
self.settings.setdefault("dropHudCache", "don't drop")
self.writeq = None self.writeq = None
self.database = Database.Database(self.config, sql = self.sql) self.database = Database.Database(self.config, sql = self.sql)