summaryrefslogtreecommitdiff
path: root/storage/connect/xobject.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-01-23 17:54:53 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2015-01-23 17:54:53 +0100
commitdc091a29352bf034ce699395f26a939020c9422e (patch)
tree0fd65ef8802e1ee5771c71c879b1c83cb3905764 /storage/connect/xobject.cpp
parente57677238379624fc4aa1ff5b2852acfad5c2372 (diff)
downloadmariadb-git-dc091a29352bf034ce699395f26a939020c9422e.tar.gz
- Fix MDEV-7489 (in add_field)
modified: storage/connect/ha_connect.cc - Fix MDEV-7494 (adding Insert_quoted in the STRING class) modified: storage/connect/tabmysql.cpp storage/connect/xobject.cpp storage/connect/xobject.h - Fix MDEV-7498 in value.cpp (AllocateValue) modified: storage/connect/value.cpp - Handle backslash in Json serialize + uchar + typo. modified: storage/connect/json.cpp storage/connect/tabjson.cpp
Diffstat (limited to 'storage/connect/xobject.cpp')
-rw-r--r--storage/connect/xobject.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index 4ddd4f5b30f..b9a0236e7c8 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -347,6 +347,31 @@ bool STRING::Append(char c)
} // end of Append
/***********************************************************************/
+/* Append a quoted PSZ to a STRING. */
+/***********************************************************************/
+bool STRING::Append_quoted(PSZ s)
+{
+ bool b = Append('\'');
+
+ if (s) for (char *p = s; !b && *p; p++)
+ switch (*p) {
+ case '\'':
+ case '\\':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\b':
+ case '\f': b |= Append('\\');
+ // passthru
+ default:
+ b |= Append(*p);
+ break;
+ } // endswitch *p
+
+ return (b |= Append('\''));
+} // end of Append_quoted
+
+/***********************************************************************/
/* Resize to given length but only when last suballocated. */
/* New size should be greater than string length. */
/***********************************************************************/