[Zope] Calling sql method from FS product

peter sabaini sabaini@inode.at
Wed, 11 Dec 2002 16:29:10 +0100


I usually add ZSQL Methods as attributes of my class, eg.:


from Products.ZSQLMethods.SQL import SQL

class myProduct(Acquisition.Implicit):
     flushLogData = SQL('flushLogData',
                        'Flush the access data to the RDBMS',
                        'database_connection',
                         'logData:string',
                         '''execute flushLogData
                            @logData=<dtml-sqlvar logData type=string>
                         ''',
                                 )


The database connection is passed as a string; the SQL class has to able 
to find it via acqusition (hence I inherit from Acquisition.Implicit).

For details see the Products.ZSQLMethods.SQL.SQL class

cheers,
peter.



Ruslan Spivak wrote:
> Hello zope users,
> 
> need your help: how to call sql method from the filesystem product?
> should i create this sql method through the web before, or is it
> possible to call sql directly from product code?
> 
> Your help is very, very appreciated.
> Thanks in advance.
> 
> Best regards,
>  Ruslan                          mailto:alienoid@is.lg.ua
> 
> 
> _______________________________________________
> 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 )
> 
>