1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix for BUG#29318 "Statements prepared with PREPARE and with one

parameter don't use query cache"
Thanks to the fix of BUG#26842, statements prepared with SQL PREPARE
and having parameters can now use the query cache.


mysql-test/include/query_cache_sql_prepare.inc:
  now, statements prepared with SQL PREPARE use the query cache even
  when they have parameters.
mysql-test/r/query_cache_ps_no_prot.result:
  updated result: we see caching happened.
mysql-test/r/query_cache_ps_ps_prot.result:
  updated result: we see caching happened
sql/sql_prepare.cc:
  query expansion does not insert user variables' references anymore,
  it now inserts parameters' values (BUG#26842's fix did this);
  so we can use the query cache.
This commit is contained in:
unknown
2007-06-23 19:16:51 +02:00
parent a50a88e29c
commit ba7e22dbe4
4 changed files with 212 additions and 190 deletions

View File

@@ -2922,18 +2922,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena;
if ((protocol->type() == Protocol::PROTOCOL_TEXT) && (param_count > 0))
{
/*
This is a mysql_sql_stmt_prepare(); query expansion will insert user
variable references, and user variables are uncacheable, thus we have to
mark this statement as uncacheable.
This has to be done before setup_set_params(), as it may make expansion
unneeded.
*/
lex->safe_to_cache_query= FALSE;
}
if (error == 0)
{
setup_set_params();