summaryrefslogtreecommitdiff
path: root/sql/sp_head.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-09-17 15:40:38 +0200
committerunknown <pem@mysql.comhem.se>2004-09-17 15:40:38 +0200
commite2c4279ce2540413af535348b06148f62ce0d610 (patch)
tree1a5856409767655746801aa6e8341de4da23b4f4 /sql/sp_head.h
parent32fed579c50eebb134a783e578e9ee2938233034 (diff)
downloadmariadb-git-e2c4279ce2540413af535348b06148f62ce0d610.tar.gz
Fixed BUG#3583: query cache doesn't work for stored procedures.
mysql-test/r/sp.result: New test case for BUG#3583. (And current query is now set correctly.) mysql-test/t/sp.test: New test case for BUG#3583. sql/sp_head.cc: Set the thd->query and try to use cached query, if any, when executing a statement. sql/sp_head.h: Extract the sub-query and store in sp_instr_stmt. sql/sql_cache.cc: Keep the net->pkt_nr up-to-date when using query cache. This makes it work with stored procedures too. sql/sql_cache.h: Keep the net->pkt_nr up-to-date when using query cache. This makes it work with stored procedures too. sql/sql_yacc.yy: Extract the sub-query and store in sp_instr_stmt. (And it's never safe to cache references to local variables.)
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r--sql/sp_head.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 9c308961aa4..6aa05838291 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -88,6 +88,7 @@ public:
my_bool m_simple_case; // TRUE if parsing simple case, FALSE otherwise
my_bool m_multi_results; // TRUE if a procedure with SELECT(s)
my_bool m_in_handler; // TRUE if parser in a handler body
+ uchar *m_tmp_query; // Temporary pointer to sub query string
uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value
st_sp_chistics *m_chistics;
ulong m_sql_mode; // For SHOW CREATE
@@ -314,9 +315,14 @@ class sp_instr_stmt : public sp_instr
public:
+ LEX_STRING m_query; // For thd->query
+
sp_instr_stmt(uint ip, sp_pcontext *ctx)
: sp_instr(ip, ctx), m_lex(NULL)
- {}
+ {
+ m_query.str= 0;
+ m_query.length= 0;
+ }
virtual ~sp_instr_stmt();