Question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Oct 14 15:02:10 EDT 2008


En Tue, 14 Oct 2008 03:27:37 -0300, Aditi Meher <meher4u1 at gmail.com>  
escribió:

> I am using ubuntu operating system,i am using python and self app for
> DB storage.
>
> I hv already mentioned in my question that i want to display 10
> records out of 100,how to create buffer to store remaining records
> which i am not displaying.
>
> I know the logic,but my language of sytax is not good so i want actual
> code please can u mail it to me.
>
> I have created DB using self app and after that created table using
> python into DB, i hv also inserted the records into it using python.

Maybe you're making things more complicated that they should be.
You don't have to create a "buffer" to store records. If you only want to  
move forward (that is, you don't have to show previous records) just keep  
the cursor, and use cursor.fetchmany(10) to fetch the next 10 rows to show.
If you have to move back and forth, just use cursor.fetchall and store the  
result (this is your "buffer", a list of records).
For 100 records that's all you need. If you expect it to grow to 100000  
records, or have many users concurrently updating the database, this might  
not be the right answer.

-- 
Gabriel Genellina




More information about the Python-list mailing list