p82 - made import of SQL interface libraries into try-except loop to facilitate choosing between mysql and pgsql

This commit is contained in:
steffen123 2008-09-16 22:19:50 +01:00
parent 092f68e259
commit cd212af029
5 changed files with 50 additions and 21 deletions

View File

@ -5,6 +5,8 @@ Please also see db-todo.txt
alpha4 (release 22-29Sep)
======
newsletter&mailing list
update requirements to include new pgsql interface lib and rename to dependencies.txt
ebuild: support pgsql
find correct sf logo link
fix HUD config location and update release script accordingly
@ -13,7 +15,7 @@ update install-in-gentoo on website
update ebuild and ubuntu guide for HUD_config.xml
store raw hand in db and write reimport function using the raw hand field
ftp: read maxSeats
ftp: read maxSeats rather than making an assumption
make sure totalProfit shows actual profit rather than winnings.
update abbreviations.txt
export settings[hud-defaultInterval] to conf
@ -23,39 +25,38 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
change to savannah?
implement steal and positions in stud
anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no
Everything that didn't make it into alpha3
Import draw (maybe without HudCache for a start)
table with data for graphs for SD/F, W$wSF, W$@SD
separate db table design version and last bugfix in importer
change tabledesign VALIGN
change tabledesign VALIGN and add link to webpage
finish updating filelist
finish todos in git instructions
debian/ubuntu package http://www.debian.org/doc/maint-guide/ch-start.en.html
howto remote DB
move all user docs to webpage
contributor list on webpage
finish bringing back tourney
No river stats for stud games
hole/board cards are not correctly stored in the db for stud games
HORSE (and presumably other mixed games) hand history files not handled correctly
Some MTTs won't import (rebuys??)
Many STTs won't import
before beta
===========
No Full Tilt support in HUD
No river stats for stud games
hole/board cards are not correctly stored in the db for stud games
HORSE (and presumably other mixed games) hand history files not handled correctly
HUD stat windows are too big on Windows
HUD task bar entries on Windows won't go away
Some MTTs won't import (rebuys??)
Many STTs won't import
MTT/STT not tested in HUD
HUD stats not aggregated
Player names with non-Latin chars throw warnings in HUD
HUD doesn't start when fpdb is started from the Windows "Start Menu"
Exiting HUD on Windows doesn't properly clean up stat windows
finish bringing back tourney
ebuild: USE gtk, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, git-ebuild, get it into sunrise
make hud display W$SD etc as fraction.
add dedicated update page
update status or make a support matrix table for website
fix up bg colours in tv
move version into seperate file for fpdb gui and db
SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug
create little test script for people to run to verify successful installation of pydeps
@ -63,7 +64,6 @@ split hud data generation into separate for loops and make it more efficient
fix bug that sawFlop/Turn/River/CBChance/etc gets miscalculated if someone is allin - might as well add all-in recognition for this
make 3 default HUD configs (easy (4-5 fields), advanced (10ish fields), crazy (20 or so))
make it work with postgres
gentoo ebuild: USE postgresql
expand instructions for profile file
maybe remove siteId from gametypes
?change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands per stake and position?

View File

@ -32,12 +32,14 @@ import sys
import Configuration
import SQL
try:
# pgdb database module for posgres via DB-API
import psycopg2
import psycopg2
# pgdb uses pyformat. is that fixed or an option?
# mysql bindings
import MySQLdb
import MySQLdb
except:
pass
class Database:
def __init__(self, c, db_name, game):

View File

@ -20,7 +20,23 @@ import pygtk
pygtk.require('2.0')
import gtk
import os
import MySQLdb
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_db

View File

@ -35,13 +35,10 @@ class fpdb_db:
self.database=database
self.user=user
self.password=password
#print "fpdb_db.connect, database:",database
if backend==self.MYSQL_INNODB:
import MySQLdb
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
# import pgdb
# self.db = pgdb.connect(dsn=host+":"+database, user='postgres', password=password)
import psycopg2
self.db = psycopg2.connect(host = host, user = user, password = password, database = database)
else:

View File

@ -18,9 +18,19 @@
#see status.txt for site/games support info
import sys
import MySQLdb
import psycopg2
#import pgdb
try:
import MySQLdb
mysqlLibFound=True
except:
pass
try:
import psycopg2
pgsqlLibFound=True
except:
pass
import math
import os
import datetime
@ -47,9 +57,13 @@ def import_file_dict(options, settings, callHud=False):
#connect to DB
if options.settings['db-backend'] == 2:
if not mysqlLibFound:
raise fpdb_simple.FpdbError("interface library MySQLdb not found but MySQL selected as backend - please install the library or change the config file")
db = MySQLdb.connect(host = options.server, user = options.user,
passwd = options.password, db = options.database)
elif options.settings['db-backend'] == 3:
if not pgsqlLibFound:
raise fpdb_simple.FpdbError("interface library psycopg2 not found but PostgreSQL selected as backend - please install the library or change the config file")
db = psycopg2.connect(host = options.server, user = options.user,
password = options.password, database = options.database)
elif options.settings['db-backend'] == 4: