Merge mysql.com:/usr/local/bk/mysql-5.0

into  mysql.com:/usr/home/pem/mysql-5.1-new


include/my_base.h:
  Auto merged
libmysqld/examples/Makefile.am:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/r/ndb_alter_table.result:
  Auto merged
mysql-test/r/ndb_basic.result:
  Auto merged
mysql-test/t/ndb_alter_table.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/examples/ha_example.cc:
  Auto merged
storage/myisam/ft_parser.c:
  Auto merged
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  Auto merged
storage/ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
libmysqld/Makefile.am:
  Manual merge.
sql/ha_ndbcluster.cc:
  Manual merge.
sql/mysqld.cc:
  Manual merge.
This commit is contained in:
unknown 2005-11-28 20:14:12 +01:00
commit 8c7852ba3c
51 changed files with 832 additions and 163 deletions

View File

@ -16,28 +16,28 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
AC_MSG_RESULT([using bundled yaSSL])
yassl_dir="extra/yassl"
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.a \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.a"
yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.la \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la"
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
# System specific checks
yassl_integer_extra_cxxflags=""
case $host_cpu--$CXX_VERSION in
sparc*--*Sun*C++*5.6*)
# Disable inlining when compiling taocrypt/src/integer.cpp
yassl_integer_extra_cxxflags="+d"
AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/integer.cpp])
# Disable inlining when compiling taocrypt/src/
yassl_taocrypt_extra_cxxflags="+d"
AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/])
;;
esac
AC_SUBST([yassl_integer_extra_cxxflags])
AC_SUBST([yassl_taocrypt_extra_cxxflags])
else
yassl_dir=""
AC_MSG_RESULT(no)
fi
AC_SUBST(yassl_libs)
AC_SUBST(yassl_libs_with_path)
AC_SUBST(yassl_includes)
AC_SUBST(yassl_dir)
AC_SUBST(yassl_libs_with_path)
AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ])
])

View File

@ -28,6 +28,8 @@
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _XOPEN_SOURCE /* needed to include getopt.h on some platforms. */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

View File

@ -1,7 +1,7 @@
INCLUDES = -I../include -I../taocrypt/include -I../mySTL
noinst_LIBRARIES = libyassl.a
libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
noinst_LTLIBRARIES = libyassl.la
libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)

View File

@ -1,15 +1,11 @@
INCLUDES = -I../include -I../../mySTL
noinst_LIBRARIES = libtaoint.a libtaocrypt.a
noinst_LTLIBRARIES = libtaocrypt.la
libtaoint_a_SOURCES = integer.cpp
libtaoint_a_CXXFLAGS = @yassl_integer_extra_cxxflags@
libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp \
md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \
template_instnt.cpp
libtaocrypt_a_LIBADD = libtaoint_a-integer.o
template_instnt.cpp integer.cpp
libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C
EXTRA_DIST = $(wildcard ../include/*.hpp)
AM_CXXFLAGS = -DYASSL_PURE_C

View File

@ -244,7 +244,7 @@ enum ha_base_keytype {
#define HA_OPTION_CHECKSUM 32
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
#define HA_OPTION_CREATE_FROM_ENGINE 256
#define HA_OPTION_CREATE_FROM_ENGINE 256
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
@ -256,15 +256,48 @@ enum ha_base_keytype {
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_DELAY_KEY_WRITE 64
/* Bits in flag to _status */
/*
The following flags (OR-ed) are passed to handler::info() method.
The method copies misc handler information out of the storage engine
to data structures accessible from MySQL
#define HA_STATUS_POS 1 /* Return position */
#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */
#define HA_STATUS_TIME 4 /* Return update time */
#define HA_STATUS_CONST 8 /* Return constants values */
#define HA_STATUS_VARIABLE 16
#define HA_STATUS_ERRKEY 32
#define HA_STATUS_AUTO 64
Same flags are also passed down to mi_status, myrg_status, etc.
*/
/* this one is not used */
#define HA_STATUS_POS 1
/*
assuming the table keeps shared actual copy of the 'info' and
local, possibly outdated copy, the following flag means that
it should not try to get the actual data (locking the shared structure)
slightly outdated version will suffice
*/
#define HA_STATUS_NO_LOCK 2
/* update the time of the last modification (in handler::update_time) */
#define HA_STATUS_TIME 4
/*
update the 'constant' part of the info:
handler::max_data_file_length, max_index_file_length, create_time
sortkey, ref_length, block_size, data_file_name, index_file_name.
handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
*/
#define HA_STATUS_CONST 8
/*
update the 'variable' part of the info:
handler::records, deleted, data_file_length, index_file_length,
delete_length, check_time, mean_rec_length
*/
#define HA_STATUS_VARIABLE 16
/*
get the information about the key that caused last duplicate value error
update handler::errkey and handler::dupp_ref
see handler::get_dup_key()
*/
#define HA_STATUS_ERRKEY 32
/*
update handler::auto_increment_value
*/
#define HA_STATUS_AUTO 64
/* Errorcodes given by functions */

View File

@ -22,14 +22,14 @@
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@ @yassl_libs@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared libmysql.def
noinst_HEADERS = client_settings.h

View File

@ -34,8 +34,8 @@ link_sources:
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@
$(openssl_includes) $(yassl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
mysqltest_embedded_LINK = $(CXXLINK)

View File

@ -433,4 +433,7 @@ INSERT INTO t1 VALUES('testword\'\'');
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
a
testword''
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
a
testword''
DROP TABLE t1;

View File

@ -594,3 +594,24 @@ flush privileges;
set @user123="non-existent";
select * from mysql.db where user=@user123;
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
set names koi8r;
create database ÂÄ;
grant select on ÂÄ.* to root@localhost;
select hex(Db) from mysql.db where Db='ÂÄ';
hex(Db)
D0B1D0B4
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
flush privileges;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
drop database ÂÄ;
revoke all privileges on ÂÄ.* from root@localhost;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
set names latin1;

View File

@ -2002,3 +2002,13 @@ a count(a)
1 1
NULL 1
drop table t1;
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
alter table t1 drop primary key, add primary key (f2, f1);
explain select distinct f1 a, f1 b from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
drop table t1;

View File

@ -1466,4 +1466,4 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ref a a 5 test.t3.b X
1 SIMPLE t6 ref a a 5 test.t4.b X
1 SIMPLE t5 ref a a 5 test.t3.b X
drop table t0, t1, t2, t4, t5, t6;
drop table t0, t1, t2, t3, t4, t5, t6, t7;

View File

@ -179,7 +179,7 @@ a b c
2 two two
alter table t1 drop index c;
select * from t1 where b = 'two';
ERROR HY000: Table definition has changed, please retry transaction
ERROR HY000: Can't lock file (errno: 241)
select * from t1 where b = 'two';
a b c
2 two two

View File

@ -667,13 +667,13 @@ counter datavalue
57 newval
58 newval
drop table t1;
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
b
drop table t1;
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
a
2
drop table atablewithareallylongandirritatingname;
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
b
drop table t1;

View File

@ -806,3 +806,22 @@ execute stmt;
@@tx_isolation
REPEATABLE-READ
deallocate prepare stmt;
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
not null)";
execute stmt;
drop table t1;
execute stmt;
drop table t1;
execute stmt;
drop table t1;
set names latin1;
prepare stmt from "create table t1 (a enum('test') default 'test')
character set utf8";
execute stmt;
drop table t1;
execute stmt;
drop table t1;
execute stmt;
drop table t1;
set names default;
deallocate prepare stmt;

View File

@ -2708,6 +2708,14 @@ select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
count(f2) >0
1
drop table t1,t2;
create table t1 (f1 int,f2 int);
insert into t1 values(1,1);
create table t2 (f3 int, f4 int, primary key(f3,f4));
insert into t2 values(1,1);
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
f1 f2
1 1
drop table t1,t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
@ -3283,3 +3291,49 @@ f1 f2 x1
30 1 30
drop table t1;
drop view v1, v2, v3;
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
PRIMARY KEY(key_a,key_b));
INSERT INTO t1 VALUES (0,'');
INSERT INTO t1 VALUES (1,'i');
INSERT INTO t1 VALUES (2,'j');
INSERT INTO t1 VALUES (3,'k');
INSERT INTO t2 VALUES (1,'r');
INSERT INTO t2 VALUES (2,'s');
INSERT INTO t2 VALUES (3,'t');
INSERT INTO t3 VALUES (1,5,'x');
INSERT INTO t3 VALUES (1,6,'y');
INSERT INTO t3 VALUES (2,5,'xx');
INSERT INTO t3 VALUES (2,6,'yy');
INSERT INTO t3 VALUES (2,7,'zz');
INSERT INTO t3 VALUES (3,5,'xxx');
SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
key_a foo
2 xx
EXPLAIN SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
key_a foo
2 xx
EXPLAIN SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
DROP TABLE t1,t2,t3;

View File

@ -988,6 +988,10 @@ end|
select f5(1)|
f5(1)
1
select f5(2)|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select f5(3)|
ERROR HY000: Recursive stored functions and triggers are not allowed.
create function f6() returns int
begin
declare n int;
@ -1035,6 +1039,12 @@ select * from v1|
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
create function f1() returns int
return (select sum(data) from t1) + (select sum(data) from v1)|
select f1()|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select * from v1|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select * from v2|
ERROR HY000: Recursive stored functions and triggers are not allowed.
drop function f1|
create function f1() returns int
return (select sum(data) from t1)|
@ -1053,7 +1063,7 @@ f0()
select *, f0() from v0|
f0() f0()
100 100
lock tables t1 read, t1 as t11 read, mysql.proc read|
lock tables t1 read, t1 as t11 read|
select f3()|
f3()
1
@ -1251,6 +1261,62 @@ drop procedure opp|
drop procedure ip|
show procedure status like '%p%'|
Db Name Type Definer Modified Created Security_type Comment
drop table if exists fib|
create table fib ( f bigint unsigned not null )|
drop procedure if exists fib|
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from fib order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into fib values (x+y);
call fib(n-1);
end;
end if;
end|
set @@max_sp_recursion_depth= 20|
insert into fib values (0), (1)|
call fib(3)|
select * from fib order by f asc|
f
0
1
1
2
delete from fib|
insert into fib values (0), (1)|
call fib(20)|
select * from fib order by f asc|
f
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
drop table fib|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
drop procedure if exists bar|
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
@ -1479,6 +1545,52 @@ select @x2|
@x2
2
drop procedure bug2260|
drop procedure if exists bug2267_1|
create procedure bug2267_1()
begin
show procedure status;
end|
drop procedure if exists bug2267_2|
create procedure bug2267_2()
begin
show function status;
end|
drop procedure if exists bug2267_3|
create procedure bug2267_3()
begin
show create procedure bug2267_1;
end|
drop procedure if exists bug2267_4|
drop function if exists bug2267_4|
create procedure bug2267_4()
begin
show create function bug2267_4;
end|
create function bug2267_4() returns int return 100|
call bug2267_1()|
Db Name Type Definer Modified Created Security_type Comment
test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_2()|
Db Name Type Definer Modified Created Security_type Comment
test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_3()|
Procedure sql_mode Create Procedure
bug2267_1 CREATE PROCEDURE `bug2267_1`()
begin
show procedure status;
end
call bug2267_4()|
Function sql_mode Create Function
bug2267_4 CREATE FUNCTION `bug2267_4`() RETURNS int(11)
return 100
drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
drop function bug2267_4|
drop procedure if exists bug2227|
create procedure bug2227(x int)
begin
@ -1490,6 +1602,18 @@ call bug2227(9)|
1.3 x y 42 z
1.3 9 2.6 42 zzz
drop procedure bug2227|
drop procedure if exists bug2614|
create procedure bug2614()
begin
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
call bug2614()|
call bug2614()|
drop table t3|
drop procedure bug2614|
drop function if exists bug2674|
create function bug2674() returns int
return @@sort_buffer_size|
@ -3868,5 +3992,58 @@ drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop procedure if exists bug13729|
drop table if exists t3|
create table t3 (s1 int, primary key (s1))|
insert into t3 values (1),(2)|
create procedure bug13729()
begin
declare continue handler for sqlexception select 55;
update t3 set s1 = 1;
end|
call bug13729()|
55
55
select * from t3|
s1
1
2
drop procedure bug13729|
drop table t3|
drop procedure if exists bug14643_1|
drop procedure if exists bug14643_2|
create procedure bug14643_1()
begin
declare continue handler for sqlexception select 'boo' as 'Handler';
begin
declare v int default x;
if v = 1 then
select 1;
else
select 2;
end if;
end;
end|
create procedure bug14643_2()
begin
declare continue handler for sqlexception select 'boo' as 'Handler';
case x
when 1 then
select 1;
else
select 2;
end case;
end|
call bug14643_1()|
Handler
boo
2
2
call bug14643_2()|
Handler
boo
2
2
drop procedure bug14643_1|
drop procedure bug14643_2|
drop table t1,t2;

View File

@ -369,3 +369,59 @@ drop procedure bug13825_0|
drop procedure bug13825_1|
drop procedure bug13825_2|
drop table t1, t2|
drop table if exists t3|
drop procedure if exists bug14840_1|
drop procedure if exists bug14840_2|
create table t3
(
x int,
y int,
primary key (x)
) engine=InnoDB|
create procedure bug14840_1()
begin
declare err int default 0;
declare continue handler for sqlexception
set err = err + 1;
start transaction;
update t3 set x = 1, y = 42 where x = 2;
insert into t3 values (3, 4711);
if err > 0 then
rollback;
else
commit;
end if;
select * from t3;
end|
create procedure bug14840_2()
begin
declare err int default 0;
declare continue handler for sqlexception
begin
set err = err + 1;
select err as 'Ping';
end;
update t3 set x = 1, y = 42 where x = 2;
update t3 set x = 1, y = 42 where x = 2;
insert into t3 values (3, 4711);
select * from t3;
end|
insert into t3 values (1, 3), (2, 5)|
call bug14840_1()|
x y
1 3
2 5
delete from t3|
insert into t3 values (1, 3), (2, 5)|
call bug14840_2()|
Ping
1
Ping
2
x y
1 3
2 5
3 4711
drop procedure bug14840_1|
drop procedure bug14840_2|
drop table t3|

View File

@ -354,6 +354,7 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
#
INSERT INTO t1 VALUES('testword\'\'');
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
DROP TABLE t1;
# End of 4.1 tests

View File

@ -487,4 +487,16 @@ flush privileges;
set @user123="non-existent";
select * from mysql.db where user=@user123;
set names koi8r;
create database 薩;
grant select on 薩.* to root@localhost;
select hex(Db) from mysql.db where Db='薩';
show grants for root@localhost;
flush privileges;
show grants for root@localhost;
drop database 薩;
revoke all privileges on 薩.* from root@localhost;
show grants for root@localhost;
set names latin1;
# End of 4.1 tests

View File

@ -693,3 +693,13 @@ create table t1(a int, key(a)) engine=innodb;
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
drop table t1;
#
# Bug #13293 Wrongly used index results in endless loop.
#
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
alter table t1 drop primary key, add primary key (f2, f1);
explain select distinct f1 a, f1 b from t1;
explain select distinct f1, f2 from t1;
drop table t1;

View File

@ -899,4 +899,4 @@ explain select * from t2 left join
(t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b
join t5 on t5.a=t3.b) on t3.a=t2.b;
drop table t0, t1, t2, t4, t5, t6;
drop table t0, t1, t2, t3, t4, t5, t6, t7;

View File

@ -153,7 +153,7 @@ connection server1;
alter table t1 drop index c;
connection server2;
# This should fail since index information is not automatically refreshed
--error 1412
--error 1015
select * from t1 where b = 'two';
select * from t1 where b = 'two';
connection server1;

View File

@ -606,6 +606,14 @@ select * from t1 order by counter;
drop table t1;
#
# BUG#14514 Creating table with packed key fails silently
#
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
drop table t1;
# End of 4.1 tests
#
@ -615,12 +623,3 @@ create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
drop table atablewithareallylongandirritatingname;
#
# BUG#14514
#
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
drop table t1;

View File

@ -842,4 +842,32 @@ set @@tx_isolation=default;
execute stmt;
deallocate prepare stmt;
#
# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP"
#
# Part I. Make sure the typelib for ENUM is created in the statement memory
# root.
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
not null)";
execute stmt;
drop table t1;
execute stmt;
drop table t1;
execute stmt;
drop table t1;
# Part II. Make sure that when the default value is converted to UTF-8,
# the new item is # created in the statement memory root.
set names latin1;
prepare stmt from "create table t1 (a enum('test') default 'test')
character set utf8";
execute stmt;
drop table t1;
execute stmt;
drop table t1;
execute stmt;
drop table t1;
# Cleanup
set names default;
deallocate prepare stmt;
# End of 4.1 tests

View File

@ -2253,6 +2253,17 @@ insert into t1 values (1,1);
insert into t2 values (1,1),(1,2);
select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
drop table t1,t2;
#
# Bug #14482 Server crash when subselecting from the same table
#
create table t1 (f1 int,f2 int);
insert into t1 values(1,1);
create table t2 (f3 int, f4 int, primary key(f3,f4));
insert into t2 values(1,1);
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
drop table t1,t2;
# End of 4.1 tests
#
@ -2749,3 +2760,48 @@ select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
drop table t1;
drop view v1, v2, v3;
#
# Bug #15106: lost equality predicate of the form field=const in a join query
#
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
PRIMARY KEY(key_a,key_b));
INSERT INTO t1 VALUES (0,'');
INSERT INTO t1 VALUES (1,'i');
INSERT INTO t1 VALUES (2,'j');
INSERT INTO t1 VALUES (3,'k');
INSERT INTO t2 VALUES (1,'r');
INSERT INTO t2 VALUES (2,'s');
INSERT INTO t2 VALUES (3,'t');
INSERT INTO t3 VALUES (1,5,'x');
INSERT INTO t3 VALUES (1,6,'y');
INSERT INTO t3 VALUES (2,5,'xx');
INSERT INTO t3 VALUES (2,6,'yy');
INSERT INTO t3 VALUES (2,7,'zz');
INSERT INTO t3 VALUES (3,5,'xxx');
SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
EXPLAIN SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
EXPLAIN SELECT t2.key_a,foo
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
INNER JOIN t3 ON t1.key_a = t3.key_a
WHERE t2.key_a=2 and key_b=5;
DROP TABLE t1,t2,t3;

View File

@ -1211,15 +1211,13 @@ begin
end if;
end|
select f5(1)|
# This should generate an error about insuficient number of tables locked
# Now this crash server
--disable_parsing # until bug#11394 fix
--error 1100
# Since currently recursive functions are disallowed ER_SP_NO_RECURSION
# error will be returned, once we will allow them error about
# insufficient number of locked tables will be returned instead.
--error ER_SP_NO_RECURSION
select f5(2)|
# But now it simply miserably fails because we are trying to use the same
# lex on the next iteration :/ It should generate some error too...
--error ER_SP_NO_RECURSION
select f5(3)|
--enable_parsing
# OTOH this should work
create function f6() returns int
@ -1265,13 +1263,12 @@ select * from v1|
# views and functions ?
create function f1() returns int
return (select sum(data) from t1) + (select sum(data) from v1)|
# This queries will crash server because we can't use LEX in
# reenterable fashion yet. Patch disabling recursion will heal this.
--disable_parsing
--error ER_SP_NO_RECURSION
select f1()|
--error ER_SP_NO_RECURSION
select * from v1|
--error ER_SP_NO_RECURSION
select * from v2|
--enable_parsing
# Back to the normal cases
drop function f1|
create function f1() returns int
@ -1289,9 +1286,7 @@ select *, f0() from v0|
#
# Let us test how well prelocking works with explicit LOCK TABLES.
#
# Nowdays we have to lock mysql.proc to be able to read SP definitions.
# But Monty was going to fix this.
lock tables t1 read, t1 as t11 read, mysql.proc read|
lock tables t1 read, t1 as t11 read|
# These should work well
select f3()|
select id, f3() from t1 as t11|
@ -1481,9 +1476,6 @@ show procedure status like '%p%'|
# Fibonacci, for recursion test. (Yet Another Numerical series :)
#
# This part of test is disabled until we implement support for
# recursive stored procedures.
--disable_parsing
--disable_warnings
drop table if exists fib|
--enable_warnings
@ -1512,6 +1504,9 @@ begin
end if;
end|
# Enable recursion
set @@max_sp_recursion_depth= 20|
# Minimum test: recursion of 3 levels
insert into fib values (0), (1)|
@ -1531,7 +1526,7 @@ call fib(20)|
select * from fib order by f asc|
drop table fib|
drop procedure fib|
--enable_parsing
set @@max_sp_recursion_depth= 0|
#
# Comment & suid
@ -1800,16 +1795,8 @@ select @x2|
drop procedure bug2260|
#
# BUG#2267
# BUG#2267 "Lost connect if stored procedure has SHOW FUNCTION STATUS"
#
# NOTE: This test case will be fixed as soon as Monty
# will allow to open mysql.proc table under LOCK TABLES
# without mentioning in lock list.
#
# FIXME: Other solution would be to use preopened proc table
# instead of opening it anew.
#
--disable_parsing
--disable_warnings
drop procedure if exists bug2267_1|
--enable_warnings
@ -1836,11 +1823,13 @@ end|
--disable_warnings
drop procedure if exists bug2267_4|
drop function if exists bug2267_4|
--enable_warnings
create procedure bug2267_4()
begin
show create function fac;
show create function bug2267_4;
end|
create function bug2267_4() returns int return 100|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
call bug2267_1()|
@ -1853,7 +1842,7 @@ drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
--enable_parsing
drop function bug2267_4|
#
# BUG#2227
@ -1873,23 +1862,16 @@ call bug2227(9)|
drop procedure bug2227|
#
# BUG#2614
# BUG#2614 "Stored procedure with INSERT ... SELECT that does not
# contain any tables crashes server"
#
# QQ The second insert doesn't work with temporary tables (it was an
# QQ ordinary table before we changed the locking scheme). It results
# QQ in an error: 1137: Can't reopen table: 't3'
# QQ which is a known limit with temporary tables.
# QQ For this reason we can't run this test any more (i.e., if we modify
# QQ it, it's no longer a test case for the bug), but we keep it here
# QQ anyway, for tracability.
--disable_parsing
--disable_warnings
drop procedure if exists bug2614|
--enable_warnings
create procedure bug2614()
begin
drop temporary table if exists t3;
create temporary table t3 (id int default '0' not null);
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
@ -1898,9 +1880,8 @@ end|
call bug2614()|
--enable_warnings
call bug2614()|
drop temporary table t3|
drop table t3|
drop procedure bug2614|
--enable_parsing
#
# BUG#2674
@ -4773,8 +4754,75 @@ drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
#
# BUG#13729: Stored procedures: packet error after exception handled
#
--disable_warnings
drop procedure if exists bug13729|
drop table if exists t3|
--enable_warnings
create table t3 (s1 int, primary key (s1))|
insert into t3 values (1),(2)|
create procedure bug13729()
begin
declare continue handler for sqlexception select 55;
update t3 set s1 = 1;
end|
call bug13729()|
# Used to cause Packets out of order
select * from t3|
drop procedure bug13729|
drop table t3|
#
# BUG#14643: Stored Procedure: Continuing after failed var. initialization
# crashes server.
#
--disable_warnings
drop procedure if exists bug14643_1|
drop procedure if exists bug14643_2|
--enable_warnings
create procedure bug14643_1()
begin
declare continue handler for sqlexception select 'boo' as 'Handler';
begin
declare v int default x;
if v = 1 then
select 1;
else
select 2;
end if;
end;
end|
create procedure bug14643_2()
begin
declare continue handler for sqlexception select 'boo' as 'Handler';
case x
when 1 then
select 1;
else
select 2;
end case;
end|
call bug14643_1()|
call bug14643_2()|
drop procedure bug14643_1|
drop procedure bug14643_2|
#
# BUG#NNNN: New bug synopsis

View File

@ -355,6 +355,70 @@ drop procedure bug13825_2|
drop table t1, t2|
#
# BUG#14840: CONTINUE handler problem
#
--disable_warnings
drop table if exists t3|
drop procedure if exists bug14840_1|
drop procedure if exists bug14840_2|
--enable_warnings
create table t3
(
x int,
y int,
primary key (x)
) engine=InnoDB|
# This used to hang the client since the insert returned with an
# error status (left over from the update) even though it succeeded,
# which caused the execution to end at that point.
create procedure bug14840_1()
begin
declare err int default 0;
declare continue handler for sqlexception
set err = err + 1;
start transaction;
update t3 set x = 1, y = 42 where x = 2;
insert into t3 values (3, 4711);
if err > 0 then
rollback;
else
commit;
end if;
select * from t3;
end|
# A simpler (non-transactional) case: insert at select should be done
create procedure bug14840_2()
begin
declare err int default 0;
declare continue handler for sqlexception
begin
set err = err + 1;
select err as 'Ping';
end;
update t3 set x = 1, y = 42 where x = 2;
update t3 set x = 1, y = 42 where x = 2;
insert into t3 values (3, 4711);
select * from t3;
end|
insert into t3 values (1, 3), (2, 5)|
call bug14840_1()|
delete from t3|
insert into t3 values (1, 3), (2, 5)|
call bug14840_2()|
drop procedure bug14840_1|
drop procedure bug14840_2|
drop table t3|
#
# BUG#NNNN: New bug synopsis
#

View File

@ -267,7 +267,7 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
*/
switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) {
case 0:
case _O_EXCL: // ignore EXCL w/o CREAT
case _O_EXCL: /* ignore EXCL w/o CREAT */
filecreate= OPEN_EXISTING;
break;
@ -281,7 +281,7 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
break;
case _O_TRUNC:
case _O_TRUNC | _O_EXCL: // ignore EXCL w/o CREAT
case _O_TRUNC | _O_EXCL: /* ignore EXCL w/o CREAT */
filecreate= TRUNCATE_EXISTING;
break;
@ -290,7 +290,7 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
break;
default:
// this can't happen ... all cases are covered
/* this can't happen ... all cases are covered */
errno= EINVAL;
_doserrno= 0L;
return -1;

View File

@ -1495,12 +1495,17 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
static void
mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
{
struct st_VioSSLConnectorFd *st=
(struct st_VioSSLConnectorFd*) mysql->connector_fd;
DBUG_ENTER("mysql_ssl_free");
my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
if (st)
SSL_CTX_free(st->ssl_context);
my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR));
mysql->options.ssl_key = 0;
mysql->options.ssl_cert = 0;

View File

@ -495,6 +495,8 @@ int ha_example::rnd_pos(byte * buf, byte *pos)
/*
::info() is used to return information to the optimizer.
see my_base.h for the complete description
Currently this table handler doesn't implement most of the fields
really needed. SHOW also makes use of this data
Another note, you will probably want to have the following in your

View File

@ -3435,17 +3435,20 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_PRINT("info", ("Table schema version: %d",
tab->getObjectVersion()));
}
if (m_table != (void *)tab)
{
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
}
else if (m_table_version < tab->getObjectVersion())
if (m_table_version < tab->getObjectVersion())
{
/*
The table has been altered, caller has to retry
*/
DBUG_RETURN(my_errno= HA_ERR_TABLE_DEF_CHANGED);
NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
DBUG_RETURN(ndb_to_mysql_error(&err));
}
if (m_table != (void *)tab)
{
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
if (!(my_errno= build_index_list(ndb, table, ILBP_OPEN)))
DBUG_RETURN(my_errno);
}
m_table_info= tab_info;
}
@ -3936,8 +3939,8 @@ int ha_ndbcluster::create(const char *name,
uint pack_length, length, i, pk_length= 0;
const void *data, *pack_data;
char name2[FN_HEADLEN];
bool create_from_engine= test(info->table_options &
HA_OPTION_CREATE_FROM_ENGINE);
bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
DBUG_ENTER("ha_ndbcluster::create");
DBUG_PRINT("enter", ("name: %s", name));

View File

@ -1174,7 +1174,7 @@ public:
key_range *max_key)
{ return (ha_rows) 10; }
virtual void position(const byte *record)=0;
virtual void info(uint)=0;
virtual void info(uint)=0; // see my_base.h for full description
virtual int extra(enum ha_extra_function operation)
{ return 0; }
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)

View File

@ -700,23 +700,15 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
{
if (const_item())
{
Item_string *conv;
uint cnv_errors;
char buf[MAX_FIELD_WIDTH];
String tmp(buf, sizeof(buf), &my_charset_bin);
String cstr, *ostr= val_str(&tmp);
/*
As safe_charset_converter is not executed for
a parameter bound to NULL, ostr should never be 0.
*/
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &cnv_errors);
if (cnv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
cstr.charset(),
collation.derivation)))
return NULL;
conv->str_value.copy();
conv->str_value.mark_as_const();
return conv;
String *ostr= val_str(&cnvstr);
cnvitem->str_value.copy(ostr->ptr(), ostr->length(),
ostr->charset(), tocs, &cnv_errors);
if (cnv_errors)
return NULL;
cnvitem->str_value.mark_as_const();
cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
return cnvitem;
}
return NULL;
}
@ -2105,6 +2097,8 @@ Item_param::Item_param(unsigned pos_in_query_arg) :
value is set.
*/
maybe_null= 1;
cnvitem= new Item_string("", 0, &my_charset_bin, DERIVATION_COERCIBLE);
cnvstr.set(cnvbuf, sizeof(cnvbuf), &my_charset_bin);
}
@ -5302,7 +5296,7 @@ Item_result item_cmp_type(Item_result a,Item_result b)
void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
{
Item *item= *ref;
Item *new_item;
Item *new_item= NULL;
if (item->basic_const_item())
return; // Can't be better
Item_result res_type=item_cmp_type(comp_item->result_type(),
@ -5335,7 +5329,16 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
break;
}
case ROW_RESULT:
if (item->type() == Item::ROW_ITEM && comp_item->type() == Item::ROW_ITEM)
{
/*
Substitute constants only in Item_rows. Don't affect other Items
with ROW_RESULT (eg Item_singlerow_subselect).
For such Items more optimal is to detect if it is constant and replace
it with Item_row. This would optimize queries like this:
SELECT * FROM t1 WHERE (a,b) = (SELECT a,b FROM t2 LIMIT 1);
*/
Item_row *item_row= (Item_row*) item;
Item_row *comp_item_row= (Item_row*) comp_item;
uint col;
@ -5353,6 +5356,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
break;
}
/* Fallthrough */
case REAL_RESULT:
{ // It must REAL_RESULT
double result= item->val_real();

View File

@ -1084,7 +1084,11 @@ public:
class Item_param :public Item
{
char cnvbuf[MAX_FIELD_WIDTH];
String cnvstr;
Item *cnvitem;
public:
enum enum_item_param_state
{
NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE,

View File

@ -3662,7 +3662,7 @@ void Item_equal::merge(Item_equal *item)
the multiple equality already contains a constant and its
value is not equal to the value of c.
*/
add(const_item);
add(c);
}
cond_false|= item->cond_false;
}

View File

@ -1463,7 +1463,7 @@ int calc_weekday(long daynr,bool sunday_first_day_of_week);
uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
void find_date(char *pos,uint *vek,uint flag);
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
TYPELIB *typelib(List<String> &strings);
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
const char *newname);

View File

@ -1645,6 +1645,7 @@ void end_thread(THD *thd, bool put_in_cache)
wake_thread--;
thd=thread_cache.get();
thd->real_id=pthread_self();
thd->thread_stack= (char *) &thd;
(void) thd->store_globals();
thd->thr_create_time= time(NULL);
threads.append(thd);
@ -7001,10 +7002,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_MYISAM_STATS_METHOD:
{
ulong method_conv;
int method;
LINT_INIT(method_conv);
myisam_stats_method_str= argument;
int method;
if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
{
fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument);

View File

@ -3142,10 +3142,10 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
/* F=F-covered by first(I) */
bitmap_union(&covered_fields, &(*ror_scan_mark)->covered_fields);
all_covered= bitmap_is_subset(&param->needed_fields, &covered_fields);
} while (!all_covered && (++ror_scan_mark < ror_scans_end));
if (!all_covered)
DBUG_RETURN(NULL); /* should not happen actually */
} while ((++ror_scan_mark < ror_scans_end) && !all_covered);
if (!all_covered || (ror_scan_mark - tree->ror_scans) == 1)
DBUG_RETURN(NULL);
/*
Ok, [tree->ror_scans .. ror_scan) holds covering index_intersection with
@ -7211,6 +7211,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
{
select_items_it.rewind();
cur_used_key_parts.clear_all();
uint max_key_part= 0;
while ((item= select_items_it++))
{
item_field= (Item_field*) item; /* (SA5) already checked above. */
@ -7228,7 +7229,19 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
cur_group_prefix_len+= cur_part->store_length;
cur_used_key_parts.set_bit(key_part_nr);
++cur_group_key_parts;
max_key_part= max(max_key_part,key_part_nr);
}
/*
Check that used key parts forms a prefix of the index.
To check this we compare bits in all_parts and cur_parts.
all_parts have all bits set from 0 to (max_key_part-1).
cur_parts have bits set for only used keyparts.
*/
ulonglong all_parts, cur_parts;
all_parts= (1<<max_key_part) - 1;
cur_parts= cur_used_key_parts.to_ulonglong() >> 1;
if (all_parts != cur_parts)
goto next_index;
}
else
DBUG_ASSERT(FALSE);

View File

@ -2215,6 +2215,26 @@ sp_instr_set::exec_core(THD *thd, uint *nextp)
{
int res= thd->spcont->set_item_eval(thd, m_offset, &m_value, m_type);
if (res < 0 &&
thd->spcont->get_item(m_offset) == NULL &&
thd->spcont->found_handler_here())
{
/*
Failed to evaluate the value, the variable is still not initialized,
and a handler has been found. Set to null so we can continue.
*/
Item *it= new Item_null();
if (!it || thd->spcont->set_item_eval(thd, m_offset, &it, m_type) < 0)
{ /* If this also failed, we have to abort */
sp_rcontext *spcont= thd->spcont;
thd->spcont= 0; /* Avoid handlers */
my_error(ER_OUT_OF_RESOURCES, MYF(0));
spcont->clear_handler();
thd->spcont= spcont;
}
}
*nextp = m_ip+1;
return res;
}

View File

@ -183,6 +183,7 @@ THD::THD()
spcont(NULL)
{
stmt_arena= this;
thread_stack= 0;
db= 0;
catalog= (char*)"std"; // the only catalog we have for now
main_security_ctx.init();

View File

@ -1241,14 +1241,16 @@ public:
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
#endif
}
#ifdef USING_TRANSACTIONS
st_transactions()
{
#ifdef USING_TRANSACTIONS
bzero((char*)this, sizeof(*this));
xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
}
#else
xid_state.xa_state= XA_NOTR;
#endif
}
} transaction;
Field *dupp_field;
#ifndef __WIN__

View File

@ -911,7 +911,6 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
}
key_info= table->key_info;
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
bzero((char*) &create_info, sizeof(create_info));
file->update_create_info(&create_info);
primary_key= share->primary_key;

View File

@ -799,7 +799,14 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
*/
if (!interval)
{
interval= sql_field->interval= typelib(sql_field->interval_list);
/*
Create the typelib in prepared statement memory if we're
executing one.
*/
MEM_ROOT *stmt_root= thd->stmt_arena->mem_root;
interval= sql_field->interval= typelib(stmt_root,
sql_field->interval_list);
List_iterator<String> it(sql_field->interval_list);
String conv, *tmp;
for (uint i= 0; (tmp= it++); i++)
@ -810,7 +817,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{
uint cnv_errs;
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
interval->type_names[i]= strmake_root(thd->mem_root, conv.ptr(),
interval->type_names[i]= strmake_root(stmt_root, conv.ptr(),
conv.length());
interval->type_lengths[i]= conv.length();
}
@ -830,8 +837,22 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
*/
if (sql_field->def && cs != sql_field->def->collation.collation)
{
if (!(sql_field->def=
sql_field->def->safe_charset_converter(cs)))
Query_arena backup_arena;
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
if (need_to_change_arena)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
thd->stmt_arena->is_first_sp_execute());
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
}
sql_field->def= sql_field->def->safe_charset_converter(cs);
if (need_to_change_arena)
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
if (! sql_field->def)
{
/* Could not convert */
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);

View File

@ -516,7 +516,12 @@ int mysql_update(THD *thd,
}
else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
{
thd->fatal_error(); // Force error message
/*
If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
do anything; otherwise...
*/
if (error != HA_ERR_FOUND_DUPP_KEY)
thd->fatal_error(); /* Other handler errors are fatal */
table->file->print_error(error,MYF(0));
error= 1;
break;
@ -1365,7 +1370,12 @@ bool multi_update::send_data(List<Item> &not_used_values)
updated--;
if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
{
thd->fatal_error(); // Force error message
/*
If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
do anything; otherwise...
*/
if (error != HA_ERR_FOUND_DUPP_KEY)
thd->fatal_error(); /* Other handler errors are fatal */
table->file->print_error(error,MYF(0));
DBUG_RETURN(1);
}

View File

@ -1721,15 +1721,15 @@ fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types,
} /* fix_type_pointers */
TYPELIB *typelib(List<String> &strings)
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings)
{
TYPELIB *result=(TYPELIB*) sql_alloc(sizeof(TYPELIB));
TYPELIB *result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB));
if (!result)
return 0;
result->count=strings.elements;
result->name="";
uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1);
if (!(result->type_names= (const char**) sql_alloc(nbytes)))
if (!(result->type_names= (const char**) alloc_root(mem_root, nbytes)))
return 0;
result->type_lengths= (uint*) (result->type_names + result->count + 1);
List_iterator<String> it(strings);

View File

@ -160,8 +160,10 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
if (true_word_char(cs,*doc))
mwc=0;
else if (!misc_word_char(*doc) || mwc++)
else if (!misc_word_char(*doc) || mwc)
break;
else
mwc++;
param->prev='A'; /* be sure *prev is true_word_char */
word->len= (uint)(doc-word->pos) - mwc;

View File

@ -342,14 +342,21 @@ ConfigRetriever::setNodeId(Uint32 nodeid)
Uint32
ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds)
{
int res;
_ownNodeId= 0;
if(m_handle != 0)
{
while (1)
{
int res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type);
if(!ndb_mgm_is_connected(m_handle))
if(!ndb_mgm_connect(m_handle, 0, 0, 0))
goto next;
res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type);
if(res >= 0)
return _ownNodeId= (Uint32)res;
next:
if (no_retries == 0)
break;
no_retries--;

View File

@ -336,10 +336,16 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
const Properties* p = parser.parse(ctx, session);
if (p == NULL){
if(!ndb_mgm_is_connected(handle)) {
return NULL;
DBUG_RETURN(NULL);
}
else
{
if(ctx.m_status==Parser_t::Eof
|| ctx.m_status==Parser_t::NoLine)
{
ndb_mgm_disconnect(handle);
DBUG_RETURN(NULL);
}
/**
* Print some info about why the parser returns NULL
*/

View File

@ -87,7 +87,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
#ifdef HAVE_OPENSSL
if (type == VIO_TYPE_SSL)
{
vio->viodelete =vio_ssl_delete;
vio->viodelete =vio_delete;
vio->vioerrno =vio_ssl_errno;
vio->read =vio_ssl_read;
vio->write =vio_ssl_write;

View File

@ -28,7 +28,6 @@ void vio_ignore_timeout(Vio *vio, uint which, uint timeout);
#ifdef HAVE_OPENSSL
#include "my_net.h" /* needed because of struct in_addr */
void vio_ssl_delete(Vio* vio);
int vio_ssl_read(Vio *vio,gptr buf, int size);
int vio_ssl_write(Vio *vio,const gptr buf,int size);
void vio_ssl_timeout(Vio *vio, uint which, uint timeout);

View File

@ -69,25 +69,6 @@ report_errors()
DBUG_VOID_RETURN;
}
/*
Delete a vio object
SYNPOSIS
vio_ssl_delete()
vio Vio object. May be 0.
*/
void vio_ssl_delete(Vio * vio)
{
if (vio)
{
if (vio->type != VIO_CLOSED)
vio_close(vio);
my_free((gptr) vio,MYF(0));
}
}
int vio_ssl_errno(Vio *vio __attribute__((unused)))
{