diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-10-16 13:38:42 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-10-16 13:38:42 +0400 |
commit | e5d13c1567cd5600f163aedfc940b3ba6b7703af (patch) | |
tree | e7ddb60207533508db6f4c509e8921e398769eed /sql/sql_array.h | |
parent | ce069b1f6b3847309b06e548adf23fa0c7238336 (diff) | |
parent | e62e1e8a3b82f037cb3c76986327b36647288a2d (diff) | |
download | mariadb-git-e5d13c1567cd5600f163aedfc940b3ba6b7703af.tar.gz |
Merge 10.0-base -> 10.0
Diffstat (limited to 'sql/sql_array.h')
-rw-r--r-- | sql/sql_array.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/sql_array.h b/sql/sql_array.h index 697819787f2..b527f26b186 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -117,6 +117,7 @@ public: */ Elem& at(size_t idx) { + DBUG_ASSERT(idx < array.elements); return *(((Elem*)array.buffer) + idx); } /// Const variant of at(), which cannot change data @@ -199,6 +200,23 @@ public: set_dynamic(&array, &el, idx); } + bool resize(size_t new_size, Elem default_val) + { + size_t old_size= elements(); + if (allocate_dynamic(&array, new_size)) + return true; + + if (new_size > old_size) + { + set_dynamic(&array, (uchar*)&default_val, new_size - 1); + /*for (size_t i= old_size; i != new_size; i++) + { + at(i)= default_val; + }*/ + } + return false; + } + ~Dynamic_array() { delete_dynamic(&array); |