[mod_python] Passing Cursor Objects

Mike Looijmans mike.looijmans at asml.com
Fri Jul 18 07:10:37 EST 2003


Good explanation, I'm sure you're erring on the 'too much' side here.

Anyway, MySQL has a quite nice LIMIT command for this purpose. You can not
only get the 'first 10' rows, but you can also make it fetch the last 10 or
from 30-40. So all you need is to keep track of where you were and what the
query was (you could make the page into a form and add <input type=hidden>
tags and prev/next submit buttons. Or you could put the query into the url.

If you have really long queries (URLs are limited to 6kB) consider using
either POST requests or store the query into the database and supply a
'handle' (row ID) instead. Throw away the query after an hour or so...


>So the long and short of it is you'll have to open a new cursor for
>each request from the web.  It may help to think about the state of the
>cursor that's most important to you: not the connection ID to the MySQL
>server or anything like that.  It's probably the row number the user
>last viewed, along with the components of the query.  If you put *that*
>information into the generated HTML in such a way that the browser will
>send it back to you (again, <input> tags are good for this), then
>you'll be able to create a cursor in the necessary state by grabbing
>any old cursor and executing the appropriate query.
>
>I hope this helps.  I try to err on the side of too much explaination.




-- 
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.




More information about the Mod_python mailing list