On 18 Dec 2012, at 3:03pm, tigeryth <doityth...@163.com> wrote:

>   i use sqlite in my project. it is good because of its capacity bigger than 
> ACCESS.  i used CDaoRecordset of MFC to handle records in ACCESS, whick is 
> convenient to me move around records in table and edit certain record.
> 
> according to my habit, i wish sqlite has some kind of functions like, 
> move(int) to get to cerctain record, getbookmark(...) to the record marked 
> record and setbookmark() to mark the record, moveprov() to move one record 
> back and movenext() to the record forward, IsEOF and IsBOF to know we are not 
> out of table domain. all in one word, not only move forwardly but also 
> backwardly through records in table.
> 
> i know sqlite3_get_table( )  ,  sqlite3_step() function and struct 
> sqlite3_stmt  archive some goal mentioned above, but not all!!

Every table has a secret column which can be addressed as id or rowid.  There's 
an index on this column, so you can find values very quickly.  You can use this 
column to uniquely identify a row in the table.  Move forward by looking for 
the next bigger rowid value.  Move backwards by looking for the next smaller 
rowid value.  So you can write your own 'movenext()' code that does something 
like

SELECT rowid FROM myTable WHERE rowid > [current_rowid] ORDER BY rowid LIMIT 1

You might want to read

<http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor>

and get back to us if you still have questions.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to