3613 Marc Alff 2011-03-24 [merge]
Merge mysql-trunk --> mysql-trunk-stage
added:
mysql-test/include/not_crashrep.inc
modified:
client/mysqltest.cc
client/sql_string.cc
client/sql_string.h
include/my_global.h
mysql-test/collections/default.daily
mysql-test/collections/default.push
mysql-test/mysql-test-run.pl
mysql-test/r/innodb_mysql_lock2.result
mysql-test/r/partition.result
mysql-test/r/partition_explicit_prune.result
mysql-test/r/ps.result
mysql-test/suite/binlog/t/binlog_index.test
mysql-test/suite/binlog/t/rpl_crash_safe_master_checksum.test
mysql-test/suite/funcs_1/t/is_engines_innodb.test
mysql-test/suite/innodb/t/innodb_bug53756.test
mysql-test/suite/rpl/r/rpl_grant.result
mysql-test/suite/rpl/t/rpl_crash_safe_master.test
mysql-test/suite/rpl/t/rpl_grant.test
mysql-test/suite/rpl/t/rpl_sync.test
mysql-test/t/myisam_crash_before_flush_keys.test
mysql-test/t/ps.test
plugin/fulltext/plugin_example.c
sql/debug_sync.h
sql/field.cc
sql/field.h
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/ha_ndbcluster_cond.cc
sql/ha_ndbcluster_cond.h
sql/handler.cc
sql/handler.h
sql/hash_filo.cc
sql/hash_filo.h
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_cmpfunc.h
sql/item_func.cc
sql/item_func.h
sql/item_geofunc.cc
sql/item_geofunc.h
sql/item_strfunc.cc
sql/item_strfunc.h
sql/item_subselect.cc
sql/item_subselect.h
sql/item_sum.cc
sql/item_sum.h
sql/item_timefunc.cc
sql/item_timefunc.h
sql/log_event.cc
sql/log_event.h
sql/opt_range.cc
sql/opt_range.h
sql/partition_info.cc
sql/partition_info.h
sql/procedure.cc
sql/procedure.h
sql/protocol.cc
sql/protocol.h
sql/records.cc
sql/records.h
sql/scheduler.cc
sql/scheduler.h
sql/set_var.cc
sql/set_var.h
sql/sp_cache.cc
sql/sp_cache.h
sql/sp_head.cc
sql/sp_head.h
sql/sp_pcontext.cc
sql/sp_pcontext.h
sql/sp_rcontext.cc
sql/sp_rcontext.h
sql/sql_acl.cc
sql/sql_analyse.cc
sql/sql_analyse.h
sql/sql_class.cc
sql/sql_class.h
sql/sql_crypt.cc
sql/sql_crypt.h
sql/sql_cursor.cc
sql/sql_cursor.h
sql/sql_join_cache.cc
sql/sql_list.cc
sql/sql_list.h
sql/sql_select.cc
sql/sql_select.h
sql/sql_string.cc
sql/sql_string.h
sql/sql_udf.cc
sql/sql_udf.h
sql/transaction.cc
sql/transaction.h
sql/tztime.cc
sql/tztime.h
storage/archive/ha_archive.cc
storage/archive/ha_archive.h
storage/blackhole/ha_blackhole.cc
storage/blackhole/ha_blackhole.h
storage/csv/ha_tina.cc
storage/csv/transparent_file.cc
storage/example/ha_example.cc
storage/example/ha_example.h
storage/federated/ha_federated.cc
storage/federated/ha_federated.h
storage/heap/ha_heap.cc
storage/heap/ha_heap.h
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisammrg/ha_myisammrg.cc
storage/myisammrg/ha_myisammrg.h
storage/perfschema/ha_perfschema.h
strings/uctypedump.c
tests/mysql_client_test.c
3612 Marc Alff 2011-03-23
Follow up on code review.
Fixed tables:
- EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME
- EVENTS_STATEMENTS_SuMMARY_BY_THREAD_BY_EVENT_NAME
to follow the iteration pattern changed previously for table
- EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
Iteration per thread is in the outer most loop.
modified:
storage/perfschema/table_esgs_by_thread_by_event_name.cc
storage/perfschema/table_esgs_by_thread_by_event_name.h
storage/perfschema/table_esms_by_thread_by_event_name.cc
storage/perfschema/table_esms_by_thread_by_event_name.h
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2011-03-17 09:43:28 +0000
+++ b/client/mysqltest.cc 2011-03-22 15:40:32 +0000
@@ -8343,14 +8343,16 @@ int main(int argc, char **argv)
}
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
init_re();
+
+ /* Cursor protcol implies ps protocol */
+ if (cursor_protocol)
+ ps_protocol= 1;
+
ps_protocol_enabled= ps_protocol;
sp_protocol_enabled= sp_protocol;
view_protocol_enabled= view_protocol;
explain_protocol_enabled= explain_protocol;
cursor_protocol_enabled= cursor_protocol;
- /* Cursor protcol implies ps protocol */
- if (cursor_protocol_enabled)
- ps_protocol_enabled= 1;
st_connection *con= connections;
#ifdef EMBEDDED_LIBRARY
=== modified file 'client/sql_string.cc'
--- a/client/sql_string.cc 2011-03-09 20:54:55 +0000
+++ b/client/sql_string.cc 2011-03-22 11:44:40 +0000
@@ -15,10 +15,6 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
=== modified file 'client/sql_string.h'
--- a/client/sql_string.h 2011-03-09 20:54:55 +0000
+++ b/client/sql_string.h 2011-03-22 11:44:40 +0000
@@ -18,10 +18,6 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
class String;
int sortcmp(const String *a,const String *b, const CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2011-03-09 20:54:55 +0000
+++ b/include/my_global.h 2011-03-22 11:44:40 +0000
@@ -46,11 +46,6 @@
#define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */
-/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#define USE_PRAGMA_INTERFACE
-#endif
-
#if defined(__OpenBSD__) && (OpenBSD >= 200411)
#define HAVE_ERRNO_AS_DEFINE
#endif
=== modified file 'mysql-test/collections/default.daily'
--- a/mysql-test/collections/default.daily 2011-03-22 10:56:44 +0000
+++ b/mysql-test/collections/default.daily 2011-03-23 11:37:04 +0000
@@ -5,8 +5,6 @@ perl mysql-test-run.pl --force --timer
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol --skip-test-list=collections/disabled-daily.list
-perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
-perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1 --vardir=var-ps_funcs_1 --suite=funcs_1 --ps-protocol
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress
=== modified file 'mysql-test/collections/default.push'
--- a/mysql-test/collections/default.push 2011-02-21 13:56:58 +0000
+++ b/mysql-test/collections/default.push 2011-03-23 11:37:04 +0000
@@ -1,4 +1,3 @@
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list --unit-tests
perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_ps_row --vardir=var-main-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded --vardir=var-main_emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
=== added file 'mysql-test/include/not_crashrep.inc'
--- a/mysql-test/include/not_crashrep.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_crashrep.inc 2011-03-15 15:06:59 +0000
@@ -0,0 +1,24 @@
+# Check if CrashReporter is enabled and would open a window
+
+perl;
+sub skip_test {
+ # Only relevant on Mac OS X
+ return 0 unless $^O eq 'darwin';
+ my $crep= `defaults read com.apple.CrashReporter DialogType`;
+ return 0 if $?;
+ chomp ($crep);
+ $crep= lc $crep;
+ return ($crep eq 'basic' || $crep eq 'developer');
+}
+my $skip= skip_test();
+open (F, ">" . $ENV{'MYSQL_TMP_DIR'} . "/crashrep.inc");
+print F "let \$crashrep= $skip;\n";
+close F;
+EOF
+
+--source $MYSQL_TMP_DIR/crashrep.inc
+--remove_file $MYSQL_TMP_DIR/crashrep.inc
+
+if ($crashrep) {
+ --skip CrashReporter would popup a window
+}
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2011-03-17 11:33:17 +0000
+++ b/mysql-test/mysql-test-run.pl 2011-03-23 11:37:04 +0000
@@ -162,7 +162,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG
# If you add a new suite, please check TEST_DIRS in Makefile.am.
#
-my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,perfschema";
+my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,perfschema,funcs_1";
my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose
=== modified file 'mysql-test/r/innodb_mysql_lock2.result'
--- a/mysql-test/r/innodb_mysql_lock2.result 2010-07-19 16:09:51 +0000
+++ b/mysql-test/r/innodb_mysql_lock2.result 2011-03-23 09:52:24 +0000
@@ -605,11 +605,11 @@ begin;
# Acquire SR metadata lock on t1.
select * from t1;
i
+4
1
+5
2
3
-4
-5
# Switching to connection 'con1'.
# Sending:
alter table t1 rebuild partition p0;
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2011-03-11 09:58:45 +0000
+++ b/mysql-test/r/partition.result 2011-03-23 09:52:24 +0000
@@ -1776,9 +1776,9 @@ insert into t1 values (18446744073709551
(18446744073709551613), (18446744073709551612);
select * from t1;
a
+18446744073709551614
18446744073709551612
18446744073709551613
-18446744073709551614
18446744073709551615
select * from t1 where a = 18446744073709551615;
a
@@ -1786,9 +1786,9 @@ a
delete from t1 where a = 18446744073709551615;
select * from t1;
a
+18446744073709551614
18446744073709551612
18446744073709551613
-18446744073709551614
drop table t1;
CREATE TABLE t1 (
num int(11) NOT NULL, cs int(11) NOT NULL)
=== modified file 'mysql-test/r/partition_explicit_prune.result'
--- a/mysql-test/r/partition_explicit_prune.result 2011-02-01 11:38:39 +0000
+++ b/mysql-test/r/partition_explicit_prune.result 2011-03-23 09:52:24 +0000
@@ -332,12 +332,12 @@ ERROR 42000: You have an error in your S
SELECT * FROM t1 `PARTITION`;
a b
-2 (pNeg-)subp0
-5 p0-9:subp3
-10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
+5 p0-9:subp3
1 subp3
3 subp3
+10 p10-99
100 `p100-99999`(-subp6)
1000 `p100-99999`(-subp6)
101 `p100-99999`(-subp7)
@@ -346,12 +346,12 @@ ERROR 42000: You have an error in your S
SELECT * FROM t1 AS `PARTITION`;
a b
-2 (pNeg-)subp0
-5 p0-9:subp3
-10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
+5 p0-9:subp3
1 subp3
3 subp3
+10 p10-99
100 `p100-99999`(-subp6)
1000 `p100-99999`(-subp6)
101 `p100-99999`(-subp7)
@@ -536,10 +536,10 @@ HANDLER_WRITE 127
SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
a b
-2 (pNeg-)subp0
-10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
-21 REPLACEd by REPLACE
+10 p10-99
FLUSH STATUS;
SELECT * FROM t1 PARTITION (pNeg, `p10-99`) INTO OUTFILE 'loadtest.txt';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
@@ -576,7 +576,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND
VARIABLE_NAME VARIABLE_VALUE
HANDLER_EXTERNAL_LOCK 6
HANDLER_ROLLBACK 1
-HANDLER_WRITE 18
+HANDLER_WRITE 21
# 6 locks (1 ha_partiiton + 2 ha_innobase) x 2 (lock+unlock)
# 1 rollback
SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
@@ -950,12 +950,12 @@ SUBPARTITION BY HASH (a)
SELECT * FROM t1;
a b
-2 (pNeg-)subp0, Updated
-10 p10-99
+-222 `p100-99999`(-subp6), Updated from a = 100
-21 REPLACEd by REPLACE
1 subp3
3 subp3
+10 p10-99
1000 `p100-99999`(-subp6)
--222 `p100-99999`(-subp6), Updated from a = 100
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
SHOW CREATE TABLE t2;
Table Create Table
@@ -981,9 +981,9 @@ SUBPARTITION BY HASH (a)
SUBPARTITION subp7 ENGINE = InnoDB)) */
SELECT * FROM t2;
a b
-10 p10-99
1 subp3
3 subp3
+10 p10-99
1000 `p100-99999`(-subp6)
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
SHOW CREATE TABLE t3;
@@ -995,11 +995,11 @@ t3 CREATE TABLE `t3` (
SELECT * FROM t3;
a b
-2 (pNeg-)subp0, Updated
+-222 `p100-99999`(-subp6), Updated from a = 100
-21 REPLACEd by REPLACE
1 subp3
3 subp3
1000 `p100-99999`(-subp6)
--222 `p100-99999`(-subp6), Updated from a = 100
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
FLUSH STATUS;
DELETE t1 PARTITION (pNeg), t3 FROM t1, t3
=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result 2011-02-15 11:47:33 +0000
+++ b/mysql-test/r/ps.result 2011-03-22 12:06:52 +0000
@@ -3705,5 +3705,19 @@ CREATE TABLE t1 (a INT);
BEGIN;
PREPARE stmt1 FROM "SELECT * FROM t1";
DROP TABLE t1;
+
#
-# End of 6.0 tests.
+# Bug#56115: invalid memory reads when PS selecting from
+# information_schema tables
+# Bug#58701: crash in Field::make_field, cursor-protocol
+#
+# NOTE: MTR should be run both with --ps-protocol and --cursor-protocol.
+#
+
+SELECT *
+FROM (SELECT 1 UNION SELECT 2) t;
+1
+1
+2
+#
+# End of 5.5 tests.
=== modified file 'mysql-test/suite/binlog/t/binlog_index.test'
--- a/mysql-test/suite/binlog/t/binlog_index.test 2011-01-10 06:17:31 +0000
+++ b/mysql-test/suite/binlog/t/binlog_index.test 2011-03-15 15:17:13 +0000
@@ -6,6 +6,8 @@ source include/not_embedded.inc;
# Don't test this under valgrind, memory leaks will occur
--source include/not_valgrind.inc
source include/have_debug.inc;
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
=== modified file 'mysql-test/suite/binlog/t/rpl_crash_safe_master_checksum.test'
--- a/mysql-test/suite/binlog/t/rpl_crash_safe_master_checksum.test 2010-12-22 03:31:50 +0000
+++ b/mysql-test/suite/binlog/t/rpl_crash_safe_master_checksum.test 2011-03-15 15:17:13 +0000
@@ -13,6 +13,7 @@
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc
+-- source include/not_crashrep.inc
call mtr.add_suppression("Attempting backtrace");
call mtr.add_suppression("allocated tablespace *., old maximum was 0");
=== modified file 'mysql-test/suite/funcs_1/t/is_engines_innodb.test'
--- a/mysql-test/suite/funcs_1/t/is_engines_innodb.test 2008-03-07 19:18:14 +0000
+++ b/mysql-test/suite/funcs_1/t/is_engines_innodb.test 2011-03-23 11:37:04 +0000
@@ -8,6 +8,14 @@
# testsuite funcs_1
#
+# This test fails for embedded mode bug#11880671 - Myisam is default engine for embedded mode
+# Remove following condition when InnoDB is default engine in embedded mode
+if (`SELECT VERSION() LIKE '%embedded%'`)
+{
+ --skip Bug#11880671 - Myisam is default engine for embedded mode
+}
+
+
let $engine_type= InnoDB;
--source include/have_innodb.inc
--vertical_results
=== modified file 'mysql-test/suite/innodb/t/innodb_bug53756.test'
--- a/mysql-test/suite/innodb/t/innodb_bug53756.test 2011-02-10 08:58:23 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug53756.test 2011-03-15 15:11:17 +0000
@@ -17,6 +17,9 @@
# This test case needs InnoDB.
-- source include/have_innodb.inc
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+
#
# Precautionary clean up.
#
=== modified file 'mysql-test/suite/rpl/r/rpl_grant.result'
--- a/mysql-test/suite/rpl/r/rpl_grant.result 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_grant.result 2011-03-11 19:16:12 +0000
@@ -178,4 +178,9 @@ DROP FUNCTION b54866_f;
DROP TABLE test.t2;
DROP USER 'b54866_user'@'localhost';
DROP DATABASE b54866;
+include/rpl_reset.inc
+CREATE USER foo IDENTIFIED WITH 'my_plugin';
+ERROR HY000: Plugin 'my_plugin' is not loaded
+# Search for occurrences of CREATE USER in the output from mysqlbinlog
+- Occurrences: 0
include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_crash_safe_master.test'
--- a/mysql-test/suite/rpl/t/rpl_crash_safe_master.test 2011-02-15 08:25:14 +0000
+++ b/mysql-test/suite/rpl/t/rpl_crash_safe_master.test 2011-03-15 15:17:13 +0000
@@ -31,6 +31,7 @@
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc
+-- source include/not_crashrep.inc
# Reset master
connection slave;
=== modified file 'mysql-test/suite/rpl/t/rpl_grant.test'
--- a/mysql-test/suite/rpl/t/rpl_grant.test 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_grant.test 2011-03-11 19:16:12 +0000
@@ -242,4 +242,56 @@ DROP TABLE test.t2;
--eval DROP DATABASE $dbname
--sync_slave_with_master
+#
+# BUG#11827392: 60082: EVEN THOUGH IT FAILS, 'CREATE USER' STATEMENT SI STILL BINLOGGED.
+#
+
+#
+# The test case is based on the one included in the
+# original report. It works as follows:
+#
+# 1. We issue a failing statement on the master
+# 2. Then we synchronize the slave
+# - this asserts that there is no side-effect
+# on the replication stream
+# 3. We then dump the contents of the binlog and
+# search for the CREATE USER entry. There should
+# not be any, so we print the # of entries found.
+#
+
+--connection master
+--source include/rpl_reset.inc
+--connection master
+
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER foo IDENTIFIED WITH 'my_plugin';
+--sync_slave_with_master
+
+--connection master
+
+--disable_query_log
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $prefix=`SELECT UUID()`
+--let $out_file=$MYSQLTEST_VARDIR/tmp/$prefix.out
+--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$binlog_file > $out_file
+
+--let OUTF=$out_file
+
+--enable_query_log
+
+--echo # Search for occurrences of CREATE USER in the output from mysqlbinlog
+
+perl;
+ use strict;
+ my $outf= $ENV{'OUTF'} or die "OUTF not set";
+ open(FILE, "$outf") or die("Unable to open $outf: $!\n");
+ my $count = () = grep(/create user 'foo'/gi,<FILE>);
+ print "- Occurrences: $count\n";
+ close(FILE);
+EOF
+
+--remove_file $out_file
+
--source include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_sync.test'
--- a/mysql-test/suite/rpl/t/rpl_sync.test 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_sync.test 2011-03-15 15:17:13 +0000
@@ -32,6 +32,7 @@
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/not_master_info_table.inc
+--source include/not_crashrep.inc
call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
=== modified file 'mysql-test/t/myisam_crash_before_flush_keys.test'
--- a/mysql-test/t/myisam_crash_before_flush_keys.test 2009-11-25 12:25:01 +0000
+++ b/mysql-test/t/myisam_crash_before_flush_keys.test 2011-03-15 15:11:17 +0000
@@ -10,6 +10,8 @@
call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
let $MYSQLD_DATADIR= `select @@datadir`;
SET GLOBAL delay_key_write=ALL;
=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test 2011-02-15 11:47:33 +0000
+++ b/mysql-test/t/ps.test 2011-03-22 12:06:52 +0000
@@ -3310,7 +3310,21 @@ connection default;
DROP TABLE t1;
disconnect con1;
+--echo
--echo #
---echo # End of 6.0 tests.
+--echo # Bug#56115: invalid memory reads when PS selecting from
+--echo # information_schema tables
+--echo # Bug#58701: crash in Field::make_field, cursor-protocol
+--echo #
+--echo # NOTE: MTR should be run both with --ps-protocol and --cursor-protocol.
+--echo #
+--echo
+
+SELECT *
+FROM (SELECT 1 UNION SELECT 2) t;
+
+
+--echo #
+--echo # End of 5.5 tests.
###########################################################################
=== modified file 'plugin/fulltext/plugin_example.c'
--- a/plugin/fulltext/plugin_example.c 2007-04-26 19:26:04 +0000
+++ b/plugin/fulltext/plugin_example.c 2011-03-21 15:54:40 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -259,7 +259,7 @@ mysql_declare_plugin(ftexample)
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
"simple_parser", /* name */
- "MySQL AB", /* author */
+ "Oracle Corp", /* author */
"Simple Full-Text Parser", /* description */
PLUGIN_LICENSE_GPL,
simple_parser_plugin_init, /* init function (when loaded) */
=== modified file 'sql/debug_sync.h'
--- a/sql/debug_sync.h 2010-07-02 02:58:51 +0000
+++ b/sql/debug_sync.h 2011-03-22 11:44:40 +0000
@@ -22,10 +22,6 @@
Declarations for the Debug Sync Facility. See debug_sync.cc for details.
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <my_global.h>
class THD;
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-03-17 09:43:28 +0000
+++ b/sql/field.cc 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
This file implements classes defined in field.h
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_select.h"
#include "rpl_rli.h" // Pull in Relay_log_info
=== modified file 'sql/field.h'
--- a/sql/field.h 2011-03-09 20:54:55 +0000
+++ b/sql/field.h 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "mysqld.h" /* system_charset_info */
#include "table.h" /* TABLE */
#include "sql_string.h" /* String */
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-11-18 16:34:56 +0000
+++ b/sql/ha_ndbcluster.cc 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
MySQL and NDB Cluster
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_table.h" // build_table_filename,
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2010-07-13 17:29:44 +0000
+++ b/sql/ha_ndbcluster.h 2011-03-22 11:44:40 +0000
@@ -23,10 +23,6 @@
/* The class defining a handle to an NDB Cluster table */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/* Blob tables and events are internal to NDB and must never be accessed */
#define IS_NDB_BLOB_PREFIX(A) is_prefix(A, "NDB$BLOB")
=== modified file 'sql/ha_ndbcluster_cond.cc'
--- a/sql/ha_ndbcluster_cond.cc 2011-02-21 11:33:20 +0000
+++ b/sql/ha_ndbcluster_cond.cc 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
This file defines the NDB Cluster handler engine_condition_pushdown
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_class.h" // set_var.h: THD
#include "my_global.h" // WITH_*
=== modified file 'sql/ha_ndbcluster_cond.h'
--- a/sql/ha_ndbcluster_cond.h 2010-07-13 17:29:44 +0000
+++ b/sql/ha_ndbcluster_cond.h 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
the NDB Cluster handler
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/*
It is necessary to include set_var.h instead of item.h because there
are dependencies on include order for set_var.h and item.h. This
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-03-08 19:14:42 +0000
+++ b/sql/handler.cc 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
Handler-calling-functions
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h"
#include "rpl_handler.h"
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-03-09 20:54:55 +0000
+++ b/sql/handler.h 2011-03-22 11:44:40 +0000
@@ -18,10 +18,6 @@
/* Definitions for parameters to do with handler-routines */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_const.h"
#include "mysqld.h" /* server_id */
#include "sql_plugin.h" /* plugin_ref, st_plugin_int, plugin */
=== modified file 'sql/hash_filo.cc'
--- a/sql/hash_filo.cc 2010-07-02 18:15:21 +0000
+++ b/sql/hash_filo.cc 2011-03-22 11:44:40 +0000
@@ -19,9 +19,5 @@
** to usage.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "hash_filo.h"
=== modified file 'sql/hash_filo.h'
--- a/sql/hash_filo.h 2010-07-02 02:58:51 +0000
+++ b/sql/hash_filo.h 2011-03-22 11:44:40 +0000
@@ -22,10 +22,6 @@
#ifndef HASH_FILO_H
#define HASH_FILO_H
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class interface */
-#endif
-
#include "hash.h" /* my_hash_get_key, my_hash_free_key, HASH */
#include "m_string.h" /* bzero */
#include "mysqld.h" /* key_hash_filo_lock */
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2011-03-17 09:47:50 +0000
+++ b/sql/item.cc 2011-03-22 11:44:40 +0000
@@ -14,9 +14,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
=== modified file 'sql/item.h'
--- a/sql/item.h 2011-03-17 09:47:50 +0000
+++ b/sql/item.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_priv.h" /* STRING_BUFFER_USUAL_SIZE */
#include "unireg.h"
#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-03-17 11:33:17 +0000
+++ b/sql/item_cmpfunc.cc 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
This file defines all compare functions
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include <m_ctype.h>
#include "sql_select.h"
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2011-03-09 20:54:55 +0000
+++ b/sql/item_cmpfunc.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* compare and test functions */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "thr_malloc.h" /* sql_calloc */
#include "item_func.h" /* Item_int_func, Item_bool_func */
#include "my_regex.h"
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-03-17 17:39:31 +0000
+++ b/sql/item_func.cc 2011-03-24 08:00:03 +0000
@@ -20,10 +20,6 @@
This file defines all numerical functions
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
/*
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2011-03-17 11:48:04 +0000
+++ b/sql/item_func.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* Function items used by mysql */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#ifdef HAVE_IEEEFP_H
extern "C" /* Bug in BSDI include file */
{
=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc 2010-10-28 09:54:31 +0000
+++ b/sql/item_geofunc.cc 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
This file defines all spatial functions
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
/*
It is necessary to include set_var.h instead of item.h because there
=== modified file 'sql/item_geofunc.h'
--- a/sql/item_geofunc.h 2011-03-08 19:14:42 +0000
+++ b/sql/item_geofunc.h 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
#ifdef HAVE_SPATIAL
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "gcalc_slicescan.h"
class Item_geometry_func: public Item_str_func
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2011-03-10 08:23:14 +0000
+++ b/sql/item_strfunc.cc 2011-03-22 11:44:40 +0000
@@ -25,10 +25,6 @@
(This shouldn't be needed)
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
/* May include caustic 3rd-party defs. Use early, so it can override nothing. */
#include "sha2.h"
#include "my_global.h" // HAVE_*
=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h 2011-03-10 08:23:14 +0000
+++ b/sql/item_strfunc.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* This file defines all string functions */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
class MY_LOCALE;
class Item_str_func :public Item_func
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc 2011-03-17 09:47:50 +0000
+++ b/sql/item_subselect.cc 2011-03-22 11:44:40 +0000
@@ -24,10 +24,6 @@
methods (sql_select.h/sql_select.cc)
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
/*
It is necessary to include set_var.h instead of item.h because there
=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h 2011-03-17 07:40:26 +0000
+++ b/sql/item_subselect.h 2011-03-22 11:44:40 +0000
@@ -18,10 +18,6 @@
/* subselect Item */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
class st_select_lex;
class st_select_lex_unit;
class JOIN;
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2011-03-17 09:47:50 +0000
+++ b/sql/item_sum.cc 2011-03-22 11:44:40 +0000
@@ -21,10 +21,6 @@
Sum functions (COUNT, MIN...)
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_select.h"
=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h 2011-03-09 20:54:55 +0000
+++ b/sql/item_sum.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* classes for sum functions */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <my_tree.h>
#include "sql_udf.h" /* udf_handler */
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2011-03-17 11:11:39 +0000
+++ b/sql/item_timefunc.cc 2011-03-22 11:44:40 +0000
@@ -24,10 +24,6 @@
Move month and days to language files
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
/*
It is necessary to include set_var.h instead of item.h because there
=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h 2011-03-11 09:35:38 +0000
+++ b/sql/item_timefunc.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* Function items used by mysql */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
class MY_LOCALE;
enum date_time_format_types
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-03-17 17:39:31 +0000
+++ b/sql/log_event.cc 2011-03-24 08:00:03 +0000
@@ -20,10 +20,6 @@
#else
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h"
#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2011-03-14 17:55:26 +0000
+++ b/sql/log_event.h 2011-03-22 11:44:40 +0000
@@ -28,10 +28,6 @@
#ifndef _log_event_h
#define _log_event_h
-#if defined(USE_PRAGMA_INTERFACE) && defined(MYSQL_SERVER)
-#pragma interface /* gcc class implementation */
-#endif
-
#include <my_bitmap.h>
#include "rpl_constants.h"
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2011-03-17 11:48:04 +0000
+++ b/sql/opt_range.cc 2011-03-22 11:44:40 +0000
@@ -103,10 +103,6 @@
subject and may omit some details.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "key.h" // is_key_used, key_copy, key_cmp, key_restore
#include "sql_parse.h" // check_stack_overrun
@@ -1179,7 +1175,9 @@ QUICK_SELECT_I::QUICK_SELECT_I()
QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
bool no_alloc, MEM_ROOT *parent_alloc,
bool *create_error)
- :free_file(0),cur_range(NULL),last_range(0),dont_free(0)
+ :free_file(0), cur_range(NULL), last_range(0),
+ mrr_flags(0), mrr_buf_size(0), mrr_buf_desc(NULL),
+ dont_free(0)
{
my_bitmap_map *bitmap;
DBUG_ENTER("QUICK_RANGE_SELECT::QUICK_RANGE_SELECT");
@@ -1192,7 +1190,6 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(T
/* 'thd' is not accessible in QUICK_RANGE_SELECT::reset(). */
mrr_buf_size= thd->variables.read_rnd_buff_size;
- mrr_buf_desc= NULL;
if (!no_alloc && !parent_alloc)
{
@@ -1220,17 +1217,12 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(T
}
-void QUICK_RANGE_SELECT::need_sorted_output()
+void QUICK_RANGE_SELECT::need_sorted_output(bool sort)
{
- if (!(mrr_flags & HA_MRR_SORTED))
- {
- /*
- Native implementation can't produce sorted output. We'll have to
- switch to default
- */
- mrr_flags |= HA_MRR_USE_DEFAULT_IMPL;
- }
- mrr_flags |= HA_MRR_SORTED;
+ if (sort)
+ mrr_flags |= HA_MRR_SORTED;
+ else
+ mrr_flags &= ~HA_MRR_SORTED;
}
@@ -8714,7 +8706,8 @@ int QUICK_RANGE_SELECT::reset()
{
if (in_ror_merged_scan)
head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap);
- if ((error= file->ha_index_init(index,1)))
+ const bool sorted= (mrr_flags & HA_MRR_SORTED);
+ if ((error= file->ha_index_init(index, sorted)))
DBUG_RETURN(error);
}
@@ -8989,10 +8982,11 @@ int QUICK_RANGE_SELECT::get_next_prefix(
last_range->make_min_endpoint(&start_key, prefix_length, keypart_map);
last_range->make_max_endpoint(&end_key, prefix_length, keypart_map);
+ const bool sorted= (mrr_flags & HA_MRR_SORTED);
result= file->read_range_first(last_range->min_keypart_map ? &start_key : 0,
last_range->max_keypart_map ? &end_key : 0,
test(last_range->flag & EQ_RANGE),
- TRUE);
+ sorted);
if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
last_range= 0; // Stop searching
@@ -9104,6 +9098,7 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUI
*/
mrr_buf_desc= NULL;
mrr_flags |= HA_MRR_USE_DEFAULT_IMPL;
+ mrr_flags |= HA_MRR_SORTED; // 'sorted' as internals use index_last/_prev
mrr_buf_size= 0;
@@ -10584,12 +10579,20 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *par
if (quick_prefix_records == HA_POS_ERROR)
quick->quick_prefix_select= NULL; /* Can't construct a quick select. */
else
+ {
/* Make a QUICK_RANGE_SELECT to be used for group prefix retrieval. */
quick->quick_prefix_select= get_quick_select(param, param_idx,
index_tree,
- HA_MRR_USE_DEFAULT_IMPL, 0,
+ HA_MRR_USE_DEFAULT_IMPL |
+ HA_MRR_SORTED,
+ 0,
&quick->alloc);
-
+ if (!quick->quick_prefix_select)
+ {
+ delete quick;
+ DBUG_RETURN(NULL);
+ }
+ }
/*
Extract the SEL_ARG subtree that contains only ranges for the MIN/MAX
attribute, and create an array of QUICK_RANGES to be used by the
@@ -10985,7 +10988,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(vo
DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::reset");
head->set_keyread(TRUE); /* We need only the key attributes */
- if ((result= file->ha_index_init(index,1)))
+ /*
+ Request ordered index access as usage of ::index_last(),
+ ::index_first() within QUICK_GROUP_MIN_MAX_SELECT depends on it.
+ */
+ if ((result= file->ha_index_init(index, true)))
DBUG_RETURN(result);
if (quick_prefix_select && quick_prefix_select->reset())
DBUG_RETURN(1);
=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h 2010-12-17 12:58:04 +0000
+++ b/sql/opt_range.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
#ifndef _opt_range_h
#define _opt_range_h
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "thr_malloc.h" /* sql_memdup */
#include "records.h" /* READ_RECORD */
#include "queues.h" /* QUEUE */
@@ -285,11 +281,15 @@ public:
virtual bool clustered_pk_range() { return false; }
/*
- Request that this quick select produces sorted output. Not all quick
- selects can do it, the caller is responsible for calling this function
- only for those quick selects that can.
+ Request that this quick select produces sorted output if 'sort==true'.
+ Not all quick selects can provide sorted output, the caller is responsible
+ for calling this function only for those quick selects that can.
+ Caller is allowed to later cancel its sorted request by setting
+ 'sort==false'. However, the implementation is allowed to provide sorted
+ output even in this case if benificial, or required by implementation
+ internals.
*/
- virtual void need_sorted_output() = 0;
+ virtual void need_sorted_output(bool sort) = 0;
enum {
QS_TYPE_RANGE = 0,
QS_TYPE_INDEX_MERGE = 1,
@@ -399,7 +399,7 @@ uint quick_range_seq_next(range_seq_t rs
/*
Quick select that does a range scan on a single key. The records are
- returned in key order.
+ returned in key order if ::need_sorted_output(true) has been called.
*/
class QUICK_RANGE_SELECT : public QUICK_SELECT_I
{
@@ -465,7 +465,7 @@ public:
MEM_ROOT *parent_alloc, bool *create_error);
~QUICK_RANGE_SELECT();
- void need_sorted_output();
+ void need_sorted_output(bool sort);
int init();
int reset(void);
int get_next();
@@ -569,7 +569,7 @@ public:
~QUICK_INDEX_MERGE_SELECT();
int init();
- void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ }
+ void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
bool reverse_sorted() { return false; }
@@ -647,7 +647,7 @@ public:
~QUICK_ROR_INTERSECT_SELECT();
int init();
- void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ }
+ void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
bool reverse_sorted() { return false; }
@@ -718,7 +718,7 @@ public:
~QUICK_ROR_UNION_SELECT();
int init();
- void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ }
+ void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
bool reverse_sorted() { return false; }
@@ -860,7 +860,7 @@ public:
void adjust_prefix_ranges();
bool alloc_buffers();
int init();
- void need_sorted_output() { /* always do it */ }
+ void need_sorted_output(bool sort) { /* always do it */ }
int reset();
int get_next();
bool reverse_sorted() { return false; }
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2011-02-09 22:35:46 +0000
+++ b/sql/partition_info.cc 2011-03-22 11:44:40 +0000
@@ -15,10 +15,6 @@
/* Some general useful functions */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
-
#include "sql_priv.h"
// Required to get server definitions for mysql/plugin.h right
#include "sql_plugin.h"
=== modified file 'sql/partition_info.h'
--- a/sql/partition_info.h 2011-02-09 22:35:46 +0000
+++ b/sql/partition_info.h 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "partition_element.h"
class partition_info;
=== modified file 'sql/procedure.cc'
--- a/sql/procedure.cc 2010-07-02 18:15:21 +0000
+++ b/sql/procedure.cc 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
/* Procedures (functions with changes output of select) */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "procedure.h"
#include "sql_analyse.h" // Includes procedure
=== modified file 'sql/procedure.h'
--- a/sql/procedure.h 2011-03-09 20:54:55 +0000
+++ b/sql/procedure.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* When using sql procedures */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/*
It is necessary to include set_var.h instead of item.h because there
are dependencies on include order for set_var.h and item.h. This
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc 2011-03-09 20:54:55 +0000
+++ b/sql/protocol.cc 2011-03-22 11:44:40 +0000
@@ -20,10 +20,6 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "protocol.h"
=== modified file 'sql/protocol.h'
--- a/sql/protocol.h 2011-03-09 20:54:55 +0000
+++ b/sql/protocol.h 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_error.h"
#include "my_decimal.h" /* my_decimal */
=== modified file 'sql/records.cc'
--- a/sql/records.cc 2010-11-23 11:04:47 +0000
+++ b/sql/records.cc 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma implementation /* gcc class implementation */
-#endif
-
/**
@file
=== modified file 'sql/records.h'
--- a/sql/records.h 2010-07-13 17:29:44 +0000
+++ b/sql/records.h 2011-03-22 11:44:40 +0000
@@ -15,9 +15,6 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
#include <my_global.h> /* for uint typedefs */
struct st_join_table;
=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc 2010-09-01 13:05:01 +0000
+++ b/sql/scheduler.cc 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
Implementation for the thread scheduler
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma implementation
-#endif
-
#include <sql_priv.h>
#include "unireg.h" // REQUIRED: for other includes
#include "scheduler.h"
=== modified file 'sql/scheduler.h'
--- a/sql/scheduler.h 2010-10-08 12:57:46 +0000
+++ b/sql/scheduler.h 2011-03-22 11:44:40 +0000
@@ -20,10 +20,6 @@
Classes for the thread scheduler
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface
-#endif
-
class THD;
/* Functions used when manipulating threads */
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2011-03-15 13:03:22 +0000
+++ b/sql/set_var.cc 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
-
/* variable declarations are in sys_vars.cc now !!! */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2011-03-09 20:54:55 +0000
+++ b/sql/set_var.h 2011-03-22 11:44:40 +0000
@@ -20,10 +20,6 @@
"public" interface to sys_var - server configuration variables.
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <my_getopt.h>
class sys_var;
=== modified file 'sql/sp_cache.cc'
--- a/sql/sp_cache.cc 2010-07-02 02:58:51 +0000
+++ b/sql/sp_cache.cc 2011-03-22 11:44:40 +0000
@@ -15,9 +15,6 @@
#include "sql_priv.h"
#include "unireg.h"
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
#include "sp_cache.h"
#include "sp_head.h"
=== modified file 'sql/sp_cache.h'
--- a/sql/sp_cache.h 2010-07-02 18:15:21 +0000
+++ b/sql/sp_cache.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
#ifndef _SP_CACHE_H_
#define _SP_CACHE_H_
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "my_global.h" /* ulong */
/*
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-03-09 20:54:55 +0000
+++ b/sql/sp_head.cc 2011-03-22 11:44:40 +0000
@@ -27,9 +27,6 @@
#include "sql_array.h" // Dynamic_array
#include "log_event.h" // append_query_string, Query_log_event
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
#include "sp_head.h"
#include "sp.h"
#include "sp_pcontext.h"
=== modified file 'sql/sp_head.h'
--- a/sql/sp_head.h 2011-03-09 20:54:55 +0000
+++ b/sql/sp_head.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
#ifndef _SP_HEAD_H_
#define _SP_HEAD_H_
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/*
It is necessary to include set_var.h instead of item.h because there
are dependencies on include order for set_var.h and item.h. This
=== modified file 'sql/sp_pcontext.cc'
--- a/sql/sp_pcontext.cc 2010-11-05 22:14:29 +0000
+++ b/sql/sp_pcontext.cc 2011-03-22 11:44:40 +0000
@@ -15,10 +15,6 @@
#include "sql_priv.h"
#include "unireg.h"
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
-
#include "sp_pcontext.h"
#include "sp_head.h"
=== modified file 'sql/sp_pcontext.h'
--- a/sql/sp_pcontext.h 2010-11-05 22:14:29 +0000
+++ b/sql/sp_pcontext.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
#ifndef _SP_PCONTEXT_H_
#define _SP_PCONTEXT_H_
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_string.h" // LEX_STRING
#include "mysql_com.h" // enum_field_types
#include "field.h" // Create_field
=== modified file 'sql/sp_rcontext.cc'
--- a/sql/sp_rcontext.cc 2010-07-30 15:30:30 +0000
+++ b/sql/sp_rcontext.cc 2011-03-22 11:44:40 +0000
@@ -15,10 +15,6 @@
#include "sql_priv.h"
#include "unireg.h"
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
-#endif
-
#include "mysql.h"
#include "sp_head.h"
#include "sql_cursor.h"
=== modified file 'sql/sp_rcontext.h'
--- a/sql/sp_rcontext.h 2010-11-13 15:11:39 +0000
+++ b/sql/sp_rcontext.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
#ifndef _SP_RCONTEXT_H_
#define _SP_RCONTEXT_H_
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_class.h" // select_result_interceptor
struct sp_cond_type;
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2011-03-18 14:58:27 +0000
+++ b/sql/sql_acl.cc 2011-03-23 22:51:19 +0000
@@ -6513,12 +6513,14 @@ bool mysql_create_user(THD *thd, List <L
continue;
}
- some_users_created= TRUE;
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0))
{
append_user(&wrong_users, user_name, wrong_users.length() > 0);
result= TRUE;
+ continue;
}
+
+ some_users_created= TRUE;
}
mysql_mutex_unlock(&acl_cache->lock);
=== modified file 'sql/sql_analyse.cc'
--- a/sql/sql_analyse.cc 2011-03-14 18:11:41 +0000
+++ b/sql/sql_analyse.cc 2011-03-22 11:44:40 +0000
@@ -22,10 +22,6 @@
** - type set is out of optimization yet
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#define MYSQL_LEX 1
#include "sql_priv.h"
=== modified file 'sql/sql_analyse.h'
--- a/sql/sql_analyse.h 2010-07-02 18:15:21 +0000
+++ b/sql/sql_analyse.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* Analyse database */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "procedure.h" /* Procedure */
#define my_thd_charset default_charset_info
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-03-17 17:39:31 +0000
+++ b/sql/sql_class.cc 2011-03-24 08:00:03 +0000
@@ -21,10 +21,6 @@
**
*****************************************************************************/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-03-17 17:39:31 +0000
+++ b/sql/sql_class.h 2011-03-24 08:00:03 +0000
@@ -18,10 +18,6 @@
/* Classes in mysql */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#ifdef MYSQL_SERVER
#include "unireg.h" // REQUIRED: for other includes
=== modified file 'sql/sql_crypt.cc'
--- a/sql/sql_crypt.cc 2010-07-02 18:15:21 +0000
+++ b/sql/sql_crypt.cc 2011-03-22 11:44:40 +0000
@@ -22,10 +22,6 @@
needs something like 'ssh'.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_crypt.h"
#include "password.h"
=== modified file 'sql/sql_crypt.h'
--- a/sql/sql_crypt.h 2010-07-02 18:15:21 +0000
+++ b/sql/sql_crypt.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "sql_list.h" /* Sql_alloc */
#include "mysql_com.h" /* rand_struct */
=== modified file 'sql/sql_cursor.cc'
--- a/sql/sql_cursor.cc 2011-02-15 17:14:15 +0000
+++ b/sql/sql_cursor.cc 2011-03-24 08:00:03 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation /* gcc class implementation */
-#endif
-
#include "sql_priv.h"
#include "unireg.h"
#include "sql_cursor.h"
@@ -47,7 +43,7 @@ class Materialized_cursor: public Server
public:
Materialized_cursor(select_result *result, TABLE *table);
- int fill_item_list(THD *thd, List<Item> &send_result_set_metadata);
+ int send_result_set_metadata(THD *thd, List<Item> &send_result_set_metadata);
virtual bool is_open() const { return table != 0; }
virtual int open(JOIN *join __attribute__((unused)));
virtual void fetch(ulong num_rows);
@@ -138,7 +134,13 @@ int mysql_open_cursor(THD *thd, select_r
if (rc)
{
if (result_materialize->materialized_cursor)
+ {
+ /* Rollback metadata in the client-server protocol. */
+ result_materialize->abort_result_set();
+
delete result_materialize->materialized_cursor;
+ }
+
goto end;
}
@@ -147,6 +149,12 @@ int mysql_open_cursor(THD *thd, select_r
Materialized_cursor *materialized_cursor=
result_materialize->materialized_cursor;
+ /*
+ NOTE: close_thread_tables() has been called in
+ mysql_execute_command(), so all tables except from the cursor
+ temporary table have been closed.
+ */
+
if ((rc= materialized_cursor->open(0)))
{
delete materialized_cursor;
@@ -207,14 +215,16 @@ Materialized_cursor::Materialized_cursor
/**
- Preserve the original metadata that would be sent to the client.
+ Preserve the original metadata to be sent to the client.
+ Initiate sending of the original metadata to the client
+ (call Protocol::send_result_set_metadata()).
@param thd Thread identifier.
@param send_result_set_metadata List of fields that would be sent.
*/
-int Materialized_cursor::fill_item_list(THD *thd,
- List<Item> &send_result_set_metadata)
+int Materialized_cursor::send_result_set_metadata(
+ THD *thd, List<Item> &send_result_set_metadata)
{
Query_arena backup_arena;
int rc;
@@ -246,6 +256,14 @@ int Materialized_cursor::fill_item_list(
ident->db_name= thd->strdup(send_field.db_name);
ident->table_name= thd->strdup(send_field.table_name);
}
+
+ /*
+ Original metadata result set should be sent here. After
+ mysql_execute_command() is finished, item_list can not be used for
+ sending metadata, because it references closed table.
+ */
+ rc= result->send_result_set_metadata(item_list, Protocol::SEND_NUM_ROWS);
+
end:
thd->restore_active_arena(this, &backup_arena);
/* Check for thd->is_error() in case of OOM */
@@ -258,31 +276,29 @@ int Materialized_cursor::open(JOIN *join
THD *thd= fake_unit.thd;
int rc;
Query_arena backup_arena;
+
thd->set_n_backup_active_arena(this, &backup_arena);
- /* Create a list of fields and start sequential scan */
+
+ /* Create a list of fields and start sequential scan. */
+
rc= result->prepare(item_list, &fake_unit);
- if (!rc && !(rc= table->file->ha_rnd_init(TRUE)))
- is_rnd_inited= 1;
+ rc= !rc && table->file->ha_rnd_init(TRUE);
+ is_rnd_inited= !rc;
thd->restore_active_arena(this, &backup_arena);
- if (rc == 0)
- {
- /*
- Now send the result set metadata to the client. We need to
- do it here, as in Select_materialize::send_result_set_metadata the items
- for column types are not yet created (send_result_set_metadata requires
- a list of items). The new types may differ from the original
- ones sent at prepare if some of them were altered by MySQL
- HEAP tables mechanism -- used when create_tmp_field_from_item
- may alter the original column type.
- We can't simply supply SEND_EOF flag to send_result_set_metadata, because
- send_result_set_metadata doesn't flush the network buffer.
- */
- rc= result->send_result_set_metadata(item_list, Protocol::SEND_NUM_ROWS);
+ /* Commit or rollback metadata in the client-server protocol. */
+
+ if (!rc)
+ {
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
result->send_eof();
}
+ else
+ {
+ result->abort_result_set();
+ }
+
return rc;
}
@@ -377,13 +393,14 @@ bool Select_materialize::send_result_set
materialized_cursor= new (&table->mem_root)
Materialized_cursor(result, table);
- if (! materialized_cursor)
+ if (!materialized_cursor)
{
free_tmp_table(table->in_use, table);
table= 0;
return TRUE;
}
- if (materialized_cursor->fill_item_list(unit->thd, list))
+
+ if (materialized_cursor->send_result_set_metadata(unit->thd, list))
{
delete materialized_cursor;
table= 0;
=== modified file 'sql/sql_cursor.h'
--- a/sql/sql_cursor.h 2010-07-27 15:01:56 +0000
+++ b/sql/sql_cursor.h 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
#ifndef _sql_cursor_h_
#define _sql_cursor_h_
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class interface */
-#endif
-
#include "sql_class.h" /* Query_arena */
class JOIN;
=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc 2010-09-02 07:34:10 +0000
+++ b/sql/sql_join_cache.cc 2011-03-22 11:44:40 +0000
@@ -23,10 +23,6 @@
@{
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_select.h"
#include "key.h"
=== modified file 'sql/sql_list.cc'
--- a/sql/sql_list.cc 2010-07-02 18:15:21 +0000
+++ b/sql/sql_list.cc 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "unireg.h"
#include "sql_list.h"
=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h 2010-07-16 21:00:50 +0000
+++ b/sql/sql_list.h 2011-03-22 11:44:40 +0000
@@ -20,10 +20,6 @@
#include "m_string.h" /* for TRASH */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
void *sql_alloc(size_t);
#include "my_sys.h" /* alloc_root, TRASH, MY_WME,
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-03-17 17:39:31 +0000
+++ b/sql/sql_select.cc 2011-03-24 08:00:03 +0000
@@ -24,10 +24,6 @@
@{
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h"
#include "sql_select.h"
@@ -1467,7 +1463,7 @@ bool setup_semijoin_dups_elimination(JOI
output is not supported.
*/
if (tab->select && tab->select->quick)
- tab->select->quick->need_sorted_output();
+ tab->select->quick->need_sorted_output(true);
/* Calculate key length */
keylen= 0;
@@ -2743,6 +2739,23 @@ JOIN::save_join_tab()
/**
+ There may be a pending 'sorted' request on the specified
+ 'join_tab' which we now has decided we can ignore.
+*/
+static void
+disable_sorted_access(JOIN_TAB* join_tab)
+{
+ DBUG_ENTER("disable_sorted_access");
+ join_tab->sorted= 0;
+ if (join_tab->select && join_tab->select->quick)
+ {
+ join_tab->select->quick->need_sorted_output(false);
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
Exec select.
@todo
@@ -2922,7 +2935,7 @@ JOIN::exec()
curr_join->const_tables != curr_join->tables &&
curr_join->best_positions[curr_join->const_tables].sj_strategy
!= SJ_OPT_LOOSE_SCAN)
- curr_join->join_tab[curr_join->const_tables].sorted= 0;
+ disable_sorted_access(&curr_join->join_tab[curr_join->const_tables]);
if ((tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0)))
{
error= tmp_error;
@@ -3088,7 +3101,7 @@ JOIN::exec()
curr_join->group_list= 0;
if (!curr_join->sort_and_group &&
curr_join->const_tables != curr_join->tables)
- curr_join->join_tab[curr_join->const_tables].sorted= 0;
+ disable_sorted_access(&curr_join->join_tab[curr_join->const_tables]);
if (setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) ||
(tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table,
0)))
@@ -11177,9 +11190,12 @@ make_join_readinfo(JOIN *join, ulonglong
{
uint i, jcl;
bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
- bool sorted= 1;
uint first_sjm_table= MAX_TABLES;
uint last_sjm_table= MAX_TABLES;
+
+ /* First table sorted if ORDER or GROUP BY was specified */
+ bool sorted= (join->order || join->group_list);
+
DBUG_ENTER("make_join_readinfo");
if (setup_semijoin_dups_elimination(join, options, no_jbuf_after))
@@ -11196,12 +11212,8 @@ make_join_readinfo(JOIN *join, ulonglong
tab->next_select=sub_select; /* normal select */
tab->use_join_cache= JOIN_CACHE::ALG_NONE;
tab->cache_idx_cond= 0;
- /*
- TODO: don't always instruct first table's ref/range access method to
- produce sorted output.
- */
tab->sorted= sorted;
- sorted= 0; // only first must be sorted
+ sorted= false; // only first must be sorted
table->status=STATUS_NO_RECORD;
pick_table_access_method (tab);
@@ -18181,6 +18193,7 @@ join_read_key2(JOIN_TAB *tab, TABLE *tab
int error;
if (!table->file->inited)
{
+ DBUG_ASSERT(!tab->sorted); // Don't expect sort req. for single row.
table->file->ha_index_init(table_ref->key, tab->sorted);
}
@@ -18490,7 +18503,7 @@ join_read_last(JOIN_TAB *tab)
tab->read_record.index=tab->index;
tab->read_record.record=table->record[0];
if (!table->file->inited)
- table->file->ha_index_init(tab->index, 1);
+ table->file->ha_index_init(tab->index, tab->sorted);
if ((error= tab->table->file->ha_index_last(tab->table->record[0])))
return report_error(table, error);
return 0;
@@ -18514,7 +18527,7 @@ join_ft_read_first(JOIN_TAB *tab)
TABLE *table= tab->table;
if (!table->file->inited)
- table->file->ha_index_init(tab->ref.key, 1);
+ table->file->ha_index_init(tab->ref.key, tab->sorted);
table->file->ft_init();
if ((error= table->file->ft_read(table->record[0])))
@@ -20292,7 +20305,7 @@ check_reverse_order:
}
}
else if (select && select->quick)
- select->quick->need_sorted_output();
+ select->quick->need_sorted_output(true);
} // QEP has been modified
@@ -23199,9 +23212,22 @@ void select_describe(JOIN *join, bool ne
if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE &&
!(((QUICK_RANGE_SELECT*)(tab->select->quick))->mrr_flags &
- HA_MRR_USE_DEFAULT_IMPL))
+ (HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED)))
{
- extra.append(STRING_WITH_LEN("; Using MRR"));
+ /*
+ During normal execution of a query, multi_range_read_init() is
+ called to initialize MRR. If HA_MRR_SORTED is set at this point,
+ multi_range_read_init() for any native MRR implementation will
+ revert to default MRR because they cannot produce sorted output
+ currently.
+ Calling multi_range_read_init() can potentially be costly, so it
+ is not done when executing an EXPLAIN. We therefore make the
+ assumption that HA_MRR_SORTED means no MRR. If some MRR native
+ implementation will support sorted output in the future, a
+ function "bool mrr_supports_sorted()" should be added in the
+ handler.
+ */
+ extra.append(STRING_WITH_LEN("; Using MRR"));
}
if (need_tmp_table)
{
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2011-03-17 09:43:28 +0000
+++ b/sql/sql_select.h 2011-03-22 11:44:40 +0000
@@ -24,10 +24,6 @@
classes to use when handling where clause
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "procedure.h"
#include <myisam.h>
#include "sql_array.h" /* Array */
=== modified file 'sql/sql_string.cc'
--- a/sql/sql_string.cc 2011-03-09 20:54:55 +0000
+++ b/sql/sql_string.cc 2011-03-22 11:44:40 +0000
@@ -15,10 +15,6 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h 2011-03-09 20:54:55 +0000
+++ b/sql/sql_string.h 2011-03-22 11:44:40 +0000
@@ -18,10 +18,6 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "m_ctype.h" /* my_charset_bin */
#include "my_sys.h" /* alloc_root, my_free, my_realloc */
#include "m_string.h" /* TRASH */
=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc 2011-01-10 16:27:45 +0000
+++ b/sql/sql_udf.cc 2011-03-22 11:44:40 +0000
@@ -27,10 +27,6 @@
dynamic functions, so this shouldn't be a real problem.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "unireg.h"
#include "sql_base.h" // close_mysql_tables
=== modified file 'sql/sql_udf.h'
--- a/sql/sql_udf.h 2010-07-02 18:15:21 +0000
+++ b/sql/sql_udf.h 2011-03-22 11:44:40 +0000
@@ -19,10 +19,6 @@
/* This file defines structures needed by udf functions */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface
-#endif
-
enum Item_udftype {UDFTYPE_FUNCTION=1,UDFTYPE_AGGREGATE};
typedef void (*Udf_func_clear)(UDF_INIT *, uchar *, uchar *);
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2011-02-14 14:15:28 +0000
+++ b/sql/transaction.cc 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "transaction.h"
#include "rpl_handler.h"
=== modified file 'sql/transaction.h'
--- a/sql/transaction.h 2010-07-02 02:58:51 +0000
+++ b/sql/transaction.h 2011-03-22 11:44:40 +0000
@@ -16,10 +16,6 @@
#ifndef TRANSACTION_H
#define TRANSACTION_H
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <my_global.h>
#include <m_string.h>
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc 2010-10-02 19:12:58 +0000
+++ b/sql/tztime.cc 2011-03-22 11:44:40 +0000
@@ -24,10 +24,6 @@
it creates unsolved link dependencies on some platforms.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include <my_global.h>
#if !defined(TZINFO2SQL) && !defined(TESTTIME)
#include "sql_priv.h"
=== modified file 'sql/tztime.h'
--- a/sql/tztime.h 2010-07-02 18:15:21 +0000
+++ b/sql/tztime.h 2011-03-22 11:44:40 +0000
@@ -17,10 +17,6 @@
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class interface */
-#endif
-
#include "my_time.h" /* my_time_t */
#include "mysql_time.h" /* MYSQL_TIME */
#include "sql_list.h" /* Sql_alloc */
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2011-03-03 09:22:17 +0000
+++ b/storage/archive/ha_archive.cc 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h" // SSV
=== modified file 'storage/archive/ha_archive.h'
--- a/storage/archive/ha_archive.h 2011-03-08 09:21:39 +0000
+++ b/storage/archive/ha_archive.h 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <zlib.h>
#include "azlib.h"
=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc 2010-10-06 14:34:28 +0000
+++ b/storage/blackhole/ha_blackhole.cc 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#define MYSQL_SERVER 1
#include "sql_priv.h"
#include "unireg.h"
=== modified file 'storage/blackhole/ha_blackhole.h'
--- a/storage/blackhole/ha_blackhole.h 2010-10-06 14:34:28 +0000
+++ b/storage/blackhole/ha_blackhole.h 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "thr_lock.h" /* THR_LOCK */
#include "handler.h" /* handler */
#include "table.h" /* TABLE_SHARE */
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc 2010-07-29 12:33:56 +0000
+++ b/storage/csv/ha_tina.cc 2011-03-22 11:44:40 +0000
@@ -41,10 +41,6 @@ TODO:
-Brian
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "my_global.h"
#include "sql_priv.h"
#include "sql_class.h" // SSV
=== modified file 'storage/csv/transparent_file.cc'
--- a/storage/csv/transparent_file.cc 2010-07-08 21:20:08 +0000
+++ b/storage/csv/transparent_file.cc 2011-03-22 11:44:40 +0000
@@ -13,10 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include <mysql/psi/mysql_file.h>
#include "transparent_file.h"
=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc 2010-10-06 14:34:28 +0000
+++ b/storage/example/ha_example.cc 2011-03-22 11:44:40 +0000
@@ -87,10 +87,6 @@
-Brian
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "sql_priv.h"
#include "sql_class.h" // MYSQL_HANDLERTON_INTERFACE_VERSION
#include "ha_example.h"
=== modified file 'storage/example/ha_example.h'
--- a/storage/example/ha_example.h 2010-10-07 12:47:15 +0000
+++ b/storage/example/ha_example.h 2011-03-22 11:44:40 +0000
@@ -31,10 +31,6 @@
/sql/handler.h and /storage/example/ha_example.cc
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "my_global.h" /* ulonglong */
#include "thr_lock.h" /* THR_LOCK, THR_LOCK_DATA */
#include "handler.h" /* handler */
=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc 2010-11-05 22:14:29 +0000
+++ b/storage/federated/ha_federated.cc 2011-03-22 11:44:40 +0000
@@ -378,10 +378,6 @@
#include "sql_analyse.h" // append_escaped
#include <mysql/plugin.h>
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include "ha_federated.h"
#include "probes_mysql.h"
=== modified file 'storage/federated/ha_federated.h'
--- a/storage/federated/ha_federated.h 2011-03-08 08:41:57 +0000
+++ b/storage/federated/ha_federated.h 2011-03-22 11:44:40 +0000
@@ -20,10 +20,6 @@
that you can implement.
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include <mysql.h>
/*
=== modified file 'storage/heap/ha_heap.cc'
--- a/storage/heap/ha_heap.cc 2010-10-06 14:34:28 +0000
+++ b/storage/heap/ha_heap.cc 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#define MYSQL_SERVER 1
#include "sql_priv.h"
#include "probes_mysql.h"
=== modified file 'storage/heap/ha_heap.h'
--- a/storage/heap/ha_heap.h 2010-10-06 14:34:28 +0000
+++ b/storage/heap/ha_heap.h 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/* class for the the heap handler */
#include <heap.h>
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2011-03-17 11:33:17 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2011-03-22 11:44:40 +0000
@@ -29,10 +29,6 @@ You should have received a copy of the G
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#include <sql_table.h> // explain_filename, nz2, EXPLAIN_PARTITIONS_AS_COMMENT,
// EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h 2010-10-27 14:46:44 +0000
+++ b/storage/innobase/handler/ha_innodb.h 2011-03-22 11:44:40 +0000
@@ -23,10 +23,6 @@ Place, Suite 330, Boston, MA 02111-1307
Innodb
*/
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
#include "dict0stats.h"
/* Structure defines translation table between mysql index and innodb
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2011-03-08 09:21:39 +0000
+++ b/storage/myisam/ha_myisam.cc 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#define MYSQL_SERVER 1
#include "sql_priv.h"
#include "probes_mysql.h"
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h 2010-10-21 11:34:17 +0000
+++ b/storage/myisam/ha_myisam.h 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/* class for the the myisam handler */
#include <myisam.h>
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2010-10-20 19:02:59 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2011-03-22 11:44:40 +0000
@@ -85,10 +85,6 @@
They stay with the open table until its final close.
*/
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
#define MYSQL_SERVER 1
#include "sql_priv.h"
#include "unireg.h"
=== modified file 'storage/myisammrg/ha_myisammrg.h'
--- a/storage/myisammrg/ha_myisammrg.h 2010-10-06 14:34:28 +0000
+++ b/storage/myisammrg/ha_myisammrg.h 2011-03-22 11:44:40 +0000
@@ -14,10 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/* class for the the myisam merge handler */
#include <myisammrg.h>
=== modified file 'storage/perfschema/ha_perfschema.h'
--- a/storage/perfschema/ha_perfschema.h 2010-12-01 18:46:51 +0000
+++ b/storage/perfschema/ha_perfschema.h 2011-03-22 11:44:40 +0000
@@ -18,10 +18,6 @@
#include "handler.h" /* class handler */
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
/**
@file storage/perfschema/ha_perfschema.h
Performance schema storage engine (declarations).
=== modified file 'strings/uctypedump.c'
--- a/strings/uctypedump.c 2011-01-19 13:17:52 +0000
+++ b/strings/uctypedump.c 2011-03-23 12:14:17 +0000
@@ -21,7 +21,6 @@
#include <my_global.h>
#include <m_string.h>
#include <m_ctype.h>
-#include "m_ctype.h"
typedef struct my_ctype_name_st
@@ -86,156 +85,466 @@ ctypestr2num(const char *tok)
}
-int main(int ac, char ** av)
+#define MAX_CHAR 0x10FFFF
+#define MAX_DECOMPOSITION_LENGTH 2
+
+
+typedef struct
{
- char str[1024];
- unsigned char ctypea[64*1024];
- size_t i;
- size_t plane;
- MY_UNI_CTYPE uctype[256];
- FILE *f= stdin;
+ uint code;
+ char *name;
+ char general_category[3];
+ int combining_class;
+ int bidirectional_category;
+ uint decomposition_mapping[MAX_DECOMPOSITION_LENGTH];
+ uint decimal_digit_value; /* 0-9 */
+ uint digit_value; /* 0-9 */
+ char *numeric_value; /* Examples: 0, 1, 10, 100, 1000, 1/2, 5/2 */
+ my_bool mirrored; /* Y or N */
+ char *unicode_1_0_name;
+ char *iso10646_comment_field;
+ uint uppercase_mapping;
+ uint lowercase_mapping;
+ uint titlecase_mapping;
+
+ int mysql_ctype; /* ctype in MySQL format */
+
+} MY_UNIDATA_CHAR;
+
+
+typedef struct
+{
+ int maxchar;
+ int debug;
+ int ctype;
+ int decomp;
+ const char *fname;
+ const char *varname;
+} MY_UNIDATA_PARAM;
+
- if (ac > 1 && av[1] && !(f= fopen(av[1],"r")))
+
+static void
+unidata_param_init(MY_UNIDATA_PARAM *p)
+{
+ p->maxchar= MAX_CHAR;
+ p->debug= 0;
+ p->ctype= 1;
+ p->decomp= 1;
+ p->fname= NULL;
+ p->varname= "";
+}
+
+
+static void
+load_unidata(MY_UNIDATA_PARAM *prm, MY_UNIDATA_CHAR *chr)
+{
+ char str[1024];
+ FILE *f= prm->fname ? fopen(prm->fname, "r") : stdin;
+ if (!f)
{
- fprintf(stderr, "Can't open file %s\n", av[1]);
+ fprintf(stderr, "Can't open file %s\n", prm->fname);
exit(1);
}
- bzero(&ctypea,sizeof(ctypea));
- bzero(&uctype, sizeof(uctype));
-
- printf("/*\n");
- printf(" Unicode ctype data\n");
- printf(" Generated from %s\n", av[1] ? av[1] : "stdin");
- printf("*/\n");
-
- while(fgets(str, sizeof(str), f))
+
+ while (fgets(str, sizeof(str), f))
{
- size_t n= 0, code= 0;
- char *s,*e;
- int ctype= 0;
-
- for(s= str; s; )
+ size_t n;
+ char *s, *e;
+ MY_UNIDATA_CHAR ch;
+ bzero(&ch, sizeof(ch));
+
+ for(n= 0, s= str; s; n++)
{
- char *end;
- char tok[1024]="";
- e=strchr(s,';');
- if(e)
+ char *end, tok[1024]= "";
+
+ if((e= strchr(s, ';')))
{
- strncpy(tok,s,(unsigned int)(e-s));
- tok[e-s]=0;
+ strncpy(tok, s, (unsigned int) (e - s));
+ tok[e - s]= 0;
}
else
{
- strcpy(tok,s);
+ strcpy(tok, s);
}
-
- end=tok+strlen(tok);
-
+
+ end= tok + strlen(tok);
+
switch(n)
{
- case 0: code= strtol(tok,&end,16);break;
- case 2: ctype= ctypestr2num(tok);break;
+ case 0: ch.code= strtol(tok, &end, 16); break;
+ case 1: break; /* Character name */
+ case 2: /* General category */
+ ch.general_category[0]= tok[0];
+ ch.general_category[1]= tok[1];
+ ch.general_category[2]= '\0';
+ ch.mysql_ctype= ctypestr2num(tok);
+ break;
+
+ case 3: /* Canonical Combining Class */
+ ch.combining_class= atoi(tok);
+ /*
+ if (ch.combining_class)
+ printf("YYY[%04X]=%d\n", ch.code, ch.combining_class);
+ */
+ break;
+ case 4: break; /* Bidirectional Category */
+ case 5: /* Character Decomposition Mapping */
+ if (*tok != '<')
+ {
+ size_t i;
+ char *dec, *endptr;
+ for (dec= strtok_r(tok, " \t", &endptr), i= 0;
+ dec;
+ dec= strtok_r(NULL, " \t", &endptr), i++)
+ {
+ if (i >= MAX_DECOMPOSITION_LENGTH)
+ {
+ fprintf(stderr, "Decomposition length is too long for character %04X\n", ch.code);
+ exit(1);
+ }
+ ch.decomposition_mapping[i]= strtol(dec, NULL, 16);
+ }
+ }
+ break;
+
+ case 6: /* Decimal digit value */
+ ch.decimal_digit_value= atoi(tok);
+ break;
+
+ case 7: /* Digit value */
+ ch.digit_value= atoi(tok);
+ break;
+
+ case 8: /* Numeric value */
+ break;
+
+ case 9: break; /* Mirrored */
+ case 10: break; /* Unicode 1.0 Name */
+ case 11: break; /* 10646 comment field */
+ case 12: break; /* Uppercase */
+ case 13: break; /* Lowecase */
+ case 14: break; /* Titlecase */
}
-
- n++;
- if(e) s=e+1;
- else s=e;
- }
- if(code<=0xFFFF)
- {
- ctypea[code]= ctype;
+ s= e ? e + 1 : e;
}
+ if(ch.code <= prm->maxchar)
+ chr[ch.code]= ch;
}
-
+}
+
+
+static void
+unidata_char_set_cjk(MY_UNIDATA_CHAR *unidata, int max_char, int cur_char)
+{
+ if (cur_char < max_char)
+ {
+ MY_UNIDATA_CHAR *ch= &unidata[cur_char];
+ ch->mysql_ctype= _MY_L | _MY_U;
+ strcpy(ch->general_category, "Lo");
+ }
+}
+
+
+static void
+fill_implicit_ctype(MY_UNIDATA_PARAM *prm, MY_UNIDATA_CHAR *unidata)
+{
+ int i;
/* Fill digits */
for (i= '0'; i <= '9'; i++)
- ctypea[i]= _MY_NMR;
-
+ unidata[i].mysql_ctype= _MY_NMR;
+ /* Fill hex digits */
for (i= 'a'; i <= 'z'; i++)
- ctypea[i]|= _MY_X;
+ unidata[i].mysql_ctype|= _MY_X;
for (i= 'A'; i <= 'Z'; i++)
- ctypea[i]|= _MY_X;
-
-
+ unidata[i].mysql_ctype|= _MY_X;
+
/* Fill ideographs */
-
/* CJK Ideographs Extension A (U+3400 - U+4DB5) */
- for(i=0x3400;i<=0x4DB5;i++)
- {
- ctypea[i]= _MY_L | _MY_U;
- }
-
+ for(i= 0x3400; i <= 0x4DB5; i++)
+ unidata_char_set_cjk(unidata, prm->maxchar, i);
+
/* CJK Ideographs (U+4E00 - U+9FA5) */
- for(i=0x4E00;i<=0x9FA5;i++){
- ctypea[i]= _MY_L | _MY_U;
- }
-
+ for(i= 0x4E00; i <= 0x9FA5; i++) /* 9FCB in 5.2.0 */
+ unidata_char_set_cjk(unidata, prm->maxchar, i);
+
/* Hangul Syllables (U+AC00 - U+D7A3) */
- for(i=0xAC00;i<=0xD7A3;i++)
+ for(i= 0xAC00; i <= 0xD7A3; i++)
+ unidata_char_set_cjk(unidata, prm->maxchar, i);
+
+ /*
+ 20000;<CJK Ideograph Extension B, First>;Lo;0;L;;;;;N;;;;;
+ 2A6D6;<CJK Ideograph Extension B, Last>;Lo;0;L;;;;;N;;;;;
+ */
+ for (i= 0x20000; i <= 0x2A6D6; i++)
+ unidata_char_set_cjk(unidata, prm->maxchar, i);
+
+ /*
+ 2A700;<CJK Ideograph Extension C, First>;Lo;0;L;;;;;N;;;;;
+ 2B734;<CJK Ideograph Extension C, Last>;Lo;0;L;;;;;N;;;;;
+ */
+ for (i= 0x2A700; i <= 0x2B734; i++)
+ unidata_char_set_cjk(unidata, prm->maxchar, i);
+
+
+ /*
+ TODO:
+ D800;<Non Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
+ DB7F;<Non Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+ DB80;<Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
+ DBFF;<Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+ DC00;<Low Surrogate, First>;Cs;0;L;;;;;N;;;;;
+ DFFF;<Low Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+
+ E000;<Private Use, First>;Co;0;L;;;;;N;;;;;
+ F8FF;<Private Use, Last>;Co;0;L;;;;;N;;;;;
+ F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;N;;;;;
+ FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N;;;;;
+ 100000;<Plane 16 Private Use, First>;Co;0;L;;;;;N;;;;;
+ 10FFFD;<Plane 16 Private Use, Last>;Co;0;L;;;;;N;;;;;0
+ */
+}
+
+
+/*
+ Check if ctype for the entire page consisting of "nchars"
+ characters is the same.
+ Return -1 otherwise.
+*/
+static int
+page_ctype(MY_UNIDATA_CHAR *data, size_t nchars)
+{
+ size_t i;
+ for (i= 1; i < nchars; i++)
{
- ctypea[i]= _MY_L | _MY_U;
+ if (data[i].mysql_ctype != data->mysql_ctype)
+ return -1;
}
-
-
- /* Calc plane parameters */
- for(plane=0;plane<256;plane++)
+ return data->mysql_ctype;
+}
+
+
+static void
+dump_ctype(MY_UNIDATA_PARAM *prm, MY_UNIDATA_CHAR *unidata)
+{
+ int page, max_page= (prm->maxchar + 255) / 256;
+
+ printf("/*\n");
+ printf(" Unicode ctype data\n");
+ printf(" Generated from %s\n", prm->fname ? prm->fname : "stdin");
+ printf("*/\n");
+
+ /* Dump planes with mixed ctype */
+ for(page= 0; page < max_page; page++)
{
- size_t character;
- uctype[plane].ctype= ctypea+plane*256;
-
- uctype[plane].pctype= uctype[plane].ctype[0];
- for(character=1;character<256;character++)
+ if (page_ctype(unidata + page * 256, 256) < 0)
{
- if (uctype[plane].ctype[character] != uctype[plane].pctype)
+ size_t charnum, num;
+ printf("static unsigned char uctype%s_page%02X[256]=\n{\n",
+ prm->varname, page);
+ for(num= 0, charnum=0; charnum < 256; charnum++)
{
- uctype[plane].pctype= 0; /* Mixed plane */
- break;
+ printf(" %2d%s", unidata[page * 256 + charnum].mysql_ctype,
+ charnum < 255 ? "," : "");
+ if(++num == 16)
+ {
+ printf("\n");
+ num= 0;
+ }
}
+ printf("};\n\n");
}
- if (character==256) /* All the same, no needs to dump whole plane */
- uctype[plane].ctype= NULL;
}
-
- /* Dump mixed planes */
- for(plane=0;plane<256;plane++)
+
+ /* Dump ctype page index */
+ printf("MY_UNI_CTYPE my_uni_ctype%s[%d]={\n", prm->varname, max_page);
+ for(page= 0; page < max_page; page++)
{
- if(uctype[plane].ctype)
+ char page_name[128]="NULL";
+ int ctype;
+ if ((ctype= page_ctype(unidata + page * 256, 256)) < 0)
{
- int charnum=0;
- int num=0;
-
- printf("static unsigned char uctype_page%02X[256]=\n{\n",plane);
-
- for(charnum=0;charnum<256;charnum++)
+ sprintf(page_name,"uctype%s_page%02X", prm->varname, page);
+ ctype= 0;
+ }
+ printf("\t{%d,%s}%s\n", ctype, page_name, page < max_page - 1 ? "," : "");
+ }
+ printf("};\n\n\n");
+}
+
+
+/*
+static int
+decomposition_length(MY_UNIDATA_CHAR *ch)
+{
+ if (ch->decomposition_mapping[1])
+ return 2;
+ if (ch->decomposition_mapping[0])
+ return 1;
+ return 0;
+}
+*/
+
+static void
+dump_decomposition_page(MY_UNIDATA_PARAM *prm, MY_UNIDATA_CHAR *unidata,
+ uint pageno, uint nchars)
+{
+ uint i, ofs= pageno * 256;
+ printf("static MY_UNI_DECOMPOSITION decomp%s_p%02X[256]= {\n",
+ prm->varname, pageno);
+ for (i= 0; i < nchars; i++)
+ {
+ MY_UNIDATA_CHAR *ch= &unidata[ofs + i];
+
+ printf("/* %04X */ {0x%04X,0x%04X},",
+ ofs + i, ch->decomposition_mapping[0], ch->decomposition_mapping[1]);
+
+ if (ch->decomposition_mapping[0])
+ printf(" %s/* [%s-%s][%d-%d] */",
+ ch->decomposition_mapping[0] < 0x10000 ? " " : "",
+ unidata[ch->decomposition_mapping[0]].general_category,
+ unidata[ch->decomposition_mapping[1]].general_category,
+ unidata[ch->decomposition_mapping[0]].combining_class,
+ unidata[ch->decomposition_mapping[1]].combining_class);
+ printf("\n");
+ }
+ printf("};\n\n\n");
+}
+
+
+static size_t
+calc_decompositions(MY_UNIDATA_CHAR *unidata, size_t nchars)
+{
+ size_t i, n;
+ for (n= i= 0; i < nchars; i++)
+ {
+ if (unidata[i].decomposition_mapping[0])
+ n++;
+ }
+ return n;
+}
+
+
+static void
+dump_decomposition(MY_UNIDATA_PARAM *prm, MY_UNIDATA_CHAR *unidata)
+{
+ int i, npages= (prm->maxchar + 255) / 256;
+
+ printf("/*\n");
+ printf(" Unicode canonical decomposition data\n");
+ printf(" Generated from %s\n", prm->fname ? prm->fname : "stdin");
+ printf("*/\n");
+
+ /* Dump pages */
+ for (i= 0; i < npages; i++)
+ {
+ MY_UNIDATA_CHAR *page= unidata + i * 256;
+ if (calc_decompositions(page, 256))
+ dump_decomposition_page(prm, unidata, i, 256);
+ }
+
+ /* Dump decompositions */
+ printf("static MY_UNI_DECOMPOSITION *my_uni_decomp%s[%d]=\n{\n",
+ prm->varname, npages);
+ for (i= 0; i < npages; i++)
+ {
+ MY_UNIDATA_CHAR *page= unidata + i * 256;
+ if (calc_decompositions(page, 256))
+ printf("decom%s_p%02X,", prm->varname, i);
+ else
+ printf("NULL,");
+ if ((i % 8) == 7)
+ printf("\n");
+ }
+ printf("};\n");
+}
+
+
+static void
+usage(FILE *f, int rc)
+{
+ exit(rc);
+}
+
+
+static int
+get_int_option(const char *str, const char *name, int *num)
+{
+ size_t namelen= strlen(name);
+ if (!strncmp(str, name, namelen))
+ {
+ const char *val= str + namelen;
+ if (val[0] == '0' && val[1] == 'x')
+ {
+ *num= strtol(val, NULL, 16);
+ }
+ else
+ {
+ *num= atoi(val);
+ if (*num == 0 && *val !='0')
{
- int cod;
-
- cod=(plane<<8)+charnum;
- printf(" %2d%s",uctype[plane].ctype[charnum],charnum<255?",":"");
-
- num++;
- if(num==16)
- {
- printf("\n");
- num=0;
- }
+ fprintf(stderr, "\nBad numeric option value: %s\n\n", str);
+ usage(stderr, 1);
}
- printf("};\n\n");
}
+ return 1;
}
-
-
- /* Dump plane index */
- printf("MY_UNI_CTYPE my_uni_ctype[256]={\n");
- for(plane=0;plane<256;plane++)
- {
- char plane_name[128]="NULL";
- if(uctype[plane].ctype){
- sprintf(plane_name,"uctype_page%02X",plane);
+ return 0;
+}
+
+
+static int
+get_const_str_option(const char *str, const char *name, const char **val)
+{
+ size_t namelen= strlen(name);
+ if (!strncmp(str, name, namelen))
+ {
+ *val= str + namelen;
+ return 1;
+ }
+ return 0;
+}
+
+
+static void
+process_options(MY_UNIDATA_PARAM *prm, int ac, char **av)
+{
+ int i;
+ unidata_param_init(prm);
+ for (i= 1; i < ac ; i++)
+ {
+ /* printf("[%d]=%s\n", i, av[i]); */
+ if (av[i][0] != '-' || av[i][1] != '-')
+ break;
+ if (!get_const_str_option(av[i], "--name=", &prm->varname) &&
+ !get_int_option(av[i], "--maxchar=", &prm->maxchar) &&
+ !get_int_option(av[i], "--ctype=", &prm->ctype) &&
+ !get_int_option(av[i], "--decomp=", &prm->decomp) &&
+ !get_int_option(av[i], "--debug=", &prm->debug))
+ {
+ fprintf(stderr, "\nUnknown option: %s\n\n", av[i]);
+ usage(stderr, 1);
}
- printf("\t{%d,%s}%s\n",uctype[plane].pctype,plane_name,plane<255?",":"");
}
- printf("};\n");
-
+ prm->fname= av[i];
+}
+
+
+int main(int ac, char ** av)
+{
+ MY_UNIDATA_PARAM prm;
+ static MY_UNIDATA_CHAR unidata[MAX_CHAR + 1];
+
+ process_options(&prm, ac, av);
+ bzero(unidata, sizeof(unidata));
+ fill_implicit_ctype(&prm, unidata);
+ load_unidata(&prm, unidata);
+
+ if (prm.ctype)
+ dump_ctype(&prm, unidata);
+
+ if (prm.decomp)
+ dump_decomposition(&prm, unidata);
+
return 0;
}
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2011-03-17 14:06:30 +0000
+++ b/tests/mysql_client_test.c 2011-03-22 12:06:52 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15700,8 +15700,11 @@ static void test_bug13488()
check_execute(stmt1, rc);
if (!opt_silent)
- printf("data is: %s", (f1 == 1 && f2 == 1 && f3 == 2)?"OK":
- "wrong");
+ {
+ printf("data: f1: %d; f2: %d; f3: %d\n", f1, f2, f3);
+ printf("data is: %s\n",
+ (f1 == 1 && f2 == 1 && f3 == 2) ? "OK" : "wrong");
+ }
DIE_UNLESS(f1 == 1 && f2 == 1 && f3 == 2);
rc= mysql_query(mysql, "drop table t1, t2");
myquery(rc);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (marc.alff:3612 to 3613) | Marc Alff | 24 Mar |