diff options
-rw-r--r-- | sql/log_event.cc | 9 | ||||
-rw-r--r-- | sql/sp_head.cc | 2 | ||||
-rw-r--r-- | sql/sql_cache.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 |
4 files changed, 14 insertions, 4 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 23a301873cd..9e8c0695b90 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1330,8 +1330,13 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + time_zone_len + 1 + - data_len + 1, MYF(MY_WME)))) - DBUG_VOID_RETURN; + data_len + 1 +#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE) + + QUERY_CACHE_FLAGS_SIZE + + db_len + 1 +#endif + , MYF(MY_WME)))) + DBUG_VOID_RETURN; if (catalog_len) // If catalog is given { if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3. diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ebcbfb67fc8..dfc91f5a3f4 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -227,8 +227,8 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, char dbug_buff[DECIMAL_MAX_STR_LENGTH+1]; DBUG_PRINT("info", ("DECIMAL_RESULT: %s", dbug_decimal_as_string(dbug_buff, val))); -#endif } +#endif break; } case STRING_RESULT: diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 0f4fdd52583..81eed413a8e 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -923,6 +923,10 @@ end: 0 The query was cached and user was sent the result. -1 The query was cached but we didn't have rights to use it. No error is sent to the client yet. + + NOTE + This method requires that sql points to allocated memory of size: + tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE; */ int diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 31d0f3eb675..70920b07a97 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1218,7 +1218,8 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) length--; buff[length]=0; thd->query_length=length; - thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1); + thd->query= thd->memdup_w_gap(buff, length+1, + thd->db_length+1+QUERY_CACHE_FLAGS_SIZE); thd->query[length] = '\0'; /* We don't need to obtain LOCK_thread_count here because in bootstrap |