[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/common/src/dbdrivers/_pgsql DBdriver.py
From: |
Derek Neighbors |
Subject: |
gnue/common/src/dbdrivers/_pgsql DBdriver.py |
Date: |
Thu, 14 Mar 2002 01:33:38 -0500 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Derek Neighbors <address@hidden> 02/03/14 01:33:37
Modified files:
common/src/dbdrivers/_pgsql: DBdriver.py
Log message:
Added support for postgres drivers so that you can put port= in the
connections.conf file. I tested on standard port (not defined in file) as well
as non standard port (defined in file) and seems to work either way. HOWEVER
please not I only have psycopg installed so only tested for that driver.. The
changes were in _pgsql so I assume it should carry over for all drivers, but
someone should test. The code is a hack so gladly make it purdy.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/dbdrivers/_pgsql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.12&tr2=1.13&r1=text&r2=text
Patches:
Index: gnue/common/src/dbdrivers/_pgsql/DBdriver.py
diff -c gnue/common/src/dbdrivers/_pgsql/DBdriver.py:1.12
gnue/common/src/dbdrivers/_pgsql/DBdriver.py:1.13
*** gnue/common/src/dbdrivers/_pgsql/DBdriver.py:1.12 Tue Feb 26 22:29:55 2002
--- gnue/common/src/dbdrivers/_pgsql/DBdriver.py Thu Mar 14 01:33:37 2002
***************
*** 50,56 ****
class PGSQL_DataObject(DBSIG_DataObject):
def __init__(self, pgdriver=None, pgresultset=None):
DBSIG_DataObject.__init__(self)
! self._connectString = 'host=%s dbname=%s user=%s password=%s'
self._escapeSingleQuote = '\\'
if pgdriver:
self._pgdriver = pgdriver
--- 50,56 ----
class PGSQL_DataObject(DBSIG_DataObject):
def __init__(self, pgdriver=None, pgresultset=None):
DBSIG_DataObject.__init__(self)
! self._connectString = 'host=%s dbname=%s user=%s password=%s port=%s'
self._escapeSingleQuote = '\\'
if pgdriver:
self._pgdriver = pgdriver
***************
*** 63,80 ****
def connect(self, connectData={}):
GDebug.printMesg(1,"Postgresql database driver initializing")
try:
self._dataConnection = self._pgdriver.connect(self._connectString %
(connectData['host'],
connectData['dbname'],
connectData['_username'],
!
connectData['_password']))
self.triggerExtensions = PGSQL_TriggerExtensions(self._dataConnection)
except self._DatabaseError, value:
GDebug.printMesg(1,"Connect String: %s" % (self._connectString % \
(connectData['host'],
connectData['dbname'],
connectData['_username'],
! connectData['_password'])))
GDebug.printMesg(1,"Exception %s " % value)
raise GDataObjects.LoginError, value
--- 63,93 ----
def connect(self, connectData={}):
GDebug.printMesg(1,"Postgresql database driver initializing")
try:
+ #
+ # Ugly dneighbo hack as no python studs to ask questions for
+ #
+ try:
+ port = connectData['port']
+ except:
+ port = '5432'
+
+ #
+ # End hack (note port variable used below and defined in __init above)
+ #
self._dataConnection = self._pgdriver.connect(self._connectString %
(connectData['host'],
connectData['dbname'],
connectData['_username'],
! connectData['_password'],
! port))
self.triggerExtensions = PGSQL_TriggerExtensions(self._dataConnection)
except self._DatabaseError, value:
GDebug.printMesg(1,"Connect String: %s" % (self._connectString % \
(connectData['host'],
connectData['dbname'],
connectData['_username'],
! connectData['_password'],
! port)))
GDebug.printMesg(1,"Exception %s " % value)
raise GDataObjects.LoginError, value
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/common/src/dbdrivers/_pgsql DBdriver.py,
Derek Neighbors <=