Created
January 16, 2014 12:15
-
-
Save spetrunia/8453991 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== modified file 'sql/sql_array.h' | |
--- sql/sql_array.h 2013-11-20 11:05:39 +0000 | |
+++ sql/sql_array.h 2014-01-16 12:01:51 +0000 | |
@@ -105,6 +105,21 @@ template <class Elem> class Dynamic_arra | |
init(prealloc, increment); | |
} | |
+ /* | |
+ Same as above, but make use of initial buffer provided by the caller. The | |
+ Dynamic_array will not try to free the initial buffer. | |
+ */ | |
+ Dynamic_array(char *buffer, uint buffer_elements, uint increment=16) | |
+ { | |
+ init_with_buffer(buffer, buffer_elements, increment); | |
+ } | |
+ | |
+ void init_with_buffer(char *buffer, uint buffer_elements, uint increment=16) | |
+ { | |
+ my_init_dynamic_array2(&array, sizeof(Elem), buffer, buffer_elements, | |
+ increment, MYF(0)); | |
+ } | |
+ | |
void init(uint prealloc=16, uint increment=16) | |
{ | |
my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment, | |
=== modified file 'sql/sql_explain.cc' | |
--- sql/sql_explain.cc 2013-10-16 16:20:20 +0000 | |
+++ sql/sql_explain.cc 2014-01-16 12:09:33 +0000 | |
@@ -23,7 +23,9 @@ | |
Explain_query::Explain_query(THD *thd_arg) : | |
- upd_del_plan(NULL), insert_plan(NULL), thd(thd_arg), apc_enabled(false) | |
+ upd_del_plan(NULL), insert_plan(NULL), | |
+ unions(unions_buf, PREALLOC_ELEMS), selects(selects_buf, PREALLOC_ELEMS), | |
+ thd(thd_arg), apc_enabled(false) | |
{ | |
operations= 0; | |
} | |
=== modified file 'sql/sql_explain.h' | |
--- sql/sql_explain.h 2013-10-17 13:50:30 +0000 | |
+++ sql/sql_explain.h 2014-01-16 12:08:06 +0000 | |
@@ -259,6 +259,10 @@ class Explain_query : public Sql_alloc | |
/* Query "plan" for INSERTs */ | |
Explain_insert *insert_plan; | |
+ enum { PREALLOC_ELEMS= 4 }; | |
+ char unions_buf[sizeof(void*) * PREALLOC_ELEMS]; | |
+ char selects_buf[sizeof(void*) * PREALLOC_ELEMS]; | |
+ | |
Dynamic_array<Explain_union*> unions; | |
Dynamic_array<Explain_select*> selects; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment