[Zope-DB] Relational Databases in Zope 2 and Zope 3

Charlie Clark charlie at egenix.com
Tue Jun 29 06:22:28 EDT 2004


On 2004-06-29 at 11:13:31 [+0200], Chris Withers <chris at simplistix.co.uk> 
wrote:
> Charlie Clark wrote:
> > improvements over query strings on non-cached transactions. This proof of
> > concept requires changes to Zope core
> 
> What changes were required?

Sorry, overlooked this.

It currently requires patching shared.ZRDB code to include a "positional" 
method and some logic to turn keywords-value pairs into the appropriate 
parameters tuple. The DA then needs to pass the parameters to the driver's 
.execute() method

    def positionalQuery(self, *args):
        """Needed to work around the __call__ method keyword bindings
	"""
	return apply(self, (None, None, 0, 0)+args, {})

	"""Keyword to parameter mapping"""

	keys = self._arg.keys()
        if REQUEST: kw=REQUEST
	if args:
	    for i in xrange(len(keys)):
	        kw[keys[i]] = args[i]
        else:
            args = list(args)
            for i in xrange(len(keys)):
                key = keys[i]
                value = self._arg[key]
                converter = type_converters[value['type']]
                args.append(converter(kw[key]))       
            args = tuple(args)
        if kw: REQUEST=kw

Unfortunately this breaks current ZSQL methods completely and cannot be 
distributed in this form.

Charlie


More information about the Zope-DB mailing list