Commit 20b6f563 authored by Horst Hunger's avatar Horst Hunger

Due to merges.

parents e886b712 ac1ca6b9
......@@ -2407,4 +2407,13 @@ int i_am_a_dummy_function() {
return 0;
}
#ifdef __WIN__
char _db_doprnt_;
char _db_enter_;
char _db_pargs_;
char _db_process_;
char _db_push_;
char _db_return_;
#endif /*__WIN__*/
#endif
......@@ -265,7 +265,7 @@ int CertManager::Validate()
TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
int err = cert.GetError().What();
if ( err && err != TaoCrypt::SIG_OTHER_E)
if ( err )
return err;
uint sz = cert.GetPublicKey().size();
......
......@@ -108,6 +108,22 @@ extern FILE *_db_fp_(void);
#define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A)
#ifdef __WIN__
/*
On windows all the dll export has to be declared in the *.def file
so as we export these symbols in DEBUG mode we have to export
these in the RELEASE mode also. So below are the dummy symbols
for the RELEASE export
*/
extern char _db_doprnt_;
extern char _db_enter_;
extern char _db_pargs_;
extern char _db_process_;
extern char _db_push_;
extern char _db_return_;
#endif /*__WIN__*/
#endif
#ifdef __cplusplus
}
......
......@@ -18,11 +18,6 @@
#ifndef _global_h
#define _global_h
#ifndef EMBEDDED_LIBRARY
#define HAVE_REPLICATION
#define HAVE_EXTERNAL_CLIENT
#endif
/*
InnoDB depends on some MySQL internals which other plugins should not
need. This is because of InnoDB's foreign key support, "safe" binlog
......@@ -101,6 +96,11 @@
#endif
#endif /* !EMBEDDED_LIBRARY */
#ifndef EMBEDDED_LIBRARY
#define HAVE_REPLICATION
#define HAVE_EXTERNAL_CLIENT
#endif
/* Some defines to avoid ifdefs in the code */
#ifndef NETWARE_YIELD
#define NETWARE_YIELD
......
......@@ -29,13 +29,13 @@ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
TARGET_LINK_LIBRARIES(mysql_embedded wsock32)
ADD_DEPENDENCIES(mysql_embedded libmysqld)
ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
TARGET_LINK_LIBRARIES(mysqltest_embedded wsock32)
ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug mysys yassl taocrypt zlib strings wsock32)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded wsock32)
ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)
......@@ -2,6 +2,66 @@ LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 5.1 Embedded Server Library'
VERSION 5.1
EXPORTS
_db_process_
_db_enter_
_db_return_
_db_push_
_db_doprnt_
_db_pargs_
strnmov
get_charset
my_memmem
my_snprintf
pthread_exit
pthread_cond_signal
dynstr_append_mem
init_dynamic_string
dynstr_free
my_hash_free
my_vsnprintf
dynstr_append
my_close
my_open
dynstr_set
dynstr_append_os_quoted
my_delete
my_seek
my_write
create_temp_file
fn_format
dirname_part
my_hash_insert
my_hash_search
test_if_hard_path
my_copy
my_mkdir
my_sleep
my_strtod
pthread_cond_wait
my_strnncoll_simple
get_dynamic
my_regerror
init_dynamic_array2
pthread_create
pthread_cond_init
my_regcomp
my_regexec
my_regex_end
my_regfree
longlong2str
my_set_exception_pointers
my_print_stacktrace
my_thread_stack_size
my_safe_print_str
my_stat
_my_hash_init
pthread_attr_setstacksize
pthread_attr_init
my_dirend
wild_compare
my_dir
my_micro_time
find_type_or_exit
_dig_vec_upper
_dig_vec_lower
bmove_upp
......
......@@ -1848,3 +1848,35 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF'
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
70001 1085
70002 1065
ALTER TABLE t1 ADD UNIQUE (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP INDEX b ON t1;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
ALTER TABLE t1 ADD INDEX (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP TABLE t1;
End of 5.0 tests
......@@ -68,7 +68,7 @@ Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
set @@max_allowed_packet=1048576*100;
set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
......
......@@ -2,10 +2,7 @@ SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value;
@start_global_value
1048576
SET @start_session_value = @@session.max_allowed_packet;
SELECT @start_session_value;
@start_session_value
1048576
SET @@global.max_allowed_packet = DEFAULT;
'#--------------------FN_DYNVARS_070_01-------------------------#'
SET @@global.max_allowed_packet = 1000;
Warnings:
......@@ -15,7 +12,9 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1048576
SET @@session.max_allowed_packet = 20000;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SET @@session.max_allowed_packet = DEFAULT;
ERROR 42000: Variable 'max_allowed_packet' doesn't have a default value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1048576
......@@ -24,10 +23,6 @@ SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576;
@@global.max_allowed_packet = 1048576
1
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet = 1048576;
@@session.max_allowed_packet = 1048576
1
'#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024;
SELECT @@global.max_allowed_packet;
......@@ -48,25 +43,30 @@ SELECT @@global.max_allowed_packet;
1073740800
'#--------------------FN_DYNVARS_070_04-------------------------#'
SET @@session.max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.max_allowed_packet = 1025;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.max_allowed_packet = 65535;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
64512
1048576
SET @@session.max_allowed_packet = 1073741824;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1073741824
1048576
SET @@session.max_allowed_packet = 1073741823;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1073740800
1048576
'#------------------FN_DYNVARS_070_05-----------------------#'
SET @@global.max_allowed_packet = 0;
Warnings:
......@@ -103,37 +103,33 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1073741824
SET @@session.max_allowed_packet = 0;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.max_allowed_packet = 1023;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1023'
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.max_allowed_packet = -2;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.max_allowed_packet = 65530.34.;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
SET @@session.max_allowed_packet = 10737418241;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '10737418241'
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1073741824
1048576
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.max_allowed_packet = test;
ERROR 42000: Incorrect argument type to variable 'max_allowed_packet'
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1073741824
1048576
'#------------------FN_DYNVARS_070_06-----------------------#'
SELECT @@global.max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -166,6 +162,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
0
'#---------------------FN_DYNVARS_070_10----------------------#'
SET @@max_allowed_packet = 100000;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet = @@local.max_allowed_packet;
@@max_allowed_packet = @@local.max_allowed_packet
1
......@@ -174,9 +171,10 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
1
'#---------------------FN_DYNVARS_070_11----------------------#'
SET max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet;
@@max_allowed_packet
1024
1048576
SELECT local.max_allowed_packet;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.max_allowed_packet;
......@@ -187,7 +185,6 @@ SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1048576
SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1048576
......@@ -10,24 +10,15 @@ name BLOB
'#--------------------FN_DYNVARS_070_01-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@session.max_allowed_packet = 1024;
SET @@session.net_buffer_length = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1024
1048576
SET @@session.net_buffer_length = 1024;
ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
## Inserting and fetching data of length greater than 1024 ##
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
len
1470
## Verifying record in table t1 ##
SELECT * from t1;
id name
1 aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
'Bug#35381: Error is not coming on inserting and fetching data of length'
'greater than max_allowed_packet size at session level';
16384
'#--------------------FN_DYNVARS_070_02-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024;
......
SET @start_global_value = @@global.net_buffer_length;
SET @start_session_value = @@session.net_buffer_length;
SET @@global.net_buffer_length = DEFAULT;
'#--------------------FN_DYNVARS_109_01-------------------------#'
SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT;
......@@ -7,7 +7,9 @@ SELECT @@global.net_buffer_length;
@@global.net_buffer_length
16384
SET @@session.net_buffer_length = 20000;
ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SET @@session.net_buffer_length = DEFAULT;
ERROR 42000: Variable 'net_buffer_length' doesn't have a default value
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
16384
......@@ -16,10 +18,6 @@ SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384;
@@global.net_buffer_length = 16384
1
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length = 16384;
@@session.net_buffer_length = 16384
1
'#--------------------FN_DYNVARS_109_03-------------------------#'
SET @@global.net_buffer_length = 1024;
SELECT @@global.net_buffer_length;
......@@ -43,27 +41,6 @@ SELECT @@global.net_buffer_length;
64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#--------------------FN_DYNVARS_109_04-------------------------#'
SET @@session.net_buffer_length = 1024;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1025;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1048576;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 1048575;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1047552
SET @@session.net_buffer_length = 65535;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#------------------FN_DYNVARS_109_05-----------------------#'
SET @@global.net_buffer_length = 0;
Warnings:
......@@ -105,42 +82,12 @@ ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@global.net_buffer_length;
@@global.net_buffer_length
1048576
SET @@session.net_buffer_length = 0;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '0'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = -2;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '0'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1048577;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1048577'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 1048576002;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1048576002'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 65530.34.;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
SET @@session.net_buffer_length = 65550;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
65536
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.net_buffer_length = test;
ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
65536
16384
'#------------------FN_DYNVARS_109_06-----------------------#'
SELECT @@global.net_buffer_length = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -172,18 +119,10 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
@@net_buffer_length = @@global.net_buffer_length
0
'#---------------------FN_DYNVARS_109_10----------------------#'
SET @@net_buffer_length = 100000;
SELECT @@net_buffer_length = @@local.net_buffer_length;
@@net_buffer_length = @@local.net_buffer_length
1
SELECT @@local.net_buffer_length = @@session.net_buffer_length;
@@local.net_buffer_length = @@session.net_buffer_length
1
'#---------------------FN_DYNVARS_109_11----------------------#'
SET net_buffer_length = 1024;
SELECT @@net_buffer_length;
@@net_buffer_length
1024
16384
SELECT local.net_buffer_length;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.net_buffer_length;
......@@ -191,4 +130,3 @@ ERROR 42S02: Unknown table 'session' in field list
SELECT net_buffer_length = @@session.net_buffer_length;
ERROR 42S22: Unknown column 'net_buffer_length' in 'field list'
SET @@global.net_buffer_length = @start_global_value;
SET @@session.net_buffer_length = @start_session_value;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
select repeat('a',2000);
repeat('a',2000)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
......
......@@ -1343,10 +1343,10 @@ t3 CREATE TABLE `t3` (
`left(a,100000000)` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
SELECT @tmp_max:= @@max_allowed_packet;
@tmp_max:= @@max_allowed_packet
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
SET max_allowed_packet=25000000;
SET @@global.max_allowed_packet=25000000;
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
......@@ -1384,7 +1384,7 @@ t3 CREATE TABLE `t3` (
`a` varbinary(510) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t2,t3;
SET max_allowed_packet:= @tmp_max;
SET @@global.max_allowed_packet:= @tmp_max;
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1;
......
......@@ -228,7 +228,6 @@ VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
Variable_name Value
net_buffer_length 1024
......@@ -243,57 +242,45 @@ NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 200
show session variables like 'net_%';
Variable_name Value
net_buffer_length 2048
net_read_timeout 600
net_buffer_length 16384
net_read_timeout 30
net_retry_count 10
net_write_timeout 500
net_write_timeout 60
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 2048
NET_READ_TIMEOUT 600
NET_BUFFER_LENGTH 16384
NET_READ_TIMEOUT 30
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
NET_WRITE_TIMEOUT 60
set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
Variable_name Value
net_buffer_length 1024
net_buffer_length 7168
net_read_timeout 900
net_retry_count 10
net_write_timeout 1000
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 900
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 1000
show session variables like 'net_%';
Variable_name Value
net_buffer_length 7168
net_read_timeout 600
net_retry_count 10
net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 600
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set net_buffer_length=1;
set global net_buffer_length=1;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1'
show variables like 'net_buffer_length';
show global variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1024
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
set net_buffer_length=2000000000;
set global net_buffer_length=2000000000;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '2000000000'
show variables like 'net_buffer_length';
show global variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1048576
set character set cp1251_koi8;
......@@ -461,7 +448,7 @@ select @@long_query_time;
@@long_query_time
100.000001
set low_priority_updates=1;
set max_allowed_packet=100;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global max_binlog_cache_size=100;
......@@ -485,7 +472,7 @@ select @@max_user_connections;
100
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
set net_buffer_length=100;
set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_read_timeout=100;
......
......@@ -1439,3 +1439,20 @@ select hex(_utf8 X'616263FF');
select hex(_utf8 B'001111111111');
--error ER_INVALID_CHARACTER_STRING
select (_utf8 X'616263FF');
#
# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
#
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
ALTER TABLE t1 ADD UNIQUE (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
DROP INDEX b ON t1;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
ALTER TABLE t1 ADD INDEX (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
DROP TABLE t1;
--echo End of 5.0 tests
......@@ -43,8 +43,11 @@ drop table t1;
# note that when LOW_MEMORY is set the "test" below is meaningless
#
set @@max_allowed_packet=1048576*100;
set @@global.max_allowed_packet=1048576*100;
--replace_result "''" XXX "'1'" XXX
# reconnect to make the new max packet size take effect
--connect (newconn, localhost, root,,)
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
#
......
......@@ -8,7 +8,9 @@
-- disable_query_log
-- disable_result_log
SET @@max_allowed_packet=16777216;
# set packet size and reconnect
SET @@global.max_allowed_packet=16777216;
--connect (newconn, localhost, root,,)
DROP TABLE IF EXISTS bug34300;
CREATE TABLE bug34300 (
......
......@@ -36,8 +36,13 @@
SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value;
SET @start_session_value = @@session.max_allowed_packet;
SELECT @start_session_value;
# give a known value to @@session.max_allowed_packet by assigning to
# @@global and setting up a new connection (for deterministic result
# file diffing)
SET @@global.max_allowed_packet = DEFAULT;
connect (conn1, localhost, root,,);
--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
......@@ -49,7 +54,9 @@ SET @@global.max_allowed_packet = 1000;
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 20000;
--Error ER_NO_DEFAULT
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet;
......@@ -62,9 +69,6 @@ SELECT @@session.max_allowed_packet;
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576;
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet = 1048576;
--echo '#--------------------FN_DYNVARS_070_03-------------------------#'
############################################################################
......@@ -86,14 +90,19 @@ SELECT @@global.max_allowed_packet;
# Change the value of max_allowed_packet to a valid value for SESSION Scope #
#############################################################################
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1025;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 65535;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741824;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741823;
SELECT @@session.max_allowed_packet;
......@@ -118,14 +127,18 @@ SELECT @@global.max_allowed_packet;
SET @@global.max_allowed_packet = test;
SELECT @@global.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 0;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1023;
SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = -2;
SELECT @@session.max_allowed_packet;
--Error ER_PARSE_ERROR
SET @@session.max_allowed_packet = 65530.34.;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 10737418241;
SELECT @@session.max_allowed_packet;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
......@@ -180,6 +193,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
########################################################################################################
--Error ER_VARIABLE_IS_READONLY
SET @@max_allowed_packet = 100000;
SELECT @@max_allowed_packet = @@local.max_allowed_packet;
SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
......@@ -190,6 +204,7 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
# Check if max_allowed_packet can be accessed with and without @@ sign #
#############################################################################
--Error ER_VARIABLE_IS_READONLY
SET max_allowed_packet = 1024;
SELECT @@max_allowed_packet;
--Error ER_UNKNOWN_TABLE
......@@ -204,9 +219,9 @@ SELECT max_allowed_packet = @@session.max_allowed_packet;
# Restore initial value #
####################################
connection default;
SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet;
SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet;
......
......@@ -43,26 +43,19 @@ name BLOB
--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
###############################################################################
# Setting initial value of max_allowed_packet to 1024 at session level and
# verifying its behavior after inserting data greater than 1024 bytes
# Setting initial value of max_allowed_packet to 1024 at session level
# should result in an error (session variable is readonly)
###############################################################################
--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
--error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024;
SET @@session.net_buffer_length = 1024;
SELECT @@session.max_allowed_packet;
SELECT @@session.net_buffer_length;
--echo ## Inserting and fetching data of length greater than 1024 ##
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
--echo ## Verifying record in table t1 ##
SELECT * from t1;
--error ER_VARIABLE_IS_READONLY
SET @@session.net_buffer_length = 1024;
SELECT @@session.net_buffer_length;
--echo 'Bug#35381: Error is not coming on inserting and fetching data of length'
--echo 'greater than max_allowed_packet size at session level';
--echo '#--------------------FN_DYNVARS_070_02-------------------------#'
###############################################################################
......
......@@ -38,9 +38,13 @@
SET @start_global_value = @@global.net_buffer_length;
# Due to differences in results of linux and windows
#SELECT @start_global_value;
SET @start_session_value = @@session.net_buffer_length;
#SELECT @start_session_value;
# give a known value to @@session.net_buffer_length by assigning to
# @@global and setting up a new connection (for deterministic result
# file diffing)
SET @@global.net_buffer_length = DEFAULT;
connect(con1,localhost,root,,);
connection con1;
--echo '#--------------------FN_DYNVARS_109_01-------------------------#'
#################################################################
......@@ -51,7 +55,9 @@ SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length;
--Error ER_VARIABLE_IS_READONLY
SET @@session.net_buffer_length = 20000;
--Error ER_NO_DEFAULT
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length;
......@@ -64,9 +70,6 @@ SELECT @@session.net_buffer_length;
SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384;
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length = 16384;
--echo '#--------------------FN_DYNVARS_109_03-------------------------#'
###########################################################################
......@@ -91,17 +94,7 @@ SELECT @@global.net_buffer_length;
# Change the value of net_buffer_length to a valid value for SESSION Scope #
############################################################################
SET @@session.net_buffer_length = 1024;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1025;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048576;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048575;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 65535;
SELECT @@session.net_buffer_length;
--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
--echo '#------------------FN_DYNVARS_109_05-----------------------#'
......@@ -126,18 +119,8 @@ SELECT @@global.net_buffer_length;
SET @@global.net_buffer_length = test;
SELECT @@global.net_buffer_length;
SET @@session.net_buffer_length = 0;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = -2;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048577;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048576002;
SELECT @@session.net_buffer_length;
--Error ER_PARSE_ERROR
SET @@session.net_buffer_length = 65530.34.;
SET @@session.net_buffer_length = 65550;
SELECT @@session.net_buffer_length;
# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
--Error ER_WRONG_TYPE_FOR_VAR
......@@ -190,9 +173,7 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
########################################################################################################
SET @@net_buffer_length = 100000;
SELECT @@net_buffer_length = @@local.net_buffer_length;
SELECT @@local.net_buffer_length = @@session.net_buffer_length;
# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
--echo '#---------------------FN_DYNVARS_109_11----------------------#'
......@@ -200,7 +181,7 @@ SELECT @@local.net_buffer_length = @@session.net_buffer_length;
# Check if net_buffer_length can be accessed with and without @@ sign #
############################################################################
SET net_buffer_length = 1024;
# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@net_buffer_length;
--Error ER_UNKNOWN_TABLE
SELECT local.net_buffer_length;
......@@ -214,11 +195,11 @@ SELECT net_buffer_length = @@session.net_buffer_length;
# Restore initial value #
####################################
connection default;
SET @@global.net_buffer_length = @start_global_value;
# Due to differences in results of linux and windows
#SELECT @@global.net_buffer_length;
SET @@session.net_buffer_length = @start_session_value;
#SELECT @@session.net_buffer_length;
######################################################
......
......@@ -8,30 +8,30 @@
# Check protocol handling
#
connect (con1,localhost,root,,);
connection con1;
# setting values below minimum threshold of 1024 will cause truncating
set global max_allowed_packet=100;
set max_allowed_packet=100;
set global net_buffer_length=100;
set net_buffer_length=100;
# Have to be > 1024 as min value of net_buffer_length is 1024
# is not yet in effect
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000);
#
# Connection 2 should get error for too big packets
# Connection 1 should get error for too big packets
#
connect (con2,localhost,root,,);
connection con2;
connect (con1,localhost,root,,);
connection con1;
select @@net_buffer_length, @@max_allowed_packet;
--error 1153
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
#
# Reset to default values and reconnect
#
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
connect (con2,localhost,root,,);
connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
......
......@@ -861,8 +861,10 @@ drop tables t1,t2,t3;
# exceeds mediumtext maximum length
#
SELECT @tmp_max:= @@max_allowed_packet;
SET max_allowed_packet=25000000;
SELECT @tmp_max:= @@global.max_allowed_packet;
SET @@global.max_allowed_packet=25000000;
# switching connection to allow the new max_allowed_packet take effect
--connect (newconn, localhost, root,,)
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
......@@ -884,7 +886,9 @@ INSERT INTO t1 VALUES ('a');
CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3;
DROP TABLES t1,t2,t3;
SET max_allowed_packet:= @tmp_max;
--connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
#
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
......
......@@ -146,25 +146,23 @@ show global variables like 'myisam_max_sort_file_size';
--replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
# bug#22891: modified to take read-only SESSION net_buffer_length into account
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
set net_buffer_length=1;
show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set global net_buffer_length=1;
show global variables like 'net_buffer_length';
select * from information_schema.global_variables where variable_name like 'net_buffer_length';
#warning 1292
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set global net_buffer_length=2000000000;
show global variables like 'net_buffer_length';
select * from information_schema.global_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8;
show variables like "character_set_client";
......@@ -274,7 +272,7 @@ select @@long_query_time;
set long_query_time=100.000001;
select @@long_query_time;
set low_priority_updates=1;
set max_allowed_packet=100;
set global max_allowed_packet=100;
set global max_binlog_cache_size=100;
set global max_binlog_size=100;
set global max_connect_errors=100;
......@@ -288,7 +286,7 @@ set global max_user_connections=100;
select @@max_user_connections;
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
set net_buffer_length=100;
set global net_buffer_length=100;
set net_read_timeout=100;
set net_write_timeout=100;
set global query_cache_limit=100;
......
......@@ -85,6 +85,8 @@ char *my_tmpdir(MY_TMPDIR *tmpdir)
void free_tmpdir(MY_TMPDIR *tmpdir)
{
uint i;
if (!tmpdir->full_list.elements)
return;
for (i=0; i<=tmpdir->max; i++)
my_free(tmpdir->list[i], MYF(0));
delete_dynamic(&tmpdir->full_list);
......
......@@ -397,9 +397,10 @@ invalid value '%s'",
my_progname, optp->name, optend);
continue;
}
get_one_option(optp->id, optp,
*((my_bool*) value) ?
(char*) "1" : disabled_my_option);
if (get_one_option(optp->id, optp,
*((my_bool*) value) ?
(char*) "1" : disabled_my_option))
return EXIT_ARGUMENT_INVALID;
continue;
}
argument= optend;
......@@ -457,7 +458,8 @@ invalid value '%s'",
optp->arg_type == NO_ARG)
{
*((my_bool*) optp->value)= (my_bool) 1;
get_one_option(optp->id, optp, argument);
if (get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
continue;
}
else if (optp->arg_type == REQUIRED_ARG ||
......@@ -476,7 +478,8 @@ invalid value '%s'",
{
if (optp->var_type == GET_BOOL)
*((my_bool*) optp->value)= (my_bool) 1;
get_one_option(optp->id, optp, argument);
if (get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
continue;
}
/* Check if there are more arguments after this one */
......@@ -501,7 +504,8 @@ invalid value '%s'",
my_progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
if (get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
break;
}
}
......@@ -524,7 +528,8 @@ invalid value '%s'",
my_progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
if (get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
(*argc)--; /* option handled (short or long), decrease argument count */
}
......
......@@ -3627,7 +3627,7 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache)
if (!key_cache->key_cache_inited)
{
pthread_mutex_lock(&LOCK_global_system_variables);
ulong tmp_buff_size= (ulong) key_cache->param_buff_size;
size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
uint tmp_block_size= (uint) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold;
......@@ -3651,7 +3651,7 @@ int ha_resize_key_cache(KEY_CACHE *key_cache)
if (key_cache->key_cache_inited)
{
pthread_mutex_lock(&LOCK_global_system_variables);
long tmp_buff_size= (long) key_cache->param_buff_size;
size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
long tmp_block_size= (long) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold;
......
......@@ -3810,11 +3810,14 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists)
{
if (thd == entry_thd && entry)
if (entry && thd->thread_id == entry_thread_id)
goto end; // update entry->update_query_id for PS
entry_thd= thd;
if (!(entry= get_variable(&thd->user_vars, name, create_if_not_exists)))
{
entry_thread_id= 0;
return TRUE;
}
entry_thread_id= thd->thread_id;
/*
Remember the last query which updated it, this way a query can later know
if this variable is a constant item in the query (it is if update_query_id
......
......@@ -1295,16 +1295,16 @@ class Item_func_set_user_var :public Item_func
enum Item_result cached_result_type;
user_var_entry *entry;
/*
The entry_thd variable is used:
The entry_thread_id variable is used:
1) to skip unnecessary updates of the entry field (see above);
2) to reset the entry field that was initialized in the other thread
(for example, an item tree of a trigger that updates user variables
may be shared between several connections, and the entry_thd field
may be shared between several connections, and the entry_thread_id field
prevents updates of one connection user variables from a concurrent
connection calling the same trigger that initially updated some
user variable it the first connection context).
*/
THD *entry_thd;
my_thread_id entry_thread_id;
char buffer[MAX_FIELD_WIDTH];
String value;
my_decimal decimal_buff;
......@@ -1321,7 +1321,7 @@ class Item_func_set_user_var :public Item_func
LEX_STRING name; // keep it public
Item_func_set_user_var(LEX_STRING a,Item *b)
:Item_func(b), cached_result_type(INT_RESULT),
entry(NULL), entry_thd(NULL), name(a)
entry(NULL), entry_thread_id(0), name(a)
{}
enum Functype functype() const { return SUSERVAR_FUNC; }
double val_real();
......
......@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec()
and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to
the argument's charset.
Note (TODO): we could use repertoire technique here.
*/
from_cs= (args[0]->result_type() == INT_RESULT ||
args[0]->result_type() == DECIMAL_RESULT ||
......@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec()
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
args[0]->collation.collation;
charset_conversion= (cast_cs->mbmaxlen > 1) ||
!my_charset_same(from_cs, cast_cs) &&
from_cs != &my_charset_bin &&
cast_cs != &my_charset_bin;
(!my_charset_same(from_cs, cast_cs) &&
from_cs != &my_charset_bin &&
cast_cs != &my_charset_bin);
collation.set(cast_cs, DERIVATION_IMPLICIT);
char_length= (cast_length >= 0) ? cast_length :
args[0]->max_length/from_cs->mbmaxlen;
char_length= (cast_length >= 0) ?
cast_length :
args[0]->max_length / args[0]->collation.collation->mbmaxlen;
max_length= char_length * cast_cs->mbmaxlen;
}
......
......@@ -733,7 +733,7 @@ uint connection_count= 0;
/* Function declarations */
pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static int mysql_init_variables(void);
static void get_options(int *argc,char **argv);
extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
static void set_server_version(void);
......@@ -3141,12 +3141,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
if (!rpl_filter || !binlog_filter)
{
sql_perror("Could not allocate replication and binlog filters");
exit(1);
return 1;
}
if (init_thread_environment())
if (init_thread_environment() ||
mysql_init_variables())
return 1;
mysql_init_variables();
#ifdef HAVE_TZNAME
{
......@@ -3745,7 +3745,10 @@ version 5.0 and above. It is replaced by the binary log.");
{
/* as opt_bin_log==0, no need to free opt_bin_logname */
if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
exit(EXIT_OUT_OF_MEMORY);
{
sql_print_error("Out of memory");
return EXIT_OUT_OF_MEMORY;
}
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin='%s' instead.",opt_bin_logname);
......@@ -7348,6 +7351,7 @@ SHOW_VAR status_vars[]= {
{NullS, NullS, SHOW_LONG}
};
#ifndef EMBEDDED_LIBRARY
static void print_version(void)
{
set_server_version();
......@@ -7359,7 +7363,6 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
}
#ifndef EMBEDDED_LIBRARY
static void usage(void)
{
if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
......@@ -7424,7 +7427,7 @@ To see what values a running MySQL server is using, type\n\
as these are initialized by my_getopt.
*/
static void mysql_init_variables(void)
static int mysql_init_variables(void)
{
/* Things reset to zero */
opt_skip_slave_start= opt_reckless_slave = 0;
......@@ -7505,7 +7508,10 @@ static void mysql_init_variables(void)
key_caches.empty();
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
default_key_cache_base.length)))
exit(1);
{
sql_print_error("Cannot allocate the keycache");
return 1;
}
/* set key_cache_hash.default_value = dflt_key_cache */
multi_keycache_init();
......@@ -7648,6 +7654,7 @@ static void mysql_init_variables(void)
tmpenv = DEFAULT_MYSQL_HOME;
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif
return 0;
}
......@@ -7708,9 +7715,11 @@ mysqld_get_one_option(int optid,
#endif
break;
#include <sslopt-case.h>
#ifndef EMBEDDED_LIBRARY
case 'V':
print_version();
exit(0);
#endif /*EMBEDDED_LIBRARY*/
case 'W':
if (!argument)
global_system_variables.log_warnings++;
......@@ -7939,14 +7948,14 @@ mysqld_get_one_option(int optid,
if (gethostname(myhostname,sizeof(myhostname)) < 0)
{
sql_perror("Can't start server: cannot get my own hostname!");
exit(1);
return 1;
}
ent=gethostbyname(myhostname);
}
if (!ent)
{
sql_perror("Can't start server: cannot resolve hostname!");
exit(1);
return 1;
}
my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr;
}
......@@ -8143,8 +8152,8 @@ mysqld_get_one_option(int optid,
case OPT_FT_BOOLEAN_SYNTAX:
if (ft_boolean_check_syntax_string((uchar*) argument))
{
fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument);
exit(1);
sql_print_error("Invalid ft-boolean-syntax string: %s\n", argument);
return 1;
}
strmake(ft_boolean_syntax, argument, sizeof(ft_boolean_syntax)-1);
break;
......
......@@ -296,7 +296,7 @@ static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_up
&SV::low_priority_updates,
fix_low_priority_updates);
#endif
static sys_var_thd_ulong sys_max_allowed_packet(&vars, "max_allowed_packet",
static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
&SV::max_allowed_packet);
static sys_var_long_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
&max_binlog_cache_size);
......@@ -369,7 +369,7 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&myisam_stats_method_typelib,
NULL);
static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length",
static sys_var_thd_ulong_session_readonly sys_net_buffer_length(&vars, "net_buffer_length",
&SV::net_buffer_length);
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
&SV::net_read_timeout,
......@@ -2734,6 +2734,18 @@ uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
}
bool sys_var_thd_ulong_session_readonly::check(THD *thd, set_var *var)
{
if (var->type != OPT_GLOBAL)
{
my_error(ER_VARIABLE_IS_READONLY, MYF(0), "SESSION", name, "GLOBAL");
return TRUE;
}
return sys_var_thd_ulong::check(thd, var);
}
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
{
MY_LOCALE *locale_match;
......
......@@ -1024,6 +1024,29 @@ class sys_var_max_user_conn : public sys_var_thd
};
/**
* @brief This is a specialization of sys_var_thd_ulong that implements a
read-only session variable. The class overrides check() and check_default()
to achieve the read-only property for the session part of the variable.
*/
class sys_var_thd_ulong_session_readonly : public sys_var_thd_ulong
{
public:
sys_var_thd_ulong_session_readonly(sys_var_chain *chain_arg,
const char *name_arg, ulong SV::*offset_arg,
sys_check_func c_func= NULL,
sys_after_update_func au_func= NULL,
Binlog_status_enum bl_status_arg= NOT_IN_BINLOG):
sys_var_thd_ulong(chain_arg, name_arg, offset_arg, c_func, au_func, bl_status_arg)
{ }
bool check(THD *thd, set_var *var);
bool check_default(enum_var_type type)
{
return type != OPT_GLOBAL || !option_limits;
}
};
class sys_var_microseconds :public sys_var_thd
{
ulonglong SV::*offset;
......
......@@ -6151,3 +6151,6 @@ WARN_PLUGIN_DELETE_BUILTIN
WARN_PLUGIN_BUSY
eng "Plugin is busy and will be uninstalled on shutdown"
ER_VARIABLE_IS_READONLY
eng "%s variable '%s' is read-only. Use SET %s to assign the value"
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