[Zope-dev] Re: Adding a ZSQL Method programmatically

Fabio Augusto Mazzarino mazza@radiumsystems.com.br
Thu, 30 Mar 2000 10:01:04 -0300


 Jiva:

 You have to create an instance of ZSQLMethod inside your __init__( ). To do
this import SQL from Products.ZSQLMethods and instantiate it like this:
    sqlSelectAll = SQL('instanceId', 'instanceTitle', dbConn, 'param1 param2
param3 ... paramN', yourQuery)
 Where 'yourQuery' is a query defined like this:

yourQuery = """
SELECT <dtml-var param1> from <dtml-var param2>
WHERE    f1 = <dtml-sqlvar param3 type=string> AND
                 f2 = 5
                 f3 = ...
"""
 I hope this solve your problem.

 Fabio Augusto Mazzarino - mazza@radiumsystems.com.br
 RadiumSystems.com - Sao Carlos - Brazil


----- Original Message -----
From: <zope-dev-admin@zope.org>
To: <zope-dev@zope.org>
Sent: Thursday, March 30, 2000 5:51 AM
Subject: Zope-Dev digest, Vol 1 #453 - 18 msgs

> Message: 18
> Date: Thu, 30 Mar 2000 03:02:31 -0700
> From: jiva@devware.com
> To: zope-dev@zope.org
> Subject: [Zope-dev] Adding a ZSQL Method programmatically
>
> How can I add a ZSQL method programatically, as in like in a
> constructor of a python class?
> --
> Humor in the Court:
> Q.  Were you aquainted with the deceased?
> A.  Yes, sir.
> Q.  Before or after he died?
>
>