Commit 63da0750 authored by monty@mysql.com's avatar monty@mysql.com

Merge with 4.1 to get latest fix to client_test.c

parents e0f1e6af dc667223
This diff is collapsed.
...@@ -82,6 +82,12 @@ select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), un ...@@ -82,6 +82,12 @@ select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), un
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456")); select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
select length(unhex(md5("abrakadabra"))); select length(unhex(md5("abrakadabra")));
#
# Bug #6564: QUOTE(NULL
#
select concat('a', quote(NULL));
# #
# Wrong usage of functions # Wrong usage of functions
# #
......
...@@ -2574,9 +2574,12 @@ String* Item_func_inet_ntoa::val_str(String* str) ...@@ -2574,9 +2574,12 @@ String* Item_func_inet_ntoa::val_str(String* str)
This function is very useful when you want to generate SQL statements This function is very useful when you want to generate SQL statements
RETURN VALUES NOTE
QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes).
RETURN VALUES
str Quoted string str Quoted string
NULL Argument to QUOTE() was NULL or out of memory. NULL Out of memory.
*/ */
#define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7)) #define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
...@@ -2601,7 +2604,12 @@ String *Item_func_quote::val_str(String *str) ...@@ -2601,7 +2604,12 @@ String *Item_func_quote::val_str(String *str)
String *arg= args[0]->val_str(str); String *arg= args[0]->val_str(str);
uint arg_length, new_length; uint arg_length, new_length;
if (!arg) // Null argument if (!arg) // Null argument
goto null; {
str->copy("NULL", 4, collation.collation); // Return the string 'NULL'
null_value= 0;
return str;
}
arg_length= arg->length(); arg_length= arg->length();
new_length= arg_length+2; /* for beginning and ending ' signs */ new_length= arg_length+2; /* for beginning and ending ' signs */
......
...@@ -12130,11 +12130,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -12130,11 +12130,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0; return 0;
} }
static void get_options(int argc, char **argv) static void get_options(int *argc, char ***argv)
{ {
int ho_error; int ho_error;
if ((ho_error= handle_options(&argc, &argv, client_test_long_options, if ((ho_error= handle_options(argc, argv, client_test_long_options,
get_one_option))) get_one_option)))
exit(ho_error); exit(ho_error);
...@@ -12177,7 +12177,7 @@ int main(int argc, char **argv) ...@@ -12177,7 +12177,7 @@ int main(int argc, char **argv)
load_defaults("my", client_test_load_default_groups, &argc, &argv); load_defaults("my", client_test_load_default_groups, &argc, &argv);
defaults_argv= argv; defaults_argv= argv;
get_options(argc, argv); get_options(&argc, &argv);
client_connect(); /* connect to server */ client_connect(); /* connect to server */
...@@ -12187,30 +12187,28 @@ int main(int argc, char **argv) ...@@ -12187,30 +12187,28 @@ int main(int argc, char **argv)
/* Start of tests */ /* Start of tests */
test_count= 1; test_count= 1;
start_time= time((time_t *)0); start_time= time((time_t *)0);
int i, name_ok; if (!argc)
if (!argv[1])
{ {
for (fptr= my_tests; fptr->name; fptr++) for (fptr= my_tests; fptr->name; fptr++)
(*fptr->function)(); (*fptr->function)();
} }
else else
{ {
for (i= 1; argv[i]; i++) for ( ; *argv ; argv++)
{ {
name_ok= 0;
for (fptr= my_tests; fptr->name; fptr++) for (fptr= my_tests; fptr->name; fptr++)
{ {
if (!strcmp(fptr->name, argv[i])) if (!strcmp(fptr->name, *argv))
{ {
name_ok= 1;
(*fptr->function)(); (*fptr->function)();
break;
} }
} }
if (!name_ok) if (!fptr->name)
{ {
printf("\n\nGiven test not found: '%s'\n", argv[i]); fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
printf("See legal test names with %s -T\n\nAborting!\n", fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
my_progname); my_progname);
client_disconnect(); client_disconnect();
free_defaults(defaults_argv); free_defaults(defaults_argv);
exit(1); exit(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment