summaryrefslogtreecommitdiff
path: root/sql/sql_analyse.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-03-26 09:41:52 +0100
committerSergei Golubchik <sergii@pisem.net>2014-03-26 09:41:52 +0100
commitc73a0638c233f421bc17705d94e934d8fccfbe19 (patch)
tree473650aff8d7f0e9366ff4b15b3dffee41d6188c /sql/sql_analyse.cc
parentd0c6a05eb5cc6b856a523725607defb229252885 (diff)
downloadmariadb-git-c73a0638c233f421bc17705d94e934d8fccfbe19.tar.gz
remove append_escaped(), use String::append_for_single_quote() instead
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r--sql/sql_analyse.cc55
1 files changed, 1 insertions, 54 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index ac3f7f25518..9b7ea58bee6 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -1080,7 +1080,7 @@ int collect_string(String *element,
else
info->found = 1;
info->str->append('\'');
- if (append_escaped(info->str, element))
+ if (info->str->append_for_single_quote(element))
return 1;
info->str->append('\'');
return 0;
@@ -1239,56 +1239,3 @@ uint check_ulonglong(const char *str, uint length)
return ((uchar) str[-1] <= (uchar) cmp[-1]) ? smaller : bigger;
} /* check_ulonlong */
-
-/*
- Quote special characters in a string.
-
- SYNOPSIS
- append_escaped(to_str, from_str)
- to_str (in) A pointer to a String.
- from_str (to) A pointer to an allocated string
-
- DESCRIPTION
- append_escaped() takes a String type variable, where it appends
- escaped the second argument. Only characters that require escaping
- will be escaped.
-
- RETURN VALUES
- 0 Success
- 1 Out of memory
-*/
-
-bool append_escaped(String *to_str, String *from_str)
-{
- char *from, *end, c;
-
- if (to_str->realloc(to_str->length() + from_str->length()))
- return 1;
-
- from= (char*) from_str->ptr();
- end= from + from_str->length();
- for (; from < end; from++)
- {
- c= *from;
- switch (c) {
- case '\0':
- c= '0';
- break;
- case '\032':
- c= 'Z';
- break;
- case '\\':
- case '\'':
- break;
- default:
- goto normal_character;
- }
- if (to_str->append('\\'))
- return 1;
-
- normal_character:
- if (to_str->append(c))
- return 1;
- }
- return 0;
-}