On Fri, Aug 26, 2011 at 12:50:36PM +0530, Tarun scratched on the wall:
> Hi,
> 
> I am calling sqlite3_get_table() to execute query to read all records
> from table but issue is records can be many lacs so result set in char
> **result may not be able to contain that large number of records. So i
> wanted to read records in chunks like first 10000 records then next
> 10000 records this way.
> 
> I planned to execute query that works on SQL ROWNUM option
> 
> "select * from employee2 where rownum > 10000 and rownum < 20000"
> 
> but i m getting error from sqlite3 that "no such column: rownum"
> 
> Please help me to achieve "read records in chunks". I am stuck.
> Thanks in advance.

  Use the _prepare/_step APIs.  Each call to _step will return one row.
  Using only one query, you can gather as many rows as you want,
  process, repeat, until the whole query is finished.  It will also
  provide the row elements in their native format, without first
  converting everything to a string.


  I would also point out that, although sqlite3_get_table() is not
  deprecated, you really shouldn't be using it.  From the first line of
  the docs <http://sqlite.org/c3ref/free_table.html>:

      This is a legacy interface that is preserved for backwards
      compatibility. Use of this interface is not recommended.


   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to