December 18th, 2012, 11:21 PM
how to move around records in sqlite as the way as in CDaoRecordset of MFC??
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 in c/c++ 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!!
December 25th, 2012, 09:22 PM
Re: how to move around records in sqlite as the way as in CDaoRecordset of MFC??
You can only step forwards through the result set, so what you are asking for cannot be done through some function in SQLite's C API (though of course move(int) can be done by running a new query with LIMIT, but it can be slow when retrieving a row near the end of the result set). However, you could simply retrieve the entire result set into memory, upon which all the functionality that you described can be easily done just by accessing the array (or other container used to store the result set).
However, it may be infeasible or undesirable to load the entire result set into memory that way, yet you may still want to be able to step backwards. If so, the ideas described in the SQLite wiki concerning Scrolling Cursor might help.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!