Commit 6786c93b authored by unknown's avatar unknown

Merge with 4.1 to get latest fix to client_test.c


mysql-test/r/func_str.result:
  Merge with 4.1
mysys/default.c:
  Merge with 4.1
sql/item_strfunc.cc:
  Merge with 4.1
tests/client_test.c:
  Merge with 4.1
parents 7c6738fb c77cb0a3
This diff is collapsed.
......@@ -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 length(unhex(md5("abrakadabra")));
#
# Bug #6564: QUOTE(NULL
#
select concat('a', quote(NULL));
#
# Wrong usage of functions
#
......
......@@ -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
RETURN VALUES
NOTE
QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes).
RETURN VALUES
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))
......@@ -2601,7 +2604,12 @@ String *Item_func_quote::val_str(String *str)
String *arg= args[0]->val_str(str);
uint arg_length, new_length;
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();
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)),
return 0;
}
static void get_options(int argc, char **argv)
static void get_options(int *argc, char ***argv)
{
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)))
exit(ho_error);
......@@ -12177,7 +12177,7 @@ int main(int argc, char **argv)
load_defaults("my", client_test_load_default_groups, &argc, &argv);
defaults_argv= argv;
get_options(argc, argv);
get_options(&argc, &argv);
client_connect(); /* connect to server */
......@@ -12187,30 +12187,28 @@ int main(int argc, char **argv)
/* Start of tests */
test_count= 1;
start_time= time((time_t *)0);
int i, name_ok;
if (!argv[1])
if (!argc)
{
for (fptr= my_tests; fptr->name; fptr++)
(*fptr->function)();
}
else
{
for (i= 1; argv[i]; i++)
for ( ; *argv ; argv++)
{
name_ok= 0;
for (fptr= my_tests; fptr->name; fptr++)
{
if (!strcmp(fptr->name, argv[i]))
if (!strcmp(fptr->name, *argv))
{
name_ok= 1;
(*fptr->function)();
break;
}
}
if (!name_ok)
if (!fptr->name)
{
printf("\n\nGiven test not found: '%s'\n", argv[i]);
printf("See legal test names with %s -T\n\nAborting!\n",
my_progname);
fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
my_progname);
client_disconnect();
free_defaults(defaults_argv);
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