mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly
Fix that mysql.proc works with new VARCHAR fields Give warnings for wrong zero dates configure.in: Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly mysql-test/r/func_time.result: New warnings mysql-test/r/row.result: Moved code around to get things to work with --ps-protocol Note that one on warning disappered, but it should appear again when bug #9600 is fixed mysql-test/r/strict.result: enabled more tests Added more tests mysql-test/r/union.result: Test that UNION generates correct row format mysql-test/t/row.test: Moved test to get things to work with --ps-protocol mysql-test/t/strict.test: enabled more tests Added more tests mysql-test/t/union.test: Test that UNION generates correct row format sql/item.cc: Removed compiler warning Simple cleanup sql/sp.cc: Fix that mysql.proc works with new VARCHAR fields sql/time.cc: Give warnings for wrong zero dates tests/mysql_client_test.c: More startup information
This commit is contained in:
16
configure.in
16
configure.in
@ -351,11 +351,21 @@ then
|
||||
|
||||
if echo $CXX | grep gcc > /dev/null 2>&1
|
||||
then
|
||||
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
|
||||
then
|
||||
GCC_VERSION=`gcc -v 2>&1 | grep version | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'`
|
||||
echo "Using gcc version '$GCC_VERSION'"
|
||||
case "$GCC_VERSION" in
|
||||
3.4.*|3.5.*)
|
||||
# Statically link the language support function's found in libsupc++.a
|
||||
LIBS="$LIBS -lsupc++"
|
||||
fi
|
||||
echo "Using -libsupc++ for static linking with gcc"
|
||||
;;
|
||||
*)
|
||||
# Using -lsupc++ doesn't work in gcc 3.3 on SuSE 9.2
|
||||
# (causes link failures when linking things staticly)
|
||||
CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL"
|
||||
echo "Using MYSYS_NEW for static linking with gcc"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -304,6 +304,8 @@ NULL
|
||||
select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND);
|
||||
date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00 00:00:00'
|
||||
select date_add('1998-01-30',Interval 1 month);
|
||||
date_add('1998-01-30',Interval 1 month)
|
||||
1998-02-28
|
||||
@ -424,6 +426,9 @@ insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
|
||||
select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
|
||||
dayofyear("0000-00-00") dayofyear(d) dayofyear(dt) dayofyear(t) dayofyear(c)
|
||||
NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
|
||||
dayofmonth("0000-00-00") dayofmonth(d) dayofmonth(dt) dayofmonth(t) dayofmonth(c)
|
||||
0 0 0 0 0
|
||||
@ -436,15 +441,24 @@ quarter("0000-00-00") quarter(d) quarter(dt) quarter(t) quarter(c)
|
||||
select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1;
|
||||
week("0000-00-00") week(d) week(dt) week(t) week(c)
|
||||
NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
|
||||
year("0000-00-00") year(d) year(dt) year(t) year(c)
|
||||
0 0 0 0 0
|
||||
select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) from t1;
|
||||
yearweek("0000-00-00") yearweek(d) yearweek(dt) yearweek(t) yearweek(c)
|
||||
NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
|
||||
to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c)
|
||||
NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
|
||||
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
|
||||
0 0 0 0 0
|
||||
|
@ -17,16 +17,14 @@ row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
|
||||
Warnings:
|
||||
Error 1366 Incorrect decimal value: '' for column '' at row -1
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a'
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
|
||||
1
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a'
|
||||
row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3))
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a'
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
|
||||
1
|
||||
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
||||
row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3))
|
||||
1
|
||||
|
@ -259,17 +259,23 @@ INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
|
||||
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
|
||||
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
|
||||
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
|
||||
INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
|
||||
@ -280,17 +286,23 @@ INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
|
||||
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
|
||||
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
|
||||
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
|
||||
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
drop table t1;
|
||||
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
|
||||
@ -1116,6 +1128,10 @@ insert into t1 values (0,0,0);
|
||||
ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1
|
||||
insert into t1 values (0.0,0.0,0.0);
|
||||
ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1
|
||||
insert into t1 (col1) values (convert('0000-00-00',date));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
insert into t1 (col1) values (cast('0000-00-00' as date));
|
||||
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
|
||||
set sql_mode='no_zero_date';
|
||||
insert into t1 values (0,0,0);
|
||||
Warnings:
|
||||
@ -1138,6 +1154,9 @@ ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
|
||||
insert ignore into t1 values ('0000-00-00');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'col1' at row 1
|
||||
insert ignore into t1 (col1) values (cast('0000-00-00' as date));
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '0000-00-00'
|
||||
insert into t1 select * from t1;
|
||||
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
|
||||
alter table t1 modify col1 datetime;
|
||||
@ -1152,5 +1171,6 @@ select * from t1;
|
||||
col1
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
NULL
|
||||
drop table t1;
|
||||
set sql_mode=@org_mode;
|
||||
|
@ -1235,3 +1235,20 @@ show columns from t2;
|
||||
Field Type Null Key Default Extra
|
||||
a varchar(3) YES NULL
|
||||
drop table t2, t1;
|
||||
create table t1 (a varchar(5));
|
||||
create table t2 select * from t1 union select 'abcdefghijkl';
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` varchar(12) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select row_format from information_schema.TABLES where table_schema="test" and table_name="t2";
|
||||
row_format
|
||||
Dynamic
|
||||
alter table t2 ROW_FORMAT=fixed;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` varchar(12) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
|
||||
drop table t1,t2;
|
||||
|
@ -9,9 +9,9 @@ select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||
--disable_ps_warnings
|
||||
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
||||
--enable_ps_warnings
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
||||
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
||||
select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
||||
select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
|
||||
|
@ -284,8 +284,8 @@ INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
|
||||
|
||||
# deactivated because of Bug#6145
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
|
||||
|
||||
## Test INSERT with CAST AS DATETIME into DATETIME
|
||||
# All test cases expected to fail should return
|
||||
@ -308,10 +308,9 @@ INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col2) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
|
||||
|
||||
# deactivated because of Bug#6145
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
|
||||
## Test INSERT with CAST AS DATETIME into TIMESTAMP
|
||||
# All test cases expected to fail should return
|
||||
@ -338,10 +337,9 @@ INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col3) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
|
||||
|
||||
# deactivated because of Bug#6145
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
|
||||
|
||||
drop table t1;
|
||||
|
||||
@ -376,10 +374,9 @@ INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-13-15',DATE));
|
||||
|
||||
# deactivated because of Bug#6145
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
|
||||
|
||||
## Test INSERT with CONVERT to DATETIME into DATETIME
|
||||
# All test cases expected to fail should return
|
||||
@ -403,8 +400,8 @@ INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
|
||||
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
|
||||
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
|
||||
## Test INSERT with CONVERT to DATETIME into DATETIME
|
||||
# All test cases expected to fail should return
|
||||
@ -430,10 +427,9 @@ INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
|
||||
|
||||
# deactivated because of Bug#6145
|
||||
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
|
||||
#--error 1292
|
||||
#INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
--error 1292
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
|
||||
|
||||
drop table t1;
|
||||
|
||||
@ -1001,7 +997,7 @@ select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Zero dates using numbers was not checked properly (Bug #5933)
|
||||
# Zero dates using numbers was not checked properly (Bug #5933 & #6145)
|
||||
#
|
||||
|
||||
create table t1 (col1 date, col2 datetime, col3 timestamp);
|
||||
@ -1009,6 +1005,11 @@ create table t1 (col1 date, col2 datetime, col3 timestamp);
|
||||
insert into t1 values (0,0,0);
|
||||
--error 1292
|
||||
insert into t1 values (0.0,0.0,0.0);
|
||||
--error 1292
|
||||
insert into t1 (col1) values (convert('0000-00-00',date));
|
||||
--error 1292
|
||||
insert into t1 (col1) values (cast('0000-00-00' as date));
|
||||
|
||||
set sql_mode='no_zero_date';
|
||||
insert into t1 values (0,0,0);
|
||||
insert into t1 values (0.0,0.0,0.0);
|
||||
@ -1019,6 +1020,7 @@ insert ignore into t1 values ('0000-00-00');
|
||||
--error 1292
|
||||
insert into t1 select * from t1;
|
||||
insert ignore into t1 values ('0000-00-00');
|
||||
insert ignore into t1 (col1) values (cast('0000-00-00' as date));
|
||||
--error 1292
|
||||
insert into t1 select * from t1;
|
||||
--error 1292
|
||||
|
@ -760,3 +760,15 @@ create table t2 select a from t1 union select c from t1;
|
||||
create table t2 select a from t1 union select b from t1;
|
||||
show columns from t2;
|
||||
drop table t2, t1;
|
||||
|
||||
#
|
||||
# Test that union with VARCHAR produces dynamic row tables
|
||||
#
|
||||
|
||||
create table t1 (a varchar(5));
|
||||
create table t2 select * from t1 union select 'abcdefghijkl';
|
||||
show create table t2;
|
||||
select row_format from information_schema.TABLES where table_schema="test" and table_name="t2";
|
||||
alter table t2 ROW_FORMAT=fixed;
|
||||
show create table t2;
|
||||
drop table t1,t2;
|
||||
|
10
sql/item.cc
10
sql/item.cc
@ -1474,6 +1474,10 @@ double Item_string::val_real()
|
||||
&error);
|
||||
if (error || (end != org_end && !check_if_only_end_space(cs, end, org_end)))
|
||||
{
|
||||
/*
|
||||
We can use str_value.ptr() here as Item_string is gurantee to put an
|
||||
end \0 here.
|
||||
*/
|
||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
|
||||
@ -4902,7 +4906,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
int intp2= max_length - min(decimals, NOT_FIXED_DEC - 1);
|
||||
/* can't be overflow because it work only for decimals (no strings) */
|
||||
int dec_length= max(intp1, intp2) + decimals;
|
||||
max_length= max(max_length, max(item_length, dec_length));
|
||||
max_length= max(max_length, (uint) max(item_length, dec_length));
|
||||
/*
|
||||
we can't allow decimals to be NOT_FIXED_DEC, to prevent creation
|
||||
decimal with max precision (see Field_new_decimal constcuctor)
|
||||
@ -4929,8 +4933,8 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
}
|
||||
maybe_null|= item->maybe_null;
|
||||
get_full_info(item);
|
||||
DBUG_PRINT("info:", ("become type %d len %d, dec %d",
|
||||
fld_type, max_length, decimals));
|
||||
DBUG_PRINT("info", ("become type: %d len: %u dec: %u",
|
||||
(int) fld_type, max_length, (uint) decimals));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
33
sql/sp.cc
33
sql/sp.cc
@ -64,8 +64,7 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
|
||||
enum thr_lock_type ltype, TABLE **tablep, bool *opened)
|
||||
{
|
||||
TABLE *table;
|
||||
byte key[64+64+1]; // db, name, type
|
||||
uint keylen;
|
||||
byte key[NAME_LEN*2+4+1]; // db, name, optional key length type
|
||||
DBUG_ENTER("db_find_routine_aux");
|
||||
DBUG_PRINT("enter", ("type: %d name: %*s",
|
||||
type, name->m_name.length, name->m_name.str));
|
||||
@ -78,20 +77,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
|
||||
if (!mysql_proc_table_exists && ltype == TL_READ)
|
||||
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
|
||||
|
||||
// Put the key used to read the row together
|
||||
keylen= name->m_db.length;
|
||||
if (keylen > 64)
|
||||
keylen= 64;
|
||||
memcpy(key, name->m_db.str, keylen);
|
||||
memset(key+keylen, (int)' ', 64-keylen); // Pad with space
|
||||
keylen= name->m_name.length;
|
||||
if (keylen > 64)
|
||||
keylen= 64;
|
||||
memcpy(key+64, name->m_name.str, keylen);
|
||||
memset(key+64+keylen, (int)' ', 64-keylen); // Pad with space
|
||||
key[128]= type;
|
||||
keylen= sizeof(key);
|
||||
|
||||
if (thd->lex->proc_table)
|
||||
table= thd->lex->proc_table->table;
|
||||
else
|
||||
@ -120,8 +105,22 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
|
||||
}
|
||||
mysql_proc_table_exists= 1;
|
||||
|
||||
/*
|
||||
Create key to find row. We have to use field->store() to be able to
|
||||
handle VARCHAR and CHAR fields.
|
||||
Assumption here is that the three first fields in the table are
|
||||
'db', 'name' and 'type' and the first key is the primary key over the
|
||||
same fields.
|
||||
*/
|
||||
table->field[0]->store(name->m_db.str, name->m_db.length, &my_charset_bin);
|
||||
table->field[1]->store(name->m_name.str, name->m_name.length,
|
||||
&my_charset_bin);
|
||||
table->field[2]->store((longlong) type);
|
||||
key_copy(key, table->record[0], table->key_info,
|
||||
table->key_info->key_length);
|
||||
|
||||
if (table->file->index_read_idx(table->record[0], 0,
|
||||
key, keylen,
|
||||
key, table->key_info->key_length,
|
||||
HA_READ_KEY_EXACT))
|
||||
{
|
||||
*tablep= NULL;
|
||||
|
@ -186,6 +186,7 @@ ulong convert_month_to_period(ulong month)
|
||||
NOTE
|
||||
See description of str_to_datetime() for more information.
|
||||
*/
|
||||
|
||||
timestamp_type
|
||||
str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
|
||||
uint flags)
|
||||
@ -199,7 +200,7 @@ str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
|
||||
(MODE_INVALID_DATES |
|
||||
MODE_NO_ZERO_DATE))),
|
||||
&was_cut);
|
||||
if (was_cut)
|
||||
if (was_cut || ts_type <= MYSQL_TIMESTAMP_ERROR)
|
||||
make_truncated_value_warning(current_thd, str, length, ts_type, NullS);
|
||||
return ts_type;
|
||||
}
|
||||
|
@ -253,7 +253,12 @@ static void client_connect()
|
||||
mysql_autocommit(mysql, TRUE);
|
||||
|
||||
if (!opt_silent)
|
||||
{
|
||||
fprintf(stdout, "\nConnected to MySQL server version: %s (%lu)\n",
|
||||
mysql_get_server_info(mysql),
|
||||
(ulong) mysql_get_server_version(mysql));
|
||||
fprintf(stdout, "\n Creating a test database '%s' ...", current_db);
|
||||
}
|
||||
strxmov(query, "CREATE DATABASE IF NOT EXISTS ", current_db, NullS);
|
||||
|
||||
rc= mysql_query(mysql, query);
|
||||
@ -12662,7 +12667,7 @@ static void test_view_sp_list_fields()
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
|
||||
myheader("test_view_insert_fields");
|
||||
myheader("test_view_sp_list_fields");
|
||||
|
||||
rc= mysql_query(mysql, "DROP FUNCTION IF EXISTS f1");
|
||||
myquery(rc);
|
||||
|
Reference in New Issue
Block a user