[PEAK] firebird support for peak

darryl developer at csrules.dyndns.org
Tue Dec 30 15:05:25 EST 2003


Well golly gee. I never think much about licenses.

Will you read it now?

-darryl



Phillip J. Eby wrote:
> At 01:12 PM 12/30/03 -0600, darryl wrote:
> 
> FYI, we can't accept contributions under any license more restrictive 
> than "PSF or ZPL", so I deleted the rest of your message without reading 
> past the point where I saw the above, so that I won't be influenced by 
> seeing your code.
> 
> We can only take BSD/MIT-ish licenses, because PEAK as a whole is under 
> such a license.  Sorry.


-------------------------------------------------------------------------------
# Copyright 2003 Darryl VanDorp. All rights reserved.
#
#This software may be used under the same terms as Zope (ZPL) or
#Python (PSF)
#THERE ARE ABSOLUTELY NO WARRANTIES OF ANY KIND.

from peak.api import *
from peak.storage.SQL import ValueBasedTypeConn, GenericSQL_URL
from peak.storage.interfaces import ISQLObjectLister

class FirebirdConnection(ValueBasedTypeConn):

     protocols.advise(
         instancesProvide=[ISQLObjectLister]
     )

     DRIVER = "kinterbasdb"

     def _open(self):

         a = self.address

         return self.API.connect(
             host = a.server, database = a.db, user = a.user, password = 
a.passwd
         )

     def onJoinTxn(self, txnService):
         self.connection.begin()

     def txnTime(self,d,a):

         self.joinedTxn

         r = ~self("SELECT current_timestamp from rdb$database")
         return r[0]

     txnTime = binding.Make(txnTime)

     supportedTypes = (
         'DATETIME','NUMBER','STRING','ROWID','BINARY'
     )

class FirebirdURL(GenericSQL_URL):

     supportedSchemes = ('firebird',)
     defaultFactory = 'rdm.database.firebird.connection.FirebirdConnection'

protocols.declareAdapter(
     lambda url, proto: FirebirdConnection(address = url),
     provides = [storage.ISQLConnection],
     forTypes = [FirebirdURL],
     )



More information about the PEAK mailing list