ZSQLMethods: Printing out the SQL

ZSQLMethods are used to query external relational databases like Oracle. They can be static SQL, like:

    select column from table

Or you can put DTML in for the SQL statement so that you can have dynamically created SQL. Note that you may have to pass parameters to the ZSQLMethod.

    select column from table
      where <dtml-sqltest someColumn>

The full range of DTML can be used inside a ZSQLMethod, plus the extra ZSQLMethod specific DTML tags. This added complexity can make it difficult to determine why the ZSQLMethod is not returning the expected results.

To debug, or perhaps for other purposes, it is useful to be able to get at the SQL that is generated from the ZSQLMethod. To do this, you add src__=1 as a parameter when calling the ZSQLMethod.

Example Python Script code would look like:

    print container.MyZSQLMethod(src__=1)

Last modified: 2007/10/09 11:27:47.743000 GMT-4 by christopher.n.deckard.1
Created: 2007/10/09 11:27:47.743000 GMT-4 by brian.r.brinegar.1.

Categories

Search the Knowledge Base

Include:

Quick search results

    Admin Options: Edit this Document