MXS-1043: Handle @@identity like @@last_insert_id
The type of @@identity, @@last_insert_id and last_insert_id() is now the same, that is, QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ.
This commit is contained in:
parent
ac0f975f9c
commit
0218ac9e9c
@ -913,11 +913,23 @@ static uint32_t resolve_query_type(parsing_info_t *pi, THD* thd)
|
||||
|
||||
/** System session variable */
|
||||
case Item_func::GSYSVAR_FUNC:
|
||||
func_qtype |= QUERY_TYPE_SYSVAR_READ;
|
||||
MXS_DEBUG("%lu [resolve_query_type] "
|
||||
"functype GSYSVAR_FUNC, system "
|
||||
"variable read.",
|
||||
pthread_self());
|
||||
{
|
||||
const char* name = item->name;
|
||||
if (name &&
|
||||
((strcasecmp(name, "@@last_insert_id") == 0) ||
|
||||
(strcasecmp(name, "@@identity") == 0)))
|
||||
{
|
||||
func_qtype |= QUERY_TYPE_MASTER_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
func_qtype |= QUERY_TYPE_SYSVAR_READ;
|
||||
}
|
||||
MXS_DEBUG("%lu [resolve_query_type] "
|
||||
"functype GSYSVAR_FUNC, system "
|
||||
"variable read.",
|
||||
pthread_self());
|
||||
}
|
||||
break;
|
||||
|
||||
/** User-defined variable read */
|
||||
|
@ -670,7 +670,15 @@ static void update_affected_fields(QC_SQLITE_INFO* info,
|
||||
}
|
||||
else
|
||||
{
|
||||
info->types |= QUERY_TYPE_SYSVAR_READ;
|
||||
if ((strcasecmp(&zToken[2], "identity") == 0) ||
|
||||
(strcasecmp(&zToken[2], "last_insert_id") == 0))
|
||||
{
|
||||
info->types |= QUERY_TYPE_MASTER_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->types |= QUERY_TYPE_SYSVAR_READ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -12,3 +12,6 @@ QUERY_TYPE_BEGIN_TRX
|
||||
QUERY_TYPE_ROLLBACK
|
||||
QUERY_TYPE_COMMIT
|
||||
QUERY_TYPE_SESSION_WRITE
|
||||
QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ
|
||||
QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ
|
||||
QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ
|
||||
|
@ -12,3 +12,6 @@ BEGIN;
|
||||
ROLLBACK;
|
||||
COMMIT;
|
||||
use X;
|
||||
select last_insert_id();
|
||||
select @@last_insert_id;
|
||||
select @@identity;
|
||||
|
Loading…
x
Reference in New Issue
Block a user