[Zope-DB] Multiple SQL Statements

William Trenker wtrenker@shaw.ca
Tue, 28 May 2002 16:10:06 -0700

Content-type: text/plain; x-avg-checked=avg-ok-4677EA0; charset=us-ascii;
Content-transfer-encoding: 7BIT

Questions :

1) What are the higher-level Zope application scenarios where a 
NULL-separated query string gets passed to a Zope DA's query method?

2) It is quite common to specify multiple SQL statements in a single ZSQL 
Method.  Are these passed to the database as a single string or is the ZSQL 
script first parsed and the SQL statements passed to the database 
individually?  Asked another way, is it assumed that the database can 
handle multiple, semi-colon delimited, SQL statements in a single call to 
the database?  Or does Zope first split these up and pass them, 
one-at-a-time, to the database?


A Zope DA defines a query method in its DB class.  The query method is used 
to pass SQL to the underlying database.  The sql is passed to the query 
method in a parameter, often called "query_string" which is first split on 
NULLs, typically by:
queries=filter(None, map(string.strip,string.split(query_string, '\0')))

The "queries" sequence is then looped over and each individual query in the 
sequence is passed to the database.

I'm wondering where, within the Zope framework, a series of SQL statements 
separated by NULLS ('\0') is intended to be provided, or constructed, for 
passing to the DA?

Thank you.


"The commandments of the LORD are right, bringing joy to the heart. The 
commands of the LORD are clear, giving insight to life . . . For this is 
the love of God, that we keep His commandments. And His commandments are 
not burdensome." (Psalm 19:8, 1John 
5:3)    <http://torahteacher.com/>torahteacher.com

Content-type: text/plain; charset=us-ascii; x-avg=cert;
Content-transfer-encoding: 7BIT
Content-disposition: inline

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.363 / Virus Database: 201 - Release Date: 5/21/02