Getting the number of rows in a query is maybe very expensive(*), and 
SQLite doesn't support it.
As I know, you can do one thing – if you really need to use this 
information –  fisrt, create a query with *select count(*) from…* And 
hope for nobody modify the database between your two query.

(*) because SQLite support only the forward step with the resultset, so 
if you go to the last row, you can not jump back to the first, you must 
create a new query or store the results.

Sorry my english.

Best Regards,
Máté.

Nuno Magalhães írta:
> I'm using SQLite for an academic project, through Java's JDBC
> (sqlitejdbc-0.5.4.jar). After executing a simple select, i can iterate
> the ResultSet all the way (showing to output), no problem. The
> problem, which may be silly, is that i need to get a row count so i
> can initialize a variable.
>
> I tried using rs.getFetchSize() but it returns 0. This is the only
> method i could relate to "getting number of rows" from the method
> list.
>
> I tried rs.last(); but get "SQLException: ResultSet is
> TYPE_FORWARD_ONLY" and wouldn't be able to get back anyway.
>
> I tried iterating the set and using rs.isLast() but i get
> "SQLException: function not yet implemented for SQLite".
>
> I've also tried setting flags on the statement but i get the same
> exceptions. Am i missing something obvious?
>   


--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to