summaryrefslogtreecommitdiff
path: root/sql/sql_analyse.cc
diff options
context:
space:
mode:
authorunknown <patg@pc248.lfp.kcls.org>2005-01-20 18:36:40 -0800
committerunknown <patg@pc248.lfp.kcls.org>2005-01-20 18:36:40 -0800
commit66b62e051930dbcd9dc1d38f0cac574692932834 (patch)
treedeb5a7cc7ebc3ade7e8c5fd0d1105f928f2f133a /sql/sql_analyse.cc
parent9aaa87e909484a9c12b2a5e8913da45f8b7d0e9d (diff)
downloadmariadb-git-66b62e051930dbcd9dc1d38f0cac574692932834.tar.gz
-Added quote_data and needs_quotes (moved from federated handler.
-New tests and results logging_ok: Logging to logging@openlogging.org accepted ha_federated.h: removed quote_data and type_quote (now in the Field class) ha_federated.cc: moved quote_data and type_quote to field class field.h: new methods quote_data and needs_quotes declared field.cc: new field class methods quote_data and needs_quotes (per Monty's request) federated.test: more tests, joins, index tests have_federated_db.require: new name of federated system var federated.result: new test results for federated handler have_federated_db.inc: changed name of variable in test due to change in vars sql_analyse.cc: over-ridden append_escaped to take (String *, char *, uint) per requirements of 'create_where_from_key' method in federated handler. mysql_priv.h: define over-ridden append_escaped to take arguments from 'create_where_from_key' method in federated handler ha_federated.cc: implemented "create_where_from_key" to deal properly with two-byte prefix and multi keys. Initial testing shows it works, but I still need to move quoting to field class and also look at changes per Segei's suggestions. sql/mysql_priv.h: define over-ridden append_escaped to take arguments from 'create_where_from_key' method in federated handler sql/sql_analyse.cc: over-ridden append_escaped to take (String *, char *, uint) per requirements of 'create_where_from_key' method in federated handler. mysql-test/include/have_federated_db.inc: changed name of variable in test due to change in vars mysql-test/r/federated.result: new test results for federated handler mysql-test/r/have_federated_db.require: new name of federated system var mysql-test/t/federated.test: more tests, joins, index tests sql/field.cc: new field class methods quote_data and needs_quotes (per Monty's request) sql/field.h: new methods quote_data and needs_quotes declared sql/ha_federated.cc: moved quote_data and type_quote to field class sql/ha_federated.h: removed quote_data and type_quote (now in the Field class) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r--sql/sql_analyse.cc40
1 files changed, 38 insertions, 2 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 6a9a9e51231..8a74d9709dd 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,
@@ -1047,7 +1048,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;
@@ -1081,3 +1082,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;
+}