[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] mysql_num_rows equivalent in SQLite
From:       Roger Binns <rogerb () rogerbinns ! com>
Date:       2009-02-23 21:31:12
Message-ID: 49A315A0.3000508 () rogerbinns ! com
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bezplatno@jabse.com wrote:
>   Can you told me, how to find number of rows, of already
> prepared SELECT query.

SQLite doesn't work that way.  It calculates the next result row when
you ask for it, rather than calculating all of them up front.  To find
out how many rows there are is as much work as calculating them all so
it is bad form to write code that way.  If you absolutely have to then
use 'select count(*) from .... your original query ...' to get the count
and then run the original query.  This will do the work twice.  Unless
you wrap the whole thing in a transaction it is also possible for the
number of rows between the two to differ.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkmjFZ0ACgkQmOOfHg372QRerACeIjrzgoKRpok5RWeMSW5t79bT
FXIAn1SjdFjAM1AKmQjp7i2ZyoDZzIuO
=rp2t
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic