[Zope-DB] RE: [egenix-info] RE: [egenix-support] <question> (No id YET)

Charlie Clark charlie at egenix.com
Wed Mar 31 06:11:45 EST 2004


On 2004-03-30 at 22:43:26 [+0200], Morten Bech wrote:
> Well it works now, but ?
> 
> Could you please send me a very little dtml doc on getting something
> from a DB ?
> 
> Before i used another Oracle product through the ZMI and there you wrote
> your sql called it through dtml and that was it. Im a bit confused about
> what to do now. Nothing in your manual describes it with a decent
> example or am i wrong ?

Hi Morten,

I'm cc'ing this to our users' list and also to the Zope-DB list as we don't 
generally provide this kind of support.

If you're very new to Zope then you should take the time to look at the 
Zope book which is available online and has lots of examples on how to do 
things with Zope. But here are few steps to get you on your way:

create a ZSQL method with SQL code to collect something from a database
eg.

SELECT name, age FROM person

assuming you've got a relation called person with attributes name, and age.

Then you can add a ZSearchInterface to use this query to generate a report. 
We suggest you dive straight on into PageTemplates rather than DTML which 
is considered by most to be deprecated.

Assuming your ZSQL method is called qPerson, a ZPT might look something 
like this.

<table>
<tr>
<td>Name</td>
<td>Age</td>
</tr>
<tr tal:repeat="result here/qPerson">
<td tal:content="result/person"></td>
<td tal:content"result/age"></td>
</tr>
</table>

Good luck!

Charlie Clark
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Zope-DB mailing list