[Zope-DB] result set question
Wed, 13 Mar 2002 08:32:29 -0500
Splitting results is easy. Look at the Help docs for <dtml-in> and you'll
see the commands for batching.
You might want to create a separate ZSQLMethod for the detail view of an
object, or you might want to share your list-getting method. You can do
# parameters: fooid:optional
SELECT * FROM tblFoo
WHERE fooid=<dtml-sqlvar fooid type=foo>
And you can call this method w/o an id to get all records, or with an id to
get just one. The downside is that it's less clear and that you're getting
all fields for your list; if your table has many long fields, this is
unneccessary work. However, it is less to write and less to maintain.
Joel BURTON | firstname.lastname@example.org | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant
From: email@example.com [mailto:firstname.lastname@example.org]On Behalf Of
Sent: Wednesday, March 13, 2002 1:58 AM
Subject: [Zope-DB] result set question
I am developing a search engine with Zope. It queries a mySQL database
according to the search criteria of a web form and outputs the results. I
have it working and all but I would like to ask two things:
1. Is it possible to split the results into pages of say 10 results? If yes,
how? Does Zope provide a way of doing this? Do I need to ask mySQL to fetch
the first 10 records, then the next 10, and so on? Is it possible?
2. I want to have each record hyperlinked, so that when a user clicks on it,
he/she can view more details. Do I need to create a separate database access
object to handle these requests?
I am sorry if these are too simple questions, but I am reading the
documentation and cannot find an exact answer. I am still trying to grasp
exactly how zope works.