470,604 Members | 2,056 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

FOUND_ROWS() in Multiple Users Environmnent

Hi,

Suppose many users will issue SELECT statement to the server, e.g.
1. UserA issued a SELECT statement
2. UserA issued FOUND_ROWS() and get the correct result

The above is okay, but problems might occur when there is more than one
users

1. UserA issued a SELECT statement
2. UserB issued another SELECT statement
3. UserA issued FOUND_ROWS() and will get the wrong result??

how to handle this?
Thanks.

Mar 14 '06 #1
1 1737
<ho******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
1. UserA issued a SELECT statement
2. UserB issued another SELECT statement
3. UserA issued FOUND_ROWS() and will get the wrong result??

how to handle this?


FOUND_ROWS() is supposed to be similar to LAST_INSERT_ID(), in that it gives
the correct answer in the context of a given connection, even if other
statements are being executed on different connections.

Try this experiment: open two command windows, and run the mysql shell in
each window. Execute a query in shell A that returns N rows. Then execute
a query in shell B that returns some different number of rows. Then go back
to shell A and execute "SELECT FOUND_ROWS();". It should return the value N
of the previous query you executed in that shell, even though another query
has been executed in the meantime in shell B.

Note that executing "SELECT FOUND_ROWS();" again always returns the answer
1, because that's how many rows were returned by "SELECT FOUND_ROWS();".

Regards,
Bill K.
Mar 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by tshad | last post: by
9 posts views Thread by Graham | last post: by
6 posts views Thread by andrea azzini | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.