[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Relational Database Connectivity

webmaster at zope.org webmaster at zope.org
Tue Nov 25 12:13:59 EST 2003

A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDatabases.stx#3-64


      If you call a Z SQL Method without argument from DTML, the arguments
      are automatically collected from the REQUEST. This is the technique 
      that we have used so far in this chapter. It works well when you want
      to query a database from a search form, but sometimes you want to 
      manually or programmatically query a database. Z SQL Methods can be
      called with explicit arguments from DTML or Python.  For example, to
      query the *employee_by_id* Z SQL Method manually, the following DTML
      can be used::

        <dtml-var standard_html_header>

          <dtml-in expr="employee_by_id(emp_id=42)">
            <h1><dtml-var last>, <dtml-var first></h1>

            <p><dtml-var first>'s employee id is <dtml-var emp_id>.  <dtml-var
            first> makes <dtml-var salary fmt=dollars-and-cents> per year.</p>

        <dtml-var standard_html_footer>

        % Anonymous User - Nov. 25, 2003 12:13 pm:
         And how do you do it if you want to call it with a dtml-var as argument instead of a fix argument.

         I tried <dtml-in expr="employee_by_id(emp_id=<dtml-var bidule>)"> but it didn't work

More information about the ZDP mailing list