[Zope-DB] ZFireBirdDA Connection Strings

Yasushi Iwata yasusii@rakucyaku.com
Mon, 15 Apr 2002 22:35:53 +0900


kinterbasdb.connect() takes some other parameters like charset. But
ZFireBirdDA cannot specify a character set for the connection.

I want specify connection strings like this:

  dsn=127.0.0.1:/home/ib/foo.gdb user=bar password=*** charset=eucj_0208

Here is the patch for db.py.

*** db.py.orig	Mon Apr 15 22:19:00 2002
--- db.py	Mon Apr 15 21:49:45 2002
***************
*** 31,37 ****
  
  import string, sys
  strsplit=string.split
! from string import strip, find
  from time import time
  
  failures=0
--- 31,37 ----
  
  import string, sys
  strsplit=string.split
! from string import strip, find, split
  from time import time
  
  failures=0
***************
*** 65,73 ****
  	    self.db.close()
  	except:
  	    pass
! 	connbits=strsplit(self.connection, ' ')
! 	db=kinterbasdb.connect(dsn=connbits[0],user=connbits[1],password=connbits[2])
! 	self.db=db
  	self.cursor=self.db.cursor()
          
      def str(self,v, StringType=type('')):
--- 65,75 ----
  	    self.db.close()
  	except:
  	    pass
!         kwargs={}
!         for s in split(self.connection):
!             k,v=s.split('=',1)
!             kwargs[k]=v
!         self.db=apply(kinterbasdb.connect, (), kwargs)
  	self.cursor=self.db.cursor()
          
      def str(self,v, StringType=type('')):
***************
*** 197,200 ****
                  })
          return items, result
  
- 
--- 199,201 ----