[Zope] SQL Queries
Dan Schenck <schenck@ultra.posc.org>
Dan Schenck <schenck@ultra.posc.org>
16 Jan 00 08:31:30 -0600
Giampiero,
You can easily do that. Take a look at this code. It is a DTML Method, tableCount_html
which displays a page that allows a user to select a table name from a select list in a form.
The options are retrieved from a data base before the page is displayed:
<dtml-var standard_html_header>
<form action="tableInstances" method="get">
<h2 align="center"><dtml-var document_title></h2>
<hr>
<p><font size="+1">Enter query parameters:</font></p>
<table>
<tr><th>Entity name</th>
<td><SELECT NAME="entity_name" SIZE=1>
<dtml-in getTableNames>
<OPTION><dtml-var table_def_nm null=""></OPTION>
</dtml-in>
</SELECT>
</td></tr>
<tr><td colspan=2 align=center>
<input type="SUBMIT" name="SUBMIT" value="Submit Query">
</td></tr>
</table>
</form>
<p> </p>
<dtml-var standard_html_footer>
Here is the code for getTableNames, a Z SQL Method that uses the ODBC interface to
query an Oracle database for the possible list of tables to select from:
select table_def_nm from table_def
order by 1
As you can see, when someone references tableCount_html the getTableNames method is
called without the user pressing any buttons.
Dan Schenck
POSC
Houston, TX
> ** Original Subject: [Zope] SQL Queries
> ** Original Sender: Giampiero Raffaini <giampiero@btinternet.com>
> ** Original Date: Sun, 16 Jan 2000 14:04:53 GMT
> ** Original Message follows...
>
> 16/01/2000 13:59:55
> Hello there,
> I am new to zope and i find it great. I am still learning it and I have a few questions, but one
in particular;
> I used Coldfusion before and I was able to do this:
> I had a db with movies, with Title,director,year and so on. I could run a query looking for
Tilte and ID and then
> output the result on a line and make each of the Titles a dynamically generated link
(something like
> <a href="newpage.cfm?#ID#>#Title#</a> if you know what I mean).
> Now my question is:
> is it possible in Zope to run SQL queries without the need to actually click on a Submit
button?
> Cheers
>
>
> _______________________________________________
> 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 )
>
>** --------- End Original Message ----------- **
>
Dan R. Schenck mailto:schenck@posc.org
POSC http://www.posc.org
Suite 275
10777 Westheimer
Houston, TX 77042