diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-12-04 22:38:16 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-12-04 22:38:16 +0100 |
commit | 27f9d2f9291efaca2a96fbda1c68e410abd94767 (patch) | |
tree | 2f4f53d612a0cd9f17b94287327cb319437f9d7e /storage/connect/xobject.cpp | |
parent | dc8a0df0a2c72a974c7e76eb8a3f945e6eed4f15 (diff) | |
download | mariadb-git-27f9d2f9291efaca2a96fbda1c68e410abd94767.tar.gz |
Commit updating CONNECT from the 10.1 version
Diffstat (limited to 'storage/connect/xobject.cpp')
-rw-r--r-- | storage/connect/xobject.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp index 92bf039c07c..a0b7849543d 100644 --- a/storage/connect/xobject.cpp +++ b/storage/connect/xobject.cpp @@ -11,6 +11,7 @@ /* Include mariaDB header file. */ /***********************************************************************/ #include "my_global.h" +#include "m_string.h" /***********************************************************************/ /* Include required application header files */ @@ -290,14 +291,14 @@ bool STRING::Set(char *s, uint n) } // end of Set /***********************************************************************/ -/* Append a char* to a STRING. */ +/* Append a char* to a STRING. */ /***********************************************************************/ -bool STRING::Append(const char *s, uint ln) +bool STRING::Append(const char *s, uint ln, bool nq) { if (!s) return false; - uint len = Length + ln + 1; + uint i, len = Length + ln + 1; if (len > Size) { char *p = Realloc(len); @@ -311,8 +312,22 @@ bool STRING::Append(const char *s, uint ln) } // endif n - strncpy(Strp + Length, s, ln); - Length = len - 1; + if (nq) { + for (i = 0; i < ln; i++) + switch (s[i]) { + case '\\': Strp[Length++] = '\\'; Strp[Length++] = '\\'; break; + case '\0': Strp[Length++] = '\\'; Strp[Length++] = '0'; break; + case '\'': Strp[Length++] = '\\'; Strp[Length++] = '\''; break; + case '\n': Strp[Length++] = '\\'; Strp[Length++] = 'n'; break; + case '\r': Strp[Length++] = '\\'; Strp[Length++] = 'r'; break; + case '\032': Strp[Length++] = '\\'; Strp[Length++] = 'Z'; break; + default: Strp[Length++] = s[i]; + } // endswitch s[i] + + } else + for (i = 0; i < ln && s[i]; i++) + Strp[Length++] = s[i]; + Strp[Length] = 0; return false; } // end of Append |