Commit c40277d8 authored by Konstantin Osipov's avatar Konstantin Osipov

Merge trunk -> trunk-runtime.

parents 017d66b5 19fac19a
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`)
{
--skip federated plugin not available
}
...@@ -73,3 +73,23 @@ id text ...@@ -73,3 +73,23 @@ id text
line2 line2
line3 line3
drop table t1; 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;
...@@ -94,7 +94,7 @@ Warnings: ...@@ -94,7 +94,7 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1 Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL; UPDATE t1 SET d=1/NULL;
Warnings: Warnings:
Warning 1265 Data truncated for column 'd' at row 1 Warning 1048 Column 'd' cannot be null
UPDATE t1 SET d=NULL; UPDATE t1 SET d=NULL;
Warnings: Warnings:
Warning 1048 Column 'd' cannot be null Warning 1048 Column 'd' cannot be null
......
...@@ -638,3 +638,22 @@ CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7)) ...@@ -638,3 +638,22 @@ CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7))
Warnings: Warnings:
Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567' Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567'
End of 5.1 tests 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
#
...@@ -429,3 +429,34 @@ INSERT INTO t1 VALUES (1); ...@@ -429,3 +429,34 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
End of 5.1 tests 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
--plugin_dir=../storage/federated/.libs
--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;
...@@ -108,3 +108,11 @@ load xml infile '../../std_data/loadxml2.dat' into table t1; ...@@ -108,3 +108,11 @@ load xml infile '../../std_data/loadxml2.dat' into table t1;
select * from t1; select * from t1;
drop table 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;
...@@ -446,3 +446,21 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS ...@@ -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)); SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
--echo End of 5.1 tests --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 #
...@@ -327,3 +327,44 @@ INSERT INTO t1 VALUES (1); ...@@ -327,3 +327,44 @@ INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.1 tests --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
...@@ -1796,6 +1796,24 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, ...@@ -1796,6 +1796,24 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
&dummy_offset)) &dummy_offset))
continue; 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)) && if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII)) ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
conv= new Item_func_conv_charset(*arg, coll.collation, 1); conv= new Item_func_conv_charset(*arg, coll.collation, 1);
...@@ -5405,7 +5423,7 @@ int Item::save_in_field(Field *field, bool no_conversions) ...@@ -5405,7 +5423,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
{ {
double nr= val_real(); double nr= val_real();
if (null_value) if (null_value)
return set_field_to_null(field); return set_field_to_null_with_conversions(field, no_conversions);
field->set_notnull(); field->set_notnull();
error=field->store(nr); error=field->store(nr);
} }
......
...@@ -1498,7 +1498,8 @@ class Item_user_var_as_out_param :public Item ...@@ -1498,7 +1498,8 @@ class Item_user_var_as_out_param :public Item
LEX_STRING name; LEX_STRING name;
user_var_entry *entry; user_var_entry *entry;
public: 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 */ /* We should return something different from FIELD_ITEM here */
enum Type type() const { return STRING_ITEM;} enum Type type() const { return STRING_ITEM;}
double val_real(); double val_real();
......
...@@ -702,7 +702,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, ...@@ -702,7 +702,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
{ {
if (n++) if (n++)
pfields.append(", "); pfields.append(", ");
if (item->name) if (item->type() == Item::FIELD_ITEM)
{ {
pfields.append("`"); pfields.append("`");
pfields.append(item->name); pfields.append(item->name);
......
# 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 # 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 # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
...@@ -24,6 +24,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ ...@@ -24,6 +24,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \ -I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \ -I$(top_srcdir)/sql \
-I$(srcdir) -I$(srcdir)
WRAPLIBS= WRAPLIBS=
LDADD = LDADD =
...@@ -50,11 +51,22 @@ libfederated_a_SOURCES= ha_federated.cc ...@@ -50,11 +51,22 @@ libfederated_a_SOURCES= ha_federated.cc
EXTRA_DIST = CMakeLists.txt plug.in EXTRA_DIST = CMakeLists.txt plug.in
if HAVE_DTRACE_DASH_G 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_LIBADD = probes_mysql.o
libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
CLEANFILES = probes_mysql.o dtrace_files dtrace_providers # For federated as shared library
DTRACEFILES = libfederated_a-ha_federated.o 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 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: dtrace_files:
echo $(DTRACEFILES) > $@ echo $(DTRACEFILES) > $@
...@@ -65,8 +77,12 @@ probes_mysql.d: ...@@ -65,8 +77,12 @@ probes_mysql.d:
$(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
echo timestamp > dtrace_sources 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) probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
endif endif
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
......
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