[Zope] Accessing ZSQL connection from external method

jiva@devware.com jiva@devware.com
Mon, 27 Mar 2000 04:09:38 -0700


Aha! I have it!

Your external methods are given a pointer to self as the first
arguement.  You can use this to access any methods in the current
folder (self is the current folder)  So just call:

self.MyZSQLMethod(arg1, arg2)

where arg1 and arg2 are would be the arguments for the ZSQL Method.

On Sun, Mar 26, 2000 at 02:36:19PM +0200, Ragnar Beer wrote:
> Howdy!
> 
> I'm making heavy use of MySQLdb in my external methods. Now I just 
> realized that ZSQL-connections are kept open permanently and it would 
> save a lot of time if I wouldn't have to open a connection each time 
> my external method is invoked but use the already existing 
> ZSQL-connection instead.
> My question: How can I access a ZSQL-connection (ZMySQLDA) from an 
> external method?
> 
> 
> P.S.: I benchmarked MySQLdb and found that opening a connection took 
> 1.2ms on my systen whereas a very short request for authentication 
> took only 1.1ms. So beeing able to use an existing connection would 
> result in about 100% performance gain (at least at first glance).
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
Under capitalism, man exploits man.  Under communism, it's just the opposite.
		-- J.K. Galbraith