Commit ab7b3328 authored by unknown's avatar unknown

Task #627 : user variables' names are now case-insensitive :

@test=@"tEsT"=@`teST` etc. Tests updated.
Note that the patch to sql_class.cc does not use HASH_CASE_INSENSITIVE as did the one which I sent for review. This is because meanwhile HASH_CASE_INSENSITIVE has disappeared (since cset 1.1504.1.6).


mysql-test/r/variables.result:
  updated test
mysql-test/t/variables.test:
  updated test
sql/sql_class.cc:
  Task #627 : user variables' names are now case-insensitive :
  @test=@"tEsT"=@`teST` etc.
parent fb5df27a
drop table if exists t1,t2;
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
@test @`select` @TEST @not_used
1 2 3 NULL
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
1 1 1 1 1
set @TEST=2;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
2 2 2 2 2
set @"tEST"=3;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
3 3 3 3 3
set @`TeST`=4;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
4 4 4 4 4
select @`teST`:=5;
@`teST`:=5
5
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
5 5 5 5 5
set @select=2,@t5=1.23456;
select @`select`,@not_used;
@`select` @not_used
2 NULL
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
select @test_int,@test_double,@test_string,@test_string2,@select;
@test_int @test_double @test_string @test_string2 @select
......
......@@ -5,8 +5,20 @@
drop table if exists t1,t2;
--enable_warnings
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
# case insensitivity tests (new in 5.0)
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @TEST=2;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @"tEST"=3;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @`TeST`=4;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
select @`teST`:=5;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @select=2,@t5=1.23456;
select @`select`,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
select @test_int,@test_double,@test_string,@test_string2,@select;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
......
......@@ -151,9 +151,9 @@ THD::THD():user_time(0), is_fatal_error(0),
bzero((char*) &warn_root,sizeof(warn_root));
init_alloc_root(&warn_root, 1024, 0);
user_connect=(USER_CONN *)0;
hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0,
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
(hash_free_key) free_user_var,0);
(hash_free_key) free_user_var, 0);
/* For user vars replication*/
if (opt_bin_log)
......@@ -257,7 +257,7 @@ void THD::change_user(void)
cleanup();
cleanup_done= 0;
init();
hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0,
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
(hash_free_key) free_user_var, 0);
}
......
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