If you don't mind to use some memory, you can use sqlite3_get_table.
http://www.sqlite.org/capi3ref.html#sqlite3_get_table

Paolo

If I would use SELECT COUNT(*) then I have to ask the query again,
right?
E.g:
First I have to do:
SELECT * FROM data WHERE Foo == "bar" LIMIT 1000;
to get the data and then
SELECT COUNT(*) FROM data WHERE Foo == "bar";
to get the total lnumber of lines.

The problem is that the database is very large and the query can be
complex, so I want to avoid to use two queries.
I had hoped that there would be a way to do just ask one query with the
LIMIT keyword and also get the total number of lines.

Johan

Bert Verhees wrote:
IMHO COUNT does a complete tablescan to count the records, it did in a previous version of sqlite
Bert

Paolo Vernazza wrote:
I'm not sure what do you need... but you tried using
SELECT COUNT(*) FROM etc etc etc
Paolo

Trygg Johan wrote:

Hello,

I'm using SQLite with TCL and I have a small question:

Is it possible to get information on how many lines a select query
with
the LIMIT keyword would have produced if I hadn't used the LIMIT
keyword?

One way of doing this would be to do another query without the LIMIT
keyword, count the number of lines you got, and then throw away the
resulting data, but this seem to be a bit of waste of both resources
and
time... so I hope someone has a better solution :)

Thanks in advance,
Johan Trygg




Reply via email to