[Zope] Accessing Zope DA connection from external method

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Mon, 27 Sep 1999 19:10:10 +1000 (EST)


On Mon, 27 Sep 1999, Hannu Krosing wrote:

> > Can anyone point out how do I reference a Zope DA Connection from an
> > external method. This way I can make use of an existing open connection
> > instead.
> 
> >From a short look at the source it seems that you can just use
> 
> YourZopeConnection.query('select * from data')
> 
> I quess the result will be the same as from using ZSQL Method, but it 
> may be something simpler. 

Does anyone know if we can retrieve a pyDB 1.0 compliant Connection
object from a Zope DA? My guess is probably not, as I don't think a Zope DA
has to be implemented on top of this interface.

I need to perform the same query a few thousand times, and would like
to avoid the SQL compilation step by reusing the same cursor and just
rebinding the parameters. Does anyone know if ZSQL methods
perform this optimization behind our backs, or if it would be possible
for a particular Zope DA to do this optimization? I'd guess it would be
up to an individual DA to do this optimization, as pyDB 1.0 didn't specify
how parameter binding would work and pyDB 2.0 for some ridiculous reason 
lets it be done in 4 different ways.

 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen