Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  sin.intern.azundris.com:/home/tnurnberg/30444/51-30444
This commit is contained in:
tnurnberg@sin.intern.azundris.com 2007-10-04 19:06:27 +02:00
commit 8402823d41
14 changed files with 115 additions and 9 deletions

View File

@ -51,6 +51,15 @@ SELECT c1 as want1result from t1 where c1 like 'locatio%';
SELECT c1 as want1result from t1 where c1 like 'location%'; SELECT c1 as want1result from t1 where c1 like 'location%';
DROP TABLE t1; DROP TABLE t1;
#
# Bug #31070: crash during conversion of charsets
#
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
select a sounds like a from t1;
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
# Restore settings # Restore settings
USE test; USE test;

View File

@ -52,6 +52,19 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,19 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,19 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,19 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -2587,6 +2587,19 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -286,6 +286,8 @@ select * from information_schema.session_variables where variable_name like 'net
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024 NET_BUFFER_LENGTH 1024
set net_buffer_length=2000000000; set net_buffer_length=2000000000;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '2000000000'
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1048576 net_buffer_length 1048576

View File

@ -161,6 +161,7 @@ select * from information_schema.session_variables where variable_name like 'net
set net_buffer_length=1; set net_buffer_length=1;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.session_variables where variable_name like 'net_buffer_length';
--warning 1292
set net_buffer_length=2000000000; set net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.session_variables where variable_name like 'net_buffer_length';

View File

@ -19,6 +19,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <errno.h>
static void default_reporter(enum loglevel level, const char *format, ...); static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter; my_error_reporter my_getopt_error_reporter= &default_reporter;
@ -730,7 +731,15 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
longlong num; longlong num;
*error= 0; *error= 0;
errno= 0;
num= strtoll(argument, &endchar, 10); num= strtoll(argument, &endchar, 10);
if (errno == ERANGE)
{
my_getopt_error_reporter(ERROR_LEVEL,
"Incorrect integer value: '%s'", argument);
*error= 1;
return 0;
}
if (*endchar == 'k' || *endchar == 'K') if (*endchar == 'k' || *endchar == 'K')
num*= 1024L; num*= 1024L;
else if (*endchar == 'm' || *endchar == 'M') else if (*endchar == 'm' || *endchar == 'M')
@ -767,7 +776,14 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err)
num= eval_num_suffix(arg, err, (char*) optp->name); num= eval_num_suffix(arg, err, (char*) optp->name);
if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value && if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value &&
optp->max_value) /* if max value is not set -> no upper limit */ optp->max_value) /* if max value is not set -> no upper limit */
{
char buf[22];
my_getopt_error_reporter(WARNING_LEVEL,
"Truncated incorrect %s value: '%s'",
optp->name, llstr(num, buf));
num= (ulonglong) optp->max_value; num= (ulonglong) optp->max_value;
}
num= ((num - optp->sub_size) / block_size); num= ((num - optp->sub_size) / block_size);
num= (longlong) (num * block_size); num= (longlong) (num * block_size);
return max(num, optp->min_value); return max(num, optp->min_value);

View File

@ -1188,16 +1188,31 @@ bool sys_var_thd_ulong::check(THD *thd, set_var *var)
bool sys_var_thd_ulong::update(THD *thd, set_var *var) bool sys_var_thd_ulong::update(THD *thd, set_var *var)
{ {
ulonglong tmp= var->save_result.ulonglong_value; ulonglong tmp= var->save_result.ulonglong_value;
char buf[22];
bool truncated= false;
/* Don't use bigger value than given with --maximum-variable-name=.. */ /* Don't use bigger value than given with --maximum-variable-name=.. */
if ((ulong) tmp > max_system_variables.*offset) if ((ulong) tmp > max_system_variables.*offset)
{
truncated= true;
llstr(tmp, buf);
tmp= max_system_variables.*offset; tmp= max_system_variables.*offset;
}
#if SIZEOF_LONG == 4 #if SIZEOF_LONG == 4
/* Avoid overflows on 32 bit systems */ /* Avoid overflows on 32 bit systems */
if (tmp > (ulonglong) ~(ulong) 0) if (tmp > (ulonglong) ~(ulong) 0)
{
truncated= true;
llstr(tmp, buf);
tmp= ((ulonglong) ~(ulong) 0); tmp= ((ulonglong) ~(ulong) 0);
}
#endif #endif
if (truncated)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), name,
buf);
if (option_limits) if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);

View File

@ -6272,12 +6272,12 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc,const uchar *s,const uchar *e) my_wc_t *pwc,const uchar *s,const uchar *e)
{ {
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -8614,12 +8614,12 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e) my_wc_t *pwc, const uchar *s, const uchar *e)
{ {
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -5664,12 +5664,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){ my_wc_t *pwc, const uchar *s, const uchar *e){
int hi; int hi;
hi=(int) s[0];
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -4527,12 +4527,12 @@ mb:
static int static int
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){ my_wc_t *pwc, const uchar *s, const uchar *e){
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi < 0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;