CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    22

    how to move around records in sqlite as the way as in CDaoRecordset of MFC??

    hi,

    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!!

    how ?



    thanks!!!

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    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.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured