MXS-1527 Do not consider sysvars to be updated in SELECT

A statement like

    select if(@@hostname='box02','prod_mariadb02','n');

does not modify @@hostname. Hence the type mask should be
QUERY_TYPE_READ|QUERY_TYPE_SYSVAR_READ and NOT
QUERY_TYPE_READ|QUERY_TYPE_GSYSVAR_WRITE.
This commit is contained in:
Johan Wikman 2017-12-27 10:54:12 +02:00
parent 58373b3495
commit ba9b4a3bf6

View File

@ -1023,7 +1023,10 @@ static void update_field_infos(QC_SQLITE_INFO* info,
{
if (zToken[1] == '@')
{
if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT))
// TODO: This should actually be "... && (info->operation == QUERY_OP_SET)"
// TODO: but there is no QUERY_OP_SET at the moment.
if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT) &&
(info->operation != QUERY_OP_SELECT))
{
info->type_mask |= QUERY_TYPE_GSYSVAR_WRITE;
}