Merge with 4.1

BitKeeper/etc/logging_ok:
  auto-union
client/sql_string.cc:
  Auto merged
configure.in:
  Auto merged
include/my_global.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/create.result:
  Auto merged
mysql-test/r/olap.result:
  Auto merged
mysql-test/r/warnings.result:
  Auto merged
mysql-test/t/create.test:
  Auto merged
mysql-test/t/warnings.test:
  Auto merged
mysys/raid.cc:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
sql/field.cc:
  Auto merged
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e:
  Auto merged
BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e:
  Auto merged
sql/ha_berkeley.cc:
  Auto merged
sql/ha_blackhole.cc:
  Auto merged
sql/ha_heap.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_geofunc.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/item_uniq.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/procedure.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/protocol_cursor.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_analyse.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_error.cc:
  Auto merged
sql/sql_handler.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_map.cc:
  Auto merged
sql/sql_olap.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_string.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_udf.cc:
  Auto merged
sql/examples/ha_archive.cc:
  Auto merged
sql/examples/ha_example.cc:
  Auto merged
sql/examples/ha_tina.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/tztime.cc:
  Auto merged
strings/ctype-win1250ch.c:
  Auto merged
mysql-test/r/func_gconcat.result:
  merge & ensure that 4.1 and 5.0 source have tests in same order
mysql-test/r/innodb.result:
  merge & ensure that 4.1 and 5.0 source have tests in same order
mysql-test/t/func_gconcat.test:
  merge & ensure that 4.1 and 5.0 source have tests in same order
mysql-test/t/innodb.test:
  merge & ensure that 4.1 and 5.0 source have tests in same order
sql/item_func.cc:
  merge
sql/mysqld.cc:
  merge
sql/opt_range.cc:
  merge
sql/sql_parse.cc:
  merge
  Give better name to goto labels
sql/sql_select.cc:
  merge
This commit is contained in:
unknown 2005-06-07 00:31:53 +03:00
commit bd47a7df59
67 changed files with 416 additions and 302 deletions

View File

@ -16,12 +16,11 @@
/* This file is originally from the mysql distribution. Coded by monty */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>

View File

@ -1765,12 +1765,23 @@ if test "$ac_cv_sizeof_off_t" -eq 0
then
AC_MSG_ERROR("MySQL needs a off_t type.")
fi
# do we need #pragma interface/#pragma implementation ?
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
# follow any standard), we'll use well-defined preprocessor macros:
AC_TRY_CPP([
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
#error USE_PRAGMA_IMPLEMENTATION
#endif
],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
# This always gives a warning. Ignore it unless you are cross compiling
AC_C_BIGENDIAN
#---START: Used in for client configure
# Check base type of last arg to accept
MYSQL_TYPE_ACCEPT
#---END:
# Figure out what type of struct rlimit to use with setrlimit
MYSQL_TYPE_STRUCT_RLIMIT

View File

@ -43,16 +43,11 @@
#define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */
/* Determine when to use "#pragma interface" */
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
#ifdef USE_PRAGMA_IMPLEMENTATION
#define USE_PRAGMA_INTERFACE
#endif
/* Determine when to use "#pragma implementation" */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
#define USE_PRAGMA_IMPLEMENTATION
#endif
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
@ -306,13 +301,6 @@ C_MODE_END
#include <alloca.h>
#endif
#ifdef HAVE_ATOMIC_ADD
#define __SMP__
#ifdef HAVE_LINUX_CONFIG_H
#include <linux/config.h> /* May define CONFIG_SMP */
#endif
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
#if defined(__ia64__)
#define new my_arg_new
#define need_to_restore_new 1

View File

@ -25,7 +25,7 @@ sub mtr_full_hostname () {
if ( $hostname !~ /\./ )
{
my $address= gethostbyname($hostname)
or die "Couldn't resolve $hostname : $!";
or mtr_error("Couldn't resolve $hostname : $!");
my $fullname= gethostbyaddr($address, AF_INET);
$hostname= $fullname if $fullname;
}

View File

@ -17,6 +17,7 @@ sub mtr_spawn ($$$$$$);
sub mtr_stop_mysqld_servers ($);
sub mtr_kill_leftovers ();
sub mtr_record_dead_children ();
sub mtr_exit ($);
sub sleep_until_file_created ($$$);
# static in C
@ -784,4 +785,17 @@ sub sleep_until_file_created ($$$) {
}
##############################################################################
#
# When we exit, we kill off all children
#
##############################################################################
sub mtr_exit ($) {
my $code= shift;
local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$);
exit($code);
}
1;

View File

@ -268,7 +268,8 @@ sub mtr_warning (@) {
}
sub mtr_error (@) {
die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
mtr_exit(1);
}
sub mtr_debug (@) {

View File

@ -398,7 +398,7 @@ sub main () {
}
}
exit(0);
mtr_exit(0);
}
##############################################################################
@ -568,7 +568,9 @@ sub command_line_setup () {
$opt_vardir= "$glob_mysql_test_dir/var";
}
if ( $opt_vardir !~ m,^/, )
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
{
# Make absolute path, relative test dir
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
@ -1292,9 +1294,9 @@ sub install_db ($$) {
mtr_report("Installing \u$type Databases");
open(IN, $init_db_sql)
or error("Can't open $init_db_sql: $!");
or mtr_error("Can't open $init_db_sql: $!");
open(OUT, ">", $init_db_sql_tmp)
or error("Can't write to $init_db_sql_tmp: $!");
or mtr_error("Can't write to $init_db_sql_tmp: $!");
while (<IN>)
{
chomp;
@ -1568,7 +1570,7 @@ sub report_failure_and_restart ($) {
{
stop_masters_slaves();
}
exit(1);
mtr_exit(1);
}
# FIXME always terminate on failure?!
@ -2267,5 +2269,5 @@ Options not yet described, or that I want to look into more
with-openssl
HERE
exit(1);
mtr_exit(1);
}

View File

@ -513,9 +513,9 @@ drop database mysqltest;
select database();
database()
NULL
select database();
database()
NULL
select database(), user();
database() user()
NULL mysqltest_1@localhost
use test;
create table t1 (a int, index `primary` (a));
ERROR 42000: Incorrect index name 'primary'
@ -579,7 +579,6 @@ select * from t2;
b
1
drop table t1,t2;
use test;
create table t1 (a int);
create table t1 select * from t1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause

View File

@ -7,3 +7,15 @@ SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
a length(a) a='' a=' ' a=' '
0 1 1 1
DROP TABLE t1;
CREATE TABLE t1 (
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
PRIMARY KEY (`popisek`)
);
INSERT INTO t1 VALUES ('2005-01-1');
SELECT * FROM t1 WHERE popisek = '2005-01-1';
popisek
2005-01-1
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
popisek
2005-01-1
drop table t1;

View File

@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b)
First Row
Second Row
DROP TABLE t1;
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
a_id b_list
1 1,2,3
2 4,5
3 NULL
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
@ -462,6 +450,49 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
gc
NULL
DROP TABLE t1;
create table t2 (a int, b int);
insert into t2 values (1,1), (2,2);
select b x, (select group_concat(x) from t2) from t2;
x (select group_concat(x) from t2)
1 1,1
2 2,2
drop table t2;
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
select d,a,b from t1 order by a;
d a b
1 1 3
2 1 4
3 1 2
5 1 1
6 1 2
4 2 7
7 2 3
8 2 3
explain select a, group_concat(b) from t1 group by a with rollup;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
select a, group_concat(b) from t1 group by a with rollup;
a group_concat(b)
1 3,4,2,1,2
2 7,3,3
NULL 3,4,2,1,2,7,3,3
select a, group_concat(distinct b) from t1 group by a with rollup;
a group_concat(distinct b)
1 3,4,2,1
2 7,3
NULL 3,4,2,1,7
select a, group_concat(b order by b) from t1 group by a with rollup;
a group_concat(b order by b)
1 1,2,2,3,4
2 3,3,7
NULL 1,2,2,3,3,3,4,7
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
a group_concat(distinct b order by b)
1 1,2,3,4
2 3,7
NULL 1,2,3,4,7
drop table t1;
create table t1 (a char(3), b char(20), primary key (a, b));
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
select group_concat(a) from t1 group by b;
@ -469,10 +500,3 @@ group_concat(a)
ABW
ABW
drop table t1;
create table r2 (a int, b int);
insert into r2 values (1,1), (2,2);
select b x, (select group_concat(x) from r2) from r2;
x (select group_concat(x) from r2)
1 1,1
2 2,2
drop table r2;

View File

@ -931,7 +931,6 @@ a
1
2
truncate table t1;
truncate table t1;
insert into t1 values(1),(2);
delete from t1;
select * from t1;
@ -1654,6 +1653,46 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
alter table t1 add key (c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c2,c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c2,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
concat(a, b)
11113333
drop table t1;
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
DROP TABLE t1;
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
a_id b_list
1 1,2,3
2 4,5
3 NULL
DROP TABLE t2;
DROP TABLE t1;
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
@ -1688,24 +1727,6 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
alter table t1 add key (c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c2,c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c2,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
@ -2391,16 +2412,6 @@ drop table t1;
set storage_engine=MyISAM;
create table t1 (v varchar(16384)) engine=innodb;
drop table t1;
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
concat(a, b)
11113333
drop table t1;
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
DROP TABLE t1;
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
insert into t1 values ('8', '6'), ('4', '7');
select min(a) from t1;

View File

@ -88,7 +88,7 @@ TV NULL NULL 600
NULL NULL NULL 7785
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
Warnings:
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;

View File

@ -181,3 +181,56 @@ drop table t1;
set table_type=MYISAM;
Warnings:
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update t1 set a='abc';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'a' at row 3
Warning 1265 Data truncated for column 'a' at row 4
Warning 1265 Data truncated for column 'a' at row 5
Warning 1265 Data truncated for column 'a' at row 6
Warning 1265 Data truncated for column 'a' at row 7
Warning 1265 Data truncated for column 'a' at row 8
Warning 1265 Data truncated for column 'a' at row 9
Warning 1265 Data truncated for column 'a' at row 10
show warnings limit 2, 1;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 3
show warnings limit 0, 10;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'a' at row 3
Warning 1265 Data truncated for column 'a' at row 4
Warning 1265 Data truncated for column 'a' at row 5
Warning 1265 Data truncated for column 'a' at row 6
Warning 1265 Data truncated for column 'a' at row 7
Warning 1265 Data truncated for column 'a' at row 8
Warning 1265 Data truncated for column 'a' at row 9
Warning 1265 Data truncated for column 'a' at row 10
show warnings limit 9, 1;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 10
show warnings limit 10, 1;
Level Code Message
show warnings limit 9, 2;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 10
show warnings limit 0, 0;
Level Code Message
show warnings limit 1;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 1
show warnings limit 0;
Level Code Message
show warnings limit 1, 0;
Level Code Message
select * from t1 limit 0;
a
select * from t1 limit 1, 0;
a
select * from t1 limit 0, 0;
a
drop table t1;

View File

@ -414,14 +414,17 @@ drop database mysqltest;
select database();
# Connect without a database
connect (user4,localhost,mysqltest_1,,*NO-ONE*);
select database();
connect (user1,localhost,mysqltest_1,,*NO-ONE*);
connection user1;
select database(), user();
connection default;
disconnect user1;
use test;
#
# Test for Bug 856 'Naming a key "Primary" causes trouble'
#
use test;
--error 1280
create table t1 (a int, index `primary` (a));
--error 1280
@ -478,8 +481,6 @@ drop table t1,t2;
# This tests two additional possible errors and a hang if
# an improper fix is present.
#
connection default;
use test;
create table t1 (a int);
--error 1093
create table t1 select * from t1;
@ -501,3 +502,4 @@ create table t1(xyz.t1.name int);
create table t1(t1.name int);
create table t2(test.t2.name int);
drop table t1,t2;

View File

@ -10,3 +10,15 @@ CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
DROP TABLE t1;
#
# Bug#9759 Empty result with 'LIKE' and cp1250_czech_cs
#
CREATE TABLE t1 (
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
PRIMARY KEY (`popisek`)
);
INSERT INTO t1 VALUES ('2005-01-1');
SELECT * FROM t1 WHERE popisek = '2005-01-1';
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
drop table t1;

View File

@ -213,21 +213,6 @@ INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
DROP TABLE t1;
#
# check null values #1
#
--disable_warnings
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
DROP TABLE t2;
DROP TABLE t1;
#
# check null values #2
#
@ -285,6 +270,28 @@ CREATE TABLE t1 (id int);
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
DROP TABLE t1;
#
# Bug #8656: Crash with group_concat on alias in outer table
#
create table t2 (a int, b int);
insert into t2 values (1,1), (2,2);
select b x, (select group_concat(x) from t2) from t2;
drop table t2;
#
# Bug #7405: problems with rollup
#
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
select d,a,b from t1 order by a;
explain select a, group_concat(b) from t1 group by a with rollup;
select a, group_concat(b) from t1 group by a with rollup;
select a, group_concat(distinct b) from t1 group by a with rollup;
select a, group_concat(b order by b) from t1 group by a with rollup;
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
drop table t1;
#
# Bug #6475
#
@ -292,12 +299,3 @@ create table t1 (a char(3), b char(20), primary key (a, b));
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
select group_concat(a) from t1 group by b;
drop table t1;
#
# Bug #8656: Crash with group_concat on alias in outer table
#
create table r2 (a int, b int);
insert into r2 values (1,1), (2,2);
select b x, (select group_concat(x) from r2) from r2;
drop table r2;

View File

@ -615,7 +615,6 @@ truncate table t1;
insert into t1 values(1),(2);
select * from t1;
truncate table t1;
truncate table t1;
insert into t1 values(1),(2);
delete from t1;
select * from t1;
@ -1056,8 +1055,8 @@ insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
insert t2 select * from t1;
insert t3 select * from t1;
checksum table t1, t2, t3, t4 quick;
checksum table t1, t2, t3;
checksum table t1, t2, t3 extended;
checksum table t1, t2, t3, t4;
checksum table t1, t2, t3, t4 extended;
#show table status;
drop table t1,t2,t3;
@ -1176,28 +1175,6 @@ show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
#
# range optimizer problem
#
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
select count(*) from t1 where x>0;
select count(*) from t1 where x=0;
select count(*) from t1 where x<0;
select count(*) from t1 where x < -16;
select count(*) from t1 where x = -16;
explain select count(*) from t1 where x > -16;
# The following result should be (2). To be fixed when we add 'unsigned flag' to
# Field::store(longlong)
select count(*) from t1 where x > -16;
select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601;
drop table t1;
#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
@ -1220,6 +1197,62 @@ alter table t1 add key (c1,c2,c1);
alter table t1 add key (c1,c1,c2);
drop table t1;
#
# Bug #4082: integer truncation
#
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
drop table t1;
#
# BUG#7709 test case - Boolean fulltext query against unsupported
# engines does not fail
#
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
#
# check null values #1
#
--disable_warnings
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
DROP TABLE t2;
DROP TABLE t1;
#
# range optimizer problem
#
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
select count(*) from t1 where x>0;
select count(*) from t1 where x=0;
select count(*) from t1 where x<0;
select count(*) from t1 where x < -16;
select count(*) from t1 where x = -16;
explain select count(*) from t1 where x > -16;
# The following result should be (2). To be fixed when we add 'unsigned flag' to
# Field::store(longlong)
select count(*) from t1 where x > -16;
select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601;
drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total";
@ -1301,25 +1334,6 @@ eval set storage_engine=$default;
create table t1 (v varchar(16384)) engine=innodb;
drop table t1;
#
# Bug #4082: integer truncation
#
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
drop table t1;
#
# BUG#7709 test case - Boolean fulltext query against unsupported
# engines does not fail
#
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
#
# BUG#11039 Wrong key length in min()
#

View File

@ -129,3 +129,25 @@ drop table t1;
# Test for deprecated table_type variable
#
set table_type=MYISAM;
#
# Tests for show warnings limit a, b
#
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
# should generate 10 warnings
update t1 set a='abc';
show warnings limit 2, 1;
show warnings limit 0, 10;
show warnings limit 9, 1;
show warnings limit 10, 1;
show warnings limit 9, 2;
show warnings limit 0, 0;
show warnings limit 1;
show warnings limit 0;
show warnings limit 1, 0;
# make sure behaviour is consistent with select ... limit
select * from t1 limit 0;
select * from t1 limit 1, 0;
select * from t1 limit 0, 0;
drop table t1;

View File

@ -70,8 +70,6 @@
tonu@mysql.com & monty@mysql.com
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -14,8 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -63,8 +63,6 @@
-Brian
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -38,8 +38,6 @@ TODO:
-Brian
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -19,8 +19,6 @@
** This file implements classes defined in field.h
*****************************************************************************/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -47,13 +47,12 @@
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#ifdef HAVE_BERKELEY_DB
#include <m_ctype.h>
#include <myisampack.h>

View File

@ -15,14 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#ifdef HAVE_BLACKHOLE_DB
#include "ha_blackhole.h"

View File

@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -27,8 +27,6 @@ have disables the InnoDB inlining in this file. */
in Windows?
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -20,10 +20,8 @@
NDB Cluster
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"

View File

@ -17,8 +17,6 @@
/* Handler-calling-functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -20,8 +20,6 @@
** to usage.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -15,12 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#include <m_ctype.h>
#include "my_dir.h"

View File

@ -17,8 +17,6 @@
/* This file defines all compare functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -17,8 +17,6 @@
/* This file defines all numerical functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
@ -2373,7 +2371,7 @@ longlong Item_func_field::val_int()
return 0;
for (uint i=1; i < arg_count ; i++)
{
if (!args[i]->is_null() && val == args[i]->val_int())
if (val == args[i]->val_int() && !args[i]->null_value)
return (longlong) (i);
}
}
@ -2386,7 +2384,7 @@ longlong Item_func_field::val_int()
for (uint i=1; i < arg_count; i++)
{
dec_arg= args[i]->val_decimal(&dec_arg_buf);
if (!args[i]->is_null() && !my_decimal_cmp(dec_arg, dec))
if (!args[i]->null_value && !my_decimal_cmp(dec_arg, dec))
return (longlong) (i);
}
}
@ -2397,7 +2395,7 @@ longlong Item_func_field::val_int()
return 0;
for (uint i=1; i < arg_count ; i++)
{
if (!args[i]->is_null() && val == args[i]->val_real())
if (val == args[i]->val() && !args[i]->null_value)
return (longlong) (i);
}
}

View File

@ -17,14 +17,11 @@
/* This file defines all spatial functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#ifdef HAVE_SPATIAL
#include <m_ctype.h>

View File

@ -20,8 +20,6 @@
** (This shouldn't be needed)
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -22,8 +22,6 @@ SUBSELECT TODO:
(sql_select.h/sql_select.cc)
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -17,8 +17,6 @@
/* Sum functions (COUNT, MIN...) */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -17,8 +17,6 @@
/* This file defines all time functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -16,10 +16,8 @@
/* Compability file */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"

View File

@ -17,11 +17,10 @@
#ifndef MYSQL_CLIENT
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#include "slave.h"
#include <my_dir.h>

View File

@ -53,7 +53,7 @@ inline query_id_t next_query_id() { return query_id++; }
/* useful constants */
extern const key_map key_map_empty;
extern const key_map key_map_full;
extern key_map key_map_full; /* Should be threaded as const */
extern const char *primary_key_name;
#include "mysql_com.h"

View File

@ -381,6 +381,9 @@ char mysql_real_data_home[FN_REFLEN],
*opt_init_file, *opt_tc_log_file,
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
const key_map key_map_empty(0);
key_map key_map_full(0); // Will be initialized later
const char *opt_date_time_formats[3];
char *mysql_data_home= mysql_real_data_home;
@ -5931,6 +5934,7 @@ static void mysql_init_variables(void)
bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
bzero((char *) &global_status_var, sizeof(global_status_var));
opt_large_pages= 0;
key_map_full.set_all();
/* Character sets */
system_charset_info= &my_charset_utf8_general_ci;

View File

@ -36,8 +36,6 @@
QUICK_RANGEs are also created in this step.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -691,10 +691,14 @@ class SQL_SELECT :public Sql_alloc {
~SQL_SELECT();
void cleanup();
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
{ return test_quick_select(thd, key_map(~(uint)0), 0, limit, force_quick_range) < 0; }
{
key_map tmp;
tmp.set_all();
return test_quick_select(thd, tmp, 0, limit, force_quick_range) < 0;
}
inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; }
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
ha_rows limit, bool force_quick_range=0);
ha_rows limit, bool force_quick_range);
};

View File

@ -17,8 +17,6 @@
/* Procedures (functions with changes output of select) */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -19,8 +19,6 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -19,8 +19,6 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -48,8 +48,6 @@
new attribute.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -23,8 +23,6 @@
** - type set is out of optimization yet
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -2096,7 +2096,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
SYNOPSIS
open_normal_and_derived_tables
thd - thread handler
tables - list of tables for open&locking
tables - list of tables for open
RETURN
FALSE - ok

View File

@ -22,8 +22,6 @@
**
*****************************************************************************/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -23,8 +23,6 @@
needs something like 'ssh'.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -239,6 +239,8 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
offset--;
continue;
}
if (limit-- == 0)
break;
protocol->prepare_for_resend();
protocol->store(warning_level_names[err->level],
warning_level_length[err->level], system_charset_info);
@ -246,8 +248,6 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
protocol->store(err->msg, strlen(err->msg), system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
if (!--limit)
break;
}
send_eof(thd);
DBUG_RETURN(FALSE);

View File

@ -1094,7 +1094,7 @@ public:
volatile bool status,dead;
COPY_INFO info;
I_List<delayed_row> rows;
uint group_count;
ulong group_count;
TABLE_LIST table_list; // Argument
delayed_insert()
@ -1766,7 +1766,7 @@ static void free_delayed_insert_blobs(register TABLE *table)
bool delayed_insert::handle_inserts(void)
{
int error;
uint max_rows;
ulong max_rows;
bool using_ignore=0, using_bin_log=mysql_bin_log.is_open();
delayed_row *row;
DBUG_ENTER("handle_inserts");
@ -1785,11 +1785,11 @@ bool delayed_insert::handle_inserts(void)
}
thd.proc_info="insert";
max_rows=delayed_insert_limit;
max_rows= delayed_insert_limit;
if (thd.killed || table->s->version != refresh_version)
{
thd.killed= THD::KILL_CONNECTION;
max_rows= ~(uint)0; // Do as much as possible
max_rows= ~(ulong)0; // Do as much as possible
}
/*

View File

@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -28,8 +28,6 @@
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif

View File

@ -2747,7 +2747,7 @@ mysql_execute_command(THD *thd)
TABLE_LIST *select_tables= lex->query_tables;
if ((res= create_table_precheck(thd, select_tables, create_table)))
goto unsent_create_error;
goto end_with_restore_list;
#ifndef HAVE_READLINK
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
@ -2757,7 +2757,7 @@ mysql_execute_command(THD *thd)
create_table->table_name) ||
append_file_to_dir(thd, &lex->create_info.index_file_name,
create_table->table_name))
goto unsent_create_error;
goto end_with_restore_list;
#endif
/*
If we are using SET CHARSET without DEFAULT, add an implicit
@ -2787,8 +2787,8 @@ mysql_execute_command(THD *thd)
*/
if (wait_if_global_read_lock(thd, 0, 1))
{
res= -1;
goto unsent_create_error;
res= 1;
goto end_with_restore_list;
}
if (select_lex->item_list.elements) // With select
{
@ -2807,7 +2807,8 @@ mysql_execute_command(THD *thd)
unique_table(create_table, select_tables))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->table_name);
goto unsent_create_error1;
res= 1;
goto end_with_restart_wait;
}
/* If we create merge table, we have to test tables in merge, too */
if (lex->create_info.used_fields & HA_CREATE_USED_UNION)
@ -2820,7 +2821,8 @@ mysql_execute_command(THD *thd)
if (unique_table(tab, select_tables))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->table_name);
goto unsent_create_error1;
res= 1;
goto end_with_restart_wait;
}
}
}
@ -2863,15 +2865,8 @@ mysql_execute_command(THD *thd)
if (!res)
send_ok(thd);
}
/*
Release the protection against the global read lock and wake
everyone, who might want to set a global read lock.
*/
start_waiting_global_read_lock(thd);
lex->link_first_table_back(create_table, link_to_local);
break;
unsent_create_error1:
end_with_restart_wait:
/*
Release the protection against the global read lock and wake
everyone, who might want to set a global read lock.
@ -2879,9 +2874,9 @@ unsent_create_error1:
start_waiting_global_read_lock(thd);
/* put tables back for PS rexecuting */
unsent_create_error:
end_with_restore_list:
lex->link_first_table_back(create_table, link_to_local);
goto error;
break;
}
case SQLCOM_CREATE_INDEX:
DBUG_ASSERT(first_table == all_tables && first_table != 0);

View File

@ -84,7 +84,7 @@ static int send_file(THD *thd)
char fname[FN_REFLEN+1];
const char *errmsg = 0;
int old_timeout;
uint packet_len;
unsigned long packet_len;
char buf[IO_SIZE]; // It's safe to alloc this
DBUG_ENTER("send_file");

View File

@ -17,8 +17,6 @@
/* mysql_select and join optimization */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
@ -36,9 +34,6 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"index_merge"
};
const key_map key_map_empty(0);
const key_map key_map_full(~(uint)0);
static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
static bool make_join_statistics(JOIN *join, TABLE_LIST *leaves, COND *conds,
DYNAMIC_ARRAY *keyuse);
@ -88,7 +83,7 @@ static bool only_eq_ref_tables(JOIN *join, ORDER *order, table_map tables);
static void update_depend_map(JOIN *join);
static void update_depend_map(JOIN *join, ORDER *order);
static ORDER *remove_const(JOIN *join,ORDER *first_order,COND *cond,
bool *simple_order);
bool change_list, bool *simple_order);
static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
List<Item> &fields, bool send_row,
uint select_options, const char *info,
@ -749,7 +744,7 @@ JOIN::optimize()
/* Optimize distinct away if possible */
{
ORDER *org_order= order;
order=remove_const(this, order,conds,&simple_order);
order=remove_const(this, order,conds,1, &simple_order);
/*
If we are using ORDER BY NULL or ORDER BY const_expression,
return result in any order (even if we are using a GROUP BY)
@ -817,8 +812,9 @@ JOIN::optimize()
DBUG_RETURN(1);
}
simple_group= 0;
if (rollup.state == ROLLUP::STATE_NONE)
group_list= remove_const(this, group_list, conds, &simple_group);
group_list= remove_const(this, group_list, conds,
rollup.state == ROLLUP::STATE_NONE,
&simple_group);
if (!group_list && group)
{
order=0; // The output has only one row
@ -830,7 +826,7 @@ JOIN::optimize()
if (procedure && procedure->group)
{
group_list= procedure->group= remove_const(this, procedure->group, conds,
&simple_group);
1, &simple_group);
calc_group_buffer(this, group_list);
}
@ -2088,8 +2084,8 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
{
select->head=table;
table->reginfo.impossible_range=0;
if ((error=select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
limit)) == 1)
if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
limit, 0)) == 1)
DBUG_RETURN(select->quick->records);
if (error == -1)
{
@ -5091,7 +5087,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->select_cond=0;
join_tab->quick=0;
join_tab->type= JT_ALL; /* Map through all records */
join_tab->keys.init(~(uint)0); /* test everything in quick */
join_tab->keys.init();
join_tab->keys.set_all(); /* test everything in quick */
join_tab->info=0;
join_tab->on_expr_ref=0;
join_tab->last_inner= 0;
@ -5540,7 +5537,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
join->unit->select_limit_cnt)) < 0)
join->unit->select_limit_cnt), 0) < 0)
{
/*
Before reporting "Impossible WHERE" for the whole query
@ -5553,7 +5550,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
join->unit->select_limit_cnt)) < 0)
join->unit->select_limit_cnt),0) < 0)
DBUG_RETURN(1); // Impossible WHERE
}
else
@ -6122,20 +6119,39 @@ static void update_depend_map(JOIN *join, ORDER *order)
/*
simple_order is set to 1 if sort_order only uses fields from head table
and the head table is not a LEFT JOIN table
Remove all constants and check if ORDER only contains simple expressions
SYNOPSIS
remove_const()
join Join handler
first_order List of SORT or GROUP order
cond WHERE statement
change_list Set to 1 if we should remove things from list
If this is not set, then only simple_order is
calculated
simple_order Set to 1 if we are only using simple expressions
RETURN
Returns new sort order
simple_order is set to 1 if sort_order only uses fields from head table
and the head table is not a LEFT JOIN table
*/
static ORDER *
remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
remove_const(JOIN *join,ORDER *first_order, COND *cond,
bool change_list, bool *simple_order)
{
if (join->tables == join->const_tables)
return 0; // No need to sort
DBUG_ENTER("remove_const");
return change_list ? 0 : first_order; // No need to sort
ORDER *order,**prev_ptr;
table_map first_table= join->join_tab[join->const_tables].table->map;
table_map not_const_tables= ~join->const_table_map;
table_map ref;
DBUG_ENTER("remove_const");
prev_ptr= &first_order;
*simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1;
@ -6166,7 +6182,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
}
if ((ref=order_tables & (not_const_tables ^ first_table)))
{
if (!(order_tables & first_table) && only_eq_ref_tables(join,first_order,ref))
if (!(order_tables & first_table) &&
only_eq_ref_tables(join,first_order, ref))
{
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue;
@ -6175,11 +6192,13 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
}
}
}
*prev_ptr= order; // use this entry
if (change_list)
*prev_ptr= order; // use this entry
prev_ptr= &order->next;
}
*prev_ptr=0;
if (!first_order) // Nothing to sort/group
if (change_list)
*prev_ptr=0;
if (prev_ptr == &first_order) // Nothing to sort/group
*simple_order=1;
DBUG_PRINT("exit",("simple_order: %d",(int) *simple_order));
DBUG_RETURN(first_order);
@ -9829,7 +9848,7 @@ test_if_quick_select(JOIN_TAB *tab)
delete tab->select->quick;
tab->select->quick=0;
return tab->select->test_quick_select(tab->join->thd, tab->keys,
(table_map) 0, HA_POS_ERROR);
(table_map) 0, HA_POS_ERROR, 0);
}
@ -10865,12 +10884,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
parameres are set correctly by the range optimizer.
*/
key_map new_ref_key_map;
new_ref_key_map.clear_all(); /* Force the creation of quick select */
new_ref_key_map.set_bit(new_ref_key); /* only for new_ref_key. */
new_ref_key_map.clear_all(); // Force the creation of quick select
new_ref_key_map.set_bit(new_ref_key); // only for new_ref_key.
if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0,
(tab->join->select_options & OPTION_FOUND_ROWS) ?
HA_POS_ERROR : tab->join->unit->select_limit_cnt) <= 0)
(tab->join->select_options &
OPTION_FOUND_ROWS) ?
HA_POS_ERROR :
tab->join->unit->select_limit_cnt,0) <=
0)
DBUG_RETURN(0);
}
ref_key= new_ref_key;
@ -12528,6 +12550,8 @@ bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &send_fields,
for (uint i=0 ; i <= send_group_parts ;i++)
sum_funcs_end[i]= func;
}
else if (rollup.state == ROLLUP::STATE_READY)
DBUG_RETURN(FALSE); // Don't put end marker
*func=0; // End marker
DBUG_RETURN(FALSE);
}
@ -13070,12 +13094,12 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
This is an element that is used by the GROUP BY and should be
set to NULL in this level
*/
Item_null_result *null_item;
item->maybe_null= 1; // Value will be null sometimes
null_item= rollup.null_items[i];
DBUG_ASSERT(null_item->result_field == 0 ||
null_item->result_field ==
((Item_field *) item)->result_field);
null_item->result_field= ((Item_field *) item)->result_field;
null_item->result_field == item->get_tmp_table_field());
null_item->result_field= item->get_tmp_table_field();
item= null_item;
break;
}

View File

@ -16,12 +16,11 @@
/* This file is originally from the mysql distribution. Coded by monty */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>

View File

@ -346,7 +346,7 @@ int quick_rm_table(enum db_type base,const char *db,
build_table_path(path, sizeof(path), db, table_name, reg_ext);
if (my_delete(path,MYF(0)))
error=1; /* purecov: inspected */
build_table_path(path, sizeof(path), db, table_name, "");
*fn_ext(path)= 0; // Remove reg_ext
return ha_delete_table(current_thd, base, path, table_name, 0) || error;
}
@ -1556,7 +1556,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
char tmp_table_name[NAME_LEN+1];
char tmp_table_name[tmp_file_prefix_length+22+22+22+3];
my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x",
tmp_file_prefix, current_pid, thd->thread_id,
thd->tmp_table++);
@ -2909,7 +2909,7 @@ int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ?
table_list->alias : table_list->table_name,
reg_ext) != 0 ||
reg_ext) == 0 ||
mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file))
/* don't need to free((gptr) key_info_buffer);*/
@ -3010,7 +3010,7 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ?
table_list->alias : table_list->table_name,
reg_ext) != 0 ||
reg_ext) == 0 ||
mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file))
/*don't need to free((gptr) key_numbers);*/

View File

@ -28,10 +28,8 @@
dynamic functions, so this shouldn't be a real problem.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: implement sql_udf.h
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"

View File

@ -25,12 +25,11 @@
it creates unsolved link dependencies on some platforms.
*/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include <my_global.h>
#if !defined(TZINFO2SQL) && !defined(TESTTIME)
#include "mysql_priv.h"
#else

View File

@ -552,7 +552,7 @@ static uchar NEAR like_range_prefix_max_win1250ch[] = {
240, 242, 242, 245, 245, 245, 245, 247, 248, 251, 251, 251, 251, 253, 254, 255,
};
#define min_sort_char '\x00'
#define min_sort_char '\x20'
#define max_sort_char '\xff'
/*