[mod_python] Perfect solution for split recordset by N number of records per page

durumdara durumdara at gmail.com
Thu Sep 28 03:20:02 EDT 2006


Hi !

Basically the (db, web) server developers must limit the result(set).
They must filter data tables with queries, they must must the limit 
record count that they get back to clients.

In the most of the websites the usual way to descreasing the result page 
length to splitting the result to N pieces (r number of records), and to 
creating a "thumbnails" for the pages.
See google...

The Zope have an automatic and automagic built-in thing that can provide 
thumbnails to resultsets.

In mod_python I need to build it (If I see good).

The question is: Have you any idea, how to I create it ?

The my biggest problem: how to control the queries.
Some of the database servers support the "TOP" (or "START") "attribute" 
that can say to the server, where it starts the query (what is the first 
record in the total recordset).
Some of the databases also support the "LIMIT" "attribute" that can 
limit recordset (how many records I need).
With these parameters the db server can "cut" some records from the 
total query result.
FireBird can do it as I know.

If these functions are not presented in the server, the queries "recno" 
or "rowid" param can help to us.

But if none of these things are presented, what can I do ? (I have 
DBISAM connection through Windows ODBC).
I can fetch records while I not found the N. record, and I fetch until 
limit have been reach.
Example: I split recordset by 50 records. When I want to load page 5, I 
must jump to the record 5*50 = 250. record in the queries resultset, and 
must fetch 50 records - this is the content of the result page that I 
shall be create later.

It is working with little resultset, but when I have 2000-10000 records, 
this method is too slow.

The Zope is handle this by it's automagically way, I don't know how.

How you handle this thing in your website ?

Thanks for your help and for your idea !

    dd





More information about the Mod_python mailing list