[Zope] ZSQLMethodFile?

Peter Sabaini sabaini@inode.at
Wed, 11 Jun 2003 12:23:00 +0200


This is a cryptographically signed message in MIME format.

--------------ms000007000303020908070907
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Peter Bengtsson wrote:
> Just like there's DTMLFile and PageTemplateFile, what about ZSQL 
> Methods? So that you can run ZSQL methods from the filesystem (for a 
> python product)
> 
> If not, I'll have to open my filesystem files and programmatically 
> create these objects.
> 


I usually just create ZSQL Methods as attributes of my (product) class:

import Acquisition
from Products.ZSQLMethods.SQL import SQL

class mySQLClass(Acquisition.Implicit):
     # We need Acquisition in order to find our db connection

     # a database connection with this id must exist!
     dbconnection = "the_db_connection"

     _sql_null = "select 1 as one"
     zsql_null = SQL('null',
                'A dumb zsql method for testing purposes',
                dbconnection,
                '',
                _sql_null,
                )



An instance of "mySQLClass" then could call self.zsql_null just like a 
standard ZSQL Method

For details, take a look at Products.ZSQLMethods.SQL or its superclass, 
Shared.DC.ZRDB.DA.DA

  - peter.


--------------ms000007000303020908070907
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJcjCC
AxcwggKAoAMCAQICAwlZhTANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCWkExFTATBgNV
BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUx
HTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVl
bWFpbCBSU0EgMjAwMC44LjMwMB4XDTAzMDIyMTEzMTY0NloXDTA0MDIyMTEzMTY0NlowWzEQ
MA4GA1UEBBMHU2FiYWluaTEOMAwGA1UEKhMF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