diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-05-13 19:40:33 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-05-13 19:40:33 +0400 |
commit | 8f22da1657364228f29c7a29ef0b3ad8e3448a2d (patch) | |
tree | 02de3fd9dc4a78b41cebbbcdd18d21402bd7722a | |
parent | 94ee84548d5d9a8672ae6a7e1246ce3850ba7ef7 (diff) | |
parent | 7af6ac8f3ed64333f3dcb87c15e93bcfafd66bf1 (diff) | |
download | mariadb-git-8f22da1657364228f29c7a29ef0b3ad8e3448a2d.tar.gz |
Merge trunk -> trunk-runtime.
-rw-r--r-- | mysql-test/include/have_federated_plugin.inc | 5 | ||||
-rw-r--r-- | mysql-test/r/loadxml.result | 20 | ||||
-rw-r--r-- | mysql-test/r/null.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_datetime.result | 19 | ||||
-rw-r--r-- | mysql-test/r/user_var.result | 31 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_plugin-master.opt | 2 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_plugin.result | 0 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_plugin.test | 22 | ||||
-rw-r--r-- | mysql-test/t/loadxml.test | 8 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 18 | ||||
-rw-r--r-- | mysql-test/t/user_var.test | 41 | ||||
-rw-r--r-- | sql/item.cc | 20 | ||||
-rw-r--r-- | sql/item_func.h | 3 | ||||
-rw-r--r-- | sql/sql_load.cc | 2 | ||||
-rw-r--r-- | storage/federated/Makefile.am | 26 |
15 files changed, 210 insertions, 9 deletions
diff --git a/mysql-test/include/have_federated_plugin.inc b/mysql-test/include/have_federated_plugin.inc new file mode 100644 index 00000000000..5c7549de53f --- /dev/null +++ b/mysql-test/include/have_federated_plugin.inc @@ -0,0 +1,5 @@ +if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`) +{ + --skip federated plugin not available +} + diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result index 55e6759748a..7742f456252 100644 --- a/mysql-test/r/loadxml.result +++ b/mysql-test/r/loadxml.result @@ -73,3 +73,23 @@ id text line2
line3 drop table t1; +# +# Bug#51571 load xml infile causes server crash +# +CREATE TABLE t1 (a text, b text); +LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1 +ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b); +SELECT * FROM t1 ORDER BY a; +a b +1 !b1 +11 !b11 +111 !b111 +112 !b112 & < > " ' &unknown; -- check entities +2 !b2 +212 !b212 +213 !b213 +214 !b214 +215 !b215 +216 !&bb b; +3 !b3 +DROP TABLE t1; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 1cdc48e6552..585d7a14ce9 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -94,7 +94,7 @@ Warnings: Warning 1265 Data truncated for column 'd' at row 1 UPDATE t1 SET d=1/NULL; Warnings: -Warning 1265 Data truncated for column 'd' at row 1 +Warning 1048 Column 'd' cannot be null UPDATE t1 SET d=NULL; Warnings: Warning 1048 Column 'd' cannot be null diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 6875c0404d0..a054659abe9 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -638,3 +638,22 @@ CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7)) Warnings: Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567' End of 5.1 tests +# +# Start of 5.5 tests +# +# +# Bug#52849 datetime index not work +# +CREATE TABLE t1 (Id INT, AtTime DATETIME, KEY AtTime (AtTime)); +SET NAMES CP850; +INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12'); +EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref AtTime AtTime 9 const 1 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = '2010-02-22 18:40:07') +DROP TABLE t1; +SET NAMES latin1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index c73d2e64540..29c05a60166 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -429,3 +429,34 @@ INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); DROP TABLE t1; End of 5.1 tests +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); +INSERT INTO t1 SET f1 = NULL ; +SET @aux = NULL ; +INSERT INTO t1 SET f1 = @aux ; +SET @aux1 = 0.123E-1; +SET @aux1 = NULL; +INSERT INTO t1 SET f1 = @aux1 ; +SELECT * FROM t1; +f1 +1 +2 +3 +DROP TABLE t1; +CREATE TABLE t1(f1 VARCHAR(257) , f2 INT, PRIMARY KEY(f2)); +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1; +SET @aux = 1; +SET @aux = NULL; +INSERT INTO test.t1 (f1, f2) VALUES (1, 1), (@aux, 2); +SET @aux = 'text'; +SET @aux = NULL; +INSERT INTO t1(f1, f2) VALUES (1, 3), (@aux, 4); +SELECT f1, f2 FROM t1 ORDER BY f2; +f1 f2 +1 1 +1 2 +1 3 +1 4 +DROP TRIGGER trg1; +DROP TABLE t1; +End of 5.5 tests diff --git a/mysql-test/suite/federated/federated_plugin-master.opt b/mysql-test/suite/federated/federated_plugin-master.opt new file mode 100644 index 00000000000..ac2e9458e5f --- /dev/null +++ b/mysql-test/suite/federated/federated_plugin-master.opt @@ -0,0 +1,2 @@ +--plugin_dir=../storage/federated/.libs + diff --git a/mysql-test/suite/federated/federated_plugin.result b/mysql-test/suite/federated/federated_plugin.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/suite/federated/federated_plugin.result diff --git a/mysql-test/suite/federated/federated_plugin.test b/mysql-test/suite/federated/federated_plugin.test new file mode 100644 index 00000000000..81421e226b1 --- /dev/null +++ b/mysql-test/suite/federated/federated_plugin.test @@ -0,0 +1,22 @@ +--source include/not_windows.inc +--source include/have_federated_plugin.inc + +CREATE TABLE t1(a int) ENGINE=FEDERATED; +DROP TABLE t1; + +INSTALL PLUGIN federated SONAME 'ha_federated.so'; +--error 1125 +INSTALL PLUGIN FEDERATED SONAME 'ha_federated.so'; + +UNINSTALL PLUGIN federated; + +INSTALL PLUGIN federated SONAME 'ha_federated.so'; + +CREATE TABLE t1(a int) ENGINE=FEDERATED; + +DROP TABLE t1; + +UNINSTALL PLUGIN federated; +--error ER_SP_DOES_NOT_EXIST +UNINSTALL PLUGIN federated; + diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test index 84a89a332a0..6faf712b6ce 100644 --- a/mysql-test/t/loadxml.test +++ b/mysql-test/t/loadxml.test @@ -108,3 +108,11 @@ load xml infile '../../std_data/loadxml2.dat' into table t1; select * from t1; drop table t1; +--echo # +--echo # Bug#51571 load xml infile causes server crash +--echo # +CREATE TABLE t1 (a text, b text); +LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1 +ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b); +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index d4fa6bed186..e607823764b 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -446,3 +446,21 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7)); --echo End of 5.1 tests + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Bug#52849 datetime index not work +--echo # +CREATE TABLE t1 (Id INT, AtTime DATETIME, KEY AtTime (AtTime)); +SET NAMES CP850; +INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12'); +EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07'; +DROP TABLE t1; +SET NAMES latin1; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 5147b098ae0..fc4bc61f526 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -327,3 +327,44 @@ INSERT INTO t1 VALUES (1); DROP TABLE t1; --echo End of 5.1 tests + +# +# Bug#50511: Sometimes wrong handling of user variables containing NULL. +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); + +INSERT INTO t1 SET f1 = NULL ; + +SET @aux = NULL ; +INSERT INTO t1 SET f1 = @aux ; + +SET @aux1 = 0.123E-1; +SET @aux1 = NULL; +INSERT INTO t1 SET f1 = @aux1 ; + +SELECT * FROM t1; + +DROP TABLE t1; + +CREATE TABLE t1(f1 VARCHAR(257) , f2 INT, PRIMARY KEY(f2)); +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1; + +SET @aux = 1; # INT +SET @aux = NULL; +INSERT INTO test.t1 (f1, f2) VALUES (1, 1), (@aux, 2); + +SET @aux = 'text'; # STRING +SET @aux = NULL; +INSERT INTO t1(f1, f2) VALUES (1, 3), (@aux, 4); + +SELECT f1, f2 FROM t1 ORDER BY f2; + +DROP TRIGGER trg1; +DROP TABLE t1; + +--echo End of 5.5 tests diff --git a/sql/item.cc b/sql/item.cc index 4199f8a409a..5fea7b9c075 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1796,6 +1796,24 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, &dummy_offset)) continue; + /* + No needs to add converter if an "arg" is NUMERIC or DATETIME + value (which is pure ASCII) and at the same time target DTCollation + is ASCII-compatible. For example, no needs to rewrite: + SELECT * FROM t1 WHERE datetime_field = '2010-01-01'; + to + SELECT * FROM t1 WHERE CONVERT(datetime_field USING cs) = '2010-01-01'; + + TODO: avoid conversion of any values with + repertoire ASCII and 7bit-ASCII-compatible, + not only numeric/datetime origin. + */ + if ((*arg)->collation.derivation == DERIVATION_NUMERIC && + (*arg)->collation.repertoire == MY_REPERTOIRE_ASCII && + !((*arg)->collation.collation->state & MY_CS_NONASCII) && + !(coll.collation->state & MY_CS_NONASCII)) + continue; + if (!(conv= (*arg)->safe_charset_converter(coll.collation)) && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII)) conv= new Item_func_conv_charset(*arg, coll.collation, 1); @@ -5405,7 +5423,7 @@ int Item::save_in_field(Field *field, bool no_conversions) { double nr= val_real(); if (null_value) - return set_field_to_null(field); + return set_field_to_null_with_conversions(field, no_conversions); field->set_notnull(); error=field->store(nr); } diff --git a/sql/item_func.h b/sql/item_func.h index c3f8b254f28..834ecd60e21 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1498,7 +1498,8 @@ class Item_user_var_as_out_param :public Item LEX_STRING name; user_var_entry *entry; public: - Item_user_var_as_out_param(LEX_STRING a) : name(a) {} + Item_user_var_as_out_param(LEX_STRING a) : name(a) + { set_name(a.str, 0, system_charset_info); } /* We should return something different from FIELD_ITEM here */ enum Type type() const { return STRING_ITEM;} double val_real(); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index be047a8711f..ff9c16d229b 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -702,7 +702,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, { if (n++) pfields.append(", "); - if (item->name) + if (item->type() == Item::FIELD_ITEM) { pfields.append("`"); pfields.append(item->name); diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index 58e08b1462a..aa275b909ea 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -1,5 +1,5 @@ -# Copyright (C) 2006 MySQL AB -# +# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, Inc. +# All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. @@ -23,7 +23,8 @@ pkgplugindir = $(pkglibdir)/plugin INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql \ - -I$(srcdir) + -I$(srcdir) + WRAPLIBS= LDADD = @@ -50,11 +51,22 @@ libfederated_a_SOURCES= ha_federated.cc EXTRA_DIST = CMakeLists.txt plug.in if HAVE_DTRACE_DASH_G +# The object for static and dynamic linking of federated differ +# For static linkage of federated to mysqld + libfederated_a_LIBADD = probes_mysql.o libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = libfederated_a-ha_federated.o +# For federated as shared library +ha_federated_la_LIBADD = probes_sh_mysql.o +# Hack: We "depend" on ".libs/" but have no rule for it, +# but it is created as a byproduct of the ".lo" +DTRACESHAREDDEPS = ha_federated_la-ha_federated.lo +DTRACESHAREDFILES = ha_federated_la-ha_federated.o DTRACEPROVIDER = probes_mysql.d +ha_federated_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers + +CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES) +DTRACEFILES = libfederated_a-ha_federated.o dtrace_files: echo $(DTRACEFILES) > $@ @@ -65,8 +77,12 @@ probes_mysql.d: $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d echo timestamp > dtrace_sources +probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS) + $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ + $(CP) $(DTRACESHAREDFILES) .libs probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ + endif # Don't update the files from bitkeeper |