removed all occurences of db_type/db-type

This commit is contained in:
fpdb-mme 2009-11-03 19:18:51 +01:00
parent 92f98e9f51
commit 9063d9749c
5 changed files with 3054 additions and 3062 deletions

View File

@ -236,11 +236,10 @@ class Database:
self.db_server = node.getAttribute("db_server").lower() self.db_server = node.getAttribute("db_server").lower()
self.db_ip = node.getAttribute("db_ip") self.db_ip = node.getAttribute("db_ip")
self.db_user = node.getAttribute("db_user") self.db_user = node.getAttribute("db_user")
self.db_type = node.getAttribute("db_type")
self.db_pass = node.getAttribute("db_pass") self.db_pass = node.getAttribute("db_pass")
self.db_selected = string_to_bool(node.getAttribute("default"), default=False) self.db_selected = string_to_bool(node.getAttribute("default"), default=False)
log.debug("Database db_name:'%(name)s' db_server:'%(server)s' db_ip:'%(ip)s' db_user:'%(user)s' db_type:'%(type)s' db_pass (not logged) selected:'%(sel)s'" \ log.debug("Database db_name:'%(name)s' db_server:'%(server)s' db_ip:'%(ip)s' db_user:'%(user)s' db_pass (not logged) selected:'%(sel)s'" \
% { 'name':self.db_name, 'server':self.db_server, 'ip':self.db_ip, 'user':self.db_user, 'type':self.db_type, 'sel':self.db_selected} ) % { 'name':self.db_name, 'server':self.db_server, 'ip':self.db_ip, 'user':self.db_user, 'sel':self.db_selected} )
def __str__(self): def __str__(self):
temp = 'Database = ' + self.db_name + '\n' temp = 'Database = ' + self.db_name + '\n'
@ -627,9 +626,6 @@ class Config:
try: db['db-server'] = self.supported_databases[name].db_server try: db['db-server'] = self.supported_databases[name].db_server
except: pass except: pass
try: db['db-type'] = self.supported_databases[name].db_type
except: pass
if self.supported_databases[name].db_server== DATABASE_TYPE_MYSQL: if self.supported_databases[name].db_server== DATABASE_TYPE_MYSQL:
db['db-backend'] = 2 db['db-backend'] = 2
elif self.supported_databases[name].db_server== DATABASE_TYPE_POSTGRESQL: elif self.supported_databases[name].db_server== DATABASE_TYPE_POSTGRESQL:
@ -641,20 +637,18 @@ class Config:
return db return db
def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None, def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None,
db_pass = None, db_server = None, db_type = None): db_pass = None, db_server = None):
db_node = self.get_db_node(db_name) db_node = self.get_db_node(db_name)
if db_node != None: if db_node != None:
if db_ip != None: db_node.setAttribute("db_ip", db_ip) if db_ip != None: db_node.setAttribute("db_ip", db_ip)
if db_user != None: db_node.setAttribute("db_user", db_user) if db_user != None: db_node.setAttribute("db_user", db_user)
if db_pass != None: db_node.setAttribute("db_pass", db_pass) if db_pass != None: db_node.setAttribute("db_pass", db_pass)
if db_server != None: db_node.setAttribute("db_server", db_server) if db_server != None: db_node.setAttribute("db_server", db_server)
if db_type != None: db_node.setAttribute("db_type", db_type)
if self.supported_databases.has_key(db_name): if self.supported_databases.has_key(db_name):
if db_ip != None: self.supported_databases[db_name].dp_ip = db_ip if db_ip != None: self.supported_databases[db_name].dp_ip = db_ip
if db_user != None: self.supported_databases[db_name].dp_user = db_user if db_user != None: self.supported_databases[db_name].dp_user = db_user
if db_pass != None: self.supported_databases[db_name].dp_pass = db_pass if db_pass != None: self.supported_databases[db_name].dp_pass = db_pass
if db_server != None: self.supported_databases[db_name].dp_server = db_server if db_server != None: self.supported_databases[db_name].dp_server = db_server
if db_type != None: self.supported_databases[db_name].dp_type = db_type
return return
def getDefaultSite(self): def getDefaultSite(self):

View File

@ -205,7 +205,7 @@ class Database:
# where possible avoid creating new SQL instance by using the global one passed in # where possible avoid creating new SQL instance by using the global one passed in
if sql is None: if sql is None:
self.sql = SQL.Sql(type = self.type, db_server = self.db_server) self.sql = SQL.Sql(db_server = self.db_server)
else: else:
self.sql = sql self.sql = sql
@ -249,7 +249,6 @@ class Database:
db_params = c.get_db_parameters() db_params = c.get_db_parameters()
self.import_options = c.get_import_parameters() self.import_options = c.get_import_parameters()
self.type = db_params['db-type']
self.backend = db_params['db-backend'] self.backend = db_params['db-backend']
self.db_server = db_params['db-server'] self.db_server = db_params['db-server']
self.database = db_params['db-databaseName'] self.database = db_params['db-databaseName']

View File

@ -570,8 +570,8 @@ Left-Drag to Move"
</hhcs> </hhcs>
<supported_databases> <supported_databases>
<database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD" db_type="fpdb"></database> <database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD"></database>
<!-- <database db_ip="localhost" db_name="fpdb" db_pass="fpdb" db_server="sqlite" db_type="fpdb" db_user="fpdb"/> --> <!-- <database db_ip="localhost" db_name="fpdb" db_pass="fpdb" db_server="sqlite" db_user="fpdb"/> -->
</supported_databases> </supported_databases>
</FreePokerToolsConfig> </FreePokerToolsConfig>

View File

@ -33,12 +33,11 @@ import re
class Sql: class Sql:
def __init__(self, game = 'holdem', type = 'fpdb', db_server = 'mysql'): def __init__(self, game = 'holdem', db_server = 'mysql'):
self.query = {} self.query = {}
###############################################################################3 ###############################################################################3
# Support for the Free Poker DataBase = fpdb http://fpdb.sourceforge.net/ # Support for the Free Poker DataBase = fpdb http://fpdb.sourceforge.net/
# #
if type == 'fpdb':
################################ ################################
# List tables # List tables

View File

@ -450,7 +450,7 @@ class fpdb:
if self.db != None and self.db.fdb != None: if self.db != None and self.db.fdb != None:
self.db.disconnect() self.db.disconnect()
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) self.sql = SQL.Sql(db_server = self.settings['db-server'])
try: try:
self.db = Database.Database(self.config, sql = self.sql) self.db = Database.Database(self.config, sql = self.sql)
except FpdbMySQLFailedError: except FpdbMySQLFailedError: