diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-09-21 12:54:56 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-09-21 12:54:56 +0200 |
commit | 59d51f0c12d6f2bccc8354079be67c6e520d3675 (patch) | |
tree | d4bf888eceb9434807dd4889fd04257d5bf5ad2b /sql/sql_string.h | |
parent | fb8bc59f0120fbd3517a291e71d81c3d11443baa (diff) | |
parent | 4368efe870f225279106798f71978b68c473e2ab (diff) | |
download | mariadb-git-59d51f0c12d6f2bccc8354079be67c6e520d3675.tar.gz |
Merge branch '10.2' into bb-10.2-connector-c-integ-subm
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 51a11c7a4ff..cc7cff09d77 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -32,6 +32,7 @@ class String; typedef struct st_io_cache IO_CACHE; typedef struct st_mem_root MEM_ROOT; +#include "pack.h" int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); inline uint32 copy_and_convert(char *to, uint32 to_length, @@ -359,7 +360,9 @@ public: if (ALIGN_SIZE(arg_length+1) < Alloced_length) { char *new_ptr; - if (!(new_ptr=(char*) my_realloc(Ptr,arg_length,MYF(0)))) + if (!(new_ptr=(char*) + my_realloc(Ptr, arg_length,MYF((thread_specific ? + MY_THREAD_SPECIFIC : 0))))) { Alloced_length = 0; real_alloc(arg_length); @@ -495,6 +498,11 @@ public: { Ptr[str_length++] = c; } + void q_append2b(const uint32 n) + { + int2store(Ptr + str_length, n); + str_length += 2; + } void q_append(const uint32 n) { int4store(Ptr + str_length, n); @@ -559,6 +567,7 @@ public: return Ptr+ old_length; /* Area to use */ } + inline bool append(const char *s, uint32 arg_length, uint32 step_alloc) { uint32 new_length= arg_length + str_length; @@ -623,6 +632,19 @@ public: { return !sortcmp(this, other, cs); } + void q_net_store_length(ulonglong length) + { + DBUG_ASSERT(Alloced_length >= (str_length + net_length_size(length))); + char *pos= (char *) net_store_length((uchar *)(Ptr + str_length), length); + str_length= pos - Ptr; + } + void q_net_store_data(const uchar *from, size_t length) + { + DBUG_ASSERT(Alloced_length >= (str_length + length + + net_length_size(length))); + q_net_store_length(length); + q_append((const char *)from, length); + } }; |