diff options
author | unknown <patg@patrick-galbraiths-computer.local> | 2005-01-25 09:35:57 -0800 |
---|---|---|
committer | unknown <patg@patrick-galbraiths-computer.local> | 2005-01-25 09:35:57 -0800 |
commit | 2622ed76f3b6bdae707c66d051d6973954f649cb (patch) | |
tree | 9d66a67def294bf8d52acdbd4a5a8a3979cf15a5 /sql/sql_analyse.cc | |
parent | f796818f94ed2f151e3afbe7badf0dfae0d54c55 (diff) | |
parent | 409ddae4b86cbdfc42c2cae84825fb4d2e7c2fcb (diff) | |
download | mariadb-git-2622ed76f3b6bdae707c66d051d6973954f649cb.tar.gz |
Merge pgalbraith@bk-internal.mysql.com:/home/bk/mysql-5.0
into patrick-galbraiths-computer.local:/Users/patg/mysql-5.0
sql/set_var.cc:
Auto merged
sql/sql_analyse.cc:
Auto merged
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r-- | sql/sql_analyse.cc | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index ce58c585061..3f97cab1511 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -59,7 +59,8 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)), return compare_ulonglong(s,t); } -static bool append_escaped(String *to_str, String *from_str); +bool append_escaped(String *to_str, String *from_str); +bool append_escaped(String *to_str, char *from, uint from_len); Procedure * proc_analyse_init(THD *thd, ORDER *param, select_result *result, @@ -1052,7 +1053,7 @@ uint check_ulonglong(const char *str, uint length) 1 Out of memory */ -static bool append_escaped(String *to_str, String *from_str) +bool append_escaped(String *to_str, String *from_str) { char *from, *end, c; @@ -1086,3 +1087,38 @@ static bool append_escaped(String *to_str, String *from_str) } return 0; } + +bool append_escaped(String *to_str, char *from, uint from_len) +{ + char *end, c; + + if (to_str->realloc(to_str->length() + from_len)) + return 1; + + end= from + from_len; + + 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; +} |