1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

We should skip beggining '(' characters when test query on possibility

to be in the query cache. (BUG#14652)
This commit is contained in:
bell@sanja.is.com.ua
2005-12-01 14:26:19 +02:00
parent 1a8ac44cff
commit 12d1bf1231
3 changed files with 59 additions and 9 deletions

View File

@ -956,16 +956,26 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
goto err;
}
/*
Test if the query is a SELECT
(pre-space is removed in dispatch_command)
*/
if (my_toupper(system_charset_info, sql[0]) != 'S' ||
my_toupper(system_charset_info, sql[1]) != 'E' ||
my_toupper(system_charset_info,sql[2]) !='L')
{
DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
goto err;
uint i= 0;
/*
Skip '(' characters in queries like following:
(select a from t1) union (select a from t1);
*/
while (sql[i]=='(')
i++;
/*
Test if the query is a SELECT
(pre-space is removed in dispatch_command)
*/
if (my_toupper(system_charset_info, sql[i]) != 'S' ||
my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
my_toupper(system_charset_info, sql[i + 2]) != 'L')
{
DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
goto err;
}
}
STRUCT_LOCK(&structure_guard_mutex);