- August 6, 2007 3:05 PM
MySQL AB :: MySQL 5.1 リファレンスマニュアル :: 17.2.9 カーソル
メモ
メモ
There are 3 possible types, "SENSITIVE", "INSENSITIVE" and "ASENSITIVE"
SENSITIVE means is that the server runs the query and it gets back a list of rows matching the query. That is, they will have been filtered, ordered, etc. However, the server does not make a copy of the results at this time but instead points back to the rows on the server.
This means that if another MySQL thread changes a row in the table referenced by your results, you will in fact see those changes as you advance through the cursor. Following from that, when you actually read the data from the cursors, they may no longer be in the correct order, or match your WHERE condition as the data may have been changed from what it was originally when the query ran.
INSENSITIVE means that the server takes a copy of the data at the time the query was executed, and that any further updates do not affect the data in that cursor.
ASENSITIVE means that it may be one or the other, you can't rely on it being either way - which way the server goes depends on various things including how the server executed the query.
For example, if it is a very simple query, where the server can just read the data out directly - it would probably make the data SENSITIVE.
However if you had a more complex query, involving JOINs, SUBQUERIES, etc - it would most likely end up in a temporary table and thus behave an an INSENSITIVE manner.
Note that it is not as simple as this, it is just an example to give you an idea what might make the difference between the data happening to be SENSITIVE or INSENSITIVE in any one case.