diff options
244 files changed, 2469 insertions, 22235 deletions
diff --git a/cmake/configure.pl b/cmake/configure.pl index 1dc8080810c..b24afa034c7 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -185,6 +185,11 @@ foreach my $option (@ARGV) ($option =~ /enable/ ? "1" : "0"); next; } + if ($option =~ /with-comment=/) + { + $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index fcc1a2054b1..19a8a61df2d 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -86,7 +86,7 @@ IF(UNIX) SET(CMAKE_INSTALL_PREFIX ${default_prefix} CACHE PATH "install prefix" FORCE) ENDIF() - SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR5") + SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4") LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind) IF(ind EQUAL -1) MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." diff --git a/include/mysql/client_plugin.h b/include/mysql/client_plugin.h index d9c0dd02008..cc3f468040f 100644 --- a/include/mysql/client_plugin.h +++ b/include/mysql/client_plugin.h @@ -79,8 +79,7 @@ struct st_mysql_client_plugin_AUTHENTICATION /** loads a plugin and initializes it - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting + @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded, -1 to disable type check @param argc number of arguments to pass to the plugin initialization @@ -100,8 +99,7 @@ mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, This is the same as mysql_load_plugin, but take va_list instead of a list of arguments. - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting + @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded, -1 to disable type check @param argc number of arguments to pass to the plugin initialization @@ -118,8 +116,7 @@ mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, /** finds an already loaded plugin by name, or loads it, if necessary - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting + @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded diff --git a/mysql-test/collections/mysql-5.5-bugteam.daily b/mysql-test/collections/mysql-5.5-bugteam.daily new file mode 100644 index 00000000000..81dffff91ce --- /dev/null +++ b/mysql-test/collections/mysql-5.5-bugteam.daily @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb diff --git a/mysql-test/collections/mysql-5.5-bugteam.push b/mysql-test/collections/mysql-5.5-bugteam.push new file mode 100644 index 00000000000..06118ed9e1e --- /dev/null +++ b/mysql-test/collections/mysql-5.5-bugteam.push @@ -0,0 +1,4 @@ +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 +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 diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 87f96496c73..a7d7a8aefa4 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -177,8 +177,6 @@ sub collect_test_cases ($$$$) { if ( $opt_reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run - my %sort_criteria; - # Make a mapping of test name to a string that represents how that test # should be sorted among the other tests. Put the most important criterion # first, then a sub-criterion, then sub-sub-criterion, etc. @@ -190,24 +188,31 @@ sub collect_test_cases ($$$$) { # Append the criteria for sorting, in order of importance. # push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B")); + push(@criteria, $tinfo->{template_path}); # Group test with equal options together. # Ending with "~" makes empty sort later than filled my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; push(@criteria, join("!", sort @{$opts}) . "~"); + # Add slave opts if any + if ($tinfo->{'slave_opt'}) + { + push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}})); + } + # This sorts tests with force-restart *before* identical tests + push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart"); - $sort_criteria{$tinfo->{name}} = join(" ", @criteria); + $tinfo->{criteria}= join(" ", @criteria); } - @$cases = sort { - $sort_criteria{$a->{'name'}} . $a->{'name'} cmp - $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases; + @$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases; # For debugging the sort-order # foreach my $tinfo (@$cases) # { - # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n"); + # my $tname= $tinfo->{name} . ' ' . $tinfo->{combination}; + # my $crit= $tinfo->{criteria}; + # print("$tname\n\t$crit\n"); # } - } if (defined $print_testcases){ diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f741e62e71f..28956eb0092 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -704,22 +704,40 @@ sub run_test_server ($$$) { next; } - # Prefer same configuration, or just use next if --noreorder - if (!$opt_reorder or (defined $result and - $result->{template_path} eq $t->{template_path})) - { - #mtr_report("Test uses same config => good match"); - # Test uses same config => good match - $next= splice(@$tests, $i, 1); - last; - } - # Second best choice is the first that does not fulfill # any of the above conditions if (!defined $second_best){ #mtr_report("Setting second_best to $i"); $second_best= $i; } + + # Smart allocation of next test within this thread. + + if ($opt_reorder and $opt_parallel > 1 and defined $result) + { + my $wid= $result->{worker}; + # Reserved for other thread, try next + next if (defined $t->{reserved} and $t->{reserved} != $wid); + if (! defined $t->{reserved}) + { + # Force-restart not relevant when comparing *next* test + $t->{criteria} =~ s/force-restart$/no-restart/; + my $criteria= $t->{criteria}; + # Reserve similar tests for this worker, but not too many + my $maxres= (@$tests - $i) / $opt_parallel + 1; + for (my $j= $i+1; $j <= $i + $maxres; $j++) + { + my $tt= $tests->[$j]; + last unless defined $tt; + last if $tt->{criteria} ne $criteria; + $tt->{reserved}= $wid; + } + } + } + + # At this point we have found next suitable test + $next= splice(@$tests, $i, 1); + last; } # Use second best choice if no other test has been found @@ -728,10 +746,12 @@ sub run_test_server ($$$) { mtr_error("Internal error, second best too large($second_best)") if $second_best > $#$tests; $next= splice(@$tests, $second_best, 1); + delete $next->{reserved}; } if ($next) { - #$next->print_test(); + # We don't need this any more + delete $next->{criteria}; $next->write_test($sock, 'TESTCASE'); $running{$next->key()}= $next; $num_ndb_tests++ if ($next->{ndb_test}); @@ -816,6 +836,11 @@ sub run_worker ($) { delete($test->{'comment'}); delete($test->{'logfile'}); + # A sanity check. Should this happen often we need to look at it. + if (defined $test->{reserved} && $test->{reserved} != $thread_num) { + my $tres= $test->{reserved}; + mtr_warning("Test reserved for w$tres picked up by w$thread_num"); + } $test->{worker} = $thread_num if $opt_parallel > 1; run_testcase($test); @@ -894,7 +919,7 @@ sub command_line_setup { 'ssl|with-openssl' => \$opt_ssl, 'skip-ssl' => \$opt_skip_ssl, 'compress' => \$opt_compress, - 'vs-config' => \$opt_vs_config, + 'vs-config=s' => \$opt_vs_config, # Max number of parallel threads to use 'parallel=s' => \$opt_parallel, @@ -4741,17 +4766,6 @@ sub server_need_restart { } } - # Temporary re-enable the "always restart slave" hack - # this should be removed asap, but will require that each rpl - # testcase cleanup better after itself - ie. stop and reset - # replication - # Use the "#!use-slave-opt" marker to detect that this is a "slave" - # server - if ( $server->option("#!use-slave-opt") ){ - mtr_verbose_restart($server, "Always restart slave(s)"); - return 1; - } - my $is_mysqld= grep ($server eq $_, mysqlds()); if ($is_mysqld) { diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 122d722be71..02ff80890e0 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -2040,6 +2040,20 @@ predicted_order hex(utf8_encoding) 100 E0B78AE2808DE0B6BA 101 E0B78AE2808DE0B6BB DROP TABLE t1; +SET NAMES utf8 COLLATE utf8_sinhala_ci; +CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci); +INSERT INTO t1 VALUES ('a'),('ae'),('af'); +SELECT s1,hex(s1) FROM t1 ORDER BY s1; +s1 hex(s1) +a 61 +ae 6165 +af 6166 +SELECT * FROM t1 ORDER BY s1; +s1 +a +ae +af +DROP TABLE t1; End of 5.4 tests # # Start of 5.5 tests diff --git a/mysql-test/r/sp-bugs.result b/mysql-test/r/sp-bugs.result index a88c89537e2..2425f40d9c2 100644 --- a/mysql-test/r/sp-bugs.result +++ b/mysql-test/r/sp-bugs.result @@ -75,4 +75,40 @@ CALL p1 (); ERROR HY000: Trigger does not exist DROP TABLE t1; DROP PROCEDURE p1; +# +# Bug#54375: Error in stored procedure leaves connection +# in different default schema +# +SET @@SQL_MODE = 'STRICT_ALL_TABLES'; +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +USE db1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1); +CREATE FUNCTION f1 ( +some_value int +) +RETURNS smallint +DETERMINISTIC +BEGIN +INSERT INTO t1 SET c1 = some_value; +RETURN(LAST_INSERT_ID()); +END$$ +DROP DATABASE IF EXISTS db2; +CREATE DATABASE db2; +USE db2; +SELECT DATABASE(); +DATABASE() +db2 +SELECT db1.f1(1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT DATABASE(); +DATABASE() +db2 +USE test; +DROP FUNCTION db1.f1; +DROP TABLE db1.t1; +DROP DATABASE db1; +DROP DATABASE db2; End of 5.1 tests diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 13941b56040..3136b5dfcc0 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -5005,3 +5005,15 @@ SELECT * FROM t2 UNION SELECT * FROM t2 ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); DROP TABLE t1,t2; End of 5.1 tests +# +# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): +# Assertion `file' failed. +# +CREATE TABLE t1 (a INT); +SELECT 1 FROM +(SELECT ROW( +(SELECT 1 FROM t1 RIGHT JOIN +(SELECT 1 FROM t1, t1 t2) AS d ON 1), +1) FROM t1) AS e; +ERROR 21000: Operand should contain 1 column(s) +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_index-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt index 099f07e5d4e..62409b9f6be 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt @@ -1 +1,2 @@ --max_binlog_size=4096 --default-storage-engine=MyISAM +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt index e2cfcb299cf..2a1187d3fe4 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt @@ -1 +1,2 @@ --binlog-do-db=b42829 +--force-restart diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc deleted file mode 100644 index 7054e196153..00000000000 --- a/mysql-test/suite/ibmdb2i/include/have_i54.inc +++ /dev/null @@ -1,20 +0,0 @@ -# Check for IBM i 6.1 or later ---disable_query_log -system uname -rv > $MYSQLTEST_VARDIR/tmp/version; ---disable_warnings -drop table if exists uname_vr; ---enable_warnings -create temporary table uname_vr (r int, v int); ---disable_warnings -eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' '; ---enable_warnings -let $ok = `select count(*) from uname_vr where v = 5 and r = 4`; -drop table uname_vr; -remove_file $MYSQLTEST_VARDIR/tmp/version; ---enable_query_log -if (!$ok) -{ - skip "Need IBM i 5.4 or later"; -} - - diff --git a/mysql-test/suite/ibmdb2i/include/have_i61.inc b/mysql-test/suite/ibmdb2i/include/have_i61.inc deleted file mode 100644 index 84b9a17c1d8..00000000000 --- a/mysql-test/suite/ibmdb2i/include/have_i61.inc +++ /dev/null @@ -1,20 +0,0 @@ -# Check for IBM i 6.1 or later ---disable_query_log -system uname -rv > $MYSQLTEST_VARDIR/tmp/version; ---disable_warnings -drop table if exists uname_vr; ---enable_warnings -create temporary table uname_vr (r int, v int); ---disable_warnings -eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' '; ---enable_warnings -let $ok = `select count(*) from uname_vr where v > 5`; -drop table uname_vr; -remove_file $MYSQLTEST_VARDIR/tmp/version; ---enable_query_log -if (!$ok) -{ - skip "Need IBM i 6.1 or later"; -} - - diff --git a/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc b/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc deleted file mode 100644 index f3ef0b4f1ac..00000000000 --- a/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc +++ /dev/null @@ -1,6 +0,0 @@ -if (!`SELECT count(*) FROM information_schema.engines WHERE - (support = 'YES' OR support = 'DEFAULT') AND - engine = 'ibmdb2i'`) -{ - skip Need ibmdb2i engine; -} diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result deleted file mode 100644 index ddf92db6bca..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result +++ /dev/null @@ -1,11 +0,0 @@ -create schema `A12345_@$#`; -create table `A12345_@$#`.t1 (i int) engine=ibmdb2i; -show create table `A12345_@$#`.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `i` int(11) DEFAULT NULL -) ENGINE=IBMDB2I DEFAULT CHARSET=latin1 -select * from `A12345_@$#`.t1; -i -drop table `A12345_@$#`.t1; -drop schema `A12345_@$#`; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result deleted file mode 100644 index 10a3070fcc4..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result +++ /dev/null @@ -1,4 +0,0 @@ -create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i; -drop table t1; -create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i; -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result deleted file mode 100644 index 8276b401073..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result +++ /dev/null @@ -1,4 +0,0 @@ -create table t1 (c char(1) character set armscii8) engine=ibmdb2i; -ERROR HY000: Can't create table 'test.t1' (errno: 2504) -create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i; -ERROR HY000: Can't create table 'test.t1' (errno: 2504) diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result deleted file mode 100644 index 311e800e1b0..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result +++ /dev/null @@ -1,18 +0,0 @@ -create table ABC (i int) engine=ibmdb2i; -drop table ABC; -create table `1234567890ABC` (i int) engine=ibmdb2i; -drop table `1234567890ABC`; -create table `!@#$%` (i int) engine=ibmdb2i; -drop table `!@#$%`; -create table `ABCD#########` (i int) engine=ibmdb2i; -drop table `ABCD#########`; -create table `_` (i int) engine=ibmdb2i; -drop table `_`; -create table `abc##def` (i int) engine=ibmdb2i; -drop table `abc##def`; -set names utf8; -create table İ (s1 int) engine=ibmdb2i; -drop table İ; -create table İİ (s1 int) engine=ibmdb2i; -drop table İİ; -set names latin1; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result deleted file mode 100644 index 916e1d93ee5..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result +++ /dev/null @@ -1,33 +0,0 @@ -drop table if exists t1; -create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i; -insert into t1 values ("ch"),("h"),("i"); -select * from t1 order by c; -c -h -ch -i -drop table t1; -create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i; -insert into t1 values ("ch"),("h"),("i"); -select * from t1 order by c; -c -h -ch -i -drop table t1; -create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i; -insert into t1 values("abc"),("abcd"),("aaaa"); -select c from t1 order by c; -c -abc -abcd -aaaa -drop table t1; -create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i; -insert into t1 values("abc"),("abcd"),("aaaa"); -select c from t1 order by c; -c -abc -abcd -aaaa -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result deleted file mode 100644 index 2392b746877..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result +++ /dev/null @@ -1,7 +0,0 @@ -drop table if exists t1; -create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i; -insert into t1 values ("test"); -select * from t1 order by c; -c -test -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result deleted file mode 100644 index b9f4dcfc656..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result +++ /dev/null @@ -1,20 +0,0 @@ -set ibmdb2i_create_index_option=1; -drop schema if exists test1; -create schema test1; -use test1; -CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i; -drop table t1; -create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i; -select * from fd; -SQSSEQ -*HEX -*HEX -*HEX -*HEX -drop table fd; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result deleted file mode 100644 index d5bfc2579fd..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result +++ /dev/null @@ -1,9 +0,0 @@ -create table ABC (i int) engine=ibmdb2i; -insert into ABC values(1); -create table abc (i int) engine=ibmdb2i; -insert into abc values (2); -select * from ABC; -i -1 -drop table ABC; -drop table abc; diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result deleted file mode 100644 index 4f7d71cab2d..00000000000 --- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result +++ /dev/null @@ -1,1204 +0,0 @@ -drop table if exists t1, ffd, fd; -CREATE TABLE t1 (armscii8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_bin engine=ibmdb2i; -CREATE TABLE t1 (armscii8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_general_ci engine=ibmdb2i; -CREATE TABLE t1 (ascii_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (ascii_bin char(10) primary key) collate ascii_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ascii_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (ascii_general_ci char(10) primary key) collate ascii_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (big5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate big5_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (big5_bin char(10) primary key) collate big5_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (big5_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate big5_chinese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (big5_chinese_ci char(10) primary key) collate big5_chinese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1250_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1250_bin char(10) primary key) collate cp1250_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1250_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_croatian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1250_croatian_ci char(10) primary key) collate cp1250_croatian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1250_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_czech_cs engine=ibmdb2i; -CREATE TABLE t1 (cp1250_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1250_general_ci char(10) primary key) collate cp1250_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1250_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_polish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1250_polish_ci char(10) primary key) collate cp1250_polish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1251_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1251_bin char(10) primary key) collate cp1251_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1251_bulgarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bulgarian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1251_bulgarian_ci char(10) primary key) collate cp1251_bulgarian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1251_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1251_general_ci char(10) primary key) collate cp1251_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1251_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_cs engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1251_general_cs char(10) primary key) collate cp1251_general_cs engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1251_ukrainian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_ukrainian_ci engine=ibmdb2i; -CREATE TABLE t1 (cp1256_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1256_bin char(10) primary key) collate cp1256_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1256_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp1256_general_ci char(10) primary key) collate cp1256_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp1257_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_bin engine=ibmdb2i; -CREATE TABLE t1 (cp1257_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_general_ci engine=ibmdb2i; -CREATE TABLE t1 (cp1257_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_lithuanian_ci engine=ibmdb2i; -CREATE TABLE t1 (cp850_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp850_bin char(10) primary key) collate cp850_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp850_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp850_general_ci char(10) primary key) collate cp850_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp852_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp852_bin char(10) primary key) collate cp852_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp852_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (cp852_general_ci char(10) primary key) collate cp852_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp866_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_bin engine=ibmdb2i; -CREATE TABLE t1 (cp866_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_general_ci engine=ibmdb2i; -CREATE TABLE t1 (cp932_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (cp932_bin char(10) primary key) collate cp932_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (cp932_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_japanese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (cp932_japanese_ci char(10) primary key) collate cp932_japanese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (dec8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_bin engine=ibmdb2i; -CREATE TABLE t1 (dec8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_swedish_ci engine=ibmdb2i; -CREATE TABLE t1 (eucjpms_bin integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_bin engine=ibmdb2i; -CREATE TABLE t1 (eucjpms_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_japanese_ci engine=ibmdb2i; -CREATE TABLE t1 (euckr_bin integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (euckr_bin char(10) primary key) collate euckr_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (euckr_korean_ci integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_korean_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (euckr_korean_ci char(10) primary key) collate euckr_korean_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (gb2312_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (gb2312_bin char(10) primary key) collate gb2312_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (gb2312_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_chinese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (gb2312_chinese_ci char(10) primary key) collate gb2312_chinese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (gbk_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (gbk_bin char(10) primary key) collate gbk_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (gbk_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_chinese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (gbk_chinese_ci char(10) primary key) collate gbk_chinese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (geostd8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_bin engine=ibmdb2i; -CREATE TABLE t1 (geostd8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_general_ci engine=ibmdb2i; -CREATE TABLE t1 (greek_bin integer, c char(10), v varchar(20), index(c), index(v)) collate greek_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (greek_bin char(10) primary key) collate greek_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (greek_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate greek_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (greek_general_ci char(10) primary key) collate greek_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (hebrew_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (hebrew_bin char(10) primary key) collate hebrew_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (hebrew_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (hebrew_general_ci char(10) primary key) collate hebrew_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (hp8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_bin engine=ibmdb2i; -CREATE TABLE t1 (hp8_english_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_english_ci engine=ibmdb2i; -CREATE TABLE t1 (keybcs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_bin engine=ibmdb2i; -CREATE TABLE t1 (keybcs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_general_ci engine=ibmdb2i; -CREATE TABLE t1 (koi8r_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_bin engine=ibmdb2i; -CREATE TABLE t1 (koi8r_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_general_ci engine=ibmdb2i; -CREATE TABLE t1 (koi8u_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_bin engine=ibmdb2i; -CREATE TABLE t1 (koi8u_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_general_ci engine=ibmdb2i; -CREATE TABLE t1 (latin1_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_bin char(10) primary key) collate latin1_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_danish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_danish_ci char(10) primary key) collate latin1_danish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_general_ci char(10) primary key) collate latin1_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_cs engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_general_cs char(10) primary key) collate latin1_general_cs engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_german1_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german1_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_german1_ci char(10) primary key) collate latin1_german1_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_german2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german2_ci engine=ibmdb2i; -CREATE TABLE t1 (latin1_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_spanish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_spanish_ci char(10) primary key) collate latin1_spanish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin1_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_swedish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin1_swedish_ci char(10) primary key) collate latin1_swedish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin2_bin char(10) primary key) collate latin2_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin2_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_croatian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin2_croatian_ci char(10) primary key) collate latin2_croatian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin2_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_czech_cs engine=ibmdb2i; -CREATE TABLE t1 (latin2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin2_general_ci char(10) primary key) collate latin2_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_hungarian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin2_hungarian_ci char(10) primary key) collate latin2_hungarian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin5_bin char(10) primary key) collate latin5_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin5_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_turkish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (latin5_turkish_ci char(10) primary key) collate latin5_turkish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (latin7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_bin engine=ibmdb2i; -CREATE TABLE t1 (latin7_estonian_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_estonian_cs engine=ibmdb2i; -CREATE TABLE t1 (latin7_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_ci engine=ibmdb2i; -CREATE TABLE t1 (latin7_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_cs engine=ibmdb2i; -CREATE TABLE t1 (macce_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macce_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (macce_bin char(10) primary key) collate macce_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (macce_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macce_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (macce_general_ci char(10) primary key) collate macce_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (macroman_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_bin engine=ibmdb2i; -CREATE TABLE t1 (macroman_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_general_ci engine=ibmdb2i; -CREATE TABLE t1 (sjis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (sjis_bin char(10) primary key) collate sjis_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (sjis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_japanese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (sjis_japanese_ci char(10) primary key) collate sjis_japanese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (swe7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_bin engine=ibmdb2i; -CREATE TABLE t1 (swe7_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_swedish_ci engine=ibmdb2i; -CREATE TABLE t1 (tis620_bin integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (tis620_bin char(10) primary key) collate tis620_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (tis620_thai_ci integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_thai_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 11 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 23 NULL 6 Using where -drop table t1; -create table t1 (tis620_thai_ci char(10) primary key) collate tis620_thai_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_bin char(10) primary key) collate ucs2_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_czech_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_czech_ci char(10) primary key) collate ucs2_czech_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_danish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_danish_ci char(10) primary key) collate ucs2_danish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_esperanto_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_esperanto_ci char(10) primary key) collate ucs2_esperanto_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_estonian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_estonian_ci char(10) primary key) collate ucs2_estonian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_general_ci char(10) primary key) collate ucs2_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_hungarian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_hungarian_ci char(10) primary key) collate ucs2_hungarian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_icelandic_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_icelandic_ci char(10) primary key) collate ucs2_icelandic_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_latvian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_latvian_ci char(10) primary key) collate ucs2_latvian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_lithuanian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_lithuanian_ci char(10) primary key) collate ucs2_lithuanian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_persian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_persian_ci char(10) primary key) collate ucs2_persian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_polish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_polish_ci char(10) primary key) collate ucs2_polish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_romanian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_romanian_ci char(10) primary key) collate ucs2_romanian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_roman_ci engine=ibmdb2i; -CREATE TABLE t1 (ucs2_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovak_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_slovak_ci char(10) primary key) collate ucs2_slovak_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovenian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_slovenian_ci char(10) primary key) collate ucs2_slovenian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish2_ci engine=ibmdb2i; -CREATE TABLE t1 (ucs2_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_spanish_ci char(10) primary key) collate ucs2_spanish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_swedish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_swedish_ci char(10) primary key) collate ucs2_swedish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_turkish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_turkish_ci char(10) primary key) collate ucs2_turkish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ucs2_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_unicode_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 21 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 43 NULL 6 Using where -drop table t1; -create table t1 (ucs2_unicode_ci char(10) primary key) collate ucs2_unicode_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ujis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (ujis_bin char(10) primary key) collate ujis_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (ujis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_japanese_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (ujis_japanese_ci char(10) primary key) collate ujis_japanese_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_bin engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_bin char(10) primary key) collate utf8_bin engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_czech_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_czech_ci char(10) primary key) collate utf8_czech_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_danish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_danish_ci char(10) primary key) collate utf8_danish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_esperanto_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_esperanto_ci char(10) primary key) collate utf8_esperanto_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_estonian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_estonian_ci char(10) primary key) collate utf8_estonian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_general_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_general_ci char(10) primary key) collate utf8_general_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_hungarian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_hungarian_ci char(10) primary key) collate utf8_hungarian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_icelandic_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_icelandic_ci char(10) primary key) collate utf8_icelandic_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_latvian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_latvian_ci char(10) primary key) collate utf8_latvian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_lithuanian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_lithuanian_ci char(10) primary key) collate utf8_lithuanian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_persian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_persian_ci char(10) primary key) collate utf8_persian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_polish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_polish_ci char(10) primary key) collate utf8_polish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_romanian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_romanian_ci char(10) primary key) collate utf8_romanian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_roman_ci engine=ibmdb2i; -CREATE TABLE t1 (utf8_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovak_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_slovak_ci char(10) primary key) collate utf8_slovak_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovenian_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_slovenian_ci char(10) primary key) collate utf8_slovenian_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish2_ci engine=ibmdb2i; -CREATE TABLE t1 (utf8_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_spanish_ci char(10) primary key) collate utf8_spanish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_swedish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_swedish_ci char(10) primary key) collate utf8_swedish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_turkish_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_turkish_ci char(10) primary key) collate utf8_turkish_ci engine=ibmdb2i; -drop table t1; -CREATE TABLE t1 (utf8_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_unicode_ci engine=ibmdb2i; -insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); -insert into t1 select * from t1; -explain select c,v from t1 force index(c) where c like "ab%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 31 NULL 6 Using where -explain select c,v from t1 force index(v) where v like "de%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 63 NULL 6 Using where -drop table t1; -create table t1 (utf8_unicode_ci char(10) primary key) collate utf8_unicode_ci engine=ibmdb2i; -drop table t1; -create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i; -create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i; -create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer); -insert into intermed (cs, ccsid) select * from ffd; -create temporary table intermed2 (row integer key auto_increment, srtseq char(10)); -insert into intermed2 (srtseq) select * from fd; -select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row; -ccsid cs srtseq -500 "ascii_bin" QBLA101F4U -500 "ascii_general_ci" QALA101F4S -1200 "big5_bin" QBCHT04B0U -1200 "big5_chinese_ci" QACHT04B0S -1153 "cp1250_bin" QELA20481U -1153 "cp1250_croatian_ci" QALA20481S -1153 "cp1250_general_ci" QCLA20481S -1153 "cp1250_polish_ci" QDLA20481S -1025 "cp1251_bin" QCCYR0401U -1025 "cp1251_bulgarian_ci QACYR0401S -1025 "cp1251_general_ci" QBCYR0401S -1025 "cp1251_general_cs" QBCYR0401U -420 "cp1256_bin" QBARA01A4U -420 "cp1256_general_ci" QAARA01A4S -500 "cp850_bin" QDLA101F4U -500 "cp850_general_ci" QCLA101F4S -870 "cp852_bin" QBLA20366U -870 "cp852_general_ci" QALA20366S -1200 "cp932_bin" QBJPN04B0U -1200 "cp932_japanese_ci" QAJPN04B0S -1200 "euckr_bin" QBKOR04B0U -1200 "euckr_korean_ci" QAKOR04B0S -1200 "gb2312_bin" QBCHS04B0U -1200 "gb2312_chinese_ci" QACHS04B0S -1200 "gbk_bin" QDCHS04B0U -1200 "gbk_chinese_ci" QCCHS04B0S -875 "greek_bin" QBELL036BU -875 "greek_general_ci" QAELL036BS -424 "hebrew_bin" QBHEB01A8U -424 "hebrew_general_ci" QAHEB01A8S -1148 "latin1_bin" QFLA1047CU -1148 "latin1_danish_ci" QALA1047CS -1148 "latin1_general_ci" QBLA1047CS -1148 "latin1_general_cs" QBLA1047CU -1148 "latin1_german1_ci" QCLA1047CS -1148 "latin1_spanish_ci" QDLA1047CS -1148 "latin1_swedish_ci" QELA1047CS -870 "latin2_bin" QGLA20366U -870 "latin2_croatian_ci" QCLA20366S -870 "latin2_general_ci" QELA20366S -870 "latin2_hungarian_ci QFLA20366S -1026 "latin5_bin" QBTRK0402U -1026 "latin5_turkish_ci" QATRK0402S -870 "macce_bin" QILA20366U -870 "macce_general_ci" QHLA20366S -1200 "sjis_bin" QDJPN04B0U -1200 "sjis_japanese_ci" QCJPN04B0S -838 "tis620_bin" QBTHA0346U -838 "tis620_thai_ci" QATHA0346S -13488 "ucs2_bin" *HEX -13488 "ucs2_czech_ci" I34ACS_CZ -13488 "ucs2_danish_ci" I34ADA_DK -13488 "ucs2_esperanto_ci" I34AEO -13488 "ucs2_estonian_ci" I34AET -13488 "ucs2_general_ci" QAUCS04B0S -13488 "ucs2_hungarian_ci" I34AHU -13488 "ucs2_icelandic_ci" I34AIS -13488 "ucs2_latvian_ci" I34ALV -13488 "ucs2_lithuanian_ci" I34ALT -13488 "ucs2_persian_ci" I34AFA -13488 "ucs2_polish_ci" I34APL -13488 "ucs2_romanian_ci" I34ARO -13488 "ucs2_slovak_ci" I34ASK -13488 "ucs2_slovenian_ci" I34ASL -13488 "ucs2_spanish_ci" I34AES -13488 "ucs2_swedish_ci" I34ASW -13488 "ucs2_turkish_ci" I34ATR -13488 "ucs2_unicode_ci" I34AEN -1200 "ujis_bin" QFJPN04B0U -1200 "ujis_japanese_ci" QEJPN04B0S -1208 "utf8_bin" *HEX -1208 "utf8_czech_ci" I34ACS_CZ -1208 "utf8_danish_ci" I34ADA_DK -1208 "utf8_esperanto_ci" I34AEO -1208 "utf8_estonian_ci" I34AET -1200 "utf8_general_ci" QAUCS04B0S -1208 "utf8_hungarian_ci" I34AHU -1208 "utf8_icelandic_ci" I34AIS -1208 "utf8_latvian_ci" I34ALV -1208 "utf8_lithuanian_ci" I34ALT -1208 "utf8_persian_ci" I34AFA -1208 "utf8_polish_ci" I34APL -1208 "utf8_romanian_ci" I34ARO -1208 "utf8_slovak_ci" I34ASK -1208 "utf8_slovenian_ci" I34ASL -1208 "utf8_spanish_ci" I34AES -1208 "utf8_swedish_ci" I34ASW -1208 "utf8_turkish_ci" I34ATR -1208 "utf8_unicode_ci" I34AEN -drop table ffd, fd; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test deleted file mode 100644 index 09a7c75cfc0..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test +++ /dev/null @@ -1,9 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; -source include/have_case_sensitive_file_system.inc; - -create schema `A12345_@$#`; -create table `A12345_@$#`.t1 (i int) engine=ibmdb2i; -show create table `A12345_@$#`.t1; -select * from `A12345_@$#`.t1; -drop table `A12345_@$#`.t1; -drop schema `A12345_@$#`; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test deleted file mode 100644 index 9b033a2298f..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test +++ /dev/null @@ -1,9 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; -source suite/ibmdb2i/include/have_i61.inc; - - -create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i; -drop table t1; - -create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i; -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test deleted file mode 100644 index ea29b5abcd4..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test +++ /dev/null @@ -1,8 +0,0 @@ ---source suite/ibmdb2i/include/have_ibmdb2i.inc ---source suite/ibmdb2i/include/have_i54.inc - ---error 1005 -create table t1 (c char(1) character set armscii8) engine=ibmdb2i; - ---error 1005 -create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test deleted file mode 100644 index da69b5d9148..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test +++ /dev/null @@ -1,28 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; - -# Test RCDFMT generation for a variety of kinds of table names -create table ABC (i int) engine=ibmdb2i; -drop table ABC; - -create table `1234567890ABC` (i int) engine=ibmdb2i; -drop table `1234567890ABC`; - -create table `!@#$%` (i int) engine=ibmdb2i; -drop table `!@#$%`; - -create table `ABCD#########` (i int) engine=ibmdb2i; -drop table `ABCD#########`; - -create table `_` (i int) engine=ibmdb2i; -drop table `_`; - -create table `abc##def` (i int) engine=ibmdb2i; -drop table `abc##def`; - -set names utf8; -create table İ (s1 int) engine=ibmdb2i; -drop table İ; - -create table İİ (s1 int) engine=ibmdb2i; -drop table İİ; -set names latin1; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test deleted file mode 100644 index 17b1d658975..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test +++ /dev/null @@ -1,26 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; -source suite/ibmdb2i/include/have_i61.inc; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i; -insert into t1 values ("ch"),("h"),("i"); -select * from t1 order by c; -drop table t1; - -create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i; -insert into t1 values ("ch"),("h"),("i"); -select * from t1 order by c; -drop table t1; - -create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i; -insert into t1 values("abc"),("abcd"),("aaaa"); -select c from t1 order by c; -drop table t1; - -create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i; -insert into t1 values("abc"),("abcd"),("aaaa"); -select c from t1 order by c; -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test deleted file mode 100644 index 93fb78ff421..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test +++ /dev/null @@ -1,11 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; -source suite/ibmdb2i/include/have_i61.inc; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i; -insert into t1 values ("test"); -select * from t1 order by c; -drop table t1; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test deleted file mode 100644 index 695d8e90ada..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test +++ /dev/null @@ -1,47 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; - -# Confirm that ibmdb2i_create_index_option causes additional *HEX sorted indexes to be created for all non-binary keys. - -set ibmdb2i_create_index_option=1; ---disable_warnings -drop schema if exists test1; -create schema test1; -use test1; ---enable_warnings - ---disable_abort_on_error ---error 0,255 -exec system "DLTF QGPL/FDOUT" > /dev/null; ---enable_abort_on_error - -#No additional index because no string fields in key -CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i; ---error 255 -exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; ---error 255 -exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -drop table t1; - -#No additional index because binary sorting -CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i; ---error 255 -exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; ---error 255 -exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -drop table t1; - -CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i; -exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -drop table t1; - -CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i; -exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -exec system "DSPFD FILE(\"test1\"/\"i___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; -drop table t1; - - -create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i; -system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test1\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null; -select * from fd; -drop table fd; diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test deleted file mode 100644 index 615df284d8f..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test +++ /dev/null @@ -1,10 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source include/have_case_sensitive_file_system.inc;
-
-create table ABC (i int) engine=ibmdb2i;
-insert into ABC values(1);
-create table abc (i int) engine=ibmdb2i;
-insert into abc values (2);
-select * from ABC;
-drop table ABC;
-drop table abc;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test deleted file mode 100644 index 899f330d360..00000000000 --- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test +++ /dev/null @@ -1,44 +0,0 @@ -source suite/ibmdb2i/include/have_ibmdb2i.inc; -source suite/ibmdb2i/include/have_i61.inc; ---disable_warnings -drop table if exists t1, ffd, fd; ---enable_warnings - ---disable_abort_on_error ---error 0,255 -exec system "DLTF QGPL/FFDOUT" > /dev/null; ---error 0,255 -exec system "DLTF QGPL/FDOUT" > /dev/null; ---enable_abort_on_error -let $count= query_get_value(select count(*) from information_schema.COLLATIONS where COLLATION_NAME <> "binary", count(*),1); - -while ($count) -{ - let $collation = query_get_value(select COLLATION_NAME from information_schema.COLLATIONS where COLLATION_NAME <> "binary" order by COLLATION_NAME desc, COLLATION_NAME, $count); - error 0,1005,2504,2028; - eval CREATE TABLE t1 ($collation integer, c char(10), v varchar(20), index(c), index(v)) collate $collation engine=ibmdb2i; - if (!$mysql_errno) - { - insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb"); - insert into t1 select * from t1; - explain select c,v from t1 force index(c) where c like "ab%"; - explain select c,v from t1 force index(v) where v like "de%"; - drop table t1; - eval create table t1 ($collation char(10) primary key) collate $collation engine=ibmdb2i; - system system "DSPFFD FILE(\"test\"/\"t1\") OUTPUT(*OUTFILE) OUTFILE(QGPL/FFDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; - system system "DSPFD FILE(\"test\"/\"t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null; - drop table t1; - } - dec $count; -} - -create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i; -system system "CPYF FROMFILE(QGPL/FFDOUT) TOFILE(\"test\"/\"ffd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null; -create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i; -system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null; -create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer); -insert into intermed (cs, ccsid) select * from ffd; -create temporary table intermed2 (row integer key auto_increment, srtseq char(10)); -insert into intermed2 (srtseq) select * from fd; -select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row; -drop table ffd, fd; diff --git a/mysql-test/suite/perfschema/include/binlog_common.inc b/mysql-test/suite/perfschema/include/binlog_common.inc index 10afe54ab5b..96c01d9a4c8 100644 --- a/mysql-test/suite/perfschema/include/binlog_common.inc +++ b/mysql-test/suite/perfschema/include/binlog_common.inc @@ -17,12 +17,12 @@ RESET MASTER; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO' +update performance_schema.setup_instruments set enabled='NO' where name like "wait/synch/rwlock/%"; -select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +select count(*) > 0 from performance_schema.events_waits_current; --disable_warnings drop table if exists test.t1; @@ -33,16 +33,16 @@ create table test.t1 (thread_id integer); create table test.t2 (name varchar(128)); insert into test.t1 - select thread_id from performance_schema.EVENTS_WAITS_CURRENT; + select thread_id from performance_schema.events_waits_current; insert into test.t2 - select name from performance_schema.SETUP_INSTRUMENTS + select name from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; drop table test.t1; drop table test.t2; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/rwlock/%"; --source include/show_binlog_events.inc diff --git a/mysql-test/suite/perfschema/include/cleanup_helper.inc b/mysql-test/suite/perfschema/include/cleanup_helper.inc index 5c2429ddb97..b7e37849f78 100644 --- a/mysql-test/suite/perfschema/include/cleanup_helper.inc +++ b/mysql-test/suite/perfschema/include/cleanup_helper.inc @@ -15,7 +15,7 @@ # Tests for PERFORMANCE_SCHEMA -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; disconnect con1; disconnect con2; diff --git a/mysql-test/suite/perfschema/include/privilege.inc b/mysql-test/suite/perfschema/include/privilege.inc index ef2acc995d5..3973c41b51b 100644 --- a/mysql-test/suite/perfschema/include/privilege.inc +++ b/mysql-test/suite/perfschema/include/privilege.inc @@ -32,48 +32,48 @@ drop table if exists test.t1; ## drop table performance_schema.t1; ## ## --error ER_DBACCESS_DENIED_ERROR -## create table performance_schema.SETUP_INSTRUMENTS(a int); +## create table performance_schema.setup_instruments(a int); ## ## --error ER_DBACCESS_DENIED_ERROR -## create table performance_schema.EVENTS_WAITS_CURRENT(a int); +## create table performance_schema.events_waits_current(a int); ## ## --error ER_DBACCESS_DENIED_ERROR -## create table performance_schema.FILE_INSTANCES(a int); +## create table performance_schema.file_instances(a int); ## ## --error ER_DBACCESS_DENIED_ERROR -## drop table performance_schema.SETUP_INSTRUMENTS; +## drop table performance_schema.setup_instruments; ## ## --error ER_DBACCESS_DENIED_ERROR -## drop table performance_schema.EVENTS_WAITS_CURRENT; +## drop table performance_schema.events_waits_current; ## ## --error ER_DBACCESS_DENIED_ERROR -## drop table performance_schema.FILE_INSTANCES; +## drop table performance_schema.file_instances; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +rename table performance_schema.setup_instruments to test.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +rename table performance_schema.events_waits_current to test.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.FILE_INSTANCES to test.t1; +rename table performance_schema.file_instances to test.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +rename table performance_schema.setup_instruments to performance_schema.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +rename table performance_schema.events_waits_current to performance_schema.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +rename table performance_schema.file_instances to performance_schema.t1; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.SETUP_INSTRUMENTS - to performance_schema.EVENTS_WAITS_CURRENT; +rename table performance_schema.setup_instruments + to performance_schema.events_waits_current; --error ER_DBACCESS_DENIED_ERROR -rename table performance_schema.EVENTS_WAITS_CURRENT - to performance_schema.SETUP_INSTRUMENTS; +rename table performance_schema.events_waits_current + to performance_schema.setup_instruments; --error ER_DBACCESS_DENIED_ERROR create procedure performance_schema.my_proc() begin end; @@ -87,108 +87,93 @@ do begin end; --error ER_DBACCESS_DENIED_ERROR create trigger performance_schema.bi_setup_instruments - before insert on performance_schema.SETUP_INSTRUMENTS + before insert on performance_schema.setup_instruments for each row begin end; --error ER_DBACCESS_DENIED_ERROR create trigger performance_schema.bi_events_waits_current - before insert on performance_schema.EVENTS_WAITS_CURRENT + before insert on performance_schema.events_waits_current for each row begin end; --error ER_DBACCESS_DENIED_ERROR create trigger performance_schema.bi_file_instances - before insert on performance_schema.FILE_INSTANCES + before insert on performance_schema.file_instances for each row begin end; --error ER_WRONG_PERFSCHEMA_USAGE create table test.t1(a int) engine=PERFORMANCE_SCHEMA; --error ER_WRONG_PERFSCHEMA_USAGE -create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +create table test.t1 like performance_schema.setup_instruments; --error ER_WRONG_PERFSCHEMA_USAGE -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; --error ER_WRONG_PERFSCHEMA_USAGE -create table test.t1 like performance_schema.FILE_INSTANCES; +create table test.t1 like performance_schema.file_instances; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name="foo"; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_CURRENT +insert into performance_schema.events_waits_current set name="foo"; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.FILE_INSTANCES +insert into performance_schema.file_instances set name="foo"; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_INSTRUMENTS; +delete from performance_schema.setup_instruments; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_CURRENT; +delete from performance_schema.events_waits_current; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_INSTANCES; +delete from performance_schema.file_instances; -lock table performance_schema.SETUP_INSTRUMENTS read; +lock table performance_schema.setup_instruments read; unlock tables; -lock table performance_schema.SETUP_INSTRUMENTS write; +lock table performance_schema.setup_instruments write; unlock tables; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -lock table performance_schema.EVENTS_WAITS_CURRENT read; +lock table performance_schema.events_waits_current read; unlock tables; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -lock table performance_schema.EVENTS_WAITS_CURRENT write; +lock table performance_schema.events_waits_current write; unlock tables; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -lock table performance_schema.FILE_INSTANCES read; +lock table performance_schema.file_instances read; unlock tables; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -lock table performance_schema.FILE_INSTANCES write; +lock table performance_schema.file_instances write; unlock tables; --echo # --echo # WL#4818, NFS2: Can use grants to give normal user access ---echo # to view data from _CURRENT and _HISTORY tables +--echo # to view data from _current and _history tables --echo # --echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. ---echo # (Except for EVENTS_WAITS_CURRENT, which is granted.) +--echo # (Except for events_waits_current, which is granted.) # Errors here will be caught by the diff afterwards --disable_abort_on_error ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' -SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1; --enable_abort_on_error diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc index 195b9cf960a..cdbfd81a24c 100644 --- a/mysql-test/suite/perfschema/include/setup_helper.inc +++ b/mysql-test/suite/perfschema/include/setup_helper.inc @@ -19,23 +19,23 @@ let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_TMPDIR= `select @@tmpdir`; --disable_query_log -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_CONSUMERS set enabled='YES'; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_consumers set enabled='YES'; --enable_query_log connect (con1, localhost, root, , ); -let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con1_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connect (con2, localhost, root, , ); -let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con2_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connect (con3, localhost, root, , ); -let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con3_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connection default; @@ -45,10 +45,10 @@ prepare stmt_dump_events from "select event_name, left(source, locate(\":\", source)) as short_source, operation, number_of_bytes - from performance_schema.EVENTS_WAITS_HISTORY_LONG + from performance_schema.events_waits_history_long where thread_id=? order by event_id;"; prepare stmt_dump_thread from - "select name from performance_schema.THREADS where thread_id=? ;"; + "select name from performance_schema.threads where thread_id=? ;"; --enable_query_log diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc index 083b302c5f7..f6e549ea44e 100644 --- a/mysql-test/suite/perfschema/include/start_server_common.inc +++ b/mysql-test/suite/perfschema/include/start_server_common.inc @@ -17,31 +17,31 @@ show databases; -select count(*) from performance_schema.PERFORMANCE_TIMERS; -select count(*) from performance_schema.SETUP_CONSUMERS; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.performance_timers; +select count(*) from performance_schema.setup_consumers; +select count(*) > 0 from performance_schema.setup_instruments; +select count(*) from performance_schema.setup_timers; # Make sure we don't crash, no matter what the starting parameters are --disable_result_log -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; --enable_result_log # This has a stable output, printing the result: diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result index c7ac05ba69d..edc7ce0bcca 100644 --- a/mysql-test/suite/perfschema/r/aggregate.result +++ b/mysql-test/suite/perfschema/r/aggregate.result @@ -1,87 +1,87 @@ "General cleanup" drop table if exists t1; -update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; -update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; -truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set enabled = 'NO'; +update performance_schema.setup_consumers set enabled = 'NO'; +truncate table performance_schema.file_summary_by_event_name; +truncate table performance_schema.file_summary_by_instance; +truncate table performance_schema.events_waits_summary_global_by_event_name; +truncate table performance_schema.events_waits_summary_by_instance; +truncate table performance_schema.events_waits_summary_by_thread_by_event_name; +update performance_schema.setup_consumers set enabled = 'YES'; +update performance_schema.setup_instruments set enabled = 'YES', timed = 'YES'; create table t1 ( id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); -update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; -update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; +update performance_schema.setup_instruments SET enabled = 'NO'; +update performance_schema.setup_consumers set enabled = 'NO'; set @dump_all=FALSE; "Verifying file aggregate consistency" SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) OR @dump_all; EVENT_NAME COUNT_READ SUM(i.COUNT_READ) SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) OR @dump_all; EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE) SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) OR @dump_all; EVENT_NAME SUM_NUMBER_OF_BYTES_READ SUM(i.SUM_NUMBER_OF_BYTES_READ) SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) OR @dump_all; EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE) "Verifying waits aggregate consistency (instance)" SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) OR @dump_all; EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT) SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) AND (MIN(i.MIN_TIMER_WAIT) != 0) OR @dump_all; EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT) SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) OR @dump_all; EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT) "Verifying waits aggregate consistency (thread)" SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) OR @dump_all; EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT) SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) @@ -89,14 +89,14 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0) OR @dump_all; EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT) SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) OR @dump_all; EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT) -update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_consumers set enabled = 'YES'; +update performance_schema.setup_instruments set enabled = 'YES', timed = 'YES'; drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result index 1e58179af51..b31b853b06d 100644 --- a/mysql-test/suite/perfschema/r/binlog_mix.result +++ b/mysql-test/suite/perfschema/r/binlog_mix.result @@ -1,11 +1,11 @@ set binlog_format=mixed; RESET MASTER; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -update performance_schema.SETUP_INSTRUMENTS set enabled='NO' +update performance_schema.setup_instruments set enabled='NO' where name like "wait/synch/rwlock/%"; -select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +select count(*) > 0 from performance_schema.events_waits_current; count(*) > 0 1 drop table if exists test.t1; @@ -13,18 +13,18 @@ drop table if exists test.t2; create table test.t1 (thread_id integer); create table test.t2 (name varchar(128)); insert into test.t1 -select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id from performance_schema.events_waits_current; insert into test.t2 -select name from performance_schema.SETUP_INSTRUMENTS +select name from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; drop table test.t1; drop table test.t2; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/rwlock/%"; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT @@ -43,7 +43,7 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result index 28803c73a84..010f2de06e6 100644 --- a/mysql-test/suite/perfschema/r/binlog_row.result +++ b/mysql-test/suite/perfschema/r/binlog_row.result @@ -1,11 +1,11 @@ set binlog_format=row; RESET MASTER; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -update performance_schema.SETUP_INSTRUMENTS set enabled='NO' +update performance_schema.setup_instruments set enabled='NO' where name like "wait/synch/rwlock/%"; -select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +select count(*) > 0 from performance_schema.events_waits_current; count(*) > 0 1 drop table if exists test.t1; @@ -13,18 +13,18 @@ drop table if exists test.t2; create table test.t1 (thread_id integer); create table test.t2 (name varchar(128)); insert into test.t1 -select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id from performance_schema.events_waits_current; insert into test.t2 -select name from performance_schema.SETUP_INSTRUMENTS +select name from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; drop table test.t1; drop table test.t2; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/rwlock/%"; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT @@ -43,7 +43,7 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result index 288eba4d3d6..60054ee8a74 100644 --- a/mysql-test/suite/perfschema/r/binlog_stmt.result +++ b/mysql-test/suite/perfschema/r/binlog_stmt.result @@ -1,14 +1,14 @@ set binlog_format=statement; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); RESET MASTER; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -update performance_schema.SETUP_INSTRUMENTS set enabled='NO' +update performance_schema.setup_instruments set enabled='NO' where name like "wait/synch/rwlock/%"; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. -select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +select count(*) > 0 from performance_schema.events_waits_current; count(*) > 0 1 drop table if exists test.t1; @@ -16,24 +16,24 @@ drop table if exists test.t2; create table test.t1 (thread_id integer); create table test.t2 (name varchar(128)); insert into test.t1 -select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id from performance_schema.events_waits_current; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. insert into test.t2 -select name from performance_schema.SETUP_INSTRUMENTS +select name from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. drop table test.t1; drop table test.t2; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/rwlock/%"; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO' +master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='NO' where name like "wait/synch/rwlock/%" master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ @@ -42,16 +42,16 @@ master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id intege master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert into test.t1 -select thread_id from performance_schema.EVENTS_WAITS_CURRENT +select thread_id from performance_schema.events_waits_current master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert into test.t2 -select name from performance_schema.SETUP_INSTRUMENTS +select name from performance_schema.setup_instruments where name like "wait/synch/rwlock/%" master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/rwlock/%" master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/checksum.result b/mysql-test/suite/perfschema/r/checksum.result index 323cb303dae..587dead845a 100644 --- a/mysql-test/suite/perfschema/r/checksum.result +++ b/mysql-test/suite/perfschema/r/checksum.result @@ -1,34 +1,34 @@ -checksum table performance_schema.COND_INSTANCES; -checksum table performance_schema.EVENTS_WAITS_CURRENT; -checksum table performance_schema.EVENTS_WAITS_HISTORY; -checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -checksum table performance_schema.FILE_INSTANCES; -checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; -checksum table performance_schema.MUTEX_INSTANCES; -checksum table performance_schema.PERFORMANCE_TIMERS; -checksum table performance_schema.RWLOCK_INSTANCES; -checksum table performance_schema.SETUP_CONSUMERS; -checksum table performance_schema.SETUP_INSTRUMENTS; -checksum table performance_schema.SETUP_TIMERS; -checksum table performance_schema.THREADS; -checksum table performance_schema.COND_INSTANCES extended; -checksum table performance_schema.EVENTS_WAITS_CURRENT extended; -checksum table performance_schema.EVENTS_WAITS_HISTORY extended; -checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; -checksum table performance_schema.FILE_INSTANCES extended; -checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; -checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; -checksum table performance_schema.MUTEX_INSTANCES extended; -checksum table performance_schema.PERFORMANCE_TIMERS extended; -checksum table performance_schema.RWLOCK_INSTANCES extended; -checksum table performance_schema.SETUP_CONSUMERS extended; -checksum table performance_schema.SETUP_INSTRUMENTS extended; -checksum table performance_schema.SETUP_TIMERS extended; -checksum table performance_schema.THREADS extended; +checksum table performance_schema.cond_instances; +checksum table performance_schema.events_waits_current; +checksum table performance_schema.events_waits_history; +checksum table performance_schema.events_waits_history_long; +checksum table performance_schema.events_waits_summary_by_instance; +checksum table performance_schema.events_waits_summary_by_thread_by_event_name; +checksum table performance_schema.events_waits_summary_global_by_event_name; +checksum table performance_schema.file_instances; +checksum table performance_schema.file_summary_by_event_name; +checksum table performance_schema.file_summary_by_instance; +checksum table performance_schema.mutex_instances; +checksum table performance_schema.performance_timers; +checksum table performance_schema.rwlock_instances; +checksum table performance_schema.setup_consumers; +checksum table performance_schema.setup_instruments; +checksum table performance_schema.setup_timers; +checksum table performance_schema.threads; +checksum table performance_schema.cond_instances extended; +checksum table performance_schema.events_waits_current extended; +checksum table performance_schema.events_waits_history extended; +checksum table performance_schema.events_waits_history_long extended; +checksum table performance_schema.events_waits_summary_by_instance extended; +checksum table performance_schema.events_waits_summary_by_thread_by_event_name extended; +checksum table performance_schema.events_waits_summary_global_by_event_name extended; +checksum table performance_schema.file_instances extended; +checksum table performance_schema.file_summary_by_event_name extended; +checksum table performance_schema.file_summary_by_instance extended; +checksum table performance_schema.mutex_instances extended; +checksum table performance_schema.performance_timers extended; +checksum table performance_schema.rwlock_instances extended; +checksum table performance_schema.setup_consumers extended; +checksum table performance_schema.setup_instruments extended; +checksum table performance_schema.setup_timers extended; +checksum table performance_schema.threads extended; diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result index ac6030690dd..aff5f3e6eee 100644 --- a/mysql-test/suite/perfschema/r/column_privilege.result +++ b/mysql-test/suite/perfschema/r/column_privilege.result @@ -3,26 +3,26 @@ Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; -grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT +grant SELECT(thread_id, event_id) on performance_schema.events_waits_current to 'pfs_user_5'@localhost; -grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS +grant UPDATE(enabled) on performance_schema.setup_instruments to 'pfs_user_5'@localhost; flush privileges; -select thread_id from performance_schema.EVENTS_WAITS_CURRENT; -select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; -select event_name from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' +select thread_id from performance_schema.events_waits_current; +select thread_id, event_id from performance_schema.events_waits_current; +update performance_schema.setup_instruments set enabled='YES'; +select event_name from performance_schema.events_waits_current; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'events_waits_current' select thread_id, event_id, event_name -from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' -update performance_schema.SETUP_INSTRUMENTS set name='illegal'; -ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'SETUP_INSTRUMENTS' -update performance_schema.SETUP_INSTRUMENTS set timed='NO'; -ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'SETUP_INSTRUMENTS' +from performance_schema.events_waits_current; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'events_waits_current' +update performance_schema.setup_instruments set name='illegal'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'setup_instruments' +update performance_schema.setup_instruments set timed='NO'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'setup_instruments' REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; DROP USER 'pfs_user_5'@localhost; flush privileges; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/ddl_cond_instances.result b/mysql-test/suite/perfschema/r/ddl_cond_instances.result index 33adcebaceb..6b8b40af463 100644 --- a/mysql-test/suite/perfschema/r/ddl_cond_instances.result +++ b/mysql-test/suite/perfschema/r/ddl_cond_instances.result @@ -1,8 +1,8 @@ -alter table performance_schema.COND_INSTANCES add column foo integer; +alter table performance_schema.cond_instances add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.COND_INSTANCES; +truncate table performance_schema.cond_instances; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.cond_instances ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.cond_instances(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result index a438c93affe..545134e5bd0 100644 --- a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result @@ -1,7 +1,7 @@ -alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; +alter table performance_schema.events_waits_current add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_CURRENT; -ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); +truncate table performance_schema.events_waits_current; +ALTER TABLE performance_schema.events_waits_current ADD INDEX test_index(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_current(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result index 748dc2f29cd..2907e865b37 100644 --- a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result @@ -1,7 +1,7 @@ -alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; +alter table performance_schema.events_waits_history add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_HISTORY; -ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); +truncate table performance_schema.events_waits_history; +ALTER TABLE performance_schema.events_waits_history ADD INDEX test_index(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result index 1a047a765f6..8926d39374b 100644 --- a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result @@ -1,7 +1,7 @@ -alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; +alter table performance_schema.events_waits_history_long add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; -ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); +truncate table performance_schema.events_waits_history_long; +ALTER TABLE performance_schema.events_waits_history_long ADD INDEX test_index(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history_long(EVENT_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result index 4a35565bae0..94168f16eb7 100644 --- a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result @@ -1,7 +1,7 @@ -alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; +alter table performance_schema.events_waits_summary_by_instance add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); +truncate table performance_schema.events_waits_summary_by_instance; +ALTER TABLE performance_schema.events_waits_summary_by_instance ADD INDEX test_index(EVENT_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_summary_by_instance(EVENT_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result index 18d98006220..1694ff9287d 100644 --- a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result @@ -1,9 +1,9 @@ -alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +alter table performance_schema.events_waits_summary_by_thread_by_event_name add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); +truncate table performance_schema.events_waits_summary_by_thread_by_event_name; +ALTER TABLE performance_schema.events_waits_summary_by_thread_by_event_name ADD INDEX test_index(THREAD_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' CREATE UNIQUE INDEX test_index -ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); +ON performance_schema.events_waits_summary_by_thread_by_event_name(THREAD_ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result index 4f3ebcaea43..3b8cf851f80 100644 --- a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result +++ b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result @@ -1,10 +1,10 @@ -alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +alter table performance_schema.events_waits_summary_global_by_event_name add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +truncate table performance_schema.events_waits_summary_global_by_event_name; +ALTER TABLE performance_schema.events_waits_summary_global_by_event_name ADD INDEX test_index(EVENT_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' CREATE UNIQUE INDEX test_index -ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME); +ON performance_schema.events_waits_summary_global_by_event_name(EVENT_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_file_instances.result b/mysql-test/suite/perfschema/r/ddl_file_instances.result index 21e65c62405..338a0260326 100644 --- a/mysql-test/suite/perfschema/r/ddl_file_instances.result +++ b/mysql-test/suite/perfschema/r/ddl_file_instances.result @@ -1,8 +1,8 @@ -alter table performance_schema.FILE_INSTANCES add column foo integer; +alter table performance_schema.file_instances add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.FILE_INSTANCES; +truncate table performance_schema.file_instances; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); +ALTER TABLE performance_schema.file_instances ADD INDEX test_index(FILE_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_instances(FILE_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result index 2f21ef56832..11bff4104bb 100644 --- a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result @@ -1,7 +1,7 @@ -alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; +alter table performance_schema.file_summary_by_event_name add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); +truncate table performance_schema.file_summary_by_event_name; +ALTER TABLE performance_schema.file_summary_by_event_name ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_event_name(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result index 8e256d1fd8d..b28847b3aca 100644 --- a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result @@ -1,7 +1,7 @@ -alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; +alter table performance_schema.file_summary_by_instance add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; -ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); +truncate table performance_schema.file_summary_by_instance; +ALTER TABLE performance_schema.file_summary_by_instance ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_instance(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result index 35397a5294d..0e35b0d766a 100644 --- a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result +++ b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result @@ -1,8 +1,8 @@ -alter table performance_schema.MUTEX_INSTANCES add column foo integer; +alter table performance_schema.mutex_instances add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.MUTEX_INSTANCES; +truncate table performance_schema.mutex_instances; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.mutex_instances ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.mutex_instances(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_performance_timers.result b/mysql-test/suite/perfschema/r/ddl_performance_timers.result index 5de8193b205..6868d419f1b 100644 --- a/mysql-test/suite/perfschema/r/ddl_performance_timers.result +++ b/mysql-test/suite/perfschema/r/ddl_performance_timers.result @@ -1,8 +1,8 @@ -alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; +alter table performance_schema.performance_timers add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.PERFORMANCE_TIMERS; +truncate table performance_schema.performance_timers; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); +ALTER TABLE performance_schema.performance_timers ADD INDEX test_index(TIMER_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.performance_timers(TIMER_NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result index 849d191b17f..e93aef47a5c 100644 --- a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result +++ b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result @@ -1,8 +1,8 @@ -alter table performance_schema.RWLOCK_INSTANCES add column foo integer; +alter table performance_schema.rwlock_instances add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.RWLOCK_INSTANCES; +truncate table performance_schema.rwlock_instances; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.rwlock_instances ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.rwlock_instances(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result index f141725ee1f..1b121a0ec4c 100644 --- a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result +++ b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result @@ -1,8 +1,8 @@ -alter table performance_schema.SETUP_CONSUMERS add column foo integer; +alter table performance_schema.setup_consumers add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.SETUP_CONSUMERS; +truncate table performance_schema.setup_consumers; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_consumers ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_consumers(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result index 42e54b587d8..f67b4f5791b 100644 --- a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result @@ -1,8 +1,8 @@ -alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; +alter table performance_schema.setup_instruments add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.SETUP_INSTRUMENTS; +truncate table performance_schema.setup_instruments; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_instruments ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_instruments(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_timers.result b/mysql-test/suite/perfschema/r/ddl_setup_timers.result index fc74730bd50..69b3d36cc1b 100644 --- a/mysql-test/suite/perfschema/r/ddl_setup_timers.result +++ b/mysql-test/suite/perfschema/r/ddl_setup_timers.result @@ -1,8 +1,8 @@ -alter table performance_schema.SETUP_TIMERS add column foo integer; +alter table performance_schema.setup_timers add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.SETUP_TIMERS; +truncate table performance_schema.setup_timers; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_timers ADD INDEX test_index(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_timers(NAME); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_threads.result b/mysql-test/suite/perfschema/r/ddl_threads.result index 5d4b54d8bbe..9d949e0920f 100644 --- a/mysql-test/suite/perfschema/r/ddl_threads.result +++ b/mysql-test/suite/perfschema/r/ddl_threads.result @@ -1,8 +1,8 @@ -alter table performance_schema.THREADS add column foo integer; +alter table performance_schema.threads add column foo integer; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -truncate table performance_schema.THREADS; +truncate table performance_schema.threads; ERROR HY000: Invalid performance_schema usage. -ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID); +ALTER TABLE performance_schema.threads ADD INDEX test_index(ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID); +CREATE UNIQUE INDEX test_index ON performance_schema.threads(ID); ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/dml_cond_instances.result b/mysql-test/suite/perfschema/r/dml_cond_instances.result index 8adc632b91b..922effc59ae 100644 --- a/mysql-test/suite/perfschema/r/dml_cond_instances.result +++ b/mysql-test/suite/perfschema/r/dml_cond_instances.result @@ -1,23 +1,23 @@ -select * from performance_schema.COND_INSTANCES limit 1; +select * from performance_schema.cond_instances limit 1; NAME OBJECT_INSTANCE_BEGIN # # -select * from performance_schema.COND_INSTANCES +select * from performance_schema.cond_instances where name='FOO'; NAME OBJECT_INSTANCE_BEGIN -insert into performance_schema.COND_INSTANCES +insert into performance_schema.cond_instances set name='FOO', object_instance_begin=12; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'COND_INSTANCES' -update performance_schema.COND_INSTANCES +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'cond_instances' +update performance_schema.cond_instances set name='FOO'; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' -delete from performance_schema.COND_INSTANCES +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'cond_instances' +delete from performance_schema.cond_instances where name like "wait/%"; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' -delete from performance_schema.COND_INSTANCES; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' -LOCK TABLES performance_schema.COND_INSTANCES READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'cond_instances' +delete from performance_schema.cond_instances; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'cond_instances' +LOCK TABLES performance_schema.cond_instances READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' UNLOCK TABLES; -LOCK TABLES performance_schema.COND_INSTANCES WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +LOCK TABLES performance_schema.cond_instances WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_current.result b/mysql-test/suite/perfschema/r/dml_events_waits_current.result index 5cd0dba7ad1..9b0bcf7f876 100644 --- a/mysql-test/suite/perfschema/r/dml_events_waits_current.result +++ b/mysql-test/suite/perfschema/r/dml_events_waits_current.result @@ -1,28 +1,28 @@ -select * from performance_schema.EVENTS_WAITS_CURRENT +select * from performance_schema.events_waits_current where event_name like 'Wait/Synch/%' limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -select * from performance_schema.EVENTS_WAITS_CURRENT +select * from performance_schema.events_waits_current where event_name='FOO'; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -insert into performance_schema.EVENTS_WAITS_CURRENT +insert into performance_schema.events_waits_current set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -update performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_current' +update performance_schema.events_waits_current set timer_start=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -update performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_current' +update performance_schema.events_waits_current set timer_start=12 where thread_id=0; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_current' +delete from performance_schema.events_waits_current where thread_id=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current' +delete from performance_schema.events_waits_current; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current' +LOCK TABLES performance_schema.events_waits_current READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +LOCK TABLES performance_schema.events_waits_current WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history.result b/mysql-test/suite/perfschema/r/dml_events_waits_history.result index 953922868fb..5fc95584c7f 100644 --- a/mysql-test/suite/perfschema/r/dml_events_waits_history.result +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history.result @@ -1,36 +1,36 @@ -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name='FOO'; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' order by timer_wait limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -insert into performance_schema.EVENTS_WAITS_HISTORY +insert into performance_schema.events_waits_history set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' -update performance_schema.EVENTS_WAITS_HISTORY +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_history' +update performance_schema.events_waits_history set timer_start=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' -update performance_schema.EVENTS_WAITS_HISTORY +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history' +update performance_schema.events_waits_history set timer_start=12 where thread_id=0; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' -delete from performance_schema.EVENTS_WAITS_HISTORY +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history' +delete from performance_schema.events_waits_history where thread_id=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' -delete from performance_schema.EVENTS_WAITS_HISTORY; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history' +delete from performance_schema.events_waits_history; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history' +LOCK TABLES performance_schema.events_waits_history READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +LOCK TABLES performance_schema.events_waits_history WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result index 494469a0db8..2ce949b2228 100644 --- a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result @@ -1,36 +1,36 @@ -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name='FOO'; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' order by timer_wait limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS # # # # # # # # NULL NULL NULL # NULL # NULL 0 -insert into performance_schema.EVENTS_WAITS_HISTORY_LONG +insert into performance_schema.events_waits_history_long set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -update performance_schema.EVENTS_WAITS_HISTORY_LONG +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_history_long' +update performance_schema.events_waits_history_long set timer_start=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -update performance_schema.EVENTS_WAITS_HISTORY_LONG +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history_long' +update performance_schema.events_waits_history_long set timer_start=12 where thread_id=0; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -delete from performance_schema.EVENTS_WAITS_HISTORY_LONG +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history_long' +delete from performance_schema.events_waits_history_long where thread_id=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history_long' +delete from performance_schema.events_waits_history_long; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history_long' +LOCK TABLES performance_schema.events_waits_history_long READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history_long' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +LOCK TABLES performance_schema.events_waits_history_long WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history_long' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result index dc262982340..0a745a2c38a 100644 --- a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result +++ b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result @@ -1,45 +1,45 @@ -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where event_name like 'Wait/Synch/%' limit 1; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where event_name='FOO'; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance order by count_star limit 1; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance order by count_star desc limit 1; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star limit 1; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star desc limit 1; EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +insert into performance_schema.events_waits_summary_by_instance set event_name='FOO', object_instance_begin=0, count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' +update performance_schema.events_waits_summary_by_instance set count_star=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' +update performance_schema.events_waits_summary_by_instance set count_star=12 where event_name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' +delete from performance_schema.events_waits_summary_by_instance where count_star=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' +delete from performance_schema.events_waits_summary_by_instance; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' +LOCK TABLES performance_schema.events_waits_summary_by_instance READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.events_waits_summary_by_instance WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result index 2a085659431..c64bcdd40f6 100644 --- a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result +++ b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result @@ -1,29 +1,29 @@ -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name like 'Wait/Synch/%' limit 1; THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name='FOO'; THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +insert into performance_schema.events_waits_summary_by_thread_by_event_name set event_name='FOO', thread_id=1, count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' +update performance_schema.events_waits_summary_by_thread_by_event_name set count_star=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' +update performance_schema.events_waits_summary_by_thread_by_event_name set count_star=12 where event_name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' +delete from performance_schema.events_waits_summary_by_thread_by_event_name where count_star=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' +delete from performance_schema.events_waits_summary_by_thread_by_event_name; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' +LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result index 64ede2fddac..c59451922c5 100644 --- a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result +++ b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result @@ -1,28 +1,28 @@ -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_global_by_event_name where event_name like 'Wait/Synch/%' limit 1; EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT # # # # # # -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_global_by_event_name where event_name='FOO'; EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +insert into performance_schema.events_waits_summary_global_by_event_name set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' +update performance_schema.events_waits_summary_global_by_event_name set count_star=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' +update performance_schema.events_waits_summary_global_by_event_name set count_star=12 where event_name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' +delete from performance_schema.events_waits_summary_global_by_event_name where count_star=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' +delete from performance_schema.events_waits_summary_global_by_event_name; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' +LOCK TABLES performance_schema.events_waits_summary_global_by_event_name READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' UNLOCK TABLES; -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' +LOCK TABLES performance_schema.events_waits_summary_global_by_event_name WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_instances.result b/mysql-test/suite/perfschema/r/dml_file_instances.result index e15d68cbad3..5a51a4ca018 100644 --- a/mysql-test/suite/perfschema/r/dml_file_instances.result +++ b/mysql-test/suite/perfschema/r/dml_file_instances.result @@ -1,23 +1,23 @@ -select * from performance_schema.FILE_INSTANCES limit 1; +select * from performance_schema.file_instances limit 1; FILE_NAME EVENT_NAME OPEN_COUNT # # # -select * from performance_schema.FILE_INSTANCES +select * from performance_schema.file_instances where file_name='FOO'; FILE_NAME EVENT_NAME OPEN_COUNT -insert into performance_schema.FILE_INSTANCES +insert into performance_schema.file_instances set file_name='FOO', event_name='BAR', open_count=12; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -update performance_schema.FILE_INSTANCES +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_instances' +update performance_schema.file_instances set file_name='FOO'; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.FILE_INSTANCES +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_instances' +delete from performance_schema.file_instances where event_name like "wait/%"; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.FILE_INSTANCES; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -LOCK TABLES performance_schema.FILE_INSTANCES READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances' +delete from performance_schema.file_instances; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances' +LOCK TABLES performance_schema.file_instances READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances' UNLOCK TABLES; -LOCK TABLES performance_schema.FILE_INSTANCES WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +LOCK TABLES performance_schema.file_instances WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result index 1ecc82f40a5..97a196dbf19 100644 --- a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result @@ -1,28 +1,28 @@ -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +select * from performance_schema.file_summary_by_event_name where event_name like 'Wait/io/%' limit 1; EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE # # # # # -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +select * from performance_schema.file_summary_by_event_name where event_name='FOO'; EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE -insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME +insert into performance_schema.file_summary_by_event_name set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' -update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' +update performance_schema.file_summary_by_event_name set count_read=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' -update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' +update performance_schema.file_summary_by_event_name set count_write=12 where event_name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' -delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' +delete from performance_schema.file_summary_by_event_name where count_read=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' -delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' -LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' +delete from performance_schema.file_summary_by_event_name; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' +LOCK TABLES performance_schema.file_summary_by_event_name READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' UNLOCK TABLES; -LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +LOCK TABLES performance_schema.file_summary_by_event_name WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_event_name' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result index 05b204cc1a9..d85e23cb6f4 100644 --- a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result @@ -1,28 +1,28 @@ -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +select * from performance_schema.file_summary_by_instance where event_name like 'Wait/io/%' limit 1; FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE # # # # # # -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +select * from performance_schema.file_summary_by_instance where event_name='FOO'; FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE -insert into performance_schema.FILE_SUMMARY_BY_INSTANCE +insert into performance_schema.file_summary_by_instance set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' -update performance_schema.FILE_SUMMARY_BY_INSTANCE +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_instance' +update performance_schema.file_summary_by_instance set count_read=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' -update performance_schema.FILE_SUMMARY_BY_INSTANCE +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance' +update performance_schema.file_summary_by_instance set count_write=12 where event_name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' -delete from performance_schema.FILE_SUMMARY_BY_INSTANCE +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance' +delete from performance_schema.file_summary_by_instance where count_read=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' -delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' -LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance' +delete from performance_schema.file_summary_by_instance; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance' +LOCK TABLES performance_schema.file_summary_by_instance READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_instance' UNLOCK TABLES; -LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.file_summary_by_instance WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_instance' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result index 862123b3450..1ea7311b149 100644 --- a/mysql-test/suite/perfschema/r/dml_mutex_instances.result +++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result @@ -1,23 +1,23 @@ -select * from performance_schema.MUTEX_INSTANCES limit 1; +select * from performance_schema.mutex_instances limit 1; NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID # # # -select * from performance_schema.MUTEX_INSTANCES +select * from performance_schema.mutex_instances where name='FOO'; NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID -insert into performance_schema.MUTEX_INSTANCES +insert into performance_schema.mutex_instances set name='FOO', object_instance_begin=12; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' -update performance_schema.MUTEX_INSTANCES +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'mutex_instances' +update performance_schema.mutex_instances set name='FOO'; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' -delete from performance_schema.MUTEX_INSTANCES +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'mutex_instances' +delete from performance_schema.mutex_instances where name like "wait/%"; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' -delete from performance_schema.MUTEX_INSTANCES; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' -LOCK TABLES performance_schema.MUTEX_INSTANCES READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'mutex_instances' +delete from performance_schema.mutex_instances; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'mutex_instances' +LOCK TABLES performance_schema.mutex_instances READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'mutex_instances' UNLOCK TABLES; -LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +LOCK TABLES performance_schema.mutex_instances WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'mutex_instances' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_performance_timers.result b/mysql-test/suite/perfschema/r/dml_performance_timers.result index 99c1c74b797..f345cce921e 100644 --- a/mysql-test/suite/perfschema/r/dml_performance_timers.result +++ b/mysql-test/suite/perfschema/r/dml_performance_timers.result @@ -1,29 +1,29 @@ -select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.performance_timers; TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD CYCLE <frequency> <resolution> <overhead> NANOSECOND <frequency> <resolution> <overhead> MICROSECOND <frequency> <resolution> <overhead> MILLISECOND <frequency> <resolution> <overhead> TICK <frequency> <resolution> <overhead> -select * from performance_schema.PERFORMANCE_TIMERS +select * from performance_schema.performance_timers where timer_name='CYCLE'; TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD CYCLE <frequency> <resolution> <overhead> -insert into performance_schema.PERFORMANCE_TIMERS +insert into performance_schema.performance_timers set timer_name='FOO', timer_frequency=1, timer_resolution=2, timer_overhead=3; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' -update performance_schema.PERFORMANCE_TIMERS +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'performance_timers' +update performance_schema.performance_timers set timer_frequency=12 where timer_name='CYCLE'; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' -delete from performance_schema.PERFORMANCE_TIMERS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' -delete from performance_schema.PERFORMANCE_TIMERS +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'performance_timers' +delete from performance_schema.performance_timers; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'performance_timers' +delete from performance_schema.performance_timers where timer_name='CYCLE'; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' -LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'performance_timers' +LOCK TABLES performance_schema.performance_timers READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'performance_timers' UNLOCK TABLES; -LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +LOCK TABLES performance_schema.performance_timers WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'performance_timers' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result index 686007e58e9..964fa0fa46f 100644 --- a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result +++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result @@ -1,23 +1,23 @@ -select * from performance_schema.RWLOCK_INSTANCES limit 1; +select * from performance_schema.rwlock_instances limit 1; NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT # # # # -select * from performance_schema.RWLOCK_INSTANCES +select * from performance_schema.rwlock_instances where name='FOO'; NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT -insert into performance_schema.RWLOCK_INSTANCES +insert into performance_schema.rwlock_instances set name='FOO', object_instance_begin=12; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' -update performance_schema.RWLOCK_INSTANCES +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'rwlock_instances' +update performance_schema.rwlock_instances set name='FOO'; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' -delete from performance_schema.RWLOCK_INSTANCES +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'rwlock_instances' +delete from performance_schema.rwlock_instances where name like "wait/%"; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' -delete from performance_schema.RWLOCK_INSTANCES; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' -LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'rwlock_instances' +delete from performance_schema.rwlock_instances; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'rwlock_instances' +LOCK TABLES performance_schema.rwlock_instances READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'rwlock_instances' UNLOCK TABLES; -LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +LOCK TABLES performance_schema.rwlock_instances WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'rwlock_instances' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_consumers.result b/mysql-test/suite/perfschema/r/dml_setup_consumers.result index 44ed751dcd2..db0a6820de9 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_consumers.result +++ b/mysql-test/suite/perfschema/r/dml_setup_consumers.result @@ -1,4 +1,4 @@ -select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.setup_consumers; NAME ENABLED events_waits_current YES events_waits_history YES @@ -8,11 +8,11 @@ events_waits_summary_by_event_name YES events_waits_summary_by_instance YES file_summary_by_event_name YES file_summary_by_instance YES -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where name='events_waits_current'; NAME ENABLED events_waits_current YES -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where enabled='YES'; NAME ENABLED events_waits_current YES @@ -23,23 +23,23 @@ events_waits_summary_by_event_name YES events_waits_summary_by_instance YES file_summary_by_event_name YES file_summary_by_instance YES -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where enabled='NO'; NAME ENABLED -insert into performance_schema.SETUP_CONSUMERS +insert into performance_schema.setup_consumers set name='FOO', enabled='YES'; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' -update performance_schema.SETUP_CONSUMERS +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_consumers' +update performance_schema.setup_consumers set name='FOO'; ERROR HY000: Invalid performance_schema usage. -update performance_schema.SETUP_CONSUMERS +update performance_schema.setup_consumers set enabled='YES'; -delete from performance_schema.SETUP_CONSUMERS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' -delete from performance_schema.SETUP_CONSUMERS +delete from performance_schema.setup_consumers; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_consumers' +delete from performance_schema.setup_consumers where name='events_waits_current'; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' -LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_consumers' +LOCK TABLES performance_schema.setup_consumers READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +LOCK TABLES performance_schema.setup_consumers WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index 15174ee40bf..fefc4f46061 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -1,5 +1,5 @@ -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Mutex/sql/%' and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') order by name limit 10; @@ -14,7 +14,7 @@ wait/synch/mutex/sql/LOCK_audit_mask YES YES wait/synch/mutex/sql/LOCK_connection_count YES YES wait/synch/mutex/sql/LOCK_crypt YES YES wait/synch/mutex/sql/LOCK_delayed_create YES YES -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Rwlock/sql/%' and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') order by name limit 10; @@ -29,7 +29,7 @@ wait/synch/rwlock/sql/MDL_context::LOCK_waiting_for YES YES wait/synch/rwlock/sql/MDL_lock::rwlock YES YES wait/synch/rwlock/sql/Query_cache_query::lock YES YES wait/synch/rwlock/sql/THR_LOCK_servers YES YES -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Cond/sql/%' and name not in ( 'wait/synch/cond/sql/COND_handler_count', @@ -46,29 +46,29 @@ wait/synch/cond/sql/COND_thread_count YES YES wait/synch/cond/sql/Delayed_insert::cond YES YES wait/synch/cond/sql/Delayed_insert::cond_client YES YES wait/synch/cond/sql/Event_scheduler::COND_state YES YES -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name='Wait'; -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where enabled='YES'; -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name='FOO', enabled='YES', timed='YES'; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -update performance_schema.SETUP_INSTRUMENTS +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments' +update performance_schema.setup_instruments set name='FOO'; ERROR HY000: Invalid performance_schema usage. -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set timed='NO'; -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='YES', timed='YES'; -delete from performance_schema.SETUP_INSTRUMENTS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -delete from performance_schema.SETUP_INSTRUMENTS +delete from performance_schema.setup_instruments; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments' +delete from performance_schema.setup_instruments where name like 'Wait/Synch/%'; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments' +LOCK TABLES performance_schema.setup_instruments READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +LOCK TABLES performance_schema.setup_instruments WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_timers.result b/mysql-test/suite/perfschema/r/dml_setup_timers.result index a9bee916cde..ad1f6df3e81 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_timers.result +++ b/mysql-test/suite/perfschema/r/dml_setup_timers.result @@ -1,33 +1,33 @@ -select * from performance_schema.SETUP_TIMERS; +select * from performance_schema.setup_timers; NAME TIMER_NAME wait CYCLE -select * from performance_schema.SETUP_TIMERS +select * from performance_schema.setup_timers where name='Wait'; NAME TIMER_NAME wait CYCLE -select * from performance_schema.SETUP_TIMERS +select * from performance_schema.setup_timers where timer_name='CYCLE'; NAME TIMER_NAME wait CYCLE -insert into performance_schema.SETUP_TIMERS +insert into performance_schema.setup_timers set name='FOO', timer_name='CYCLE'; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' -update performance_schema.SETUP_TIMERS +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_timers' +update performance_schema.setup_timers set name='FOO'; ERROR HY000: Invalid performance_schema usage. -update performance_schema.SETUP_TIMERS +update performance_schema.setup_timers set timer_name='MILLISECOND'; -select * from performance_schema.SETUP_TIMERS; +select * from performance_schema.setup_timers; NAME TIMER_NAME wait MILLISECOND -update performance_schema.SETUP_TIMERS +update performance_schema.setup_timers set timer_name='CYCLE'; -delete from performance_schema.SETUP_TIMERS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' -delete from performance_schema.SETUP_TIMERS +delete from performance_schema.setup_timers; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_timers' +delete from performance_schema.setup_timers where name='Wait'; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' -LOCK TABLES performance_schema.SETUP_TIMERS READ; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_timers' +LOCK TABLES performance_schema.setup_timers READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +LOCK TABLES performance_schema.setup_timers WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_threads.result b/mysql-test/suite/perfschema/r/dml_threads.result index 261e7977aa5..8c61521d091 100644 --- a/mysql-test/suite/perfschema/r/dml_threads.result +++ b/mysql-test/suite/perfschema/r/dml_threads.result @@ -1,27 +1,27 @@ -select * from performance_schema.THREADS +select * from performance_schema.threads where name like 'Thread/%' limit 1; THREAD_ID PROCESSLIST_ID NAME # # # -select * from performance_schema.THREADS +select * from performance_schema.threads where name='FOO'; THREAD_ID PROCESSLIST_ID NAME -insert into performance_schema.THREADS +insert into performance_schema.threads set name='FOO', thread_id=1, processlist_id=2; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS' -update performance_schema.THREADS +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'threads' +update performance_schema.threads set thread_id=12; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS' -update performance_schema.THREADS +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'threads' +update performance_schema.threads set thread_id=12 where name like "FOO"; -ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS' -delete from performance_schema.THREADS +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'threads' +delete from performance_schema.threads where id=1; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS' -delete from performance_schema.THREADS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS' -LOCK TABLES performance_schema.THREADS READ; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS' +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads' +delete from performance_schema.threads; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads' +LOCK TABLES performance_schema.threads READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'threads' UNLOCK TABLES; -LOCK TABLES performance_schema.THREADS WRITE; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS' +LOCK TABLES performance_schema.threads WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'threads' UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result index 8314bed94bf..d99e77dcd8c 100644 --- a/mysql-test/suite/perfschema/r/func_file_io.result +++ b/mysql-test/suite/perfschema/r/func_file_io.result @@ -1,18 +1,18 @@ -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; id b 1 initial value SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD')); SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; @@ -24,15 +24,15 @@ id b 2 initial value 3 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; test_ff1_timed Success -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; +UPDATE performance_schema.setup_instruments SET enabled='NO'; SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); SELECT * FROM t1 WHERE id < 6; @@ -43,40 +43,40 @@ id b 4 initial value 5 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; test_ff2_timed Success -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +UPDATE performance_schema.setup_instruments SET timed = 'NO'; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id > 4; id b 5 initial value 6 initial value 7 initial value 8 initial value -SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +SELECT * FROM performance_schema.events_waits_history_long WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +SELECT * FROM performance_schema.events_waits_history WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT * FROM performance_schema.events_waits_current WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS -UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; +UPDATE performance_schema.setup_instruments SET timed = 'YES'; SELECT * FROM t1 WHERE id < 4; id b 1 initial value @@ -87,17 +87,17 @@ SELECT SUM(COUNT_READ) AS sum_count_read, SUM(COUNT_WRITE) AS sum_count_write, SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write -FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +FROM performance_schema.file_summary_by_instance WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +FROM performance_schema.events_waits_summary_global_by_event_name WHERE COUNT_STAR > 0 ORDER BY SUM_TIMER_WAIT DESC LIMIT 10; SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h -INNER JOIN performance_schema.THREADS p USING (THREAD_ID) +FROM performance_schema.events_waits_history_long h +INNER JOIN performance_schema.threads p USING (THREAD_ID) WHERE p.PROCESSLIST_ID = 1 GROUP BY h.EVENT_NAME HAVING TOTAL_WAIT > 0; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES'; diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result index 93ba4064a90..93a8ae5d218 100644 --- a/mysql-test/suite/perfschema/r/func_mutex.result +++ b/mysql-test/suite/perfschema/r/func_mutex.result @@ -1,19 +1,19 @@ -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; id b 1 initial value SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT * FROM t1; id b @@ -26,21 +26,21 @@ id b 7 initial value 8 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; test_fm1_timed Success -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; id b 1 initial value SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT * FROM t1; id b @@ -53,19 +53,19 @@ id b 7 initial value 8 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; test_fm2_timed Success -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; id b 1 initial value SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; id b @@ -78,21 +78,21 @@ id b 7 initial value 8 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; test_fm1_rw_timed Success -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; id b 1 initial value SET @before_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; id b @@ -105,10 +105,10 @@ id b 7 initial value 8 initial value SET @after_count = (SELECT SUM(TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; test_fm2_rw_timed Success -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES'; DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result index 365ac095e84..d71bcf81ea7 100644 --- a/mysql-test/suite/perfschema/r/global_read_lock.result +++ b/mysql-test/suite/perfschema/r/global_read_lock.result @@ -1,33 +1,33 @@ use performance_schema; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; flush privileges; connect (con1, localhost, pfsuser, , test); -lock tables performance_schema.SETUP_INSTRUMENTS read; -select * from performance_schema.SETUP_INSTRUMENTS; +lock tables performance_schema.setup_instruments read; +select * from performance_schema.setup_instruments; unlock tables; -lock tables performance_schema.SETUP_INSTRUMENTS write; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +lock tables performance_schema.setup_instruments write; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; unlock tables; connection default; flush tables with read lock; connection con1; -lock tables performance_schema.SETUP_INSTRUMENTS read; -select * from performance_schema.SETUP_INSTRUMENTS; +lock tables performance_schema.setup_instruments read; +select * from performance_schema.setup_instruments; unlock tables; -lock tables performance_schema.SETUP_INSTRUMENTS write; +lock tables performance_schema.setup_instruments write; connection default; select event_name, left(source, locate(":", source)) as short_source, timer_end, timer_wait, operation -from performance_schema.EVENTS_WAITS_CURRENT +from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; event_name short_source timer_end timer_wait operation wait/synch/cond/sql/MDL_context::COND_wait_status mdl.cc: NULL NULL timed_wait unlock tables; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; unlock tables; connection default; drop user pfsuser@localhost; diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result index 8e7478564fb..ab464cce687 100644 --- a/mysql-test/suite/perfschema/r/information_schema.result +++ b/mysql-test/suite/perfschema/r/information_schema.result @@ -1,189 +1,189 @@ -select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG +select TABLE_SCHEMA, lower(TABLE_NAME), TABLE_CATALOG from information_schema.tables where TABLE_SCHEMA='performance_schema'; -TABLE_SCHEMA upper(TABLE_NAME) TABLE_CATALOG -performance_schema COND_INSTANCES def -performance_schema EVENTS_WAITS_CURRENT def -performance_schema EVENTS_WAITS_HISTORY def -performance_schema EVENTS_WAITS_HISTORY_LONG def -performance_schema EVENTS_WAITS_SUMMARY_BY_INSTANCE def -performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME def -performance_schema EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME def -performance_schema FILE_INSTANCES def -performance_schema FILE_SUMMARY_BY_EVENT_NAME def -performance_schema FILE_SUMMARY_BY_INSTANCE def -performance_schema MUTEX_INSTANCES def -performance_schema PERFORMANCE_TIMERS def -performance_schema RWLOCK_INSTANCES def -performance_schema SETUP_CONSUMERS def -performance_schema SETUP_INSTRUMENTS def -performance_schema SETUP_TIMERS def -performance_schema THREADS def -select upper(TABLE_NAME), TABLE_TYPE, ENGINE +TABLE_SCHEMA lower(TABLE_NAME) TABLE_CATALOG +performance_schema cond_instances def +performance_schema events_waits_current def +performance_schema events_waits_history def +performance_schema events_waits_history_long def +performance_schema events_waits_summary_by_instance def +performance_schema events_waits_summary_by_thread_by_event_name def +performance_schema events_waits_summary_global_by_event_name def +performance_schema file_instances def +performance_schema file_summary_by_event_name def +performance_schema file_summary_by_instance def +performance_schema mutex_instances def +performance_schema performance_timers def +performance_schema rwlock_instances def +performance_schema setup_consumers def +performance_schema setup_instruments def +performance_schema setup_timers def +performance_schema threads def +select lower(TABLE_NAME), TABLE_TYPE, ENGINE from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) TABLE_TYPE ENGINE -COND_INSTANCES BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_CURRENT BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_HISTORY BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_HISTORY_LONG BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA -FILE_INSTANCES BASE TABLE PERFORMANCE_SCHEMA -FILE_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA -FILE_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA -MUTEX_INSTANCES BASE TABLE PERFORMANCE_SCHEMA -PERFORMANCE_TIMERS BASE TABLE PERFORMANCE_SCHEMA -RWLOCK_INSTANCES BASE TABLE PERFORMANCE_SCHEMA -SETUP_CONSUMERS BASE TABLE PERFORMANCE_SCHEMA -SETUP_INSTRUMENTS BASE TABLE PERFORMANCE_SCHEMA -SETUP_TIMERS BASE TABLE PERFORMANCE_SCHEMA -THREADS BASE TABLE PERFORMANCE_SCHEMA -select upper(TABLE_NAME), VERSION, ROW_FORMAT +lower(TABLE_NAME) TABLE_TYPE ENGINE +cond_instances BASE TABLE PERFORMANCE_SCHEMA +events_waits_current BASE TABLE PERFORMANCE_SCHEMA +events_waits_history BASE TABLE PERFORMANCE_SCHEMA +events_waits_history_long BASE TABLE PERFORMANCE_SCHEMA +events_waits_summary_by_instance BASE TABLE PERFORMANCE_SCHEMA +events_waits_summary_by_thread_by_event_name BASE TABLE PERFORMANCE_SCHEMA +events_waits_summary_global_by_event_name BASE TABLE PERFORMANCE_SCHEMA +file_instances BASE TABLE PERFORMANCE_SCHEMA +file_summary_by_event_name BASE TABLE PERFORMANCE_SCHEMA +file_summary_by_instance BASE TABLE PERFORMANCE_SCHEMA +mutex_instances BASE TABLE PERFORMANCE_SCHEMA +performance_timers BASE TABLE PERFORMANCE_SCHEMA +rwlock_instances BASE TABLE PERFORMANCE_SCHEMA +setup_consumers BASE TABLE PERFORMANCE_SCHEMA +setup_instruments BASE TABLE PERFORMANCE_SCHEMA +setup_timers BASE TABLE PERFORMANCE_SCHEMA +threads BASE TABLE PERFORMANCE_SCHEMA +select lower(TABLE_NAME), VERSION, ROW_FORMAT from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) VERSION ROW_FORMAT -COND_INSTANCES 10 Dynamic -EVENTS_WAITS_CURRENT 10 Dynamic -EVENTS_WAITS_HISTORY 10 Dynamic -EVENTS_WAITS_HISTORY_LONG 10 Dynamic -EVENTS_WAITS_SUMMARY_BY_INSTANCE 10 Dynamic -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 10 Dynamic -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 10 Dynamic -FILE_INSTANCES 10 Dynamic -FILE_SUMMARY_BY_EVENT_NAME 10 Dynamic -FILE_SUMMARY_BY_INSTANCE 10 Dynamic -MUTEX_INSTANCES 10 Dynamic -PERFORMANCE_TIMERS 10 Fixed -RWLOCK_INSTANCES 10 Dynamic -SETUP_CONSUMERS 10 Dynamic -SETUP_INSTRUMENTS 10 Dynamic -SETUP_TIMERS 10 Dynamic -THREADS 10 Dynamic -select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH +lower(TABLE_NAME) VERSION ROW_FORMAT +cond_instances 10 Dynamic +events_waits_current 10 Dynamic +events_waits_history 10 Dynamic +events_waits_history_long 10 Dynamic +events_waits_summary_by_instance 10 Dynamic +events_waits_summary_by_thread_by_event_name 10 Dynamic +events_waits_summary_global_by_event_name 10 Dynamic +file_instances 10 Dynamic +file_summary_by_event_name 10 Dynamic +file_summary_by_instance 10 Dynamic +mutex_instances 10 Dynamic +performance_timers 10 Fixed +rwlock_instances 10 Dynamic +setup_consumers 10 Dynamic +setup_instruments 10 Dynamic +setup_timers 10 Dynamic +threads 10 Dynamic +select lower(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH -COND_INSTANCES 1000 0 -EVENTS_WAITS_CURRENT 1000 0 -EVENTS_WAITS_HISTORY 1000 0 -EVENTS_WAITS_HISTORY_LONG 10000 0 -EVENTS_WAITS_SUMMARY_BY_INSTANCE 1000 0 -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 1000 0 -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 1000 0 -FILE_INSTANCES 1000 0 -FILE_SUMMARY_BY_EVENT_NAME 1000 0 -FILE_SUMMARY_BY_INSTANCE 1000 0 -MUTEX_INSTANCES 1000 0 -PERFORMANCE_TIMERS 5 0 -RWLOCK_INSTANCES 1000 0 -SETUP_CONSUMERS 8 0 -SETUP_INSTRUMENTS 1000 0 -SETUP_TIMERS 1 0 -THREADS 1000 0 -select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH +lower(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH +cond_instances 1000 0 +events_waits_current 1000 0 +events_waits_history 1000 0 +events_waits_history_long 10000 0 +events_waits_summary_by_instance 1000 0 +events_waits_summary_by_thread_by_event_name 1000 0 +events_waits_summary_global_by_event_name 1000 0 +file_instances 1000 0 +file_summary_by_event_name 1000 0 +file_summary_by_instance 1000 0 +mutex_instances 1000 0 +performance_timers 5 0 +rwlock_instances 1000 0 +setup_consumers 8 0 +setup_instruments 1000 0 +setup_timers 1 0 +threads 1000 0 +select lower(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH -COND_INSTANCES 0 0 -EVENTS_WAITS_CURRENT 0 0 -EVENTS_WAITS_HISTORY 0 0 -EVENTS_WAITS_HISTORY_LONG 0 0 -EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0 -FILE_INSTANCES 0 0 -FILE_SUMMARY_BY_EVENT_NAME 0 0 -FILE_SUMMARY_BY_INSTANCE 0 0 -MUTEX_INSTANCES 0 0 -PERFORMANCE_TIMERS 0 0 -RWLOCK_INSTANCES 0 0 -SETUP_CONSUMERS 0 0 -SETUP_INSTRUMENTS 0 0 -SETUP_TIMERS 0 0 -THREADS 0 0 -select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT +lower(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH +cond_instances 0 0 +events_waits_current 0 0 +events_waits_history 0 0 +events_waits_history_long 0 0 +events_waits_summary_by_instance 0 0 +events_waits_summary_by_thread_by_event_name 0 0 +events_waits_summary_global_by_event_name 0 0 +file_instances 0 0 +file_summary_by_event_name 0 0 +file_summary_by_instance 0 0 +mutex_instances 0 0 +performance_timers 0 0 +rwlock_instances 0 0 +setup_consumers 0 0 +setup_instruments 0 0 +setup_timers 0 0 +threads 0 0 +select lower(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT -COND_INSTANCES 0 0 NULL -EVENTS_WAITS_CURRENT 0 0 NULL -EVENTS_WAITS_HISTORY 0 0 NULL -EVENTS_WAITS_HISTORY_LONG 0 0 NULL -EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 NULL -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 NULL -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0 NULL -FILE_INSTANCES 0 0 NULL -FILE_SUMMARY_BY_EVENT_NAME 0 0 NULL -FILE_SUMMARY_BY_INSTANCE 0 0 NULL -MUTEX_INSTANCES 0 0 NULL -PERFORMANCE_TIMERS 0 0 NULL -RWLOCK_INSTANCES 0 0 NULL -SETUP_CONSUMERS 0 0 NULL -SETUP_INSTRUMENTS 0 0 NULL -SETUP_TIMERS 0 0 NULL -THREADS 0 0 NULL -select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME +lower(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT +cond_instances 0 0 NULL +events_waits_current 0 0 NULL +events_waits_history 0 0 NULL +events_waits_history_long 0 0 NULL +events_waits_summary_by_instance 0 0 NULL +events_waits_summary_by_thread_by_event_name 0 0 NULL +events_waits_summary_global_by_event_name 0 0 NULL +file_instances 0 0 NULL +file_summary_by_event_name 0 0 NULL +file_summary_by_instance 0 0 NULL +mutex_instances 0 0 NULL +performance_timers 0 0 NULL +rwlock_instances 0 0 NULL +setup_consumers 0 0 NULL +setup_instruments 0 0 NULL +setup_timers 0 0 NULL +threads 0 0 NULL +select lower(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME -COND_INSTANCES NULL NULL NULL -EVENTS_WAITS_CURRENT NULL NULL NULL -EVENTS_WAITS_HISTORY NULL NULL NULL -EVENTS_WAITS_HISTORY_LONG NULL NULL NULL -EVENTS_WAITS_SUMMARY_BY_INSTANCE NULL NULL NULL -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME NULL NULL NULL -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME NULL NULL NULL -FILE_INSTANCES NULL NULL NULL -FILE_SUMMARY_BY_EVENT_NAME NULL NULL NULL -FILE_SUMMARY_BY_INSTANCE NULL NULL NULL -MUTEX_INSTANCES NULL NULL NULL -PERFORMANCE_TIMERS NULL NULL NULL -RWLOCK_INSTANCES NULL NULL NULL -SETUP_CONSUMERS NULL NULL NULL -SETUP_INSTRUMENTS NULL NULL NULL -SETUP_TIMERS NULL NULL NULL -THREADS NULL NULL NULL -select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM +lower(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME +cond_instances NULL NULL NULL +events_waits_current NULL NULL NULL +events_waits_history NULL NULL NULL +events_waits_history_long NULL NULL NULL +events_waits_summary_by_instance NULL NULL NULL +events_waits_summary_by_thread_by_event_name NULL NULL NULL +events_waits_summary_global_by_event_name NULL NULL NULL +file_instances NULL NULL NULL +file_summary_by_event_name NULL NULL NULL +file_summary_by_instance NULL NULL NULL +mutex_instances NULL NULL NULL +performance_timers NULL NULL NULL +rwlock_instances NULL NULL NULL +setup_consumers NULL NULL NULL +setup_instruments NULL NULL NULL +setup_timers NULL NULL NULL +threads NULL NULL NULL +select lower(TABLE_NAME), TABLE_COLLATION, CHECKSUM from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) TABLE_COLLATION CHECKSUM -COND_INSTANCES utf8_general_ci NULL -EVENTS_WAITS_CURRENT utf8_general_ci NULL -EVENTS_WAITS_HISTORY utf8_general_ci NULL -EVENTS_WAITS_HISTORY_LONG utf8_general_ci NULL -EVENTS_WAITS_SUMMARY_BY_INSTANCE utf8_general_ci NULL -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME utf8_general_ci NULL -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME utf8_general_ci NULL -FILE_INSTANCES utf8_general_ci NULL -FILE_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL -FILE_SUMMARY_BY_INSTANCE utf8_general_ci NULL -MUTEX_INSTANCES utf8_general_ci NULL -PERFORMANCE_TIMERS utf8_general_ci NULL -RWLOCK_INSTANCES utf8_general_ci NULL -SETUP_CONSUMERS utf8_general_ci NULL -SETUP_INSTRUMENTS utf8_general_ci NULL -SETUP_TIMERS utf8_general_ci NULL -THREADS utf8_general_ci NULL -select upper(TABLE_NAME), TABLE_COMMENT +lower(TABLE_NAME) TABLE_COLLATION CHECKSUM +cond_instances utf8_general_ci NULL +events_waits_current utf8_general_ci NULL +events_waits_history utf8_general_ci NULL +events_waits_history_long utf8_general_ci NULL +events_waits_summary_by_instance utf8_general_ci NULL +events_waits_summary_by_thread_by_event_name utf8_general_ci NULL +events_waits_summary_global_by_event_name utf8_general_ci NULL +file_instances utf8_general_ci NULL +file_summary_by_event_name utf8_general_ci NULL +file_summary_by_instance utf8_general_ci NULL +mutex_instances utf8_general_ci NULL +performance_timers utf8_general_ci NULL +rwlock_instances utf8_general_ci NULL +setup_consumers utf8_general_ci NULL +setup_instruments utf8_general_ci NULL +setup_timers utf8_general_ci NULL +threads utf8_general_ci NULL +select lower(TABLE_NAME), TABLE_COMMENT from information_schema.tables where TABLE_SCHEMA='performance_schema'; -upper(TABLE_NAME) TABLE_COMMENT -COND_INSTANCES -EVENTS_WAITS_CURRENT -EVENTS_WAITS_HISTORY -EVENTS_WAITS_HISTORY_LONG -EVENTS_WAITS_SUMMARY_BY_INSTANCE -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME -FILE_INSTANCES -FILE_SUMMARY_BY_EVENT_NAME -FILE_SUMMARY_BY_INSTANCE -MUTEX_INSTANCES -PERFORMANCE_TIMERS -RWLOCK_INSTANCES -SETUP_CONSUMERS -SETUP_INSTRUMENTS -SETUP_TIMERS -THREADS +lower(TABLE_NAME) TABLE_COMMENT +cond_instances +events_waits_current +events_waits_history +events_waits_history_long +events_waits_summary_by_instance +events_waits_summary_by_thread_by_event_name +events_waits_summary_global_by_event_name +file_instances +file_summary_by_event_name +file_summary_by_instance +mutex_instances +performance_timers +rwlock_instances +setup_consumers +setup_instruments +setup_timers +threads diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result index e389a4ce65c..4e9b08e00ef 100644 --- a/mysql-test/suite/perfschema/r/misc.result +++ b/mysql-test/suite/perfschema/r/misc.result @@ -1,13 +1,13 @@ -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE THREAD_ID IN -(SELECT THREAD_ID FROM performance_schema.THREADS) +(SELECT THREAD_ID FROM performance_schema.threads) AND EVENT_NAME IN -(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +(SELECT NAME FROM performance_schema.setup_instruments WHERE NAME LIKE "wait/synch/%") LIMIT 1; create table test.t1(a int) engine=performance_schema; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; ERROR HY000: Invalid performance_schema usage. create table performance_schema.t1(a int); ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1' @@ -22,7 +22,7 @@ a b 1 3 2 4 drop table test.ghost; -select * from performance_schema.FILE_INSTANCES +select * from performance_schema.file_instances where file_name like "%ghost%"; FILE_NAME EVENT_NAME OPEN_COUNT select * from performance_schema.no_such_table; diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result index 5d710d9183d..287abd43d74 100644 --- a/mysql-test/suite/perfschema/r/myisam_file_io.result +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result @@ -1,9 +1,9 @@ -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES' where name like "wait/io/file/myisam/%"; -update performance_schema.SETUP_CONSUMERS +update performance_schema.setup_consumers set enabled='YES'; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_history_long; flush status; drop table if exists test.no_index_tab; create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; @@ -14,7 +14,7 @@ select event_name, left(source, locate(":", source)) as short_source, operation, number_of_bytes, substring(object_name, locate("no_index_tab", object_name)) as short_name -from performance_schema.EVENTS_WAITS_HISTORY_LONG +from performance_schema.events_waits_history_long where operation not like "tell" order by thread_id, event_id; event_name short_source operation number_of_bytes short_name @@ -56,5 +56,5 @@ Performance_schema_table_handles_lost 0 Performance_schema_table_instances_lost 0 Performance_schema_thread_classes_lost 0 Performance_schema_thread_instances_lost 0 -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; drop table test.no_index_tab; diff --git a/mysql-test/suite/perfschema/r/no_threads.result b/mysql-test/suite/perfschema/r/no_threads.result index 79d16809eee..89ae72c8df1 100644 --- a/mysql-test/suite/perfschema/r/no_threads.result +++ b/mysql-test/suite/perfschema/r/no_threads.result @@ -1,11 +1,11 @@ -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_CONSUMERS set enabled='YES'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_consumers set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; drop table if exists test.t1; -truncate table performance_schema.EVENTS_WAITS_CURRENT; -truncate table performance_schema.EVENTS_WAITS_HISTORY; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_current; +truncate table performance_schema.events_waits_history; +truncate table performance_schema.events_waits_history_long; show variables like "thread_handling"; Variable_name Value thread_handling no-threads @@ -17,27 +17,27 @@ show variables like "performance_schema_max_thread%"; Variable_name Value performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 10 -select count(*) from performance_schema.THREADS +select count(*) from performance_schema.threads where name like "thread/sql/main"; count(*) 1 -select count(*) from performance_schema.THREADS +select count(*) from performance_schema.threads where name like "thread/sql/OneConnection"; count(*) 0 select event_name, operation, left(source, locate(":", source)) as short_source -from performance_schema.EVENTS_WAITS_CURRENT; +from performance_schema.events_waits_current; event_name operation short_source wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: select event_name, operation, left(source, locate(":", source)) as short_source -from performance_schema.EVENTS_WAITS_HISTORY; +from performance_schema.events_waits_history; event_name operation short_source wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: select event_name, operation, left(source, locate(":", source)) as short_source -from performance_schema.EVENTS_WAITS_HISTORY_LONG; +from performance_schema.events_waits_history_long; event_name operation short_source wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/one_thread_per_con.result b/mysql-test/suite/perfschema/r/one_thread_per_con.result index 9677a09933a..998aba6281c 100644 --- a/mysql-test/suite/perfschema/r/one_thread_per_con.result +++ b/mysql-test/suite/perfschema/r/one_thread_per_con.result @@ -1,9 +1,9 @@ -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; drop table if exists test.t1; drop table if exists test.t2; drop table if exists test.t3; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_history_long; show variables like "thread_handling"; Variable_name Value thread_handling one-thread-per-connection @@ -35,4 +35,4 @@ thread/sql/one_connection drop table test.t1; drop table test.t2; drop table test.t3; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result index 7a782687184..2ec6a3bd1dd 100644 --- a/mysql-test/suite/perfschema/r/pfs_upgrade.result +++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result @@ -8,23 +8,23 @@ use performance_schema; show tables like "user_table"; Tables_in_performance_schema (user_table) user_table -ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists -ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists -ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists -ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists -ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists -ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists -ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists -ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists -ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists -ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists -ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists -ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists +ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists +ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line 478: Table 'threads' already exists ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_table"; @@ -38,23 +38,23 @@ use performance_schema; show tables like "user_view"; Tables_in_performance_schema (user_view) user_view -ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists -ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists -ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists -ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists -ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists -ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists -ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists -ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists -ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists -ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists -ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists -ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists +ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists +ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line 478: Table 'threads' already exists ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_view"; @@ -66,23 +66,23 @@ drop view test.user_view; create procedure test.user_proc() select "Not supposed to be here"; update mysql.proc set db='performance_schema' where name='user_proc'; -ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists -ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists -ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists -ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists -ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists -ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists -ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists -ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists -ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists -ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists -ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists -ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists +ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists +ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line 478: Table 'threads' already exists ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; @@ -94,23 +94,23 @@ drop procedure test.user_proc; create function test.user_func() returns integer return 0; update mysql.proc set db='performance_schema' where name='user_func'; -ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists -ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists -ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists -ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists -ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists -ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists -ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists -ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists -ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists -ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists -ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists -ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists +ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists +ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line 478: Table 'threads' already exists ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; @@ -122,23 +122,23 @@ drop function test.user_func; create event test.user_event on schedule every 1 day do select "not supposed to be here"; update mysql.event set db='performance_schema' where name='user_event'; -ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists -ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists -ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists -ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists -ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists -ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists -ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists -ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists -ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists -ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists -ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists -ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists -ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists -ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists +ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists +ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line 478: Table 'threads' already exists ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.event where db='performance_schema'; diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result index 4283b250cee..61f5adac354 100644 --- a/mysql-test/suite/perfschema/r/privilege.result +++ b/mysql-test/suite/perfschema/r/privilege.result @@ -35,102 +35,102 @@ grant INSERT on performance_schema.* to 'pfs_user_2'@localhost; grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost; grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; -grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant ALL on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; -grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; -grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost; +grant DROP on performance_schema.setup_instruments to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; -ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; -ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant INSERT on performance_schema.setup_instruments to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'setup_instruments' +grant DELETE on performance_schema.setup_instruments to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'setup_instruments' +grant SELECT on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; -grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant UPDATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; -grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +grant ALL on performance_schema.events_waits_current to 'pfs_user_3'@localhost with GRANT OPTION; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; -grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; -grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; +grant DROP on performance_schema.events_waits_current to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; -ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; -ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; -ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +grant INSERT on performance_schema.events_waits_current to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current' +grant UPDATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current' +grant DELETE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current' +grant SELECT on performance_schema.events_waits_current to 'pfs_user_3'@localhost with GRANT OPTION; -grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +grant ALL on performance_schema.file_instances to 'pfs_user_3'@localhost with GRANT OPTION; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; -grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; -grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.file_instances to 'pfs_user_3'@localhost; +grant DROP on performance_schema.file_instances to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.file_instances to 'pfs_user_3'@localhost; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; -ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; -ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; -ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +grant INSERT on performance_schema.file_instances to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'file_instances' +grant UPDATE on performance_schema.file_instances to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'file_instances' +grant DELETE on performance_schema.file_instances to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'file_instances' +grant SELECT on performance_schema.file_instances to 'pfs_user_3'@localhost with GRANT OPTION; grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost with GRANT OPTION; flush privileges; drop table if exists test.t1; -rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +rename table performance_schema.setup_instruments to test.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +rename table performance_schema.events_waits_current to test.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to test.t1; +rename table performance_schema.file_instances to test.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +rename table performance_schema.setup_instruments to performance_schema.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +rename table performance_schema.events_waits_current to performance_schema.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +rename table performance_schema.file_instances to performance_schema.t1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS -to performance_schema.EVENTS_WAITS_CURRENT; +rename table performance_schema.setup_instruments +to performance_schema.events_waits_current; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT -to performance_schema.SETUP_INSTRUMENTS; +rename table performance_schema.events_waits_current +to performance_schema.setup_instruments; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create procedure performance_schema.my_proc() begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' @@ -140,95 +140,95 @@ create event performance_schema.my_event on schedule every 15 minute do begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_setup_instruments -before insert on performance_schema.SETUP_INSTRUMENTS +before insert on performance_schema.setup_instruments for each row begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_events_waits_current -before insert on performance_schema.EVENTS_WAITS_CURRENT +before insert on performance_schema.events_waits_current for each row begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_file_instances -before insert on performance_schema.FILE_INSTANCES +before insert on performance_schema.file_instances for each row begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +create table test.t1 like performance_schema.setup_instruments; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.FILE_INSTANCES; +create table test.t1 like performance_schema.file_instances; ERROR HY000: Invalid performance_schema usage. -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name="foo"; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -insert into performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments' +insert into performance_schema.events_waits_current set name="foo"; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -insert into performance_schema.FILE_INSTANCES +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_current' +insert into performance_schema.file_instances set name="foo"; -ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.SETUP_INSTRUMENTS; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' -delete from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.FILE_INSTANCES; -ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' -lock table performance_schema.SETUP_INSTRUMENTS read; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_instances' +delete from performance_schema.setup_instruments; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments' +delete from performance_schema.events_waits_current; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current' +delete from performance_schema.file_instances; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances' +lock table performance_schema.setup_instruments read; unlock tables; -lock table performance_schema.SETUP_INSTRUMENTS write; +lock table performance_schema.setup_instruments write; unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.FILE_INSTANCES read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances' unlock tables; -lock table performance_schema.FILE_INSTANCES write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances' unlock tables; # # WL#4818, NFS2: Can use grants to give normal user access -# to view data from _CURRENT and _HISTORY tables +# to view data from _current and _history tables # # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. -# (Except for EVENTS_WAITS_CURRENT, which is granted.) -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +# (Except for events_waits_current, which is granted.) +SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1; can select can select drop table if exists test.t1; -rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +rename table performance_schema.setup_instruments to test.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +rename table performance_schema.events_waits_current to test.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to test.t1; +rename table performance_schema.file_instances to test.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +rename table performance_schema.setup_instruments to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +rename table performance_schema.events_waits_current to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +rename table performance_schema.file_instances to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS -to performance_schema.EVENTS_WAITS_CURRENT; +rename table performance_schema.setup_instruments +to performance_schema.events_waits_current; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT -to performance_schema.SETUP_INSTRUMENTS; +rename table performance_schema.events_waits_current +to performance_schema.setup_instruments; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create procedure performance_schema.my_proc() begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' @@ -238,95 +238,95 @@ create event performance_schema.my_event on schedule every 15 minute do begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_setup_instruments -before insert on performance_schema.SETUP_INSTRUMENTS +before insert on performance_schema.setup_instruments for each row begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_events_waits_current -before insert on performance_schema.EVENTS_WAITS_CURRENT +before insert on performance_schema.events_waits_current for each row begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_file_instances -before insert on performance_schema.FILE_INSTANCES +before insert on performance_schema.file_instances for each row begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +create table test.t1 like performance_schema.setup_instruments; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.FILE_INSTANCES; +create table test.t1 like performance_schema.file_instances; ERROR HY000: Invalid performance_schema usage. -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' -insert into performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments' +insert into performance_schema.events_waits_current set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' -insert into performance_schema.FILE_INSTANCES +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current' +insert into performance_schema.file_instances set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.SETUP_INSTRUMENTS; -ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' -delete from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.FILE_INSTANCES; -ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' -lock table performance_schema.SETUP_INSTRUMENTS read; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'file_instances' +delete from performance_schema.setup_instruments; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments' +delete from performance_schema.events_waits_current; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current' +delete from performance_schema.file_instances; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'file_instances' +lock table performance_schema.setup_instruments read; unlock tables; -lock table performance_schema.SETUP_INSTRUMENTS write; +lock table performance_schema.setup_instruments write; unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.FILE_INSTANCES read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'file_instances' unlock tables; -lock table performance_schema.FILE_INSTANCES write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'file_instances' unlock tables; # # WL#4818, NFS2: Can use grants to give normal user access -# to view data from _CURRENT and _HISTORY tables +# to view data from _current and _history tables # # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. -# (Except for EVENTS_WAITS_CURRENT, which is granted.) -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +# (Except for events_waits_current, which is granted.) +SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1; can select can select drop table if exists test.t1; -rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +rename table performance_schema.setup_instruments to test.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +rename table performance_schema.events_waits_current to test.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to test.t1; +rename table performance_schema.file_instances to test.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +rename table performance_schema.setup_instruments to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +rename table performance_schema.events_waits_current to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +rename table performance_schema.file_instances to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS -to performance_schema.EVENTS_WAITS_CURRENT; +rename table performance_schema.setup_instruments +to performance_schema.events_waits_current; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT -to performance_schema.SETUP_INSTRUMENTS; +rename table performance_schema.events_waits_current +to performance_schema.setup_instruments; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create procedure performance_schema.my_proc() begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' @@ -336,95 +336,95 @@ create event performance_schema.my_event on schedule every 15 minute do begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_setup_instruments -before insert on performance_schema.SETUP_INSTRUMENTS +before insert on performance_schema.setup_instruments for each row begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_events_waits_current -before insert on performance_schema.EVENTS_WAITS_CURRENT +before insert on performance_schema.events_waits_current for each row begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_file_instances -before insert on performance_schema.FILE_INSTANCES +before insert on performance_schema.file_instances for each row begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +create table test.t1 like performance_schema.setup_instruments; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.FILE_INSTANCES; +create table test.t1 like performance_schema.file_instances; ERROR HY000: Invalid performance_schema usage. -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' -insert into performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments' +insert into performance_schema.events_waits_current set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' -insert into performance_schema.FILE_INSTANCES +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current' +insert into performance_schema.file_instances set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.SETUP_INSTRUMENTS; -ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' -delete from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.FILE_INSTANCES; -ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' -lock table performance_schema.SETUP_INSTRUMENTS read; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'file_instances' +delete from performance_schema.setup_instruments; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments' +delete from performance_schema.events_waits_current; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current' +delete from performance_schema.file_instances; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'file_instances' +lock table performance_schema.setup_instruments read; unlock tables; -lock table performance_schema.SETUP_INSTRUMENTS write; +lock table performance_schema.setup_instruments write; unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.FILE_INSTANCES read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'file_instances' unlock tables; -lock table performance_schema.FILE_INSTANCES write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'file_instances' unlock tables; # # WL#4818, NFS2: Can use grants to give normal user access -# to view data from _CURRENT and _HISTORY tables +# to view data from _current and _history tables # # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. -# (Except for EVENTS_WAITS_CURRENT, which is granted.) -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +# (Except for events_waits_current, which is granted.) +SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1; can select can select -SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1; can select can select drop table if exists test.t1; -rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +rename table performance_schema.setup_instruments to test.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +rename table performance_schema.events_waits_current to test.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to test.t1; +rename table performance_schema.file_instances to test.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +rename table performance_schema.setup_instruments to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +rename table performance_schema.events_waits_current to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +rename table performance_schema.file_instances to performance_schema.t1; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.SETUP_INSTRUMENTS -to performance_schema.EVENTS_WAITS_CURRENT; +rename table performance_schema.setup_instruments +to performance_schema.events_waits_current; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' -rename table performance_schema.EVENTS_WAITS_CURRENT -to performance_schema.SETUP_INSTRUMENTS; +rename table performance_schema.events_waits_current +to performance_schema.setup_instruments; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create procedure performance_schema.my_proc() begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' @@ -434,73 +434,73 @@ create event performance_schema.my_event on schedule every 15 minute do begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_setup_instruments -before insert on performance_schema.SETUP_INSTRUMENTS +before insert on performance_schema.setup_instruments for each row begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_events_waits_current -before insert on performance_schema.EVENTS_WAITS_CURRENT +before insert on performance_schema.events_waits_current for each row begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create trigger performance_schema.bi_file_instances -before insert on performance_schema.FILE_INSTANCES +before insert on performance_schema.file_instances for each row begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +create table test.t1 like performance_schema.setup_instruments; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; ERROR HY000: Invalid performance_schema usage. -create table test.t1 like performance_schema.FILE_INSTANCES; +create table test.t1 like performance_schema.file_instances; ERROR HY000: Invalid performance_schema usage. -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' -insert into performance_schema.EVENTS_WAITS_CURRENT +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments' +insert into performance_schema.events_waits_current set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' -insert into performance_schema.FILE_INSTANCES +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current' +insert into performance_schema.file_instances set name="foo"; -ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' -delete from performance_schema.SETUP_INSTRUMENTS; -ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' -delete from performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' -delete from performance_schema.FILE_INSTANCES; -ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' -lock table performance_schema.SETUP_INSTRUMENTS read; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'file_instances' +delete from performance_schema.setup_instruments; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments' +delete from performance_schema.events_waits_current; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current' +delete from performance_schema.file_instances; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'file_instances' +lock table performance_schema.setup_instruments read; unlock tables; -lock table performance_schema.SETUP_INSTRUMENTS write; +lock table performance_schema.setup_instruments write; unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.EVENTS_WAITS_CURRENT write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +lock table performance_schema.events_waits_current write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current' unlock tables; -lock table performance_schema.FILE_INSTANCES read; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'file_instances' unlock tables; -lock table performance_schema.FILE_INSTANCES write; -ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.file_instances write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'file_instances' unlock tables; # # WL#4818, NFS2: Can use grants to give normal user access -# to view data from _CURRENT and _HISTORY tables +# to view data from _current and _history tables # # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. -# (Except for EVENTS_WAITS_CURRENT, which is granted.) -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; -ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; -ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; -can select -can select -SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; -ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; -ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +# (Except for events_waits_current, which is granted.) +SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_history' +SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_history_long' +SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_summary_by_instance' +SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'file_summary_by_instance' revoke all privileges, grant option from 'pfs_user_1'@localhost; revoke all privileges, grant option from 'pfs_user_2'@localhost; revoke all privileges, grant option from 'pfs_user_3'@localhost; @@ -516,63 +516,63 @@ CREATE user pfs_user_4; # without grants # # Select as pfs_user_4 should fail without grant -SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; -ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' -SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; -ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' -SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; -ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +SELECT event_id FROM performance_schema.events_waits_history; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history' +SELECT event_id FROM performance_schema.events_waits_history_long; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history_long' +SELECT event_id FROM performance_schema.events_waits_current; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_current' +SELECT event_name FROM performance_schema.events_waits_summary_by_instance; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_summary_by_instance' +SELECT event_name FROM performance_schema.file_summary_by_instance; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'file_summary_by_instance' # # WL#4818, NFS3: Normal user does not have access to change what is # instrumented without grants # # User pfs_user_4 should not be allowed to tweak instrumentation without # explicit grant -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; -ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_instruments' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; -ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_CONSUMERS' -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; -ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_TIMERS' -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; -ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_instruments' +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_consumers' +UPDATE performance_schema.setup_timers SET timer_name = 'TICK'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_timers' +TRUNCATE TABLE performance_schema.events_waits_history_long; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history_long' +TRUNCATE TABLE performance_schema.events_waits_history; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history' +TRUNCATE TABLE performance_schema.events_waits_current; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_current' # # WL#4814, NFS1: Can use grants to give normal user access # to turn on and off instrumentation # # Grant access to change tables with the root account -GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; -GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; -GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; +GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4; +GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_history_long TO pfs_user_4; # User pfs_user_4 should now be allowed to tweak instrumentation -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.setup_timers SET timer_name = 'TICK'; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; # Clean up REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; DROP USER pfs_user_4; flush privileges; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result index a0aeac5a916..c7ac3d499b4 100644 --- a/mysql-test/suite/perfschema/r/query_cache.result +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -33,10 +33,10 @@ Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 -select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +select spins from performance_schema.events_waits_current order by event_name limit 1; spins NULL -select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +select name from performance_schema.setup_instruments order by name limit 1; name wait/io/file/csv/data show status like "Qcache_queries_in_cache"; @@ -48,10 +48,10 @@ Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 -select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +select spins from performance_schema.events_waits_current order by event_name limit 1; spins NULL -select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +select name from performance_schema.setup_instruments order by name limit 1; name wait/io/file/csv/data show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result index 6a30eb4ab8b..19108326f1b 100644 --- a/mysql-test/suite/perfschema/r/read_only.result +++ b/mysql-test/suite/perfschema/r/read_only.result @@ -13,9 +13,9 @@ show grants; Grants for pfsuser@localhost GRANT USAGE ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; connection default; set global read_only=1; connection con1; @@ -26,9 +26,9 @@ show grants; Grants for pfsuser@localhost GRANT USAGE ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; connection default; grant super on *.* to pfsuser@localhost; flush privileges; @@ -40,9 +40,9 @@ show grants; Grants for pfsuser@localhost GRANT SUPER ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; connection default; set global read_only= @start_read_only; drop user pfsuser@localhost; diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result index 1599d51a59f..5bafa137af5 100644 --- a/mysql-test/suite/perfschema/r/schema.result +++ b/mysql-test/suite/perfschema/r/schema.result @@ -8,32 +8,32 @@ test use performance_schema; show tables; Tables_in_performance_schema -COND_INSTANCES -EVENTS_WAITS_CURRENT -EVENTS_WAITS_HISTORY -EVENTS_WAITS_HISTORY_LONG -EVENTS_WAITS_SUMMARY_BY_INSTANCE -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME -FILE_INSTANCES -FILE_SUMMARY_BY_EVENT_NAME -FILE_SUMMARY_BY_INSTANCE -MUTEX_INSTANCES -PERFORMANCE_TIMERS -RWLOCK_INSTANCES -SETUP_CONSUMERS -SETUP_INSTRUMENTS -SETUP_TIMERS -THREADS -show create table COND_INSTANCES; -Table Create Table -COND_INSTANCES CREATE TABLE `COND_INSTANCES` ( +cond_instances +events_waits_current +events_waits_history +events_waits_history_long +events_waits_summary_by_instance +events_waits_summary_by_thread_by_event_name +events_waits_summary_global_by_event_name +file_instances +file_summary_by_event_name +file_summary_by_instance +mutex_instances +performance_timers +rwlock_instances +setup_consumers +setup_instruments +setup_timers +threads +show create table cond_instances; +Table Create Table +cond_instances CREATE TABLE `cond_instances` ( `NAME` varchar(128) NOT NULL, `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_CURRENT; +show create table events_waits_current; Table Create Table -EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` ( +events_waits_current CREATE TABLE `events_waits_current` ( `THREAD_ID` int(11) NOT NULL, `EVENT_ID` bigint(20) unsigned NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, @@ -51,9 +51,9 @@ EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` ( `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, `FLAGS` int(10) unsigned DEFAULT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_HISTORY; +show create table events_waits_history; Table Create Table -EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` ( +events_waits_history CREATE TABLE `events_waits_history` ( `THREAD_ID` int(11) NOT NULL, `EVENT_ID` bigint(20) unsigned NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, @@ -71,9 +71,9 @@ EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` ( `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, `FLAGS` int(10) unsigned DEFAULT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_HISTORY_LONG; +show create table events_waits_history_long; Table Create Table -EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` ( +events_waits_history_long CREATE TABLE `events_waits_history_long` ( `THREAD_ID` int(11) NOT NULL, `EVENT_ID` bigint(20) unsigned NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, @@ -91,9 +91,9 @@ EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` ( `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, `FLAGS` int(10) unsigned DEFAULT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; +show create table events_waits_summary_by_instance; Table Create Table -EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` ( +events_waits_summary_by_instance CREATE TABLE `events_waits_summary_by_instance` ( `EVENT_NAME` varchar(128) NOT NULL, `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, @@ -102,9 +102,9 @@ EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +show create table events_waits_summary_by_thread_by_event_name; Table Create Table -EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` ( +events_waits_summary_by_thread_by_event_name CREATE TABLE `events_waits_summary_by_thread_by_event_name` ( `THREAD_ID` int(11) NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, @@ -113,9 +113,9 @@ EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_ `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +show create table events_waits_summary_global_by_event_name; Table Create Table -EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` ( +events_waits_summary_global_by_event_name CREATE TABLE `events_waits_summary_global_by_event_name` ( `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, @@ -123,25 +123,25 @@ EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_GLO `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table FILE_INSTANCES; +show create table file_instances; Table Create Table -FILE_INSTANCES CREATE TABLE `FILE_INSTANCES` ( +file_instances CREATE TABLE `file_instances` ( `FILE_NAME` varchar(512) NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, `OPEN_COUNT` int(10) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table FILE_SUMMARY_BY_EVENT_NAME; +show create table file_summary_by_event_name; Table Create Table -FILE_SUMMARY_BY_EVENT_NAME CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` ( +file_summary_by_event_name CREATE TABLE `file_summary_by_event_name` ( `EVENT_NAME` varchar(128) NOT NULL, `COUNT_READ` bigint(20) unsigned NOT NULL, `COUNT_WRITE` bigint(20) unsigned NOT NULL, `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table FILE_SUMMARY_BY_INSTANCE; +show create table file_summary_by_instance; Table Create Table -FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` ( +file_summary_by_instance CREATE TABLE `file_summary_by_instance` ( `FILE_NAME` varchar(512) NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_READ` bigint(20) unsigned NOT NULL, @@ -149,51 +149,51 @@ FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` ( `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table MUTEX_INSTANCES; +show create table mutex_instances; Table Create Table -MUTEX_INSTANCES CREATE TABLE `MUTEX_INSTANCES` ( +mutex_instances CREATE TABLE `mutex_instances` ( `NAME` varchar(128) NOT NULL, `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table PERFORMANCE_TIMERS; +show create table performance_timers; Table Create Table -PERFORMANCE_TIMERS CREATE TABLE `PERFORMANCE_TIMERS` ( +performance_timers CREATE TABLE `performance_timers` ( `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL, `TIMER_FREQUENCY` bigint(20) DEFAULT NULL, `TIMER_RESOLUTION` bigint(20) DEFAULT NULL, `TIMER_OVERHEAD` bigint(20) DEFAULT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table RWLOCK_INSTANCES; +show create table rwlock_instances; Table Create Table -RWLOCK_INSTANCES CREATE TABLE `RWLOCK_INSTANCES` ( +rwlock_instances CREATE TABLE `rwlock_instances` ( `NAME` varchar(128) NOT NULL, `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL, `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table SETUP_CONSUMERS; +show create table setup_consumers; Table Create Table -SETUP_CONSUMERS CREATE TABLE `SETUP_CONSUMERS` ( +setup_consumers CREATE TABLE `setup_consumers` ( `NAME` varchar(64) NOT NULL, `ENABLED` enum('YES','NO') NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table SETUP_INSTRUMENTS; +show create table setup_instruments; Table Create Table -SETUP_INSTRUMENTS CREATE TABLE `SETUP_INSTRUMENTS` ( +setup_instruments CREATE TABLE `setup_instruments` ( `NAME` varchar(128) NOT NULL, `ENABLED` enum('YES','NO') NOT NULL, `TIMED` enum('YES','NO') NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table SETUP_TIMERS; +show create table setup_timers; Table Create Table -SETUP_TIMERS CREATE TABLE `SETUP_TIMERS` ( +setup_timers CREATE TABLE `setup_timers` ( `NAME` varchar(64) NOT NULL, `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 -show create table THREADS; +show create table threads; Table Create Table -THREADS CREATE TABLE `THREADS` ( +threads CREATE TABLE `threads` ( `THREAD_ID` int(11) NOT NULL, `PROCESSLIST_ID` int(11) DEFAULT NULL, `NAME` varchar(128) NOT NULL diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result index 6d596ba8d9a..a3d0931cf4c 100644 --- a/mysql-test/suite/perfschema/r/selects.result +++ b/mysql-test/suite/perfschema/r/selects.result @@ -1,38 +1,38 @@ -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long GROUP BY OPERATION HAVING TOTAL IS NOT NULL ORDER BY OPERATION LIMIT 1; OPERATION TOTAL chsize [NUM_BYTES] -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE THREAD_ID IN -(SELECT THREAD_ID FROM performance_schema.THREADS) +(SELECT THREAD_ID FROM performance_schema.threads) AND EVENT_NAME IN -(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +(SELECT NAME FROM performance_schema.setup_instruments WHERE NAME LIKE "wait/synch/%") LIMIT 1; EVENT_ID [EVENT_ID] SELECT DISTINCT EVENT_ID -FROM performance_schema.EVENTS_WAITS_CURRENT -JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +FROM performance_schema.events_waits_current +JOIN performance_schema.events_waits_history USING (EVENT_ID) +JOIN performance_schema.events_waits_history_long USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; EVENT_ID [EVENT_ID] SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT -FROM performance_schema.EVENTS_WAITS_HISTORY t1 -JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +FROM performance_schema.events_waits_history t1 +JOIN performance_schema.events_waits_history t2 USING (EVENT_ID) +JOIN performance_schema.events_waits_history t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.events_waits_history t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) ORDER BY t1.EVENT_ID, t2.EVENT_ID LIMIT 5; THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT @@ -42,11 +42,11 @@ THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT [THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] [THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] SELECT THREAD_ID, EVENT_ID FROM ( -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_current UNION -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history UNION -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history_long ) t1 ORDER BY THREAD_ID, EVENT_ID LIMIT 5; THREAD_ID EVENT_ID @@ -58,14 +58,14 @@ THREAD_ID EVENT_ID DROP TABLE IF EXISTS t_event; DROP EVENT IF EXISTS t_ps_event; CREATE TABLE t_event AS -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE 1 = 2; CREATE EVENT t_ps_event ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO INSERT INTO t_event SELECT DISTINCT EVENT_ID -FROM performance_schema.EVENTS_WAITS_CURRENT -JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +FROM performance_schema.events_waits_current +JOIN performance_schema.events_waits_history USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; ALTER TABLE t1 ADD COLUMN c INT; @@ -73,7 +73,7 @@ DROP TRIGGER IF EXISTS t_ps_trigger; CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET NEW.c = (SELECT MAX(EVENT_ID) -FROM performance_schema.EVENTS_WAITS_CURRENT); +FROM performance_schema.events_waits_current); END; | INSERT INTO t1 (id) VALUES (11), (12), (13); @@ -86,7 +86,7 @@ DROP TRIGGER t_ps_trigger; DROP PROCEDURE IF EXISTS t_ps_proc; CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT) BEGIN -SELECT thread_id FROM performance_schema.THREADS +SELECT thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = conid INTO pid; END; | @@ -94,7 +94,7 @@ CALL t_ps_proc(connection_id(), @p_id); DROP FUNCTION IF EXISTS t_ps_proc; CREATE FUNCTION t_ps_func(conid INT) RETURNS int BEGIN -return (SELECT thread_id FROM performance_schema.THREADS +return (SELECT thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = conid); END; | diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result index 474a481929a..b6f1d4828c3 100644 --- a/mysql-test/suite/perfschema/r/server_init.result +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -1,197 +1,197 @@ use performance_schema; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_open"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_net"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_time"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/mysys/THR_COND_threads"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_open"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_thread_count"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_status"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_error_log"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_status"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_create"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_crypt"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_slave_list"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_active_mi"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_manager"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_user_conn"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_connection_count"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_server_started"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_rpl_status"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_event_queue"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_user_locks"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/Cversion_lock"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_audit_mask"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_xid_cache"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_plugin"; count(name) 1 -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/tz_LOCK"; count(name) 1 -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_grant"; count(name) 1 -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; count(name) 1 -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; count(name) 1 -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_server_started"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_refresh"; count(name) 0 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_thread_count"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_manager"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_thread_cache"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_flush_thread_cache"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_rpl_status"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; count(name) 1 -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_queue_state"; count(name) 1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index d03e227fc83..f32ffe327a2 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_cond_classes"; Variable_name Value performance_schema_max_cond_classes 0 -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/cond/%"; count(*) 0 @@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; variable_value > 0 1 -select count(*) from performance_schema.COND_INSTANCES; +select count(*) from performance_schema.cond_instances; count(*) 0 show status like "performance_schema_cond_instances_lost"; diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index 812dc329aaf..ef853ccc710 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_cond_classes"; Variable_name Value performance_schema_max_cond_classes 80 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/cond/%"; count(*) > 0 1 @@ -67,7 +67,7 @@ Performance_schema_cond_classes_lost 0 show variables like "performance_schema_max_cond_instances"; Variable_name Value performance_schema_max_cond_instances 0 -select count(*) from performance_schema.COND_INSTANCES; +select count(*) from performance_schema.cond_instances; count(*) 0 select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 7ef247e0755..bafb4cac270 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_file_classes"; Variable_name Value performance_schema_max_file_classes 0 -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/io/file/%"; count(*) 0 @@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; variable_value > 0 1 -select count(*) from performance_schema.FILE_INSTANCES; +select count(*) from performance_schema.file_instances; count(*) 0 show status like "performance_schema_file_instances_lost"; diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index 301c4e44f1e..2e557e5510a 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_file_classes"; Variable_name Value performance_schema_max_file_classes 50 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/io/file/%"; count(*) > 0 1 @@ -67,7 +67,7 @@ Performance_schema_file_classes_lost 0 show variables like "performance_schema_max_file_instances"; Variable_name Value performance_schema_max_file_instances 0 -select count(*) from performance_schema.FILE_INSTANCES; +select count(*) from performance_schema.file_instances; count(*) 0 select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index a1f880d3b9e..b6d359ae5d2 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_mutex_classes"; Variable_name Value performance_schema_max_mutex_classes 0 -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/mutex/%"; count(*) 0 @@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; variable_value > 0 1 -select count(*) from performance_schema.MUTEX_INSTANCES; +select count(*) from performance_schema.mutex_instances; count(*) 0 show status like "performance_schema_mutex_instances_lost"; diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index ab566f0703a..190d58378ac 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_mutex_classes"; Variable_name Value performance_schema_max_mutex_classes 200 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/mutex/%"; count(*) > 0 1 @@ -67,7 +67,7 @@ Performance_schema_mutex_classes_lost 0 show variables like "performance_schema_max_mutex_instances"; Variable_name Value performance_schema_max_mutex_instances 0 -select count(*) from performance_schema.MUTEX_INSTANCES; +select count(*) from performance_schema.mutex_instances; count(*) 0 select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index aabc9ec49bb..b27159828f6 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_rwlock_classes"; Variable_name Value performance_schema_max_rwlock_classes 0 -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; count(*) 0 @@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; variable_value > 0 1 -select count(*) from performance_schema.RWLOCK_INSTANCES; +select count(*) from performance_schema.rwlock_instances; count(*) 0 show status like "performance_schema_rwlock_instances_lost"; diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 5e5998a9959..7466235c42f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_rwlock_classes"; Variable_name Value performance_schema_max_rwlock_classes 30 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; count(*) > 0 1 @@ -67,7 +67,7 @@ Performance_schema_rwlock_classes_lost 0 show variables like "performance_schema_max_rwlock_instances"; Variable_name Value performance_schema_max_rwlock_instances 0 -select count(*) from performance_schema.RWLOCK_INSTANCES; +select count(*) from performance_schema.rwlock_instances; count(*) 0 select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 96c3cae97ab..075c22bc405 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -57,7 +57,7 @@ show status like "performance_schema%"; show variables like "performance_schema_max_thread_classes"; Variable_name Value performance_schema_max_thread_classes 0 -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "thread/%"; count(*) 0 @@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; variable_value > 0 1 -select count(*) from performance_schema.THREADS; +select count(*) from performance_schema.threads; count(*) 0 show status like "performance_schema_thread_instances_lost"; diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index e2cf0917cbf..763b5b69ca1 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON @@ -63,7 +63,7 @@ Performance_schema_thread_classes_lost 0 show variables like "performance_schema_max_thread_instances"; Variable_name Value performance_schema_max_thread_instances 0 -select count(*) from performance_schema.THREADS; +select count(*) from performance_schema.threads; count(*) 0 select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index 8bf52580e77..4cdfad654ae 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 0 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema OFF diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 15fe4e082ab..a17f78b27db 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -5,35 +5,35 @@ mtr mysql performance_schema test -select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.performance_timers; count(*) 5 -select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) from performance_schema.setup_consumers; count(*) 8 -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 -select count(*) from performance_schema.SETUP_TIMERS; +select count(*) from performance_schema.setup_timers; count(*) 1 -select * from performance_schema.COND_INSTANCES; -select * from performance_schema.EVENTS_WAITS_CURRENT; -select * from performance_schema.EVENTS_WAITS_HISTORY; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -select * from performance_schema.FILE_INSTANCES; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; -select * from performance_schema.MUTEX_INSTANCES; -select * from performance_schema.PERFORMANCE_TIMERS; -select * from performance_schema.RWLOCK_INSTANCES; -select * from performance_schema.SETUP_CONSUMERS; -select * from performance_schema.SETUP_INSTRUMENTS; -select * from performance_schema.SETUP_TIMERS; -select * from performance_schema.THREADS; +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; show variables like "performance_schema%"; Variable_name Value performance_schema ON diff --git a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result index cdf0029eeb9..86252d4ca01 100644 --- a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result +++ b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result @@ -1,6 +1,6 @@ call mtr.add_suppression( -"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Column count of mysql.setup_instruments is wrong. " "Expected 4, found 3. The table is probably corrupted"); -select * from performance_schema.SETUP_INSTRUMENTS limit 1; -ERROR HY000: Native table 'performance_schema'.'SETUP_INSTRUMENTS' has the wrong structure -select * from performance_schema.SETUP_CONSUMERS limit 1; +select * from performance_schema.setup_instruments limit 1; +ERROR HY000: Native table 'performance_schema'.'setup_instruments' has the wrong structure +select * from performance_schema.setup_consumers limit 1; diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test index a8ca3dd91e2..13906af3099 100644 --- a/mysql-test/suite/perfschema/t/aggregate.test +++ b/mysql-test/suite/perfschema/t/aggregate.test @@ -25,19 +25,19 @@ drop table if exists t1; --enable_warnings -update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; -update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; +update performance_schema.setup_instruments set enabled = 'NO'; +update performance_schema.setup_consumers set enabled = 'NO'; # Cleanup statistics -truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +truncate table performance_schema.file_summary_by_event_name; +truncate table performance_schema.file_summary_by_instance; +truncate table performance_schema.events_waits_summary_global_by_event_name; +truncate table performance_schema.events_waits_summary_by_instance; +truncate table performance_schema.events_waits_summary_by_thread_by_event_name; # Start recording data -update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_consumers set enabled = 'YES'; +update performance_schema.setup_instruments set enabled = 'YES', timed = 'YES'; @@ -49,27 +49,27 @@ create table t1 ( insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); # Stop recording data, so the select below don't add noise. -update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; +update performance_schema.setup_instruments SET enabled = 'NO'; # Disable all consumers, for long standing waits -update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; +update performance_schema.setup_consumers set enabled = 'NO'; # Helper to debug set @dump_all=FALSE; # Note that in general: -# - COUNT/SUM/MAX(FILE_SUMMARY_BY_EVENT_NAME) >= -# COUNT/SUM/MAX(FILE_SUMMARY_BY_INSTANCE). -# - MIN(FILE_SUMMARY_BY_EVENT_NAME) <= -# MIN(FILE_SUMMARY_BY_INSTANCE). +# - COUNT/SUM/MAX(file_summary_by_event_name) >= +# COUNT/SUM/MAX(file_summary_by_instance). +# - MIN(file_summary_by_event_name) <= +# MIN(file_summary_by_instance). # There will be equality only when file instances are not removed, # aka when a file is not deleted from the file system, -# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE. +# because doing so removes a row in file_summary_by_instance. # Likewise: -# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >= -# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE) -# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <= -# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE) +# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >= +# COUNT/SUM/MAX(events_waits_summary_by_instance) +# - MIN(events_waits_summary_global_by_event_name) <= +# MIN(events_waits_summary_by_instance) # There will be equality only when an instrument instance # is not removed, which is next to impossible to predictably guarantee # in the server. @@ -77,18 +77,18 @@ set @dump_all=FALSE; # will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock. # Another example, a thread terminating will cause a mysql_mutex_destroy # on sql/LOCK_delete -# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE. +# Both cause a row to be deleted from events_waits_summary_by_instance. # Likewise: -# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >= -# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) -# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <= -# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) +# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >= +# COUNT/SUM/MAX(events_waits_summary_by_thread_by_event_name) +# - MIN(events_waits_summary_global_by_event_name) <= +# MIN(events_waits_summary_by_thread_by_event_name) # There will be equality only when no thread is removed, # that is if no thread disconnects, or no sub thread (for example insert # delayed) ever completes. # A thread completing will cause rows in -# EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME to be removed. +# events_waits_summary_by_thread_by_event_name to be removed. --echo "Verifying file aggregate consistency" @@ -101,29 +101,29 @@ set @dump_all=FALSE; # If any of these queries returns data, the test failed. SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) OR @dump_all; SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) OR @dump_all; SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) OR @dump_all; SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) -FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e -JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.file_summary_by_event_name AS e +JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) OR @dump_all; @@ -131,23 +131,23 @@ OR @dump_all; --echo "Verifying waits aggregate consistency (instance)" SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) OR @dump_all; SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) AND (MIN(i.MIN_TIMER_WAIT) != 0) OR @dump_all; SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) OR @dump_all; @@ -155,16 +155,16 @@ OR @dump_all; --echo "Verifying waits aggregate consistency (thread)" SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) OR @dump_all; SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) @@ -172,8 +172,8 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0) OR @dump_all; SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e -JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +FROM performance_schema.events_waits_summary_global_by_event_name AS e +JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t USING (EVENT_NAME) GROUP BY EVENT_NAME HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) @@ -182,8 +182,8 @@ OR @dump_all; # Cleanup -update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_consumers set enabled = 'YES'; +update performance_schema.setup_instruments set enabled = 'YES', timed = 'YES'; drop table test.t1; diff --git a/mysql-test/suite/perfschema/t/checksum.test b/mysql-test/suite/perfschema/t/checksum.test index d7fdd7b4c2c..0600edcef26 100644 --- a/mysql-test/suite/perfschema/t/checksum.test +++ b/mysql-test/suite/perfschema/t/checksum.test @@ -24,41 +24,41 @@ # --disable_result_log -checksum table performance_schema.COND_INSTANCES; -checksum table performance_schema.EVENTS_WAITS_CURRENT; -checksum table performance_schema.EVENTS_WAITS_HISTORY; -checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -checksum table performance_schema.FILE_INSTANCES; -checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; -checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; -checksum table performance_schema.MUTEX_INSTANCES; -checksum table performance_schema.PERFORMANCE_TIMERS; -checksum table performance_schema.RWLOCK_INSTANCES; -checksum table performance_schema.SETUP_CONSUMERS; -checksum table performance_schema.SETUP_INSTRUMENTS; -checksum table performance_schema.SETUP_TIMERS; -checksum table performance_schema.THREADS; +checksum table performance_schema.cond_instances; +checksum table performance_schema.events_waits_current; +checksum table performance_schema.events_waits_history; +checksum table performance_schema.events_waits_history_long; +checksum table performance_schema.events_waits_summary_by_instance; +checksum table performance_schema.events_waits_summary_by_thread_by_event_name; +checksum table performance_schema.events_waits_summary_global_by_event_name; +checksum table performance_schema.file_instances; +checksum table performance_schema.file_summary_by_event_name; +checksum table performance_schema.file_summary_by_instance; +checksum table performance_schema.mutex_instances; +checksum table performance_schema.performance_timers; +checksum table performance_schema.rwlock_instances; +checksum table performance_schema.setup_consumers; +checksum table performance_schema.setup_instruments; +checksum table performance_schema.setup_timers; +checksum table performance_schema.threads; -checksum table performance_schema.COND_INSTANCES extended; -checksum table performance_schema.EVENTS_WAITS_CURRENT extended; -checksum table performance_schema.EVENTS_WAITS_HISTORY extended; -checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; -checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; -checksum table performance_schema.FILE_INSTANCES extended; -checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; -checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; -checksum table performance_schema.MUTEX_INSTANCES extended; -checksum table performance_schema.PERFORMANCE_TIMERS extended; -checksum table performance_schema.RWLOCK_INSTANCES extended; -checksum table performance_schema.SETUP_CONSUMERS extended; -checksum table performance_schema.SETUP_INSTRUMENTS extended; -checksum table performance_schema.SETUP_TIMERS extended; -checksum table performance_schema.THREADS extended; +checksum table performance_schema.cond_instances extended; +checksum table performance_schema.events_waits_current extended; +checksum table performance_schema.events_waits_history extended; +checksum table performance_schema.events_waits_history_long extended; +checksum table performance_schema.events_waits_summary_by_instance extended; +checksum table performance_schema.events_waits_summary_by_thread_by_event_name extended; +checksum table performance_schema.events_waits_summary_global_by_event_name extended; +checksum table performance_schema.file_instances extended; +checksum table performance_schema.file_summary_by_event_name extended; +checksum table performance_schema.file_summary_by_instance extended; +checksum table performance_schema.mutex_instances extended; +checksum table performance_schema.performance_timers extended; +checksum table performance_schema.rwlock_instances extended; +checksum table performance_schema.setup_consumers extended; +checksum table performance_schema.setup_instruments extended; +checksum table performance_schema.setup_timers extended; +checksum table performance_schema.threads extended; --enable_result_log diff --git a/mysql-test/suite/perfschema/t/column_privilege.test b/mysql-test/suite/perfschema/t/column_privilege.test index b6bcbdb3396..a1b0ede6b45 100644 --- a/mysql-test/suite/perfschema/t/column_privilege.test +++ b/mysql-test/suite/perfschema/t/column_privilege.test @@ -26,10 +26,10 @@ grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; # Test per column privileges on performance_schema -grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT +grant SELECT(thread_id, event_id) on performance_schema.events_waits_current to 'pfs_user_5'@localhost; -grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS +grant UPDATE(enabled) on performance_schema.setup_instruments to 'pfs_user_5'@localhost; flush privileges; @@ -42,32 +42,28 @@ connect (con1, localhost, pfs_user_5, , ); # For statements that works, we do not look at the output --disable_result_log -select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id from performance_schema.events_waits_current; -select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id, event_id from performance_schema.events_waits_current; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; --enable_result_log # For statements that are denied, check the error number and error text. ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_COLUMNACCESS_DENIED_ERROR -select event_name from performance_schema.EVENTS_WAITS_CURRENT; +select event_name from performance_schema.events_waits_current; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_COLUMNACCESS_DENIED_ERROR select thread_id, event_id, event_name - from performance_schema.EVENTS_WAITS_CURRENT; + from performance_schema.events_waits_current; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_COLUMNACCESS_DENIED_ERROR -update performance_schema.SETUP_INSTRUMENTS set name='illegal'; +update performance_schema.setup_instruments set name='illegal'; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_COLUMNACCESS_DENIED_ERROR -update performance_schema.SETUP_INSTRUMENTS set timed='NO'; +update performance_schema.setup_instruments set timed='NO'; # Cleanup @@ -76,7 +72,7 @@ update performance_schema.SETUP_INSTRUMENTS set timed='NO'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; DROP USER 'pfs_user_5'@localhost; flush privileges; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/t/ddl_cond_instances.test b/mysql-test/suite/perfschema/t/ddl_cond_instances.test index e78429cb181..2da1100702f 100644 --- a/mysql-test/suite/perfschema/t/ddl_cond_instances.test +++ b/mysql-test/suite/perfschema/t/ddl_cond_instances.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.COND_INSTANCES add column foo integer; +alter table performance_schema.cond_instances add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.COND_INSTANCES; +truncate table performance_schema.cond_instances; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.cond_instances ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.cond_instances(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test index 34f735c1271..1914d333f00 100644 --- a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; +alter table performance_schema.events_waits_current add column foo integer; -truncate table performance_schema.EVENTS_WAITS_CURRENT; +truncate table performance_schema.events_waits_current; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); +ALTER TABLE performance_schema.events_waits_current ADD INDEX test_index(EVENT_ID); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_current(EVENT_ID); diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test index 76ebe3d85c4..97c840a350d 100644 --- a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; +alter table performance_schema.events_waits_history add column foo integer; -truncate table performance_schema.EVENTS_WAITS_HISTORY; +truncate table performance_schema.events_waits_history; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); +ALTER TABLE performance_schema.events_waits_history ADD INDEX test_index(EVENT_ID); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history(EVENT_ID); diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test index 549c5d6880b..b57a3864e1a 100644 --- a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; +alter table performance_schema.events_waits_history_long add column foo integer; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_history_long; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); +ALTER TABLE performance_schema.events_waits_history_long ADD INDEX test_index(EVENT_ID); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history_long(EVENT_ID); diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test index e6dad07fd63..a6315edd31d 100644 --- a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; +alter table performance_schema.events_waits_summary_by_instance add column foo integer; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +truncate table performance_schema.events_waits_summary_by_instance; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); +ALTER TABLE performance_schema.events_waits_summary_by_instance ADD INDEX test_index(EVENT_NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_summary_by_instance(EVENT_NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test index 5b65ec26064..f59daca4b46 100644 --- a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test @@ -19,15 +19,15 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +alter table performance_schema.events_waits_summary_by_thread_by_event_name add column foo integer; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +truncate table performance_schema.events_waits_summary_by_thread_by_event_name; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); +ALTER TABLE performance_schema.events_waits_summary_by_thread_by_event_name ADD INDEX test_index(THREAD_ID); -- error ER_DBACCESS_DENIED_ERROR CREATE UNIQUE INDEX test_index - ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); + ON performance_schema.events_waits_summary_by_thread_by_event_name(THREAD_ID); diff --git a/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test index c7a767b013b..880b4bf1a59 100644 --- a/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test +++ b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test @@ -19,16 +19,16 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +alter table performance_schema.events_waits_summary_global_by_event_name add column foo integer; -truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +truncate table performance_schema.events_waits_summary_global_by_event_name; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +ALTER TABLE performance_schema.events_waits_summary_global_by_event_name ADD INDEX test_index(EVENT_NAME); -- error ER_DBACCESS_DENIED_ERROR CREATE UNIQUE INDEX test_index - ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME); + ON performance_schema.events_waits_summary_global_by_event_name(EVENT_NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_file_instances.test b/mysql-test/suite/perfschema/t/ddl_file_instances.test index a9c9a2a95b6..9d6b8c3cf26 100644 --- a/mysql-test/suite/perfschema/t/ddl_file_instances.test +++ b/mysql-test/suite/perfschema/t/ddl_file_instances.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.FILE_INSTANCES add column foo integer; +alter table performance_schema.file_instances add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.FILE_INSTANCES; +truncate table performance_schema.file_instances; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); +ALTER TABLE performance_schema.file_instances ADD INDEX test_index(FILE_NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_instances(FILE_NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test index 2581f07c0d2..f9a9cabb5b2 100644 --- a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; +alter table performance_schema.file_summary_by_event_name add column foo integer; -truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.file_summary_by_event_name; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.file_summary_by_event_name ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_event_name(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test index e06ad2eb7cd..defbff34321 100644 --- a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test @@ -19,13 +19,13 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; +alter table performance_schema.file_summary_by_instance add column foo integer; -truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +truncate table performance_schema.file_summary_by_instance; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.file_summary_by_instance ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_instance(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test index 6489a689620..ccd970655af 100644 --- a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test +++ b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.MUTEX_INSTANCES add column foo integer; +alter table performance_schema.mutex_instances add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.MUTEX_INSTANCES; +truncate table performance_schema.mutex_instances; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.mutex_instances ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.mutex_instances(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_performance_timers.test b/mysql-test/suite/perfschema/t/ddl_performance_timers.test index b692291b8cf..f6fcfd58bab 100644 --- a/mysql-test/suite/perfschema/t/ddl_performance_timers.test +++ b/mysql-test/suite/perfschema/t/ddl_performance_timers.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; +alter table performance_schema.performance_timers add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.PERFORMANCE_TIMERS; +truncate table performance_schema.performance_timers; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); +ALTER TABLE performance_schema.performance_timers ADD INDEX test_index(TIMER_NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.performance_timers(TIMER_NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test index c07cd1ede48..e5bd8b890a1 100644 --- a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test +++ b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.RWLOCK_INSTANCES add column foo integer; +alter table performance_schema.rwlock_instances add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.RWLOCK_INSTANCES; +truncate table performance_schema.rwlock_instances; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.rwlock_instances ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.rwlock_instances(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test index c44db822145..3984e0b7fab 100644 --- a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test +++ b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test @@ -18,16 +18,15 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.SETUP_CONSUMERS add column foo integer; +alter table performance_schema.setup_consumers add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.SETUP_CONSUMERS; +truncate table performance_schema.setup_consumers; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_consumers ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_consumers(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test index c20c386447c..b900f69e801 100644 --- a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test +++ b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test @@ -18,16 +18,15 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; +alter table performance_schema.setup_instruments add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.SETUP_INSTRUMENTS; +truncate table performance_schema.setup_instruments; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_instruments ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_instruments(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_setup_timers.test b/mysql-test/suite/perfschema/t/ddl_setup_timers.test index b9a5c32ecbe..bf8878a496d 100644 --- a/mysql-test/suite/perfschema/t/ddl_setup_timers.test +++ b/mysql-test/suite/perfschema/t/ddl_setup_timers.test @@ -18,16 +18,15 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_result '\'setup_timers' '\'SETUP_TIMERS' -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.SETUP_TIMERS add column foo integer; +alter table performance_schema.setup_timers add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.SETUP_TIMERS; +truncate table performance_schema.setup_timers; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); +ALTER TABLE performance_schema.setup_timers ADD INDEX test_index(NAME); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); +CREATE UNIQUE INDEX test_index ON performance_schema.setup_timers(NAME); diff --git a/mysql-test/suite/perfschema/t/ddl_threads.test b/mysql-test/suite/perfschema/t/ddl_threads.test index 12613e30c1f..d9ff3356b8d 100644 --- a/mysql-test/suite/perfschema/t/ddl_threads.test +++ b/mysql-test/suite/perfschema/t/ddl_threads.test @@ -19,14 +19,14 @@ --source include/have_perfschema.inc -- error ER_DBACCESS_DENIED_ERROR -alter table performance_schema.THREADS add column foo integer; +alter table performance_schema.threads add column foo integer; -- error ER_WRONG_PERFSCHEMA_USAGE -truncate table performance_schema.THREADS; +truncate table performance_schema.threads; -- error ER_DBACCESS_DENIED_ERROR -ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID); +ALTER TABLE performance_schema.threads ADD INDEX test_index(ID); -- error ER_DBACCESS_DENIED_ERROR -CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID); +CREATE UNIQUE INDEX test_index ON performance_schema.threads(ID); diff --git a/mysql-test/suite/perfschema/t/dml_cond_instances.test b/mysql-test/suite/perfschema/t/dml_cond_instances.test index 1d1614db73f..528dae80dfa 100644 --- a/mysql-test/suite/perfschema/t/dml_cond_instances.test +++ b/mysql-test/suite/perfschema/t/dml_cond_instances.test @@ -19,37 +19,31 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # -select * from performance_schema.COND_INSTANCES limit 1; +select * from performance_schema.cond_instances limit 1; -select * from performance_schema.COND_INSTANCES +select * from performance_schema.cond_instances where name='FOO'; ---replace_result '\'cond_instances' '\'COND_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.COND_INSTANCES +insert into performance_schema.cond_instances set name='FOO', object_instance_begin=12; ---replace_result '\'cond_instances' '\'COND_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.COND_INSTANCES +update performance_schema.cond_instances set name='FOO'; ---replace_result '\'cond_instances' '\'COND_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.COND_INSTANCES +delete from performance_schema.cond_instances where name like "wait/%"; ---replace_result '\'cond_instances' '\'COND_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.COND_INSTANCES; +delete from performance_schema.cond_instances; ---replace_result '\'cond_instances' '\'COND_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.COND_INSTANCES READ; +LOCK TABLES performance_schema.cond_instances READ; UNLOCK TABLES; ---replace_result '\'cond_instances' '\'COND_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.COND_INSTANCES WRITE; +LOCK TABLES performance_schema.cond_instances WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_current.test b/mysql-test/suite/perfschema/t/dml_events_waits_current.test index 3a93b98cb57..f82fac63df9 100644 --- a/mysql-test/suite/perfschema/t/dml_events_waits_current.test +++ b/mysql-test/suite/perfschema/t/dml_events_waits_current.test @@ -19,44 +19,37 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_CURRENT +select * from performance_schema.events_waits_current where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_CURRENT +select * from performance_schema.events_waits_current where event_name='FOO'; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_CURRENT +insert into performance_schema.events_waits_current set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_CURRENT +update performance_schema.events_waits_current set timer_start=12; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_CURRENT +update performance_schema.events_waits_current set timer_start=12 where thread_id=0; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_CURRENT +delete from performance_schema.events_waits_current where thread_id=1; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_CURRENT; +delete from performance_schema.events_waits_current; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; +LOCK TABLES performance_schema.events_waits_current READ; UNLOCK TABLES; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; +LOCK TABLES performance_schema.events_waits_current WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history.test b/mysql-test/suite/perfschema/t/dml_events_waits_history.test index 174ef2147d1..865d261d7f9 100644 --- a/mysql-test/suite/perfschema/t/dml_events_waits_history.test +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history.test @@ -19,52 +19,45 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name='FOO'; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' order by timer_wait limit 1; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY +select * from performance_schema.events_waits_history where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_HISTORY +insert into performance_schema.events_waits_history set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_HISTORY +update performance_schema.events_waits_history set timer_start=12; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_HISTORY +update performance_schema.events_waits_history set timer_start=12 where thread_id=0; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_HISTORY +delete from performance_schema.events_waits_history where thread_id=1; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_HISTORY; +delete from performance_schema.events_waits_history; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; +LOCK TABLES performance_schema.events_waits_history READ; UNLOCK TABLES; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; +LOCK TABLES performance_schema.events_waits_history WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test index 73dc0aefd06..606e33b3e80 100644 --- a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test @@ -19,52 +19,45 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name='FOO'; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' order by timer_wait limit 1; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # -select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +select * from performance_schema.events_waits_history_long where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_HISTORY_LONG +insert into performance_schema.events_waits_history_long set thread_id='1', event_id=1, event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_HISTORY_LONG +update performance_schema.events_waits_history_long set timer_start=12; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_HISTORY_LONG +update performance_schema.events_waits_history_long set timer_start=12 where thread_id=0; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_HISTORY_LONG +delete from performance_schema.events_waits_history_long where thread_id=1; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; +delete from performance_schema.events_waits_history_long; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; +LOCK TABLES performance_schema.events_waits_history_long READ; UNLOCK TABLES; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; +LOCK TABLES performance_schema.events_waits_history_long WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test index 4c386313bc5..2e4ab9bcc74 100644 --- a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test +++ b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test @@ -19,61 +19,54 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where event_name='FOO'; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance order by count_star limit 1; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance order by count_star desc limit 1; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star limit 1; --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star desc limit 1; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +insert into performance_schema.events_waits_summary_by_instance set event_name='FOO', object_instance_begin=0, count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +update performance_schema.events_waits_summary_by_instance set count_star=12; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +update performance_schema.events_waits_summary_by_instance set count_star=12 where event_name like "FOO"; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +delete from performance_schema.events_waits_summary_by_instance where count_star=1; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +delete from performance_schema.events_waits_summary_by_instance; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; +LOCK TABLES performance_schema.events_waits_summary_by_instance READ; UNLOCK TABLES; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; +LOCK TABLES performance_schema.events_waits_summary_by_instance WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test index ce29e59d014..bdbee9a90c1 100644 --- a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test +++ b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test @@ -19,45 +19,38 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name='FOO'; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +insert into performance_schema.events_waits_summary_by_thread_by_event_name set event_name='FOO', thread_id=1, count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +update performance_schema.events_waits_summary_by_thread_by_event_name set count_star=12; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +update performance_schema.events_waits_summary_by_thread_by_event_name set count_star=12 where event_name like "FOO"; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +delete from performance_schema.events_waits_summary_by_thread_by_event_name where count_star=1; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +delete from performance_schema.events_waits_summary_by_thread_by_event_name; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; +LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name READ; UNLOCK TABLES; ---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; +LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test index cd3918f38be..4f1b50bb7c0 100644 --- a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test +++ b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test @@ -19,44 +19,37 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_global_by_event_name where event_name like 'Wait/Synch/%' limit 1; -select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +select * from performance_schema.events_waits_summary_global_by_event_name where event_name='FOO'; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +insert into performance_schema.events_waits_summary_global_by_event_name set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +update performance_schema.events_waits_summary_global_by_event_name set count_star=12; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +update performance_schema.events_waits_summary_global_by_event_name set count_star=12 where event_name like "FOO"; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +delete from performance_schema.events_waits_summary_global_by_event_name where count_star=1; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +delete from performance_schema.events_waits_summary_global_by_event_name; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ; +LOCK TABLES performance_schema.events_waits_summary_global_by_event_name READ; UNLOCK TABLES; ---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE; +LOCK TABLES performance_schema.events_waits_summary_global_by_event_name WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_file_instances.test b/mysql-test/suite/perfschema/t/dml_file_instances.test index 71a053c21be..f3a13eaee32 100644 --- a/mysql-test/suite/perfschema/t/dml_file_instances.test +++ b/mysql-test/suite/perfschema/t/dml_file_instances.test @@ -19,37 +19,31 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # -select * from performance_schema.FILE_INSTANCES limit 1; +select * from performance_schema.file_instances limit 1; -select * from performance_schema.FILE_INSTANCES +select * from performance_schema.file_instances where file_name='FOO'; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.FILE_INSTANCES +insert into performance_schema.file_instances set file_name='FOO', event_name='BAR', open_count=12; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.FILE_INSTANCES +update performance_schema.file_instances set file_name='FOO'; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_INSTANCES +delete from performance_schema.file_instances where event_name like "wait/%"; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_INSTANCES; +delete from performance_schema.file_instances; ---replace_result '\'file_instances' '\'FILE_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_INSTANCES READ; +LOCK TABLES performance_schema.file_instances READ; UNLOCK TABLES; ---replace_result '\'file_instances' '\'FILE_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_INSTANCES WRITE; +LOCK TABLES performance_schema.file_instances WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test index 3753f581560..f5e1f90e9c9 100644 --- a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test @@ -19,44 +19,37 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +select * from performance_schema.file_summary_by_event_name where event_name like 'Wait/io/%' limit 1; -select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +select * from performance_schema.file_summary_by_event_name where event_name='FOO'; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME +insert into performance_schema.file_summary_by_event_name set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +update performance_schema.file_summary_by_event_name set count_read=12; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +update performance_schema.file_summary_by_event_name set count_write=12 where event_name like "FOO"; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +delete from performance_schema.file_summary_by_event_name where count_read=1; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +delete from performance_schema.file_summary_by_event_name; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; +LOCK TABLES performance_schema.file_summary_by_event_name READ; UNLOCK TABLES; ---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; +LOCK TABLES performance_schema.file_summary_by_event_name WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test index 07372af5f36..2ac32b97f56 100644 --- a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test @@ -19,44 +19,37 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # 5 # 6 # -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +select * from performance_schema.file_summary_by_instance where event_name like 'Wait/io/%' limit 1; -select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +select * from performance_schema.file_summary_by_instance where event_name='FOO'; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.FILE_SUMMARY_BY_INSTANCE +insert into performance_schema.file_summary_by_instance set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.FILE_SUMMARY_BY_INSTANCE +update performance_schema.file_summary_by_instance set count_read=12; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.FILE_SUMMARY_BY_INSTANCE +update performance_schema.file_summary_by_instance set count_write=12 where event_name like "FOO"; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_SUMMARY_BY_INSTANCE +delete from performance_schema.file_summary_by_instance where count_read=1; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; +delete from performance_schema.file_summary_by_instance; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; +LOCK TABLES performance_schema.file_summary_by_instance READ; UNLOCK TABLES; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; +LOCK TABLES performance_schema.file_summary_by_instance WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test index 0971c664eb8..c0bbd5276a0 100644 --- a/mysql-test/suite/perfschema/t/dml_mutex_instances.test +++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test @@ -19,37 +19,31 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # -select * from performance_schema.MUTEX_INSTANCES limit 1; +select * from performance_schema.mutex_instances limit 1; -select * from performance_schema.MUTEX_INSTANCES +select * from performance_schema.mutex_instances where name='FOO'; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.MUTEX_INSTANCES +insert into performance_schema.mutex_instances set name='FOO', object_instance_begin=12; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.MUTEX_INSTANCES +update performance_schema.mutex_instances set name='FOO'; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.MUTEX_INSTANCES +delete from performance_schema.mutex_instances where name like "wait/%"; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.MUTEX_INSTANCES; +delete from performance_schema.mutex_instances; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.MUTEX_INSTANCES READ; +LOCK TABLES performance_schema.mutex_instances READ; UNLOCK TABLES; ---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; +LOCK TABLES performance_schema.mutex_instances WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_performance_timers.test b/mysql-test/suite/perfschema/t/dml_performance_timers.test index 9c2efb6f709..211e6db4fb1 100644 --- a/mysql-test/suite/perfschema/t/dml_performance_timers.test +++ b/mysql-test/suite/perfschema/t/dml_performance_timers.test @@ -19,39 +19,33 @@ --source include/have_perfschema.inc --replace_column 2 <frequency> 3 <resolution> 4 <overhead> -select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.performance_timers; --replace_column 2 <frequency> 3 <resolution> 4 <overhead> -select * from performance_schema.PERFORMANCE_TIMERS +select * from performance_schema.performance_timers where timer_name='CYCLE'; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.PERFORMANCE_TIMERS +insert into performance_schema.performance_timers set timer_name='FOO', timer_frequency=1, timer_resolution=2, timer_overhead=3; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.PERFORMANCE_TIMERS +update performance_schema.performance_timers set timer_frequency=12 where timer_name='CYCLE'; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.PERFORMANCE_TIMERS; +delete from performance_schema.performance_timers; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.PERFORMANCE_TIMERS +delete from performance_schema.performance_timers where timer_name='CYCLE'; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; +LOCK TABLES performance_schema.performance_timers READ; UNLOCK TABLES; ---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; +LOCK TABLES performance_schema.performance_timers WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test index 33a42450681..c0fd89a8e75 100644 --- a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test +++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test @@ -19,37 +19,31 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # 4 # -select * from performance_schema.RWLOCK_INSTANCES limit 1; +select * from performance_schema.rwlock_instances limit 1; -select * from performance_schema.RWLOCK_INSTANCES +select * from performance_schema.rwlock_instances where name='FOO'; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.RWLOCK_INSTANCES +insert into performance_schema.rwlock_instances set name='FOO', object_instance_begin=12; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.RWLOCK_INSTANCES +update performance_schema.rwlock_instances set name='FOO'; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.RWLOCK_INSTANCES +delete from performance_schema.rwlock_instances where name like "wait/%"; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.RWLOCK_INSTANCES; +delete from performance_schema.rwlock_instances; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; +LOCK TABLES performance_schema.rwlock_instances READ; UNLOCK TABLES; ---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; +LOCK TABLES performance_schema.rwlock_instances WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_setup_consumers.test b/mysql-test/suite/perfschema/t/dml_setup_consumers.test index 85b65864f91..2a29f428f3d 100644 --- a/mysql-test/suite/perfschema/t/dml_setup_consumers.test +++ b/mysql-test/suite/perfschema/t/dml_setup_consumers.test @@ -18,42 +18,38 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.setup_consumers; -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where name='events_waits_current'; -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where enabled='YES'; -select * from performance_schema.SETUP_CONSUMERS +select * from performance_schema.setup_consumers where enabled='NO'; ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.SETUP_CONSUMERS +insert into performance_schema.setup_consumers set name='FOO', enabled='YES'; ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' --error ER_WRONG_PERFSCHEMA_USAGE -update performance_schema.SETUP_CONSUMERS +update performance_schema.setup_consumers set name='FOO'; -update performance_schema.SETUP_CONSUMERS +update performance_schema.setup_consumers set enabled='YES'; ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_CONSUMERS; +delete from performance_schema.setup_consumers; ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_CONSUMERS +delete from performance_schema.setup_consumers where name='events_waits_current'; -LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +LOCK TABLES performance_schema.setup_consumers READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +LOCK TABLES performance_schema.setup_consumers WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test index b82cde15fb5..b6e28440758 100644 --- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test +++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test @@ -26,19 +26,19 @@ # - valgrind coverage --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.setup_instruments; --enable_result_log # DEBUG_SYNC::mutex is dependent on the build (DEBUG only) -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Mutex/sql/%' and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') order by name limit 10; # CRYPTO_dynlock_value::lock is dependent on the build (SSL) -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Rwlock/sql/%' and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') order by name limit 10; @@ -46,7 +46,7 @@ select * from performance_schema.SETUP_INSTRUMENTS # COND_handler_count is dependent on the build (Windows only) # DEBUG_SYNC::cond is dependent on the build (DEBUG only) -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name like 'Wait/Synch/Cond/sql/%' and name not in ( 'wait/synch/cond/sql/COND_handler_count', @@ -54,50 +54,46 @@ select * from performance_schema.SETUP_INSTRUMENTS order by name limit 10; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where name='Wait'; --enable_result_log --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS +select * from performance_schema.setup_instruments where enabled='YES'; --enable_result_log ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.SETUP_INSTRUMENTS +insert into performance_schema.setup_instruments set name='FOO', enabled='YES', timed='YES'; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_WRONG_PERFSCHEMA_USAGE -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set name='FOO'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set timed='NO'; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.setup_instruments; --enable_result_log -update performance_schema.SETUP_INSTRUMENTS +update performance_schema.setup_instruments set enabled='YES', timed='YES'; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_INSTRUMENTS; +delete from performance_schema.setup_instruments; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_INSTRUMENTS +delete from performance_schema.setup_instruments where name like 'Wait/Synch/%'; -LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +LOCK TABLES performance_schema.setup_instruments READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +LOCK TABLES performance_schema.setup_instruments WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_setup_timers.test b/mysql-test/suite/perfschema/t/dml_setup_timers.test index 5b5850db575..1bfc0ab83a2 100644 --- a/mysql-test/suite/perfschema/t/dml_setup_timers.test +++ b/mysql-test/suite/perfschema/t/dml_setup_timers.test @@ -18,44 +18,40 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -select * from performance_schema.SETUP_TIMERS; +select * from performance_schema.setup_timers; -select * from performance_schema.SETUP_TIMERS +select * from performance_schema.setup_timers where name='Wait'; -select * from performance_schema.SETUP_TIMERS +select * from performance_schema.setup_timers where timer_name='CYCLE'; ---replace_result '\'setup_timers' '\'SETUP_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.SETUP_TIMERS +insert into performance_schema.setup_timers set name='FOO', timer_name='CYCLE'; ---replace_result '\'setup_timers' '\'SETUP_TIMERS' --error ER_WRONG_PERFSCHEMA_USAGE -update performance_schema.SETUP_TIMERS +update performance_schema.setup_timers set name='FOO'; -update performance_schema.SETUP_TIMERS +update performance_schema.setup_timers set timer_name='MILLISECOND'; -select * from performance_schema.SETUP_TIMERS; +select * from performance_schema.setup_timers; -update performance_schema.SETUP_TIMERS +update performance_schema.setup_timers set timer_name='CYCLE'; ---replace_result '\'setup_timers' '\'SETUP_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_TIMERS; +delete from performance_schema.setup_timers; ---replace_result '\'setup_timers' '\'SETUP_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.SETUP_TIMERS +delete from performance_schema.setup_timers where name='Wait'; -LOCK TABLES performance_schema.SETUP_TIMERS READ; +LOCK TABLES performance_schema.setup_timers READ; UNLOCK TABLES; -LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +LOCK TABLES performance_schema.setup_timers WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/dml_threads.test b/mysql-test/suite/perfschema/t/dml_threads.test index b6a65b57733..e7188497061 100644 --- a/mysql-test/suite/perfschema/t/dml_threads.test +++ b/mysql-test/suite/perfschema/t/dml_threads.test @@ -19,43 +19,36 @@ --source include/have_perfschema.inc --replace_column 1 # 2 # 3 # -select * from performance_schema.THREADS +select * from performance_schema.threads where name like 'Thread/%' limit 1; -select * from performance_schema.THREADS +select * from performance_schema.threads where name='FOO'; ---replace_result '\'threads' '\'THREADS' --error ER_TABLEACCESS_DENIED_ERROR -insert into performance_schema.THREADS +insert into performance_schema.threads set name='FOO', thread_id=1, processlist_id=2; ---replace_result '\'threads' '\'THREADS' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.THREADS +update performance_schema.threads set thread_id=12; ---replace_result '\'threads' '\'THREADS' --error ER_TABLEACCESS_DENIED_ERROR -update performance_schema.THREADS +update performance_schema.threads set thread_id=12 where name like "FOO"; ---replace_result '\'threads' '\'THREADS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.THREADS +delete from performance_schema.threads where id=1; ---replace_result '\'threads' '\'THREADS' --error ER_TABLEACCESS_DENIED_ERROR -delete from performance_schema.THREADS; +delete from performance_schema.threads; ---replace_result '\'threads' '\'THREADS' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.THREADS READ; +LOCK TABLES performance_schema.threads READ; UNLOCK TABLES; ---replace_result '\'threads' '\'THREADS' -- error ER_TABLEACCESS_DENIED_ERROR -LOCK TABLES performance_schema.THREADS WRITE; +LOCK TABLES performance_schema.threads WRITE; UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test index 9ba8d061b12..64f71a99ee6 100644 --- a/mysql-test/suite/perfschema/t/func_file_io.test +++ b/mysql-test/suite/perfschema/t/func_file_io.test @@ -22,9 +22,9 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; --disable_warnings @@ -40,9 +40,9 @@ ENGINE=MyISAM; INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; # # FF1: Count for file should increase with instrumentation enabled and @@ -52,7 +52,7 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD')); @@ -61,23 +61,23 @@ SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; SELECT * FROM t1 WHERE id < 4; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; +UPDATE performance_schema.setup_instruments SET enabled='NO'; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); SELECT * FROM t1 WHERE id < 6; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); @@ -87,33 +87,33 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success # Check not timed measurements # -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; +UPDATE performance_schema.setup_instruments SET timed = 'NO'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id > 4; -SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +SELECT * FROM performance_schema.events_waits_history_long WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; -SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +SELECT * FROM performance_schema.events_waits_history WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; -SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT * FROM performance_schema.events_waits_current WHERE TIMER_WAIT != NULL OR TIMER_START != NULL OR TIMER_END != NULL; -UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; +UPDATE performance_schema.setup_instruments SET timed = 'YES'; SELECT * FROM t1 WHERE id < 4; @@ -128,7 +128,7 @@ SELECT SUM(COUNT_READ) AS sum_count_read, SUM(COUNT_WRITE) AS sum_count_write, SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write -FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +FROM performance_schema.file_summary_by_instance WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; --enable_result_log @@ -144,7 +144,7 @@ WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; # --disable_result_log SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT -FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +FROM performance_schema.events_waits_summary_global_by_event_name WHERE COUNT_STAR > 0 ORDER BY SUM_TIMER_WAIT DESC LIMIT 10; @@ -157,8 +157,8 @@ LIMIT 10; ## --disable_result_log ## SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT ## # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE -## FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h -## INNER JOIN performance_schema.THREADS p USING (THREAD_ID) +## FROM performance_schema.events_waits_history_long h +## INNER JOIN performance_schema.threads p USING (THREAD_ID) ## LEFT JOIN information_schema.PROCESSLIST i USING (ID) ## GROUP BY i.user ## ORDER BY SUM_WAIT DESC @@ -170,8 +170,8 @@ LIMIT 10; # --disable_result_log SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h -INNER JOIN performance_schema.THREADS p USING (THREAD_ID) +FROM performance_schema.events_waits_history_long h +INNER JOIN performance_schema.threads p USING (THREAD_ID) WHERE p.PROCESSLIST_ID = 1 GROUP BY h.EVENT_NAME HAVING TOTAL_WAIT > 0; @@ -183,8 +183,8 @@ HAVING TOTAL_WAIT > 0; ## --disable_result_log ## SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes -## FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h -## INNER JOIN performance_schema.THREADS p USING (THREAD_ID) +## FROM performance_schema.events_waits_history_long h +## INNER JOIN performance_schema.threads p USING (THREAD_ID) ## LEFT JOIN information_schema.PROCESSLIST i USING (ID) ## GROUP BY i.user, h.operation ## HAVING BYTES > 0 @@ -192,4 +192,4 @@ HAVING TOTAL_WAIT > 0; ## --enable_result_log # Clean-up. -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES'; diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test index 624f5734c40..51cbc77790e 100644 --- a/mysql-test/suite/perfschema/t/func_mutex.test +++ b/mysql-test/suite/perfschema/t/func_mutex.test @@ -22,9 +22,9 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; @@ -46,41 +46,41 @@ INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); # FM2: Count for mutex should not increase with instrumentation disabled # -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; @@ -89,45 +89,45 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success # Repeat for RW-lock # -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) - FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; # Clean-up. -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES'; DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test index 9b7c54b1411..d00c6583e31 100644 --- a/mysql-test/suite/perfschema/t/global_read_lock.test +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -15,7 +15,7 @@ # Tests for PERFORMANCE_SCHEMA # -# Test the effect of a flush tables with read lock on SETUP_ tables. +# Test the effect of a flush tables with read lock on setup_ tables. --source include/not_embedded.inc --source include/have_perfschema.inc @@ -24,7 +24,7 @@ use performance_schema; # Make test robust against errors in other tests. # Ensure that instrumentation is turned on when we create new connection. -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; flush privileges; @@ -32,15 +32,15 @@ flush privileges; --echo connect (con1, localhost, pfsuser, , test); connect (con1, localhost, pfsuser, , test); -lock tables performance_schema.SETUP_INSTRUMENTS read; +lock tables performance_schema.setup_instruments read; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.setup_instruments; --enable_result_log unlock tables; -lock tables performance_schema.SETUP_INSTRUMENTS write; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +lock tables performance_schema.setup_instruments write; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; unlock tables; --echo connection default; @@ -51,20 +51,20 @@ flush tables with read lock; --echo connection con1; connection con1; -lock tables performance_schema.SETUP_INSTRUMENTS read; +lock tables performance_schema.setup_instruments read; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.setup_instruments; --enable_result_log unlock tables; # This will block --send -lock tables performance_schema.SETUP_INSTRUMENTS write; +lock tables performance_schema.setup_instruments write; --echo connection default; connection default; -let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; +let $wait_condition= select 1 from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; --source include/wait_condition.inc @@ -72,7 +72,7 @@ let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where select event_name, left(source, locate(":", source)) as short_source, timer_end, timer_wait, operation - from performance_schema.EVENTS_WAITS_CURRENT + from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; unlock tables; @@ -80,8 +80,8 @@ unlock tables; connection con1; --reap -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; unlock tables; disconnect con1; diff --git a/mysql-test/suite/perfschema/t/information_schema.test b/mysql-test/suite/perfschema/t/information_schema.test index 3d2822a1db3..36ba1912df3 100644 --- a/mysql-test/suite/perfschema/t/information_schema.test +++ b/mysql-test/suite/perfschema/t/information_schema.test @@ -22,46 +22,46 @@ # Note that TABLE_NAME is in uppercase is some platforms, # and in lowercase in others. -# Using upper(TABLE_NAME) to have consistent results. +# Using lower(TABLE_NAME) to have consistent results. -select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG +select TABLE_SCHEMA, lower(TABLE_NAME), TABLE_CATALOG from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), TABLE_TYPE, ENGINE +select lower(TABLE_NAME), TABLE_TYPE, ENGINE from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), VERSION, ROW_FORMAT +select lower(TABLE_NAME), VERSION, ROW_FORMAT from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH +select lower(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH +select lower(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT +select lower(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME +select lower(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME from information_schema.tables where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM +select lower(TABLE_NAME), TABLE_COLLATION, CHECKSUM from information_schema.tables where TABLE_SCHEMA='performance_schema'; # TABLESPACE_NAME does not exist in 5.4 -# select upper(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME +# select lower(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME # from information_schema.tables # where TABLE_SCHEMA='performance_schema'; -select upper(TABLE_NAME), TABLE_COMMENT +select lower(TABLE_NAME), TABLE_COMMENT from information_schema.tables where TABLE_SCHEMA='performance_schema'; diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test index d497c205d50..72e891ca805 100644 --- a/mysql-test/suite/perfschema/t/misc.test +++ b/mysql-test/suite/perfschema/t/misc.test @@ -25,11 +25,11 @@ # --disable_result_log -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE THREAD_ID IN - (SELECT THREAD_ID FROM performance_schema.THREADS) + (SELECT THREAD_ID FROM performance_schema.threads) AND EVENT_NAME IN - (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + (SELECT NAME FROM performance_schema.setup_instruments WHERE NAME LIKE "wait/synch/%") LIMIT 1; --enable_result_log @@ -46,7 +46,7 @@ create table test.t1(a int) engine=performance_schema; # --error ER_WRONG_PERFSCHEMA_USAGE -create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +create table test.t1 like performance_schema.events_waits_current; # # Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert @@ -73,7 +73,7 @@ select * from test.ghost; drop table test.ghost; # Shoud return nothing -select * from performance_schema.FILE_INSTANCES +select * from performance_schema.file_instances where file_name like "%ghost%"; # diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test index 0861e8f4b74..c2502b5895a 100644 --- a/mysql-test/suite/perfschema/t/myisam_file_io.test +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test @@ -20,14 +20,14 @@ # Setup -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES' where name like "wait/io/file/myisam/%"; -update performance_schema.SETUP_CONSUMERS +update performance_schema.setup_consumers set enabled='YES'; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_history_long; # Reset lost counters to a known state flush status; @@ -51,7 +51,7 @@ select event_name, left(source, locate(":", source)) as short_source, operation, number_of_bytes, substring(object_name, locate("no_index_tab", object_name)) as short_name - from performance_schema.EVENTS_WAITS_HISTORY_LONG + from performance_schema.events_waits_history_long where operation not like "tell" order by thread_id, event_id; @@ -60,7 +60,7 @@ show status like 'performance_schema_%'; # Cleanup -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; drop table test.no_index_tab; diff --git a/mysql-test/suite/perfschema/t/no_threads.test b/mysql-test/suite/perfschema/t/no_threads.test index 9254535bf1f..f98aa8abdb7 100644 --- a/mysql-test/suite/perfschema/t/no_threads.test +++ b/mysql-test/suite/perfschema/t/no_threads.test @@ -21,18 +21,18 @@ # Setup : in this main thread -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_CONSUMERS set enabled='YES'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_consumers set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; --disable_warnings drop table if exists test.t1; --enable_warnings -truncate table performance_schema.EVENTS_WAITS_CURRENT; -truncate table performance_schema.EVENTS_WAITS_HISTORY; -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_current; +truncate table performance_schema.events_waits_history; +truncate table performance_schema.events_waits_history_long; show variables like "thread_handling"; @@ -45,23 +45,23 @@ show variables like "performance_schema_max_thread%"; # Verification : in this main thread -select count(*) from performance_schema.THREADS +select count(*) from performance_schema.threads where name like "thread/sql/main"; -select count(*) from performance_schema.THREADS +select count(*) from performance_schema.threads where name like "thread/sql/OneConnection"; select event_name, operation, left(source, locate(":", source)) as short_source - from performance_schema.EVENTS_WAITS_CURRENT; + from performance_schema.events_waits_current; select event_name, operation, left(source, locate(":", source)) as short_source - from performance_schema.EVENTS_WAITS_HISTORY; + from performance_schema.events_waits_history; select event_name, operation, left(source, locate(":", source)) as short_source - from performance_schema.EVENTS_WAITS_HISTORY_LONG; + from performance_schema.events_waits_history_long; # Cleanup diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con.test b/mysql-test/suite/perfschema/t/one_thread_per_con.test index 7d0daffe228..5393152f7d2 100644 --- a/mysql-test/suite/perfschema/t/one_thread_per_con.test +++ b/mysql-test/suite/perfschema/t/one_thread_per_con.test @@ -27,7 +27,7 @@ # The point is not to test myisam, but to test that each # connection is properly instrumented, with one-thread-per-connection -update performance_schema.SETUP_INSTRUMENTS set enabled='YES' +update performance_schema.setup_instruments set enabled='YES' where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; --disable_warnings @@ -36,7 +36,7 @@ drop table if exists test.t2; drop table if exists test.t3; --enable_warnings -truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +truncate table performance_schema.events_waits_history_long; show variables like "thread_handling"; diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test index 2d682de2870..277ba9bf3b8 100644 --- a/mysql-test/suite/perfschema/t/privilege.test +++ b/mysql-test/suite/perfschema/t/privilege.test @@ -76,136 +76,128 @@ grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; # Test denied privileges on specific performance_schema tables. -# SETUP_INSTRUMENT : example of PFS_updatable_acl -# EVENTS_WAITS_CURRENT : example of PFS_truncatable_acl -# FILE_INSTANCES : example of PFS_readonly_acl +# setup_instrument : example of PFS_updatable_acl +# events_waits_current : example of PFS_truncatable_acl +# file_instances : example of PFS_readonly_acl --error ER_DBACCESS_DENIED_ERROR -grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant ALL on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant DROP on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant INSERT on performance_schema.setup_instruments to 'pfs_user_3'@localhost; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant DELETE on performance_schema.setup_instruments to 'pfs_user_3'@localhost; -grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant SELECT on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; -grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +grant UPDATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost with GRANT OPTION; --error ER_DBACCESS_DENIED_ERROR -grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +grant ALL on performance_schema.events_waits_current to 'pfs_user_3'@localhost with GRANT OPTION; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant DROP on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant INSERT on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant UPDATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant DELETE on performance_schema.events_waits_current to 'pfs_user_3'@localhost; -grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +grant SELECT on performance_schema.events_waits_current to 'pfs_user_3'@localhost with GRANT OPTION; --error ER_DBACCESS_DENIED_ERROR -grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +grant ALL on performance_schema.file_instances to 'pfs_user_3'@localhost with GRANT OPTION; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant CREATE on performance_schema.file_instances to 'pfs_user_3'@localhost; # will be ER_DBACCESS_DENIED_ERROR once .FRM are removed -grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant DROP on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant INDEX on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant ALTER on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant CREATE VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant SHOW VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost; --error ER_DBACCESS_DENIED_ERROR -grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant TRIGGER on performance_schema.file_instances to 'pfs_user_3'@localhost; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant INSERT on performance_schema.file_instances to 'pfs_user_3'@localhost; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant UPDATE on performance_schema.file_instances to 'pfs_user_3'@localhost; ---replace_result '\'file_instances' '\'FILE_INSTANCES' --error ER_TABLEACCESS_DENIED_ERROR -grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant DELETE on performance_schema.file_instances to 'pfs_user_3'@localhost; -grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +grant SELECT on performance_schema.file_instances to 'pfs_user_3'@localhost with GRANT OPTION; # See bug#45354 LOCK TABLES is not a TABLE privilege @@ -258,25 +250,20 @@ CREATE user pfs_user_4; --connection pfs_user_4 --echo # Select as pfs_user_4 should fail without grant ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; +SELECT event_id FROM performance_schema.events_waits_history; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; +SELECT event_id FROM performance_schema.events_waits_history_long; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; +SELECT event_id FROM performance_schema.events_waits_current; ---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +SELECT event_name FROM performance_schema.events_waits_summary_by_instance; ---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' --error ER_TABLEACCESS_DENIED_ERROR -SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; +SELECT event_name FROM performance_schema.file_summary_by_instance; --echo # --echo # WL#4818, NFS3: Normal user does not have access to change what is @@ -287,35 +274,28 @@ SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; --echo # User pfs_user_4 should not be allowed to tweak instrumentation without --echo # explicit grant ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; ---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' --error ER_TABLEACCESS_DENIED_ERROR -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; ---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' --error ER_TABLEACCESS_DENIED_ERROR -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; ---replace_result '\'setup_timers' '\'SETUP_TIMERS' --error ER_TABLEACCESS_DENIED_ERROR -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +UPDATE performance_schema.setup_timers SET timer_name = 'TICK'; ---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' --error ER_TABLEACCESS_DENIED_ERROR -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.events_waits_history_long; ---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' --error ER_TABLEACCESS_DENIED_ERROR -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.events_waits_history; ---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' --error ER_TABLEACCESS_DENIED_ERROR -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_current; --echo # --echo # WL#4814, NFS1: Can use grants to give normal user access @@ -325,29 +305,29 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; --connection default --echo # Grant access to change tables with the root account -GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; -GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; -GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; -GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; +GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4; +GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4; +GRANT DROP ON performance_schema.events_waits_history_long TO pfs_user_4; --connection pfs_user_4 --echo # User pfs_user_4 should now be allowed to tweak instrumentation -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +UPDATE performance_schema.setup_timers SET timer_name = 'TICK'; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; -TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +TRUNCATE TABLE performance_schema.events_waits_history_long; +TRUNCATE TABLE performance_schema.events_waits_history; +TRUNCATE TABLE performance_schema.events_waits_current; --echo # Clean up --disconnect pfs_user_4 @@ -356,7 +336,7 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; DROP USER pfs_user_4; flush privileges; -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; -UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; -UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index a48704dc9d6..6e322434ae0 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -47,17 +47,17 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; -select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +select spins from performance_schema.events_waits_current order by event_name limit 1; -select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +select name from performance_schema.setup_instruments order by name limit 1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; -select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +select spins from performance_schema.events_waits_current order by event_name limit 1; -select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +select name from performance_schema.setup_instruments order by name limit 1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test index 73150207f66..98683e36327 100644 --- a/mysql-test/suite/perfschema/t/read_only.test +++ b/mysql-test/suite/perfschema/t/read_only.test @@ -16,8 +16,8 @@ # Tests for PERFORMANCE_SCHEMA # # Check that -# - a regular user can not update SETUP_ tables under --read-only -# - a user with SUPER privileges cam +# - a regular user can not update setup_ tables under --read-only +# - a user with SUPER privileges can --source include/not_embedded.inc --source include/have_perfschema.inc @@ -43,9 +43,9 @@ connection con1; select @@global.read_only; show grants; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; --enable_result_log --echo connection default; @@ -59,11 +59,11 @@ connection con1; select @@global.read_only; show grants; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.setup_instruments; --error ER_OPTION_PREVENTS_STATEMENT -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.setup_instruments set enabled='NO'; --error ER_OPTION_PREVENTS_STATEMENT -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +update performance_schema.setup_instruments set enabled='YES'; --enable_result_log --echo connection default; @@ -79,9 +79,9 @@ connect (con1, localhost, pfsuser, , test); select @@global.read_only; show grants; --disable_result_log -select * from performance_schema.SETUP_INSTRUMENTS; -update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; -update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select * from performance_schema.setup_instruments; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; --enable_result_log disconnect con1; diff --git a/mysql-test/suite/perfschema/t/schema.test b/mysql-test/suite/perfschema/t/schema.test index 727c4f5a755..32ee4a26676 100644 --- a/mysql-test/suite/perfschema/t/schema.test +++ b/mysql-test/suite/perfschema/t/schema.test @@ -25,21 +25,21 @@ use performance_schema; show tables; -show create table COND_INSTANCES; -show create table EVENTS_WAITS_CURRENT; -show create table EVENTS_WAITS_HISTORY; -show create table EVENTS_WAITS_HISTORY_LONG; -show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; -show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; -show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; -show create table FILE_INSTANCES; -show create table FILE_SUMMARY_BY_EVENT_NAME; -show create table FILE_SUMMARY_BY_INSTANCE; -show create table MUTEX_INSTANCES; -show create table PERFORMANCE_TIMERS; -show create table RWLOCK_INSTANCES; -show create table SETUP_CONSUMERS; -show create table SETUP_INSTRUMENTS; -show create table SETUP_TIMERS; -show create table THREADS; +show create table cond_instances; +show create table events_waits_current; +show create table events_waits_history; +show create table events_waits_history_long; +show create table events_waits_summary_by_instance; +show create table events_waits_summary_by_thread_by_event_name; +show create table events_waits_summary_global_by_event_name; +show create table file_instances; +show create table file_summary_by_event_name; +show create table file_summary_by_instance; +show create table mutex_instances; +show create table performance_timers; +show create table rwlock_instances; +show create table setup_consumers; +show create table setup_instruments; +show create table setup_timers; +show create table threads; diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test index d0249fe654c..e8fd0827c53 100644 --- a/mysql-test/suite/perfschema/t/selects.test +++ b/mysql-test/suite/perfschema/t/selects.test @@ -22,7 +22,7 @@ # Make some data that we can work on: -UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; --disable_warnings DROP TABLE IF EXISTS t1; @@ -35,7 +35,7 @@ INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); --replace_column 2 [NUM_BYTES] SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL -FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +FROM performance_schema.events_waits_history_long GROUP BY OPERATION HAVING TOTAL IS NOT NULL ORDER BY OPERATION @@ -43,11 +43,11 @@ LIMIT 1; # Sub SELECT --replace_column 1 [EVENT_ID] -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE THREAD_ID IN - (SELECT THREAD_ID FROM performance_schema.THREADS) + (SELECT THREAD_ID FROM performance_schema.threads) AND EVENT_NAME IN - (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + (SELECT NAME FROM performance_schema.setup_instruments WHERE NAME LIKE "wait/synch/%") LIMIT 1; @@ -55,9 +55,9 @@ LIMIT 1; --replace_column 1 [EVENT_ID] SELECT DISTINCT EVENT_ID -FROM performance_schema.EVENTS_WAITS_CURRENT -JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +FROM performance_schema.events_waits_current +JOIN performance_schema.events_waits_history USING (EVENT_ID) +JOIN performance_schema.events_waits_history_long USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; @@ -65,21 +65,21 @@ LIMIT 1; --replace_column 1 [THREAD_ID] 2 [EVENT_ID] 3 [EVENT_NAME] 4 [TIMER_WAIT] SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT -FROM performance_schema.EVENTS_WAITS_HISTORY t1 -JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) -JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +FROM performance_schema.events_waits_history t1 +JOIN performance_schema.events_waits_history t2 USING (EVENT_ID) +JOIN performance_schema.events_waits_history t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.events_waits_history t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) ORDER BY t1.EVENT_ID, t2.EVENT_ID LIMIT 5; # UNION --replace_column 1 [THREAD_ID] 2 [EVENT_ID] SELECT THREAD_ID, EVENT_ID FROM ( -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_current UNION -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history UNION -SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history_long ) t1 ORDER BY THREAD_ID, EVENT_ID LIMIT 5; @@ -93,14 +93,14 @@ DROP TABLE IF EXISTS t_event; DROP EVENT IF EXISTS t_ps_event; --enable_warnings CREATE TABLE t_event AS -SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +SELECT EVENT_ID FROM performance_schema.events_waits_current WHERE 1 = 2; CREATE EVENT t_ps_event ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO INSERT INTO t_event SELECT DISTINCT EVENT_ID - FROM performance_schema.EVENTS_WAITS_CURRENT - JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) + FROM performance_schema.events_waits_current + JOIN performance_schema.events_waits_history USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; @@ -116,7 +116,7 @@ delimiter |; CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET NEW.c = (SELECT MAX(EVENT_ID) - FROM performance_schema.EVENTS_WAITS_CURRENT); + FROM performance_schema.events_waits_current); END; | @@ -138,7 +138,7 @@ delimiter |; CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT) BEGIN - SELECT thread_id FROM performance_schema.THREADS + SELECT thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = conid INTO pid; END; @@ -157,7 +157,7 @@ delimiter |; CREATE FUNCTION t_ps_func(conid INT) RETURNS int BEGIN - return (SELECT thread_id FROM performance_schema.THREADS + return (SELECT thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = conid); END; diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test index 7036464ddb9..33eeeb7edb2 100644 --- a/mysql-test/suite/perfschema/t/server_init.test +++ b/mysql-test/suite/perfschema/t/server_init.test @@ -28,176 +28,176 @@ use performance_schema; # Verify that these global mutexes have been properly initilized in mysys -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_open"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_net"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/mysys/THR_LOCK_time"; # There are no global rwlock in mysys # Verify that these global conditions have been properly initilized in mysys -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/mysys/THR_COND_threads"; # Verify that these global mutexes have been properly initilized in sql -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_open"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_thread_count"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_status"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_error_log"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_status"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_delayed_create"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_crypt"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_slave_list"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_active_mi"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_manager"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_user_conn"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_connection_count"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_server_started"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_rpl_status"; # LOG_INFO object are created on demand, and are not global. -# select count(name) from MUTEX_INSTANCES +# select count(name) from mutex_instances # where name like "wait/synch/mutex/sql/LOG_INFO::lock"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; # The event scheduler may be disabled -# select count(name) from MUTEX_INSTANCES +# select count(name) from mutex_instances # where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_event_queue"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_user_locks"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/Cversion_lock"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_audit_mask"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_xid_cache"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/LOCK_plugin"; # Not a global variable, may be destroyed already. -# select count(name) from MUTEX_INSTANCES +# select count(name) from mutex_instances # where name like "wait/synch/mutex/sql/LOCK_gdl"; -select count(name) from MUTEX_INSTANCES +select count(name) from mutex_instances where name like "wait/synch/mutex/sql/tz_LOCK"; # Verify that these global rwlocks have been properly initilized in sql -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_grant"; -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; -select count(name) from RWLOCK_INSTANCES +select count(name) from rwlock_instances where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; # Verify that these global conditions have been properly initilized in sql -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_server_started"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_refresh"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_thread_count"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_manager"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_thread_cache"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_flush_thread_cache"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_rpl_status"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; # The event scheduler may be disabled -# select count(name) from COND_INSTANCES +# select count(name) from cond_instances # where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; -select count(name) from COND_INSTANCES +select count(name) from cond_instances where name like "wait/synch/cond/sql/COND_queue_state"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test index 34ff61c358e..da75306c2ca 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test @@ -23,7 +23,7 @@ # Expect no classes show variables like "performance_schema_max_cond_classes"; -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/cond/%"; # We lost all the classes @@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; # Expect no instances -select count(*) from performance_schema.COND_INSTANCES; +select count(*) from performance_schema.cond_instances; # Expect no instances lost show status like "performance_schema_cond_instances_lost"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test index fe2177adb82..eb77d76b70e 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test @@ -23,7 +23,7 @@ # Expect classes show variables like "performance_schema_max_cond_classes"; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/cond/%"; # Expect no class lost @@ -32,7 +32,7 @@ show status like "performance_schema_cond_classes_lost"; # Expect no instances show variables like "performance_schema_max_cond_instances"; -select count(*) from performance_schema.COND_INSTANCES; +select count(*) from performance_schema.cond_instances; # Expect instances lost select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class.test b/mysql-test/suite/perfschema/t/start_server_no_file_class.test index ca84fbbdcf2..03180dae01e 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_file_class.test +++ b/mysql-test/suite/perfschema/t/start_server_no_file_class.test @@ -23,7 +23,7 @@ # Expect no classes show variables like "performance_schema_max_file_classes"; -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/io/file/%"; # We lost all the classes @@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; # Expect no instances -select count(*) from performance_schema.FILE_INSTANCES; +select count(*) from performance_schema.file_instances; # Expect no instances lost show status like "performance_schema_file_instances_lost"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test index dbbba7bbe4a..faa5e97a853 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test +++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test @@ -23,7 +23,7 @@ # Expect classes show variables like "performance_schema_max_file_classes"; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/io/file/%"; # Expect no class lost @@ -32,7 +32,7 @@ show status like "performance_schema_file_classes_lost"; # Expect no instances show variables like "performance_schema_max_file_instances"; -select count(*) from performance_schema.FILE_INSTANCES; +select count(*) from performance_schema.file_instances; # Expect instances lost select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test index 142e150ede6..79bf3d52bc5 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test @@ -23,7 +23,7 @@ # Expect no classes show variables like "performance_schema_max_mutex_classes"; -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/mutex/%"; # We lost all the classes @@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; # Expect no instances -select count(*) from performance_schema.MUTEX_INSTANCES; +select count(*) from performance_schema.mutex_instances; # Expect no instances lost show status like "performance_schema_mutex_instances_lost"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test index 5a03251d97a..32c0a02b642 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test @@ -23,7 +23,7 @@ # Expect classes show variables like "performance_schema_max_mutex_classes"; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/mutex/%"; # Expect no class lost @@ -32,7 +32,7 @@ show status like "performance_schema_mutex_classes_lost"; # Expect no instances show variables like "performance_schema_max_mutex_instances"; -select count(*) from performance_schema.MUTEX_INSTANCES; +select count(*) from performance_schema.mutex_instances; # Expect instances lost select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test index e4dfe121fcf..10780b59fbe 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test @@ -23,7 +23,7 @@ # Expect no classes show variables like "performance_schema_max_rwlock_classes"; -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; # We lost all the classes @@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; # Expect no instances -select count(*) from performance_schema.RWLOCK_INSTANCES; +select count(*) from performance_schema.rwlock_instances; # Expect no instances lost show status like "performance_schema_rwlock_instances_lost"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test index 1d79d2d3991..2ba2ebcdd4b 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test @@ -23,7 +23,7 @@ # Expect classes show variables like "performance_schema_max_rwlock_classes"; -select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +select count(*) > 0 from performance_schema.setup_instruments where name like "wait/synch/rwlock/%"; # Expect no class lost @@ -32,7 +32,7 @@ show status like "performance_schema_rwlock_classes_lost"; # Expect no instances show variables like "performance_schema_max_rwlock_instances"; -select count(*) from performance_schema.RWLOCK_INSTANCES; +select count(*) from performance_schema.rwlock_instances; # Expect instances lost select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test index 1ed0fecb538..df825ede637 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test @@ -23,7 +23,7 @@ # Expect no classes show variables like "performance_schema_max_thread_classes"; -select count(*) from performance_schema.SETUP_INSTRUMENTS +select count(*) from performance_schema.setup_instruments where name like "thread/%"; # We lost all the classes @@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; # Expect no instances -select count(*) from performance_schema.THREADS; +select count(*) from performance_schema.threads; # Expect no instances lost show status like "performance_schema_thread_instances_lost"; diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test index 489f814ba10..150886d01f9 100644 --- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test @@ -24,7 +24,7 @@ show variables like "performance_schema_max_thread_classes"; # Not observable yet -# select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +# select count(*) > 0 from performance_schema.setup_instruments # where name like "thread/%"; # Expect no class lost @@ -33,7 +33,7 @@ show status like "performance_schema_thread_classes_lost"; # Expect no instances show variables like "performance_schema_max_thread_instances"; -select count(*) from performance_schema.THREADS; +select count(*) from performance_schema.threads; # Expect instances lost select variable_value > 0 from information_schema.global_status diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test index be079bacfbf..741b41ec46b 100644 --- a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test +++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test @@ -27,18 +27,18 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -# The message prints 'mysql.SETUP_INSTRUMENTS' -# instead of 'performance_schema.SETUP_INSTRUMENTS', +# The message prints 'mysql.setup_instruments' +# instead of 'performance_schema.setup_instruments', # due to Bug#46792 call mtr.add_suppression( -"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Column count of mysql.setup_instruments is wrong. " "Expected 4, found 3. The table is probably corrupted"); --error ER_WRONG_NATIVE_TABLE_STRUCTURE -select * from performance_schema.SETUP_INSTRUMENTS limit 1; +select * from performance_schema.setup_instruments limit 1; --disable_result_log -select * from performance_schema.SETUP_CONSUMERS limit 1; +select * from performance_schema.setup_consumers limit 1; --enable_result_log diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test index a59f568e8a2..488b359cd34 100644 --- a/mysql-test/suite/perfschema/t/thread_cache.test +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -30,14 +30,14 @@ connect (con1, localhost, root, , ); let $con1_ID=`select connection_id()`; -let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con1_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connect (con2, localhost, root, , ); let $con2_ID=`select connection_id()`; -let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con2_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connection default; @@ -58,7 +58,7 @@ connect (con3, localhost, root, , ); let $con3_ID=`select connection_id()`; -let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con3_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; disconnect con3; @@ -82,14 +82,14 @@ connect (con1, localhost, root, , ); let $con1_ID=`select connection_id()`; -let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con1_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connect (con2, localhost, root, , ); let $con2_ID=`select connection_id()`; -let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con2_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; connection default; @@ -108,7 +108,7 @@ connect (con3, localhost, root, , ); let $con3_ID=`select connection_id()`; -let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS +let $con3_THREAD_ID=`select thread_id from performance_schema.threads where PROCESSLIST_ID = connection_id()`; disconnect con3; diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl000017.result index 403f4d4d4fe..39f46c41217 100644 --- a/mysql-test/suite/rpl/r/rpl000017.result +++ b/mysql-test/suite/rpl/r/rpl000017.result @@ -13,3 +13,4 @@ n 24 drop table t1; delete from mysql.user where user="replicate"; +call mtr.force_restart(); diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index a6c59918b93..37f27ab0e4b 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -142,3 +142,4 @@ HEX(word) SELECT * FROM tmptbl504451f4258$1; ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist DROP TABLE t5; +call mtr.force_restart(); diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result index a98a81dc74f..315008d559a 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_status.result +++ b/mysql-test/suite/rpl/r/rpl_slave_status.result @@ -33,3 +33,4 @@ Slave_IO_Running = No (should be No) DROP TABLE t1; [on master] DROP TABLE t1; +call mtr.force_restart(); diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test index a65189657cc..d271ba49c68 100644 --- a/mysql-test/suite/rpl/t/rpl000017.test +++ b/mysql-test/suite/rpl/t/rpl000017.test @@ -31,4 +31,6 @@ drop table t1; delete from mysql.user where user="replicate"; sync_slave_with_master; +call mtr.force_restart(); + # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-master.opt b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt index 815a8f81d32..b0a1ce4a0be 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt +++ b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt @@ -1 +1,2 @@ --replicate-same-server-id --relay-log=slave-relay-bin +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_current_user-master.opt b/mysql-test/suite/rpl/t/rpl_current_user-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index 66f96e8f4e8..b5666ad6e91 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -174,3 +174,5 @@ SELECT * FROM tmptbl504451f4258$1; connection master; DROP TABLE t5; sync_slave_with_master; + +call mtr.force_restart(); diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh index 066f72926af..e5bb3e61d11 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_master_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh index 218209a2542..7a0c0bb382a 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_slave_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt index 58029d28ace..1e8eb90679e 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt +++ b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt @@ -1 +1,2 @@ $SEMISYNC_PLUGIN_OPT +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index 02fd555d13c..9601062b65f 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -68,3 +68,4 @@ DROP TABLE t1; --echo [on master] connection master; DROP TABLE t1; +call mtr.force_restart(); diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index 48c8dc02efb..4ec02325572 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -150,3 +150,4 @@ source include/diff_tables.inc; --echo =====Clean up=======; connection master; drop table t1; +--remove_file $MYSQLD_SLAVE_DATADIR/master.backup diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt index 80c171170f6..b37427aa2cd 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt @@ -1,3 +1,2 @@ --loose-debug="+d,all_errors_are_temporary_errors" --slave-transaction-retries=2 - - +--force-restart diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 5b665e24958..c7586c71229 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1477,6 +1477,15 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17, x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682'); SELECT predicted_order, hex(utf8_encoding) FROM t1 ORDER BY utf8_encoding COLLATE utf8_sinhala_ci; DROP TABLE t1; +# +# Postfix for Bug#26474 +# +SET NAMES utf8 COLLATE utf8_sinhala_ci; +CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci); +INSERT INTO t1 VALUES ('a'),('ae'),('af'); +SELECT s1,hex(s1) FROM t1 ORDER BY s1; +SELECT * FROM t1 ORDER BY s1; +DROP TABLE t1; --echo End of 5.4 tests diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt index 66e19c18a8a..6398e3e0a26 100644 --- a/mysql-test/t/key_cache-master.opt +++ b/mysql-test/t/key_cache-master.opt @@ -1 +1,2 @@ --key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K +--force-restart diff --git a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt index ac1a87c73b3..a9f4a6010d8 100644 --- a/mysql-test/t/mysqlbinlog-master.opt +++ b/mysql-test/t/mysqlbinlog-master.opt @@ -1 +1,2 @@ --max-binlog-size=4096 +--force-restart diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test index 8aa0791e265..fe52632c784 100644 --- a/mysql-test/t/sp-bugs.test +++ b/mysql-test/t/sp-bugs.test @@ -101,4 +101,41 @@ CALL p1 (); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # Bug#54375: Error in stored procedure leaves connection +--echo # in different default schema +--echo # + +--disable_warnings +SET @@SQL_MODE = 'STRICT_ALL_TABLES'; +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +USE db1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1); +DELIMITER $$; +CREATE FUNCTION f1 ( + some_value int +) +RETURNS smallint +DETERMINISTIC +BEGIN + INSERT INTO t1 SET c1 = some_value; + RETURN(LAST_INSERT_ID()); +END$$ +DELIMITER ;$$ +DROP DATABASE IF EXISTS db2; +CREATE DATABASE db2; +--enable_warnings +USE db2; +SELECT DATABASE(); +--error ER_DUP_ENTRY +SELECT db1.f1(1); +SELECT DATABASE(); +USE test; +DROP FUNCTION db1.f1; +DROP TABLE db1.t1; +DROP DATABASE db1; +DROP DATABASE db2; --echo End of 5.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 2e442e7f897..d4a995ee181 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3946,3 +3946,21 @@ DROP TABLE t1,t2; --enable_result_log --echo End of 5.1 tests + +--echo # +--echo # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): +--echo # Assertion `file' failed. +--echo # + +CREATE TABLE t1 (a INT); + +--error ER_OPERAND_COLUMNS +SELECT 1 FROM + (SELECT ROW( + (SELECT 1 FROM t1 RIGHT JOIN + (SELECT 1 FROM t1, t1 t2) AS d ON 1), + 1) FROM t1) AS e; + +DROP TABLE t1; + + diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 93dc4cad50c..596fc5f41ef 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1062,7 +1062,7 @@ SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1; DROP TABLE t1; - +remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*; --echo # --echo # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 02c5389f8d3..70e1d4fcdce 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -171,7 +171,7 @@ set @have_pfs= (select count(engine) from information_schema.engines where engin -- TABLE COND_INSTANCES -- -SET @l1="CREATE TABLE performance_schema.COND_INSTANCES("; +SET @l1="CREATE TABLE performance_schema.cond_instances("; SET @l2="NAME VARCHAR(128) not null,"; SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null"; SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; @@ -187,7 +187,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_CURRENT -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT("; +SET @l1="CREATE TABLE performance_schema.events_waits_current("; SET @l2="THREAD_ID INTEGER not null,"; SET @l3="EVENT_ID BIGINT unsigned not null,"; SET @l4="EVENT_NAME VARCHAR(128) not null,"; @@ -217,7 +217,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_HISTORY -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY("; +SET @l1="CREATE TABLE performance_schema.events_waits_history("; -- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); @@ -231,7 +231,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_HISTORY_LONG -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG("; +SET @l1="CREATE TABLE performance_schema.events_waits_history_long("; -- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); @@ -245,7 +245,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE("; +SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance("; SET @l2="EVENT_NAME VARCHAR(128) not null,"; SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; SET @l4="COUNT_STAR BIGINT unsigned not null,"; @@ -266,7 +266,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME("; +SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name("; SET @l2="THREAD_ID INTEGER not null,"; SET @l3="EVENT_NAME VARCHAR(128) not null,"; SET @l4="COUNT_STAR BIGINT unsigned not null,"; @@ -287,7 +287,7 @@ DROP PREPARE stmt; -- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME -- -SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME("; +SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name("; SET @l2="EVENT_NAME VARCHAR(128) not null,"; SET @l3="COUNT_STAR BIGINT unsigned not null,"; SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,"; @@ -307,7 +307,7 @@ DROP PREPARE stmt; -- TABLE FILE_INSTANCES -- -SET @l1="CREATE TABLE performance_schema.FILE_INSTANCES("; +SET @l1="CREATE TABLE performance_schema.file_instances("; SET @l2="FILE_NAME VARCHAR(512) not null,"; SET @l3="EVENT_NAME VARCHAR(128) not null,"; SET @l4="OPEN_COUNT INTEGER unsigned not null"; @@ -324,7 +324,7 @@ DROP PREPARE stmt; -- TABLE FILE_SUMMARY_BY_EVENT_NAME -- -SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME("; +SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name("; SET @l2="EVENT_NAME VARCHAR(128) not null,"; SET @l3="COUNT_READ BIGINT unsigned not null,"; SET @l4="COUNT_WRITE BIGINT unsigned not null,"; @@ -343,7 +343,7 @@ DROP PREPARE stmt; -- TABLE FILE_SUMMARY_BY_INSTANCE -- -SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE("; +SET @l1="CREATE TABLE performance_schema.file_summary_by_instance("; SET @l2="FILE_NAME VARCHAR(512) not null,"; SET @l3="EVENT_NAME VARCHAR(128) not null,"; SET @l4="COUNT_READ BIGINT unsigned not null,"; @@ -363,7 +363,7 @@ DROP PREPARE stmt; -- TABLE MUTEX_INSTANCES -- -SET @l1="CREATE TABLE performance_schema.MUTEX_INSTANCES("; +SET @l1="CREATE TABLE performance_schema.mutex_instances("; SET @l2="NAME VARCHAR(128) not null,"; SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; SET @l4="LOCKED_BY_THREAD_ID INTEGER"; @@ -380,7 +380,7 @@ DROP PREPARE stmt; -- TABLE PERFORMANCE_TIMERS -- -SET @l1="CREATE TABLE performance_schema.PERFORMANCE_TIMERS("; +SET @l1="CREATE TABLE performance_schema.performance_timers("; SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"; SET @l3="TIMER_FREQUENCY BIGINT,"; SET @l4="TIMER_RESOLUTION BIGINT,"; @@ -398,7 +398,7 @@ DROP PREPARE stmt; -- TABLE RWLOCK_INSTANCES -- -SET @l1="CREATE TABLE performance_schema.RWLOCK_INSTANCES("; +SET @l1="CREATE TABLE performance_schema.rwlock_instances("; SET @l2="NAME VARCHAR(128) not null,"; SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,"; @@ -416,7 +416,7 @@ DROP PREPARE stmt; -- TABLE SETUP_CONSUMERS -- -SET @l1="CREATE TABLE performance_schema.SETUP_CONSUMERS("; +SET @l1="CREATE TABLE performance_schema.setup_consumers("; SET @l2="NAME VARCHAR(64) not null,"; SET @l3="ENABLED ENUM ('YES', 'NO') not null"; SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; @@ -432,7 +432,7 @@ DROP PREPARE stmt; -- TABLE SETUP_INSTRUMENTS -- -SET @l1="CREATE TABLE performance_schema.SETUP_INSTRUMENTS("; +SET @l1="CREATE TABLE performance_schema.setup_instruments("; SET @l2="NAME VARCHAR(128) not null,"; SET @l3="ENABLED ENUM ('YES', 'NO') not null,"; SET @l4="TIMED ENUM ('YES', 'NO') not null"; @@ -449,7 +449,7 @@ DROP PREPARE stmt; -- TABLE SETUP_TIMERS -- -SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS("; +SET @l1="CREATE TABLE performance_schema.setup_timers("; SET @l2="NAME VARCHAR(64) not null,"; SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"; SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; @@ -465,7 +465,7 @@ DROP PREPARE stmt; -- TABLE THREADS -- -SET @l1="CREATE TABLE performance_schema.THREADS("; +SET @l1="CREATE TABLE performance_schema.threads("; SET @l2="THREAD_ID INTEGER not null,"; SET @l3="PROCESSLIST_ID INTEGER,"; SET @l4="NAME VARCHAR(128) not null"; diff --git a/sql-common/client.c b/sql-common/client.c index e8ca74eba37..3bb626e824a 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -4197,7 +4197,7 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) int pkt_len; uchar *pkt; - DBUG_ENTER ("native_password_auth_client"); + DBUG_ENTER("native_password_auth_client"); if (((MCPVIO_EXT *)vio)->mysql_change_user) @@ -4213,10 +4213,10 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) { /* read the scramble */ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) - return CR_ERROR; + DBUG_RETURN(CR_ERROR); if (pkt_len != SCRAMBLE_LENGTH + 1) - DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR); + DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR); /* save it in MYSQL */ memcpy(mysql->scramble, pkt, SCRAMBLE_LENGTH); @@ -4226,19 +4226,19 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) if (mysql->passwd[0]) { char scrambled[SCRAMBLE_LENGTH + 1]; - DBUG_PRINT ("info", ("sending scramble")); + DBUG_PRINT("info", ("sending scramble")); scramble(scrambled, (char*)pkt, mysql->passwd); if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH)) - DBUG_RETURN (CR_ERROR); + DBUG_RETURN(CR_ERROR); } else { - DBUG_PRINT ("info", ("no password")); + DBUG_PRINT("info", ("no password")); if (vio->write_packet(vio, 0, 0)) /* no password */ - DBUG_RETURN (CR_ERROR); + DBUG_RETURN(CR_ERROR); } - DBUG_RETURN (CR_OK); + DBUG_RETURN(CR_OK); } /** @@ -4250,7 +4250,7 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) uchar *pkt; int pkt_len; - DBUG_ENTER ("old_password_auth_client"); + DBUG_ENTER("old_password_auth_client"); if (((MCPVIO_EXT *)vio)->mysql_change_user) { @@ -4265,11 +4265,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) { /* read the scramble */ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) - return CR_ERROR; + DBUG_RETURN(CR_ERROR); if (pkt_len != SCRAMBLE_LENGTH_323 + 1 && pkt_len != SCRAMBLE_LENGTH + 1) - DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR); + DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR); /* save it in MYSQL */ memcpy(mysql->scramble, pkt, pkt_len); @@ -4281,11 +4281,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) char scrambled[SCRAMBLE_LENGTH_323 + 1]; scramble_323(scrambled, (char*)pkt, mysql->passwd); if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH_323 + 1)) - DBUG_RETURN (CR_ERROR); + DBUG_RETURN(CR_ERROR); } else if (vio->write_packet(vio, 0, 0)) /* no password */ - DBUG_RETURN (CR_ERROR); + DBUG_RETURN(CR_ERROR); - DBUG_RETURN (CR_OK); + DBUG_RETURN(CR_OK); } diff --git a/sql/item_func.cc b/sql/item_func.cc index afb09ff5b17..bef0e461a1f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -178,7 +178,14 @@ Item_func::fix_fields(THD *thd, Item **ref) used_tables_cache= not_null_tables_cache= 0; const_item_cache=1; - if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) + /* + Use stack limit of STACK_MIN_SIZE * 2 since + on some platforms a recursive call to fix_fields + requires more than STACK_MIN_SIZE bytes (e.g. for + MIPS, it takes about 22kB to make one recursive + call to Item_func::fix_fields()) + */ + if (check_stack_overrun(thd, STACK_MIN_SIZE * 2, buff)) return TRUE; // Fatal error if flag is set! if (arg_count) { // Print purify happy diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9e4026f3a1c..d2207303369 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4941,7 +4941,7 @@ void create_thread_to_handle_connection(THD *thd) statistic_increment(aborted_connects,&LOCK_status); /* Can't use my_error() since store_globals has not been called. */ my_snprintf(error_message_buff, sizeof(error_message_buff), - ER(ER_CANT_CREATE_THREAD), error); + ER_THD(thd, ER_CANT_CREATE_THREAD), error); net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL); mysql_mutex_lock(&LOCK_thread_count); close_connection(thd,0,0); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 5089e7e0340..47b698c3a2f 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1510,7 +1510,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) If the DB has changed, the pointer has changed too, but the original thd->db will then have been freed */ - if (cur_db_changed && !thd->killed) + if (cur_db_changed && thd->killed != THD::KILL_CONNECTION) { /* Force switching back to the saved current database, because it may be diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 98f20e09949..1c0c48c0fec 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -434,6 +434,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, err: thd_arg->lex->current_select= lex_select_save; + (void) cleanup(); DBUG_RETURN(TRUE); } diff --git a/storage/ibmdb2i/CMakeLists.txt b/storage/ibmdb2i/CMakeLists.txt deleted file mode 100644 index 54da2b00ef2..00000000000 --- a/storage/ibmdb2i/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2006, 2010, 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -CHECK_INCLUDE_FILES(qlgusr.h HAVE_PASE_ENVIRONMENT) -IF(HAVE_PASE_ENVIRONMENT) - -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/regex - ${CMAKE_SOURCE_DIR}/sql - ${CMAKE_CURRENT_SOURCE_DIR} - /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0f.xpf/cur/cmvc/base.pgm/my.xpf/apis - /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/lg.xpf - /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/tq.xpf -) - - -SET (IBMDB2I_SOURCES ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc - db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc - db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc - db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc db2i_myconv.cc) - - -MYSQL_ADD_PLUGIN(ibmdb2i ${IBMDB2I_SOURCES} STORAGE_ENGINE LINK_LIBRARIES iconv) - -ENDIF(HAVE_PASE_ENVIRONMENT) diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am deleted file mode 100644 index a9977de895d..00000000000 --- a/storage/ibmdb2i/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2007, 2008, IBM Corporation. -# All rights reserved. -# -# - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) \ - -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0f.xpf/cur/cmvc/base.pgm/my.xpf/apis \ - -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/lg.xpf \ - -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/tq.xpf -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \ - db2i_ioBuffers.h db2i_blobCollection.h \ - db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \ - db2i_iconv.h db2i_myconv.h db2i_safeString.h db2i_sqlStatementStream.h \ - db2i_ileBridge.h db2i_validatedPointer.h - -EXTRA_LTLIBRARIES = ha_ibmdb2i.la -pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ -ha_ibmdb2i_la_LIBADD = -liconv -ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ - db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ - db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc \ - db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc \ - db2i_myconv.cc - -EXTRA_LIBRARIES = libibmdb2i.a -noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ -libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS) -libibmdb2i_a_CFLAGS = $(AM_CFLAGS) -libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) - - -EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/ibmdb2i/db2i_blobCollection.cc b/storage/ibmdb2i/db2i_blobCollection.cc deleted file mode 100644 index 17101c9c0a4..00000000000 --- a/storage/ibmdb2i/db2i_blobCollection.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "db2i_blobCollection.h" - -/** - Return the size to use when allocating space for blob reads. - - @param fieldIndex The field to allocate for - @param[out] shouldProtect Indicates whether storage protection should be - applied to the space, because the size returned is - smaller than the maximum possible size. -*/ - -uint32 -BlobCollection::getSizeToAllocate(int fieldIndex, bool& shouldProtect) -{ - Field* field = table->getMySQLTable()->field[fieldIndex]; - uint fieldLength = field->max_display_length(); - - if (fieldLength <= MAX_FULL_ALLOCATE_BLOB_LENGTH) - { - shouldProtect = false; - return fieldLength; - } - - shouldProtect = true; - - uint curMaxSize = table->getBlobFieldActualSize(fieldIndex); - - uint defaultAllocSize = min(defaultAllocation, fieldLength); - - return max(defaultAllocSize, curMaxSize); - -} - -void -BlobCollection::generateBuffer(int fieldIndex) -{ - DBUG_ASSERT(table->db2Field(fieldIndex).isBlob()); - - bool protect; - buffers[table->getBlobIdFromField(fieldIndex)].Malloc(getSizeToAllocate(fieldIndex, protect), protect); - - return; -} - -/** - Realloc the read buffer associated with a blob field. - - This is used when the previous allocation for a blob field is found to be - too small (this is discovered when QMY_READ trips over the protected boundary - page). - - @param fieldIndex The field to be reallocated - @param size The size of buffer to allocate for this field. -*/ - -ValidatedPointer<char>& -BlobCollection::reallocBuffer(int fieldIndex, size_t size) -{ - ProtectedBuffer& buf = buffers[table->getBlobIdFromField(fieldIndex)]; - if (size <= buf.allocLen()) - return buf.ptr(); - - table->updateBlobFieldActualSize(fieldIndex, size); - - DBUG_PRINT("BlobCollection::reallocBuffer",("PERF: reallocing %d to %d: ", fieldIndex, size)); - - bool protect; - buf.Free(); - buf.Malloc(getSizeToAllocate(fieldIndex, protect), protect); - return buf.ptr(); -} diff --git a/storage/ibmdb2i/db2i_blobCollection.h b/storage/ibmdb2i/db2i_blobCollection.h deleted file mode 100644 index 6a60394555f..00000000000 --- a/storage/ibmdb2i/db2i_blobCollection.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_BLOBCOLLECTION_H -#define DB2I_BLOBCOLLECTION_H - -#include "db2i_global.h" -#include "db2i_file.h" - -/** - @class ProtectedBuffer - @brief Implements memory management for (optionally) protected buffers. - - Buffers created with the protection option will have a guard page set on the - page following requested allocation size. The side effect is that the actual - allocation is up to 2*4096-1 bytes larger than the size requested by the - using code. -*/ - -class ProtectedBuffer -{ -public: - ProtectedBuffer() : protectBuf(false) - {;} - - void Malloc(size_t size, bool protect = false) - { - protectBuf = protect; - bufptr.alloc(size + (protectBuf ? 0x1fff : 0x0)); - if ((void*)bufptr != NULL) - { - len = size; - if (protectBuf) - mprotect(protectedPage(), 0x1000, PROT_NONE); -#ifndef DBUG_OFF - // Prevents a problem with DBUG_PRINT over-reading in recent versions of - // MySQL - *((char*)protectedPage()-1) = 0; -#endif - } - } - - void Free() - { - if ((void*)bufptr != NULL) - { - if (protectBuf) - mprotect(protectedPage(), 0x1000, PROT_READ | PROT_WRITE); - bufptr.dealloc(); - } - } - - ~ProtectedBuffer() - { - Free(); - } - - ValidatedPointer<char>& ptr() {return bufptr;} - bool isProtected() const {return protectBuf;} - size_t allocLen() const {return len;} -private: - void* protectedPage() - { - return (void*)(((address64_t)(void*)bufptr + len + 0x1000) & ~0xfff); - } - - ValidatedPointer<char> bufptr; - size_t len; - bool protectBuf; - -}; - - -/** - @class BlobCollection - @brief Manages memory allocation for reading blobs associated with a table. - - Allocations are done on-demand and are protected with a guard page if less - than the max possible size is allocated. -*/ -class BlobCollection -{ - public: - BlobCollection(db2i_table* db2Table, uint32 defaultAllocSize) : - defaultAllocation(defaultAllocSize), table(db2Table) - { - buffers = new ProtectedBuffer[table->getBlobCount()]; - } - - ~BlobCollection() - { - delete[] buffers; - } - - ValidatedPointer<char>& getBufferPtr(int fieldIndex) - { - int blobIndex = table->getBlobIdFromField(fieldIndex); - if ((char*)buffers[blobIndex].ptr() == NULL) - generateBuffer(fieldIndex); - - return buffers[blobIndex].ptr(); - } - - ValidatedPointer<char>& reallocBuffer(int fieldIndex, size_t size); - - - private: - - uint32 getSizeToAllocate(int fieldIndex, bool& shouldProtect); - void generateBuffer(int fieldIndex); - - db2i_table* table; // The table being read - ProtectedBuffer* buffers; // The buffers - uint32 defaultAllocation; - /* The default size to use when first allocating a buffer */ -}; - -#endif diff --git a/storage/ibmdb2i/db2i_charsetSupport.cc b/storage/ibmdb2i/db2i_charsetSupport.cc deleted file mode 100644 index f5a3a74025e..00000000000 --- a/storage/ibmdb2i/db2i_charsetSupport.cc +++ /dev/null @@ -1,826 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#include "db2i_charsetSupport.h" -#include "as400_types.h" -#include "as400_protos.h" -#include "db2i_ileBridge.h" -#include "qlgusr.h" -#include "db2i_errors.h" - - -/* - The following arrays define a mapping between IANA-style text descriptors and - IBM i CCSID text descriptors. The mapping is a 1-to-1 correlation between - corresponding array slots. -*/ -#define MAX_IANASTRING 23 -static const char ianaStringType[MAX_IANASTRING][10] = -{ - {"ascii"}, - {"Big5"}, //big5 - {"cp1250"}, - {"cp1251"}, - {"cp1256"}, - {"cp850"}, - {"cp852"}, - {"cp866"}, - {"IBM943"}, //cp932 - {"EUC-KR"}, //euckr - {"IBM1381"}, //gb2312 - {"IBM1386"}, //gbk - {"greek"}, - {"hebrew"}, - {"latin1"}, - {"latin2"}, - {"latin5"}, - {"macce"}, - {"tis620"}, - {"Shift_JIS"}, //sjis - {"ucs2"}, - {"EUC-JP"}, //ujis - {"utf8"} -}; -static const char ccsidType[MAX_IANASTRING][6] = -{ - {"367"}, //ascii - {"950"}, //big5 - {"1250"}, //cp1250 - {"1251"}, //cp1251 - {"1256"}, //cp1256 - {"850"}, //cp850 - {"852"}, //cp852 - {"866"}, //cp866 - {"943"}, //cp932 - {"970"}, //euckr - {"1381"}, //gb2312 - {"1386"}, //gbk - {"813"}, //greek - {"916"}, //hebrew - {"923"}, //latin1 - {"912"}, //latin2 - {"920"}, //latin5 - {"1282"}, //macce - {"874"}, //tis620 - {"943"}, //sjis - {"13488"},//ucs2 - {"5050"}, //ujis - {"1208"} //utf8 -}; - -static _ILEpointer *QlgCvtTextDescToDesc_sym; - -/* We keep a cache of the mapping for text descriptions obtained via - QlgTextDescToDesc. The following structures implement this cache. */ -static HASH textDescMapHash; -static MEM_ROOT textDescMapMemroot; -static pthread_mutex_t textDescMapHashMutex; -struct TextDescMap -{ - struct HashKey - { - int32 inType; - int32 outType; - char inDesc[Qlg_MaxDescSize]; - } hashKey; - char outDesc[Qlg_MaxDescSize]; -}; - -/* We keep a cache of the mapping for open iconv descriptors. The following - structures implement this cache. */ -static HASH iconvMapHash; -static MEM_ROOT iconvMapMemroot; -static pthread_mutex_t iconvMapHashMutex; -struct IconvMap -{ - struct HashKey - { - uint32 direction; // These are uint32s to avoid garbage data in the key from compiler padding - uint32 db2CCSID; - const CHARSET_INFO* myCharset; - } hashKey; - iconv_t iconvDesc; -}; - - -/** - Initialize the static structures used by this module. - - This must only be called once per plugin instantiation. - - @return 0 if successful. Failure otherwise -*/ -int32 initCharsetSupport() -{ - DBUG_ENTER("initCharsetSupport"); - - int actmark = _ILELOAD("QSYS/QLGUSR", ILELOAD_LIBOBJ); - if ( actmark == -1 ) - { - DBUG_PRINT("initCharsetSupport", ("conversion srvpgm activation failed")); - DBUG_RETURN(1); - } - - QlgCvtTextDescToDesc_sym = (ILEpointer*)malloc_aligned(sizeof(ILEpointer)); - if (_ILESYM(QlgCvtTextDescToDesc_sym, actmark, "QlgCvtTextDescToDesc") == -1) - { - DBUG_PRINT("initCharsetSupport", - ("resolve of QlgCvtTextDescToDesc failed")); - DBUG_RETURN(errno); - } - - VOID(pthread_mutex_init(&textDescMapHashMutex,MY_MUTEX_INIT_FAST)); - my_hash_init(&textDescMapHash, &my_charset_bin, 10, offsetof(TextDescMap, hashKey), sizeof(TextDescMap::hashKey), 0, 0, HASH_UNIQUE); - - VOID(pthread_mutex_init(&iconvMapHashMutex,MY_MUTEX_INIT_FAST)); - my_hash_init(&iconvMapHash, &my_charset_bin, 10, offsetof(IconvMap, hashKey), sizeof(IconvMap::hashKey), 0, 0, HASH_UNIQUE); - - init_alloc_root(&textDescMapMemroot, 2048, 0); - init_alloc_root(&iconvMapMemroot, 256, 0); - - initMyconv(); - - DBUG_RETURN(0); -} - -/** - Cleanup the static structures used by this module. - - This must only be called once per plugin instantiation and only if - initCharsetSupport() was successful. -*/ -void doneCharsetSupport() -{ - cleanupMyconv(); - - free_root(&textDescMapMemroot, 0); - free_root(&iconvMapMemroot, 0); - - pthread_mutex_destroy(&textDescMapHashMutex); - my_hash_free(&textDescMapHash); - pthread_mutex_destroy(&iconvMapHashMutex); - my_hash_free(&iconvMapHash); - free_aligned(QlgCvtTextDescToDesc_sym); -} - - -/** - Convert a text description from one type to another. - - This function is just a wrapper for the IBM i QlgTextDescToDesc function plus - some overrides for conversions that the API does not handle correctly and - support for caching the computed conversion. - - @param inType The type of descriptor pointed to by "in". - @param outType The type of descriptor requested for "out". - @param in The descriptor to be convereted. - @param[out] out The equivalent descriptor - @param hashKey The hash key to be used for caching the conversion result. - - @return 0 if successful. Failure otherwise -*/ -static int32 getNewTextDesc(const int32 inType, - const int32 outType, - const char* in, - char* out, - const TextDescMap::HashKey* hashKey) -{ - DBUG_ENTER("db2i_charsetSupport::getNewTextDesc"); - const arg_type_t signature[] = { ARG_INT32, ARG_INT32, ARG_MEMPTR, ARG_INT32, ARG_MEMPTR, ARG_INT32, ARG_INT32, ARG_END }; - struct ArgList - { - ILEarglist_base base; - int32 CRDIInType; - int32 CRDIOutType; - ILEpointer CRDIDesc; - int32 CRDIDescSize; - ILEpointer CRDODesc; - int32 CRDODescSize; - int32 CTDCCSID; - } *arguments; - - if ((inType == Qlg_TypeIANA) && (outType == Qlg_TypeAix41)) - { - // Override non-standard charsets - if (unlikely(strcmp("IBM1381", in) == 0)) - { - strcpy(out, "IBM-1381"); - DBUG_RETURN(0); - } - } - else if ((inType == Qlg_TypeAS400CCSID) && (outType == Qlg_TypeAix41)) - { - // Override non-standard charsets - if (strcmp("1148", in) == 0) - { - strcpy(out, "IBM-1148"); - DBUG_RETURN(0); - } - else if (unlikely(strcmp("1153", in) == 0)) - { - strcpy(out, "IBM-1153"); - DBUG_RETURN(0); - } - } - - char argBuf[sizeof(ArgList)+15]; - arguments = (ArgList*)roundToQuadWordBdy(argBuf); - - arguments->CRDIInType = inType; - arguments->CRDIOutType = outType; - arguments->CRDIDesc.s.addr = (address64_t) in; - arguments->CRDIDescSize = Qlg_MaxDescSize; - arguments->CRDODesc.s.addr = (address64_t) out; - arguments->CRDODescSize = Qlg_MaxDescSize; - arguments->CTDCCSID = 819; - _ILECALL(QlgCvtTextDescToDesc_sym, - &arguments->base, - signature, - RESULT_INT32); - if (unlikely(arguments->base.result.s_int32.r_int32 < 0)) - { - if (arguments->base.result.s_int32.r_int32 == Qlg_InDescriptorNotFound) - { - DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET); - } - else - { - getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32); - DBUG_RETURN(DB2I_ERR_ILECALL); - } - } - - // Store the conversion information into a cache entry - TextDescMap* mapping = (TextDescMap*)alloc_root(&textDescMapMemroot, sizeof(TextDescMap)); - if (unlikely(!mapping)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - memcpy(&(mapping->hashKey), hashKey, sizeof(hashKey)); - strcpy(mapping->outDesc, out); - pthread_mutex_lock(&textDescMapHashMutex); - my_hash_insert(&textDescMapHash, (const uchar*)mapping); - pthread_mutex_unlock(&textDescMapHashMutex); - - DBUG_RETURN(0); -} - - -/** - Convert a text description from one type to another. - - This function takes a text description in one representation and converts - it into another representation. Although the OS provides some facilities for - doing this, the support is not complete, nor does MySQL always use standard - identifiers. Therefore, there are a lot of hardcoded overrides required. - There is probably some room for optimization here, but this should not be - called frequently under most circumstances. - - @param inType The type of descriptor pointed to by "in". - @param outType The type of descriptor requested for "out". - @param in The descriptor to be convereted. - @param[out] out The equivalent descriptor - - @return 0 if successful. Failure otherwise -*/ -static int32 convertTextDesc(const int32 inType, const int32 outType, const char* inDesc, char* outDesc) -{ - DBUG_ENTER("db2i_charsetSupport::convertTextDesc"); - const char* inDescOverride; - - if (inType == Qlg_TypeIANA) - { - // Override non-standard charsets - if (strcmp("big5", inDesc) == 0) - inDescOverride = "Big5"; - else if (strcmp("cp932", inDesc) == 0) - inDescOverride = "IBM943"; - else if (strcmp("euckr", inDesc) == 0) - inDescOverride = "EUC-KR"; - else if (strcmp("gb2312", inDesc) == 0) - inDescOverride = "IBM1381"; - else if (strcmp("gbk", inDesc) == 0) - inDescOverride = "IBM1386"; - else if (strcmp("sjis", inDesc) == 0) - inDescOverride = "Shift_JIS"; - else if (strcmp("ujis", inDesc) == 0) - inDescOverride = "EUC-JP"; - else - inDescOverride = inDesc; - - // Hardcode non-standard charsets - if (outType == Qlg_TypeAix41) - { - if (strcmp("Big5", inDescOverride) == 0) - { - strcpy(outDesc,"big5"); - DBUG_RETURN(0); - } - else if (strcmp("IBM1386", inDescOverride) == 0) - { - strcpy(outDesc,"GBK"); - DBUG_RETURN(0); - } - else if (strcmp("Shift_JIS", inDescOverride) == 0 || - strcmp("IBM943", inDescOverride) == 0) - { - strcpy(outDesc,"IBM-943"); - DBUG_RETURN(0); - } - else if (strcmp("tis620", inDescOverride) == 0) - { - strcpy(outDesc,"TIS-620"); - DBUG_RETURN(0); - } - else if (strcmp("ucs2", inDescOverride) == 0) - { - strcpy(outDesc,"UCS-2"); - DBUG_RETURN(0); - } - else if (strcmp("cp1250", inDescOverride) == 0) - { - strcpy(outDesc,"IBM-1250"); - DBUG_RETURN(0); - } - else if (strcmp("cp1251", inDescOverride) == 0) - { - strcpy(outDesc,"IBM-1251"); - DBUG_RETURN(0); - } - else if (strcmp("cp1256", inDescOverride) == 0) - { - strcpy(outDesc,"IBM-1256"); - DBUG_RETURN(0); - } - else if (strcmp("macce", inDescOverride) == 0) - { - strcpy(outDesc,"IBM-1282"); - DBUG_RETURN(0); - } - } - else if (outType == Qlg_TypeAS400CCSID) - { - // See if we can fast path the convert - for (int loopCnt = 0; loopCnt < MAX_IANASTRING; ++loopCnt) - { - if (strcmp((char*)ianaStringType[loopCnt],inDescOverride) == 0) - { - strcpy(outDesc,ccsidType[loopCnt]); - DBUG_RETURN(0); - } - } - } - } - else - inDescOverride = inDesc; - - // We call getNewTextDesc for all other conversions and cache the result. - TextDescMap *mapping; - TextDescMap::HashKey hashKey; - hashKey.inType= inType; - hashKey.outType= outType; - uint32 len = strlen(inDescOverride); - memcpy(hashKey.inDesc, inDescOverride, len); - memset(hashKey.inDesc+len, 0, sizeof(hashKey.inDesc) - len); - - if (!(mapping=(TextDescMap *) my_hash_search(&textDescMapHash, - (const uchar*)&hashKey, - sizeof(hashKey)))) - { - DBUG_RETURN(getNewTextDesc(inType, outType, inDescOverride, outDesc, &hashKey)); - } - else - { - strcpy(outDesc, mapping->outDesc); - } - DBUG_RETURN(0); -} - - -/** - Convert an IANA character set name into a DB2 for i CCSID value. - - @param parmIANADesc An IANA character set name - @param[out] db2Ccsid The equivalent CCSID value - - @return 0 if successful. Failure otherwise -*/ -int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid) -{ - int32 rc; - uint16 aixCcsid; - char aixCcsidString[Qlg_MaxDescSize]; - int aixEncodingScheme; - int db2EncodingScheme; - rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString); - if (unlikely(rc)) - { - if (rc == DB2I_ERR_UNSUPP_CHARSET) - getErrTxt(DB2I_ERR_UNSUPP_CHARSET, parmIANADesc); - - return rc; - } - aixCcsid = atoi(aixCcsidString); - rc = getEncodingScheme(aixCcsid, aixEncodingScheme); - if (rc != 0) - return rc; - switch(aixEncodingScheme) { // Select on encoding scheme - case 0x1100: // EDCDIC SBCS - case 0x2100: // ASCII SBCS - case 0x4100: // AIX SBCS - case 0x4105: // MS Windows - case 0x5100: // ISO 7 bit ASCII - db2EncodingScheme = 0x1100; - break; - case 0x1200: // EDCDIC DBCS - case 0x2200: // ASCII DBCS - db2EncodingScheme = 0x1200; - break; - case 0x1301: // EDCDIC Mixed - case 0x2300: // ASCII Mixed - case 0x4403: // EUC (ISO 2022) - db2EncodingScheme = 0x1301; - break; - case 0x7200: // UCS2 - db2EncodingScheme = 0x7200; - break; - case 0x7807: // UTF-8 - db2EncodingScheme = 0x7807; - break; - case 0x7500: // UTF-32 - db2EncodingScheme = 0x7500; - break; - default: // Unknown - { - getErrTxt(DB2I_ERR_UNKNOWN_ENCODING,aixEncodingScheme); - return DB2I_ERR_UNKNOWN_ENCODING; - } - break; - } - if (aixEncodingScheme == db2EncodingScheme) - { - *db2Ccsid = aixCcsid; - } - else - { - rc = getAssociatedCCSID(aixCcsid, db2EncodingScheme, db2Ccsid); // EDCDIC SBCS - if (rc != 0) - return rc; - } - - return 0; -} - - -/** - Obtain the encoding scheme of a CCSID. - - @param inCcsid An IBM i CCSID - @param[out] outEncodingScheme The associated encoding scheme - - @return 0 if successful. Failure otherwise -*/ -int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme) -{ - DBUG_ENTER("db2i_charsetSupport::getEncodingScheme"); - - static bool ptrInited = FALSE; - static char ptrSpace[sizeof(ILEpointer) + 15]; - static ILEpointer* ptrToPtr = (ILEpointer*)roundToQuadWordBdy(ptrSpace); - int rc; - - if (!ptrInited) - { - rc = _RSLOBJ2(ptrToPtr, RSLOBJ_TS_PGM, "QTQGESP", "QSYS"); - - if (rc) - { - getErrTxt(DB2I_ERR_RESOLVE_OBJ,"QTQGESP","QSYS","*PGM",errno); - DBUG_RETURN(DB2I_ERR_RESOLVE_OBJ); - } - ptrInited = TRUE; - } - - DBUG_ASSERT(inCcsid != 0); - - int GESPCCSID = inCcsid; - int GESPLen = 32; - int GESPNbrVal = 0; - int32 GESPES; - int GESPCSCPL[32]; - int GESPFB[3]; - void* ILEArgv[7]; - ILEArgv[0] = &GESPCCSID; - ILEArgv[1] = &GESPLen; - ILEArgv[2] = &GESPNbrVal; - ILEArgv[3] = &GESPES; - ILEArgv[4] = &GESPCSCPL; - ILEArgv[5] = &GESPFB; - ILEArgv[6] = NULL; - - rc = _PGMCALL(ptrToPtr, (void**)&ILEArgv, 0); - - if (rc) - { - getErrTxt(DB2I_ERR_PGMCALL,"QTQGESP","QSYS",rc); - DBUG_RETURN(DB2I_ERR_PGMCALL); - } - if (GESPFB[0] != 0 || - GESPFB[1] != 0 || - GESPFB[2] != 0) - { - getErrTxt(DB2I_ERR_QTQGESP,GESPFB[0],GESPFB[1],GESPFB[2]); - DBUG_RETURN(DB2I_ERR_QTQGESP); - } - outEncodingScheme = GESPES; - - DBUG_RETURN(0); -} - - -/** - Get the best fit equivalent CCSID. (Wrapper for QTQGRDC API) - - @param inCcsid An IBM i CCSID - @param inEncodingScheme The encoding scheme - @param[out] outCcsid The equivalent CCSID - - @return 0 if successful. Failure otherwise -*/ -int32 getAssociatedCCSID(const uint16 inCcsid, const int inEncodingScheme, uint16* outCcsid) -{ - DBUG_ENTER("db2i_charsetSupport::getAssociatedCCSID"); - static bool ptrInited = FALSE; - static char ptrSpace[sizeof(ILEpointer) + 15]; - static ILEpointer* ptrToPtr = (ILEpointer*)roundToQuadWordBdy(ptrSpace); - int rc; - - // Override non-standard charsets - if ((inCcsid == 923) && (inEncodingScheme == 0x1100)) - { - *outCcsid = 1148; - DBUG_RETURN(0); - } - else if ((inCcsid == 1250) && (inEncodingScheme == 0x1100)) - { - *outCcsid = 1153; - DBUG_RETURN(0); - } - - if (!ptrInited) - { - rc = _RSLOBJ2(ptrToPtr, RSLOBJ_TS_PGM, "QTQGRDC", "QSYS"); - - if (rc) - { - getErrTxt(DB2I_ERR_RESOLVE_OBJ,"QTQGRDC","QSYS","*PGM",errno); - DBUG_RETURN(DB2I_ERR_RESOLVE_OBJ); - } - ptrInited = TRUE; - } - - int GRDCCCSID = inCcsid; - int GRDCES = inEncodingScheme; - int GRDCSel = 0; - int GRDCAssCCSID; - int GRDCFB[3]; - void* ILEArgv[7]; - ILEArgv[0] = &GRDCCCSID; - ILEArgv[1] = &GRDCES; - ILEArgv[2] = &GRDCSel; - ILEArgv[3] = &GRDCAssCCSID; - ILEArgv[4] = &GRDCFB; - ILEArgv[5] = NULL; - - rc = _PGMCALL(ptrToPtr, (void**)&ILEArgv, 0); - - if (rc) - { - getErrTxt(DB2I_ERR_PGMCALL,"QTQGRDC","QSYS",rc); - DBUG_RETURN(DB2I_ERR_PGMCALL); - } - if (GRDCFB[0] != 0 || - GRDCFB[1] != 0 || - GRDCFB[2] != 0) - { - getErrTxt(DB2I_ERR_QTQGRDC,GRDCFB[0],GRDCFB[1],GRDCFB[2]); - DBUG_RETURN(DB2I_ERR_QTQGRDC); - } - - *outCcsid = GRDCAssCCSID; - - DBUG_RETURN(0); -} - -/** - Open an iconv conversion between a MySQL charset and the respective IBM i CCSID - - @param direction The direction of the conversion - @param mysqlCSName Name of the MySQL character set - @param db2CCSID The IBM i CCSID - @param hashKey The key to use for inserting the opened conversion into the cache - @param[out] newConversion The iconv descriptor - - @return 0 if successful. Failure otherwise -*/ -static int32 openNewConversion(enum_conversionDirection direction, - const char* mysqlCSName, - uint16 db2CCSID, - IconvMap::HashKey* hashKey, - iconv_t& newConversion) -{ - DBUG_ENTER("db2i_charsetSupport::openNewConversion"); - - char mysqlAix41Desc[Qlg_MaxDescSize]; - char db2Aix41Desc[Qlg_MaxDescSize]; - char db2CcsidString[6] = ""; - int32 rc; - - /* - First we have to convert the MySQL IANA-like name and the DB2 CCSID into - there equivalent iconv descriptions. - */ - rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc); - if (unlikely(rc)) - { - if (rc == DB2I_ERR_UNSUPP_CHARSET) - getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName); - - DBUG_RETURN(rc); - } - CHARSET_INFO *cs= &my_charset_bin; - (uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID); - rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc); - if (unlikely(rc)) - { - if (rc == DB2I_ERR_UNSUPP_CHARSET) - getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName); - - DBUG_RETURN(rc); - } - - /* Call iconv to open the conversion. */ - if (direction == toDB2) - { - newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc); - } - else - { - newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc); - } - - if (unlikely(newConversion == (iconv_t) -1)) - { - getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName); - DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET); - } - - /* Insert the new conversion into the cache. */ - IconvMap* mapping = (IconvMap*)alloc_root(&iconvMapMemroot, sizeof(IconvMap)); - if (!mapping) - { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(IconvMap)); - DBUG_RETURN( HA_ERR_OUT_OF_MEM); - } - memcpy(&(mapping->hashKey), hashKey, sizeof(mapping->hashKey)); - mapping->iconvDesc = newConversion; - pthread_mutex_lock(&iconvMapHashMutex); - my_hash_insert(&iconvMapHash, (const uchar*)mapping); - pthread_mutex_unlock(&iconvMapHashMutex); - - DBUG_RETURN(0); -} - - -/** - Open an iconv conversion between a MySQL charset and the respective IBM i CCSID - - @param direction The direction of the conversion - @param cs The MySQL character set - @param db2CCSID The IBM i CCSID - @param[out] newConversion The iconv descriptor - - @return 0 if successful. Failure otherwise -*/ -int32 getConversion(enum_conversionDirection direction, const CHARSET_INFO* cs, uint16 db2CCSID, iconv_t& conversion) -{ - DBUG_ENTER("db2i_charsetSupport::getConversion"); - - int32 rc; - - /* Build the hash key */ - IconvMap::HashKey hashKey; - hashKey.direction= direction; - hashKey.myCharset= cs; - hashKey.db2CCSID= db2CCSID; - - /* Look for the conversion in the cache and add it if it is not there. */ - IconvMap *mapping; - if (!(mapping= (IconvMap *) my_hash_search(&iconvMapHash, - (const uchar*)&hashKey, - sizeof(hashKey)))) - { - DBUG_PRINT("getConversion", ("Hash miss for direction=%d, cs=%s, ccsid=%d", direction, cs->name, db2CCSID)); - rc= openNewConversion(direction, cs->csname, db2CCSID, &hashKey, conversion); - if (rc) - DBUG_RETURN(rc); - } - else - { - conversion= mapping->iconvDesc; - } - - DBUG_RETURN(0); -} - -/** - Fast-path conversion from ASCII to EBCDIC for use in converting - identifiers to be sent to the QMY APIs. - - @param input ASCII data - @param[out] ouput EBCDIC data - @param ilen Size of input buffer and output buffer -*/ -int convToEbcdic(const char* input, char* output, size_t ilen) -{ - static bool inited = FALSE; - static iconv_t ic; - - if (ilen == 0) - return 0; - - if (!inited) - { - ic = iconv_open( "IBM-037", "ISO8859-1" ); - inited = TRUE; - } - size_t substitutedChars; - size_t olen = ilen; - if (iconv( ic, (char**)&input, &ilen, &output, &olen, &substitutedChars ) == -1) - return errno; - - return 0; -} - - -/** - Fast-path conversion from EBCDIC to ASCII for use in converting - data received from the QMY APIs. - - @param input EBCDIC data - @param[out] ouput ASCII data - @param ilen Size of input buffer and output buffer -*/ -int convFromEbcdic(const char* input, char* output, size_t ilen) -{ - static bool inited = FALSE; - static iconv_t ic; - - if (ilen == 0) - return 0; - - if (!inited) - { - ic = iconv_open("ISO8859-1", "IBM-037"); - inited = TRUE; - } - - size_t substitutedChars; - size_t olen = ilen; - if (iconv( ic, (char**)&input, &ilen, &output, &olen, &substitutedChars) == -1) - return errno; - - return 0; -} diff --git a/storage/ibmdb2i/db2i_charsetSupport.h b/storage/ibmdb2i/db2i_charsetSupport.h deleted file mode 100644 index 77051e1e0db..00000000000 --- a/storage/ibmdb2i/db2i_charsetSupport.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_CHARSETSUPPORT_H -#define DB2I_CHARSETSUPPORT_H - -#include "db2i_global.h" -#include "mysql_priv.h" -#include <mysql/plugin.h> -#include "db2i_iconv.h" - -/** - @enum enum_conversionDirection - - Conversion directions for getConversion() -*/ -enum enum_conversionDirection -{ - toMySQL, - toDB2 -}; - -int initCharsetSupport(); -void doneCharsetSupport(); -int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid); -int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme); -int32 getAssociatedCCSID(const uint16 inCcsid, const int inEncodingScheme, uint16* outCcsid); -int convToEbcdic(const char* input, char* output, size_t ilen); -int convFromEbcdic(const char* input, char* output, size_t ilen); -int32 getConversion(enum_conversionDirection direction, const CHARSET_INFO* cs, uint16 db2CCSID, iconv_t& conversion); - -#endif diff --git a/storage/ibmdb2i/db2i_collationSupport.cc b/storage/ibmdb2i/db2i_collationSupport.cc deleted file mode 100644 index 65a17fd2452..00000000000 --- a/storage/ibmdb2i/db2i_collationSupport.cc +++ /dev/null @@ -1,355 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "db2i_collationSupport.h" -#include "db2i_errors.h" - - -/* - The following arrays define a mapping between MySQL collation names and - corresponding IBM i sort sequences. The mapping is a 1-to-1 correlation - between corresponding array slots but is incomplete without case-sensitivity - markers dynamically added to the mySqlSortSequence names. -*/ -#define MAX_COLLATION 87 -static const char* mySQLCollation[MAX_COLLATION] = -{ - {"ascii_general"}, - {"ascii"}, - {"big5_chinese"}, - {"big5"}, - {"cp1250_croatian"}, - {"cp1250_general"}, - {"cp1250_polish"}, - {"cp1250"}, - {"cp1251_bulgarian"}, - {"cp1251_general"}, - {"cp1251"}, - {"cp1256_general"}, - {"cp1256"}, - {"cp850_general"}, - {"cp850"}, - {"cp852_general"}, - {"cp852"}, - {"cp932_japanese"}, - {"cp932"}, - {"euckr_korean"}, - {"euckr"}, - {"gb2312_chinese"}, - {"gb2312"}, - {"gbk_chinese"}, - {"gbk"}, - {"greek_general"}, - {"greek"}, - {"hebrew_general"}, - {"hebrew"}, - {"latin1_danish"}, - {"latin1_general"}, - {"latin1_german1"}, - {"latin1_spanish"}, - {"latin1_swedish"}, - {"latin1"}, - {"latin2_croatian"}, - {"latin2_general"}, - {"latin2_hungarian"}, - {"latin2"}, - {"latin5_turkish"}, - {"latin5"}, - {"macce_general"}, - {"macce"}, - {"sjis_japanese"}, - {"sjis"}, - {"tis620_thai"}, - {"tis620"}, - {"ucs2_czech"}, - {"ucs2_danish"}, - {"ucs2_esperanto"}, - {"ucs2_estonian"}, - {"ucs2_general"}, - {"ucs2_hungarian"}, - {"ucs2_icelandic"}, - {"ucs2_latvian"}, - {"ucs2_lithuanian"}, - {"ucs2_persian"}, - {"ucs2_polish"}, - {"ucs2_romanian"}, - {"ucs2_slovak"}, - {"ucs2_slovenian"}, - {"ucs2_spanish"}, - {"ucs2_swedish"}, - {"ucs2_turkish"}, - {"ucs2_unicode"}, - {"ucs2"}, - {"ujis_japanese"}, - {"ujis"}, - {"utf8_czech"}, - {"utf8_danish"}, - {"utf8_esperanto"}, - {"utf8_estonian"}, - {"utf8_general"}, - {"utf8_hungarian"}, - {"utf8_icelandic"}, - {"utf8_latvian"}, - {"utf8_lithuanian"}, - {"utf8_persian"}, - {"utf8_polish"}, - {"utf8_romanian"}, - {"utf8_slovak"}, - {"utf8_slovenian"}, - {"utf8_spanish"}, - {"utf8_swedish"}, - {"utf8_turkish"}, - {"utf8_unicode"}, - {"utf8"} -}; - - -static const char* mySqlSortSequence[MAX_COLLATION] = -{ - {"QALA101F4"}, - {"QBLA101F4"}, - {"QACHT04B0"}, - {"QBCHT04B0"}, - {"QALA20481"}, - {"QCLA20481"}, - {"QDLA20481"}, - {"QELA20481"}, - {"QACYR0401"}, - {"QBCYR0401"}, - {"QCCYR0401"}, - {"QAARA01A4"}, - {"QBARA01A4"}, - {"QCLA101F4"}, - {"QDLA101F4"}, - {"QALA20366"}, - {"QBLA20366"}, - {"QAJPN04B0"}, - {"QBJPN04B0"}, - {"QAKOR04B0"}, - {"QBKOR04B0"}, - {"QACHS04B0"}, - {"QBCHS04B0"}, - {"QCCHS04B0"}, - {"QDCHS04B0"}, - {"QAELL036B"}, - {"QBELL036B"}, - {"QAHEB01A8"}, - {"QBHEB01A8"}, - {"QALA1047C"}, - {"QBLA1047C"}, - {"QCLA1047C"}, - {"QDLA1047C"}, - {"QELA1047C"}, - {"QFLA1047C"}, - {"QCLA20366"}, - {"QELA20366"}, - {"QFLA20366"}, - {"QGLA20366"}, - {"QATRK0402"}, - {"QBTRK0402"}, - {"QHLA20366"}, - {"QILA20366"}, - {"QCJPN04B0"}, - {"QDJPN04B0"}, - {"QATHA0346"}, - {"QBTHA0346"}, - {"ACS_CZ"}, - {"ADA_DK"}, - {"AEO"}, - {"AET"}, - {"QAUCS04B0"}, - {"AHU"}, - {"AIS"}, - {"ALV"}, - {"ALT"}, - {"AFA"}, - {"APL"}, - {"ARO"}, - {"ASK"}, - {"ASL"}, - {"AES"}, - {"ASW"}, - {"ATR"}, - {"AEN"}, - {"*HEX"}, - {"QEJPN04B0"}, - {"QFJPN04B0"}, - {"ACS_CZ"}, - {"ADA_DK"}, - {"AEO"}, - {"AET"}, - {"QAUCS04B0"}, - {"AHU"}, - {"AIS"}, - {"ALV"}, - {"ALT"}, - {"AFA"}, - {"APL"}, - {"ARO"}, - {"ASK"}, - {"ASL"}, - {"AES"}, - {"ASW"}, - {"ATR"}, - {"AEN"}, - {"*HEX"} -}; - - -/** - Get the IBM i sort sequence that corresponds to the given MySQL collation. - - @param fieldCharSet The collated character set - @param[out] rtnSortSequence The corresponding sort sequence - - @return 0 if successful. Failure otherwise -*/ -static int32 getAssociatedSortSequence(const CHARSET_INFO *fieldCharSet, const char** rtnSortSequence) -{ - DBUG_ENTER("ha_ibmdb2i::getAssociatedSortSequence"); - - if (strcmp(fieldCharSet->csname,"binary") != 0) - { - int collationSearchLen = strlen(fieldCharSet->name); - if (fieldCharSet->state & MY_CS_BINSORT) - collationSearchLen -= 4; - else - collationSearchLen -= 3; - - uint16 loopCnt = 0; - for (loopCnt; loopCnt < MAX_COLLATION; ++loopCnt) - { - if ((strlen(mySQLCollation[loopCnt]) == collationSearchLen) && - (strncmp((char*)mySQLCollation[loopCnt], fieldCharSet->name, collationSearchLen) == 0)) - break; - } - if (loopCnt == MAX_COLLATION) // Did not find associated sort sequence - { - getErrTxt(DB2I_ERR_SRTSEQ); - DBUG_RETURN(DB2I_ERR_SRTSEQ); - } - *rtnSortSequence = mySqlSortSequence[loopCnt]; - } - - DBUG_RETURN(0); -} - - -/** - Update sort sequence information for a key. - - This function accumulates information about a key as it is called for each - field composing the key. The caller should invoke the function for each field - and (with the exception of the charset parm) preserve the values for the - parms across invocations, until a particular key has been evaluated. Once - the last field in the key has been evaluated, the fileSortSequence and - fileSortSequenceLibrary parms will contain the correct information for - creating the corresponding DB2 key. - - @param charset The character set under consideration - @param[in, out] fileSortSequenceType The type of the current key's sort seq - @param[in, out] fileSortSequence The IBM i identifier for the DB2 sort sequence - that corresponds - - @return 0 if successful. Failure otherwise -*/ -int32 updateAssociatedSortSequence(const CHARSET_INFO* charset, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary) -{ - DBUG_ENTER("ha_ibmdb2i::updateAssociatedSortSequence"); - DBUG_ASSERT(charset); - if (strcmp(charset->csname,"binary") != 0) - { - char newSortSequence[11] = ""; - char newSortSequenceType = ' '; - const char* foundSortSequence; - int rc = getAssociatedSortSequence(charset, &foundSortSequence); - if (rc) DBUG_RETURN (rc); - switch(foundSortSequence[0]) - { - case '*': // Binary - strcat(newSortSequence,foundSortSequence); - newSortSequenceType = 'B'; - break; - case 'Q': // Non-ICU sort sequence - strcat(newSortSequence,foundSortSequence); - if ((charset->state & MY_CS_BINSORT) != 0) - { - strcat(newSortSequence,"U"); - } - else if ((charset->state & MY_CS_CSSORT) != 0) - { - strcat(newSortSequence,"U"); - } - else - { - strcat(newSortSequence,"S"); - } - newSortSequenceType = 'N'; - break; - default: // ICU sort sequence - { - if ((charset->state & MY_CS_CSSORT) == 0) - { - if (osVersion.v >= 6) - strcat(newSortSequence,"I34"); // ICU 3.4 - else - strcat(newSortSequence,"I26"); // ICU 2.6.1 - } - strcat(newSortSequence,foundSortSequence); - newSortSequenceType = 'I'; - } - break; - } - if (*fileSortSequenceType == ' ') // If no sort sequence has been set yet - { - // Set associated sort sequence - strcpy(fileSortSequence,newSortSequence); - strcpy(fileSortSequenceLibrary,"QSYS"); - *fileSortSequenceType = newSortSequenceType; - } - else if (strcmp(fileSortSequence,newSortSequence) != 0) - { - // Only one sort sequence/collation is supported for each DB2 index. - getErrTxt(DB2I_ERR_MIXED_COLLATIONS); - DBUG_RETURN(DB2I_ERR_MIXED_COLLATIONS); - } - } - - DBUG_RETURN(0); -} diff --git a/storage/ibmdb2i/db2i_collationSupport.h b/storage/ibmdb2i/db2i_collationSupport.h deleted file mode 100644 index b2ce09de1ea..00000000000 --- a/storage/ibmdb2i/db2i_collationSupport.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_COLLATIONSUPPORT_H -#define DB2I_COLLATIONSUPPORT_H - -#include "db2i_global.h" -#include "mysql_priv.h" - -int32 updateAssociatedSortSequence(const CHARSET_INFO* charset, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary); - -#endif diff --git a/storage/ibmdb2i/db2i_constraints.cc b/storage/ibmdb2i/db2i_constraints.cc deleted file mode 100644 index 5b9d3600393..00000000000 --- a/storage/ibmdb2i/db2i_constraints.cc +++ /dev/null @@ -1,672 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#include "ha_ibmdb2i.h" -#include "db2i_safeString.h" - -// This function is called when building the CREATE TABLE information for -// foreign key constraints. It converts a constraint, table, schema, or -// field name from EBCDIC to ASCII. If the DB2 name is quoted, it removes -// those quotes. It then adds the appropriate quotes for a MySQL identifier. - -static void convNameForCreateInfo(THD *thd, SafeString& info, char* fromName, int len) -{ - int quote; - char cquote; // Quote character - char convName[MAX_DB2_FILENAME_LENGTH]; // Converted name - - memset(convName, 0, sizeof(convName)); - convFromEbcdic(fromName, convName, len); - quote = get_quote_char_for_identifier(thd, convName, len); - cquote = (char) quote; - if (quote != EOF) - info.strcat(cquote); - if (convName[0] == '"') // If DB2 name was quoted, remove quotes - { - if (strstr(convName, "\"\"")) - stripExtraQuotes(convName+1, len-1); - info.strncat((char*)(convName+1), len-2); - } - else // DB2 name was not quoted - info.strncat(convName, len); - if (quote != EOF) - info.strcat(cquote); -} - -/** - Evaluate the parse tree to build foreign key constraint clauses - - @parm lex The parse tree - @parm appendHere The DB2 string to receive the constraint clauses - @parm path The path to the table under consideration - @parm fields Pointer to the table's list of field pointers - @parm[in, out] fileSortSequenceType The sort sequence type associated with the table - @parm[in, out] fileSortSequence The sort sequence associated with the table - @parm[in, out] fileSortSequenceLibrary The sort sequence library associated with the table - - @return 0 if successful; HA_ERR_CANNOT_ADD_FOREIGN otherwise -*/ -int ha_ibmdb2i::buildDB2ConstraintString(LEX* lex, - String& appendHere, - const char* path, - Field** fields, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary) -{ - List_iterator<Key> keyIter(lex->alter_info.key_list); - char colName[MAX_DB2_COLNAME_LENGTH+1]; - - Key* curKey; - - while (curKey = keyIter++) - { - if (curKey->type == Key::FOREIGN_KEY) - { - appendHere.append(STRING_WITH_LEN(", ")); - - Foreign_key* fk = (Foreign_key*)curKey; - - char db2LibName[MAX_DB2_SCHEMANAME_LENGTH+1]; - if (fk->name.str) - { - char db2FKName[MAX_DB2_FILENAME_LENGTH+1]; - appendHere.append(STRING_WITH_LEN("CONSTRAINT ")); - if (fk->ref_table->db.str) - { - convertMySQLNameToDB2Name(fk->ref_table->db.str, db2LibName, sizeof(db2LibName)); - } - else - { - db2i_table::getDB2LibNameFromPath(path, db2LibName); - } - if (lower_case_table_names == 1) - my_casedn_str(files_charset_info, db2LibName); - appendHere.append(db2LibName); - - appendHere.append('.'); - - convertMySQLNameToDB2Name(fk->name.str, db2FKName, sizeof(db2FKName)); - appendHere.append(db2FKName); - } - - appendHere.append(STRING_WITH_LEN(" FOREIGN KEY (")); - - bool firstTime = true; - - List_iterator<Key_part_spec> column(fk->columns); - Key_part_spec* curColumn; - - while (curColumn = column++) - { - if (!firstTime) - { - appendHere.append(','); - } - firstTime = false; - - convertMySQLNameToDB2Name(curColumn->field_name.str, colName, sizeof(colName)); - appendHere.append(colName); - - // DB2 requires that the sort sequence on the child table match the parent table's - // sort sequence. We ensure that happens by updating the sort sequence according - // to the constrained fields. - Field** field = fields; - do - { - if (strcmp((*field)->field_name, curColumn->field_name.str) == 0) - { - int rc = updateAssociatedSortSequence((*field)->charset(), - fileSortSequenceType, - fileSortSequence, - fileSortSequenceLibrary); - - if (unlikely(rc)) return rc; - } - } while (*(++field)); - } - - firstTime = true; - - appendHere.append(STRING_WITH_LEN(") REFERENCES ")); - - if (fk->ref_table->db.str) - { - convertMySQLNameToDB2Name(fk->ref_table->db.str, db2LibName, sizeof(db2LibName)); - } - else - { - db2i_table::getDB2LibNameFromPath(path, db2LibName); - } - if (lower_case_table_names == 1) - my_casedn_str(files_charset_info, db2LibName); - appendHere.append(db2LibName); - appendHere.append('.'); - - char db2FileName[MAX_DB2_FILENAME_LENGTH+1]; - convertMySQLNameToDB2Name(fk->ref_table->table.str, db2FileName, sizeof(db2FileName)); - if (lower_case_table_names) - my_casedn_str(files_charset_info, db2FileName); - appendHere.append(db2FileName); - - - if (!fk->ref_columns.is_empty()) - { - List_iterator<Key_part_spec> ref(fk->ref_columns); - Key_part_spec* curRef; - appendHere.append(STRING_WITH_LEN(" (")); - - - while (curRef = ref++) - { - if (!firstTime) - { - appendHere.append(','); - } - firstTime = false; - - convertMySQLNameToDB2Name(curRef->field_name.str, colName, sizeof(colName)); - appendHere.append(colName); - } - - appendHere.append(STRING_WITH_LEN(") ")); - } - - if (fk->delete_opt != Foreign_key::FK_OPTION_UNDEF) - { - appendHere.append(STRING_WITH_LEN("ON DELETE ")); - switch (fk->delete_opt) - { - case Foreign_key::FK_OPTION_RESTRICT: - appendHere.append(STRING_WITH_LEN("RESTRICT ")); break; - case Foreign_key::FK_OPTION_CASCADE: - appendHere.append(STRING_WITH_LEN("CASCADE ")); break; - case Foreign_key::FK_OPTION_SET_NULL: - appendHere.append(STRING_WITH_LEN("SET NULL ")); break; - case Foreign_key::FK_OPTION_NO_ACTION: - appendHere.append(STRING_WITH_LEN("NO ACTION ")); break; - case Foreign_key::FK_OPTION_DEFAULT: - appendHere.append(STRING_WITH_LEN("SET DEFAULT ")); break; - default: - return HA_ERR_CANNOT_ADD_FOREIGN; break; - } - } - - if (fk->update_opt != Foreign_key::FK_OPTION_UNDEF) - { - appendHere.append(STRING_WITH_LEN("ON UPDATE ")); - switch (fk->update_opt) - { - case Foreign_key::FK_OPTION_RESTRICT: - appendHere.append(STRING_WITH_LEN("RESTRICT ")); break; - case Foreign_key::FK_OPTION_NO_ACTION: - appendHere.append(STRING_WITH_LEN("NO ACTION ")); break; - default: - return HA_ERR_CANNOT_ADD_FOREIGN; break; - } - } - - } - - } - - return 0; -} - - -/*********************************************************************** -Get the foreign key information in the form of a character string so -that it can be inserted into a CREATE TABLE statement. This is used by -the SHOW CREATE TABLE statement. The string will later be freed by the -free_foreign_key_create_info() method. -************************************************************************/ - -char* ha_ibmdb2i::get_foreign_key_create_info(void) -{ - DBUG_ENTER("ha_ibmdb2i::get_foreign_key_create_info"); - int rc = 0; - char* infoBuffer = NULL; // Pointer to string returned to MySQL - uint32 constraintSpaceLength;// Length of space passed to DB2 - ValidatedPointer<char> constraintSpace; // Space pointer passed to DB2 - uint32 neededLen; // Length returned from DB2 - uint32 cstCnt; // Number of foreign key constraints from DB2 - uint32 fld; // - constraint_hdr* cstHdr; // Pointer to constraint header structure - FK_constraint* FKCstDef; // Pointer to constraint definition structure - cst_name* fieldName; // Pointer to field name structure - char* tempPtr; // Temp pointer for traversing constraint space - char convName[128]; - - /* Allocate space to retrieve the DB2 constraint information. */ - - if (!(share = get_share(table_share->path.str, table))) - DBUG_RETURN(NULL); - - constraintSpaceLength = 5000; // Try allocating 5000 bytes and see if enough. - - initBridge(); - - constraintSpace.alloc(constraintSpaceLength); - rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE) - ->constraints(db2Table->dataFile()->getMasterDefnHandle(), - constraintSpace, - constraintSpaceLength, - &neededLen, - &cstCnt); - - if (unlikely(rc == QMY_ERR_NEED_MORE_SPACE)) - { - constraintSpaceLength = neededLen; // Get length of space that's needed - constraintSpace.realloc(constraintSpaceLength); - rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE) - ->constraints(db2Table->dataFile()->getMasterDefnHandle(), - constraintSpace, - constraintSpaceLength, - &neededLen, - &cstCnt); - } - - /* If constraint information was returned by DB2, build a text string */ - /* to return to MySQL. */ - - if ((rc == 0) && (cstCnt > 0)) - { - THD* thd = ha_thd(); - infoBuffer = (char*) my_malloc(MAX_FOREIGN_LEN + 1, MYF(MY_WME)); - if (infoBuffer == NULL) - { - free_share(share); - DBUG_RETURN(NULL); - } - - SafeString info(infoBuffer, MAX_FOREIGN_LEN + 1); - - /* Loop through the DB2 constraints and build a text string for each foreign */ - /* key constraint that is found. */ - - tempPtr = constraintSpace; - cstHdr = (constraint_hdr_t*)(void*)constraintSpace; // Address first constraint definition - for (int i = 0; i < cstCnt && !info.overflowed(); ++i) - { - if (cstHdr->CstType[0] == QMY_CST_FK) // If this is a foreign key constraint - { - tempPtr = (char*)(tempPtr + cstHdr->CstDefOff); - FKCstDef = (FK_constraint_t*)tempPtr; - - /* Process the constraint name. */ - - info.strncat(STRING_WITH_LEN(",\n CONSTRAINT ")); - convNameForCreateInfo(thd, info, - FKCstDef->CstName.Name, FKCstDef->CstName.Len); - - /* Process the names of the foreign keys. */ - - info.strncat(STRING_WITH_LEN(" FOREIGN KEY (")); - tempPtr = (char*)(tempPtr + FKCstDef->KeyColOff); - fieldName= (cst_name_t*)tempPtr; - for (fld = 0; fld < FKCstDef->KeyCnt; ++fld) - { - convNameForCreateInfo(thd, info, fieldName->Name, fieldName->Len); - if ((fld + 1) < FKCstDef->KeyCnt) - { - info.strncat(STRING_WITH_LEN(", ")); - fieldName = fieldName + 1; - } - } - - /* Process the schema-name and name of the referenced table. */ - - info.strncat(STRING_WITH_LEN(") REFERENCES ")); - convNameForCreateInfo(thd, info, - FKCstDef->RefSchema.Name, FKCstDef->RefSchema.Len); - info.strcat('.'); - convNameForCreateInfo(thd, info, - FKCstDef->RefTable.Name, FKCstDef->RefTable.Len); - info.strncat(STRING_WITH_LEN(" (")); - - /* Process the names of the referenced keys. */ - - tempPtr = (char*)FKCstDef; - tempPtr = (char*)(tempPtr + FKCstDef->RefColOff); - fieldName= (cst_name_t*)tempPtr; - for (fld = 0; fld < FKCstDef->RefCnt; ++fld) - { - convNameForCreateInfo(thd, info, fieldName->Name, fieldName->Len); - if ((fld + 1) < FKCstDef->RefCnt) - { - info.strncat(STRING_WITH_LEN(", ")); - fieldName = fieldName + 1; - } - } - - /* Process the ON UPDATE and ON DELETE rules. */ - - info.strncat(STRING_WITH_LEN(") ON UPDATE ")); - switch(FKCstDef->UpdMethod) - { - case QMY_NOACTION: info.strncat(STRING_WITH_LEN("NO ACTION")); break; - case QMY_RESTRICT: info.strncat(STRING_WITH_LEN("RESTRICT")); break; - default: break; - } - info.strncat(STRING_WITH_LEN(" ON DELETE ")); - switch(FKCstDef->DltMethod) - { - case QMY_CASCADE: info.strncat(STRING_WITH_LEN("CASCADE")); break; - case QMY_SETDFT: info.strncat(STRING_WITH_LEN("SET DEFAULT")); break; - case QMY_SETNULL: info.strncat(STRING_WITH_LEN("SET NULL")); break; - case QMY_NOACTION: info.strncat(STRING_WITH_LEN("NO ACTION")); break; - case QMY_RESTRICT: info.strncat(STRING_WITH_LEN("RESTRICT")); break; - default: break; - } - } - - /* Address the next constraint, if any. */ - - if ((i+1) < cstCnt) - { - tempPtr = (char*)cstHdr + cstHdr->CstLen; - cstHdr = (constraint_hdr_t*)(tempPtr); - } - } - } - - /* Cleanup and return */ - free_share(share); - - DBUG_RETURN(infoBuffer); -} - -/*********************************************************************** -Free the foreign key create info (for a table) that was acquired by the -get_foreign_key_create_info() method. -***********************************************************************/ - -void ha_ibmdb2i::free_foreign_key_create_info(char* info) -{ - DBUG_ENTER("ha_ibmdb2i::free_foreign_key_create_info"); - - if (info) - { - my_free(info); - } - DBUG_VOID_RETURN; -} - -/*********************************************************************** -This method returns to MySQL a list, with one entry in the list describing -each foreign key constraint. -***********************************************************************/ - -int ha_ibmdb2i::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) -{ - DBUG_ENTER("ha_ibmdb2i::get_foreign_key_list"); - int rc = 0; - uint32 constraintSpaceLength; // Length of space passed to DB2 - ValidatedPointer<char> constraintSpace; // Space pointer passed to DB2 - uint16 rtnCode; // Return code from DB2 - uint32 neededLen; // Bytes needed to contain DB2 constraint info - uint32 cstCnt; // Number of constraints returned by DB2 - uint32 fld; - constraint_hdr* cstHdr; // Pointer to a cst header structure - FK_constraint* FKCstDef; // Pointer to definition of foreign key constraint - cst_name* fieldName; // Pointer to field name structure - const char *method; - ulong methodLen; - char* tempPtr; // Temp pointer for traversing constraint space - char convName[128]; - - if (!(share = get_share(table_share->path.str, table))) - DBUG_RETURN(0); - - // Allocate space to retrieve the DB2 constraint information. - constraintSpaceLength = 5000; // Try allocating 5000 bytes and see if enough. - - constraintSpace.alloc(constraintSpaceLength); - rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE) - ->constraints(db2Table->dataFile()->getMasterDefnHandle(), - constraintSpace, - constraintSpaceLength, - &neededLen, - &cstCnt); - - if (unlikely(rc == QMY_ERR_NEED_MORE_SPACE)) - { - constraintSpaceLength = neededLen; // Get length of space that's needed - constraintSpace.realloc(constraintSpaceLength); - rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE) - ->constraints(db2Table->dataFile()->getMasterDefnHandle(), - constraintSpace, - constraintSpaceLength, - &neededLen, - &cstCnt); - } - - /* If constraint information was returned by DB2, build a text string */ - /* to return to MySQL. */ - if ((rc == 0) && (cstCnt > 0)) - { - tempPtr = constraintSpace; - cstHdr = (constraint_hdr_t*)(void*)constraintSpace; // Address first constraint definition - for (int i = 0; i < cstCnt; ++i) - { - if (cstHdr->CstType[0] == QMY_CST_FK) // If this is a foreign key constraint - { - FOREIGN_KEY_INFO f_key_info; - LEX_STRING *name= 0; - tempPtr = (char*)(tempPtr + cstHdr->CstDefOff); - FKCstDef = (FK_constraint_t*)tempPtr; - - /* Process the constraint name. */ - - convFromEbcdic(FKCstDef->CstName.Name, convName,FKCstDef->CstName.Len); - if (convName[0] == '"') // If quoted, exclude quotes. - f_key_info.foreign_id = thd_make_lex_string(thd, 0, - convName + 1, (uint) (FKCstDef->CstName.Len - 2), 1); - else // Not quoted - f_key_info.foreign_id = thd_make_lex_string(thd, 0, - convName, (uint) FKCstDef->CstName.Len, 1); - - /* Process the names of the foreign keys. */ - - - tempPtr = (char*)(tempPtr + FKCstDef->KeyColOff); - fieldName = (cst_name_t*)tempPtr; - for (fld = 0; fld < FKCstDef->KeyCnt; ++fld) - { - convFromEbcdic(fieldName->Name, convName, fieldName->Len); - if (convName[0] == '"') // If quoted, exclude quotes. - name = thd_make_lex_string(thd, name, - convName + 1, (uint) (fieldName->Len - 2), 1); - else - name = thd_make_lex_string(thd, name, convName, (uint) fieldName->Len, 1); - f_key_info.foreign_fields.push_back(name); - if ((fld + 1) < FKCstDef->KeyCnt) - fieldName = fieldName + 1; - } - - /* Process the schema and name of the referenced table. */ - - convFromEbcdic(FKCstDef->RefSchema.Name, convName, FKCstDef->RefSchema.Len); - if (convName[0] == '"') // If quoted, exclude quotes. - f_key_info.referenced_db = thd_make_lex_string(thd, 0, - convName + 1, (uint) (FKCstDef->RefSchema.Len -2), 1); - else - f_key_info.referenced_db = thd_make_lex_string(thd, 0, - convName, (uint) FKCstDef->RefSchema.Len, 1); - convFromEbcdic(FKCstDef->RefTable.Name, convName, FKCstDef->RefTable.Len); - if (convName[0] == '"') // If quoted, exclude quotes. - f_key_info.referenced_table = thd_make_lex_string(thd, 0, - convName +1, (uint) (FKCstDef->RefTable.Len -2), 1); - else - f_key_info.referenced_table = thd_make_lex_string(thd, 0, - convName, (uint) FKCstDef->RefTable.Len, 1); - - /* Process the names of the referenced keys. */ - - tempPtr = (char*)FKCstDef; - tempPtr = (char*)(tempPtr + FKCstDef->RefColOff); - fieldName= (cst_name_t*)tempPtr; - for (fld = 0; fld < FKCstDef->RefCnt; ++fld) - { - convFromEbcdic(fieldName->Name, convName, fieldName->Len); - if (convName[0] == '"') // If quoted, exclude quotes. - name = thd_make_lex_string(thd, name, - convName + 1, (uint) (fieldName->Len -2), 1); - else - name = thd_make_lex_string(thd, name, convName, (uint) fieldName->Len, 1); - f_key_info.referenced_fields.push_back(name); - if ((fld + 1) < FKCstDef->RefCnt) - fieldName = fieldName + 1; - } - - /* Process the ON UPDATE and ON DELETE rules. */ - - switch(FKCstDef->UpdMethod) - { - case QMY_NOACTION: - { - method = "NO ACTION"; - methodLen=9; - } - break; - case QMY_RESTRICT: - { - method = "RESTRICT"; - methodLen = 8; - } - break; - default: break; - } - f_key_info.update_method = thd_make_lex_string( - thd, f_key_info.update_method, method, methodLen, 1); - switch(FKCstDef->DltMethod) - { - case QMY_CASCADE: - { - method = "CASCADE"; - methodLen = 7; - } - break; - case QMY_SETDFT: - { - method = "SET DEFAULT"; - methodLen = 11; - } - break; - case QMY_SETNULL: - { - method = "SET NULL"; - methodLen = 8; - } - break; - case QMY_NOACTION: - { - method = "NO ACTION"; - methodLen = 9; - } - break; - case QMY_RESTRICT: - { - method = "RESTRICT"; - methodLen = 8; - } - break; - default: break; - } - f_key_info.delete_method = thd_make_lex_string( - thd, f_key_info.delete_method, method, methodLen, 1); - f_key_info.referenced_key_name= thd_make_lex_string(thd, 0, (char *)"", 1, 1); - FOREIGN_KEY_INFO *pf_key_info = (FOREIGN_KEY_INFO *) - thd_memdup(thd, &f_key_info, sizeof(FOREIGN_KEY_INFO)); - f_key_list->push_back(pf_key_info); - } - - /* Address the next constraint, if any. */ - - if ((i+1) < cstCnt) - { - tempPtr = (char*)cstHdr + cstHdr->CstLen; - cstHdr = (constraint_hdr_t*)(tempPtr); - } - } - } - - /* Cleanup and return. */ - - free_share(share); - DBUG_RETURN(0); -} - -/*********************************************************************** -Checks if the table is referenced by a foreign key. -Returns: 0 if not referenced (or error occurs), - > 0 if is referenced -***********************************************************************/ - -uint ha_ibmdb2i::referenced_by_foreign_key(void) -{ - DBUG_ENTER("ha_ibmdb2i::referenced_by_foreign_key"); - - int rc = 0; - FILE_HANDLE queryFile = 0; - uint32 resultRowLen; - uint32 count = 0; - - const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL); - const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL); - - String query(128); - query.append(STRING_WITH_LEN(" SELECT COUNT(*) FROM SYSIBM.SQLFOREIGNKEYS WHERE PKTABLE_SCHEM = '")); - query.append(libName+1, strlen(libName)-2); // parent library name - query.append(STRING_WITH_LEN("' AND PKTABLE_NAME = '")); - query.append(fileName+1, strlen(fileName)-2); // parent file name - query.append(STRING_WITH_LEN("'")); - - SqlStatementStream sqlStream(query); - - rc = bridge()->prepOpen(sqlStream.getPtrToData(), - &queryFile, - &resultRowLen); - if (rc == 0) - { - IOReadBuffer rowBuffer(1, resultRowLen); - rc = bridge()->read(queryFile, rowBuffer.ptr(), QMY_READ_ONLY, QMY_NONE, QMY_FIRST); - if (!rc) count = *((uint32*)rowBuffer.getRowN(0)); - bridge()->deallocateFile(queryFile); - } - DBUG_RETURN(count); -} diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc deleted file mode 100644 index 71a30802bf9..00000000000 --- a/storage/ibmdb2i/db2i_conversion.cc +++ /dev/null @@ -1,1459 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#include "db2i_ileBridge.h" -#include "mysql_priv.h" -#include "db2i_charsetSupport.h" -#include "ctype.h" -#include "ha_ibmdb2i.h" -#include "db2i_errors.h" -#include "wchar.h" - -const char ZERO_DATETIME_VALUE[] = "0000-00-00 00:00:00"; -const char ZERO_DATETIME_VALUE_SUBST[] = "0001-01-01 00:00:00"; -const char ZERO_DATE_VALUE[] = "0000-00-00"; -const char ZERO_DATE_VALUE_SUBST[] = "0001-01-01"; - - -/** - Put a BCD digit into a BCD string. - - @param[out] bcdString The BCD string to be modified - @param pos The position within the string to be updated. - @param val The value to be assigned into the string at pos. -*/ -static inline void bcdAssign(char* bcdString, uint pos, uint val) -{ - bcdString[pos/2] |= val << ((pos % 2) ? 0 : 4); -} - -/** - Read a BCD digit from a BCD string. - - @param[out] bcdString The BCD string to be read - @param pos The position within the string to be read. - - @return bcdGet The value of the BCD digit at pos. -*/ -static inline uint bcdGet(const char* bcdString, uint pos) -{ - return (bcdString[pos/2] >> ((pos % 2) ? 0 : 4)) & 0xf; -} - -/** - In-place convert a number in ASCII represenation to EBCDIC representation. - - @param string The string of ASCII characters - @param len The length of string -*/ -static inline void convertNumericToEbcdicFast(char* string, int len) -{ - for (int i = 0; i < len; ++i, ++string) - { - switch(*string) - { - case '-': - *string = 0x60; break; - case ':': - *string = 0x7A; break; - case '.': - *string = 0x4B; break; - default: - DBUG_ASSERT(isdigit(*string)); - *string += 0xF0 - '0'; - break; - } - } -} - - -/** - atoi()-like function for a 4-character EBCDIC string. - - @param string The EBCDIC string - @return a4toi_ebcdic The decimal value of the EBCDIC string -*/ -static inline uint16 a4toi_ebcdic(const uchar* string) -{ - return ((string[0]-0xF0) * 1000 + - (string[1]-0xF0) * 100 + - (string[2]-0xF0) * 10 + - (string[3]-0xF0)); -}; - - -/** - atoi()-like function for a 4-character EBCDIC string. - - @param string The EBCDIC string - @return a4toi_ebcdic The decimal value of the EBCDIC string -*/ -static inline uint8 a2toi_ebcdic(const uchar* string) -{ - return ((string[0]-0xF0) * 10 + - (string[1]-0xF0)); -}; - -/** - Perform character conversion for textual field data. -*/ -int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction, - uint16 fieldID, - const char* input, - char* output, - size_t ilen, - size_t olen, - size_t* outDataLen, - bool tacitErrors, - size_t* substChars) -{ - DBUG_PRINT("ha_ibmdb2i::convertFieldChars",("Direction: %d; length = %d", direction, ilen)); - - if (unlikely(ilen == 0)) - { - if (outDataLen) *outDataLen = 0; - return (0); - } - - iconv_t& conversion = db2Table->getConversionDefinition(direction, fieldID); - - if (unlikely(conversion == (iconv_t)(-1))) - { - return (DB2I_ERR_UNSUPP_CHARSET); - } - - size_t initOLen= olen; - size_t substitutedChars = 0; - int rc = iconv(conversion, (char**)&input, &ilen, &output, &olen, &substitutedChars ); - if (outDataLen) *outDataLen = initOLen - olen; - if (substChars) *substChars = substitutedChars; - if (unlikely(rc < 0)) - { - int er = errno; - if (er == EILSEQ) - { - if (!tacitErrors) getErrTxt(DB2I_ERR_ILL_CHAR, table->field[fieldID]->field_name); - return (DB2I_ERR_ILL_CHAR); - } - else - { - if (!tacitErrors) getErrTxt(DB2I_ERR_ICONV,er); - return (DB2I_ERR_ICONV); - } - } - if (unlikely(substitutedChars) && (!tacitErrors)) - { - warning(ha_thd(), DB2I_ERR_SUB_CHARS, table->field[fieldID]->field_name); - } - - return (0); -} - -/** - Append the appropriate default value clause onto a CREATE TABLE definition - - This was inspired by get_field_default_value in sql/sql_show.cc. - - @param field The field whose value is to be obtained - @param statement The string to receive the DEFAULT clause - @param quoteIt Does the data type require single quotes around the value? - @param ccsid The ccsid of the field value (if a string type); 0 if no conversion needed -*/ -static void get_field_default_value(Field *field, - String &statement, - bool quoteIt, - uint32 ccsid, - bool substituteZeroDates) -{ - if ((field->type() != FIELD_TYPE_BLOB && - !(field->flags & NO_DEFAULT_VALUE_FLAG) && - field->unireg_check != Field::NEXT_NUMBER)) - { - my_ptrdiff_t old_ptr= (my_ptrdiff_t) (field->table->s->default_values - field->table->record[0]); - field->move_field_offset(old_ptr); - - String defaultClause(64); - defaultClause.length(0); - defaultClause.append(" DEFAULT "); - if (!field->is_null()) - { - my_bitmap_map *old_map = tmp_use_all_columns(field->table, field->table->read_set); - char tmp[MAX_FIELD_WIDTH]; - - if (field->real_type() == MYSQL_TYPE_ENUM || - field->real_type() == MYSQL_TYPE_SET) - { - CHARSET_INFO *cs= &my_charset_bin; - uint len = (uint)(cs->cset->longlong10_to_str)(cs,tmp,sizeof(tmp), 10, field->val_int()); - tmp[len]=0; - defaultClause.append(tmp); - } - else - { - String type(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); - if (type.length()) - { - if (field->type() == MYSQL_TYPE_DATE && - memcmp(type.ptr(), STRING_WITH_LEN(ZERO_DATE_VALUE)) == 0) - { - if (substituteZeroDates) - type.set(STRING_WITH_LEN(ZERO_DATE_VALUE_SUBST), field->charset()); - else - { - warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - return; - } - } - else if ((field->type() == MYSQL_TYPE_DATETIME || - field->type() == MYSQL_TYPE_TIMESTAMP) && - memcmp(type.ptr(), STRING_WITH_LEN(ZERO_DATETIME_VALUE)) == 0) - { - if (substituteZeroDates) - type.set(STRING_WITH_LEN(ZERO_DATETIME_VALUE_SUBST), field->charset()); - else - { - warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - return; - } - } - - - if (field->type() != MYSQL_TYPE_STRING && - field->type() != MYSQL_TYPE_VARCHAR && - field->type() != MYSQL_TYPE_BLOB && - field->type() != MYSQL_TYPE_BIT) - { - if (quoteIt) - defaultClause.append('\''); - defaultClause.append(type); - if (quoteIt) - defaultClause.append('\''); - } - else - { - int length; - char* out; - - // If a ccsid is specified, we need to make sure that the DEFAULT - // string is converted to that encoding. - if (ccsid != 0) - { - iconv_t iconvD; - if (getConversion(toDB2, field->charset(), ccsid, iconvD)) - { - warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - return; - } - - size_t ilen = type.length(); - size_t olen = 6 * ilen; - size_t origOlen = olen; - const char* in = type.ptr(); - const char* tempIn = in; - out = (char*)my_malloc(olen, MYF(MY_WME)); - char* tempOut = out; - size_t substitutedChars; - - if (iconv(iconvD, (char**)&tempIn, &ilen, &tempOut, &olen, &substitutedChars) < 0) - { - warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out); - return; - } - // Now we process the converted string to represent it as - // hexadecimal values. - - length = origOlen - olen; - } - else - { - length = type.length(); - out = (char*)my_malloc(length*2, MYF(MY_WME)); - memcpy(out, (char*)type.ptr(), length); - } - - if (length > 16370) - { - warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out); - return; - } - - if (ccsid == 1200) - defaultClause.append("ux'"); - else if (ccsid == 13488) - defaultClause.append("gx'"); - else if (field->charset() == &my_charset_bin) - defaultClause.append("binary(x'"); - else - defaultClause.append("x'"); - - const char hexMap[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; - for (int c = length-1; c >= 0; --c) - { - out[c*2+1] = hexMap[out[c] & 0xF]; - out[c*2] = hexMap[out[c] >> 4]; - } - - defaultClause.append(out, length*2); - defaultClause.append('\''); - if (field->charset() == &my_charset_bin) - defaultClause.append(")"); - - my_free(out); - } - } - else - defaultClause.length(0); - } - tmp_restore_column_map(field->table->read_set, old_map); - } - else if (field->maybe_null()) - defaultClause.append(STRING_WITH_LEN("NULL")); - - if (old_ptr) - field->move_field_offset(-old_ptr); - - statement.append(defaultClause); - } -} - - - - -/** - Convert a MySQL field definition into its corresponding DB2 type. - - The result will be appended to mapping as a DB2 SQL phrase. - - @param field The MySQL field to be evaluated - @param[out] mapping The receiver for the DB2 SQL syntax - @param timeFormat The format to be used for mapping the TIME type -*/ -int ha_ibmdb2i::getFieldTypeMapping(Field* field, - String& mapping, - enum_TimeFormat timeFormat, - enum_BlobMapping blobMapping, - enum_ZeroDate zeroDateHandling, - bool propagateDefaults, - enum_YearFormat yearFormat) -{ - char stringBuildBuffer[257]; - uint32 fieldLength; - bool defaultNeedsQuotes = false; - uint16 db2Ccsid = 0; - - CHARSET_INFO* fieldCharSet = field->charset(); - switch (field->type()) - { - case MYSQL_TYPE_NEWDECIMAL: - { - uint precision= ((Field_new_decimal*)field)->precision; - uint scale= field->decimals(); - - if (precision <= MAX_DEC_PRECISION) - { - sprintf(stringBuildBuffer,"DECIMAL(%d, %d)",precision,scale); - } - else - { - if (scale > precision - MAX_DEC_PRECISION) - { - scale = scale - (precision - MAX_DEC_PRECISION); - precision = MAX_DEC_PRECISION; - sprintf(stringBuildBuffer,"DECIMAL(%d, %d)",precision,scale); - } - else - { - return HA_ERR_UNSUPPORTED; - } - warning(ha_thd(), DB2I_ERR_PRECISION); - } - - mapping.append(stringBuildBuffer); - } - break; - case MYSQL_TYPE_TINY: - mapping.append(STRING_WITH_LEN("SMALLINT")); - break; - case MYSQL_TYPE_SHORT: - if (((Field_num*)field)->unsigned_flag) - mapping.append(STRING_WITH_LEN("INT")); - else - mapping.append(STRING_WITH_LEN("SMALLINT")); - break; - case MYSQL_TYPE_LONG: - if (((Field_num*)field)->unsigned_flag) - mapping.append(STRING_WITH_LEN("BIGINT")); - else - mapping.append(STRING_WITH_LEN("INT")); - break; - case MYSQL_TYPE_FLOAT: - mapping.append(STRING_WITH_LEN("REAL")); - break; - case MYSQL_TYPE_DOUBLE: - mapping.append(STRING_WITH_LEN("DOUBLE")); - break; - case MYSQL_TYPE_LONGLONG: - if (((Field_num*)field)->unsigned_flag) - mapping.append(STRING_WITH_LEN("DECIMAL(20,0)")); - else - mapping.append(STRING_WITH_LEN("BIGINT")); - break; - case MYSQL_TYPE_INT24: - mapping.append(STRING_WITH_LEN("INTEGER")); - break; - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_NEWDATE: - mapping.append(STRING_WITH_LEN("DATE")); - defaultNeedsQuotes = true; - break; - case MYSQL_TYPE_TIME: - if (timeFormat == TIME_OF_DAY) - { - mapping.append(STRING_WITH_LEN("TIME")); - defaultNeedsQuotes = true; - } - else - mapping.append(STRING_WITH_LEN("INTEGER")); - break; - case MYSQL_TYPE_DATETIME: - mapping.append(STRING_WITH_LEN("TIMESTAMP")); - defaultNeedsQuotes = true; - break; - case MYSQL_TYPE_TIMESTAMP: - mapping.append(STRING_WITH_LEN("TIMESTAMP")); - - if (table_share->timestamp_field == field && propagateDefaults) - { - switch (((Field_timestamp*)field)->get_auto_set_type()) - { - case TIMESTAMP_NO_AUTO_SET: - break; - case TIMESTAMP_AUTO_SET_ON_INSERT: - mapping.append(STRING_WITH_LEN(" DEFAULT CURRENT_TIMESTAMP")); - break; - case TIMESTAMP_AUTO_SET_ON_UPDATE: - if (osVersion.v >= 6 && - !field->is_null()) - { - mapping.append(STRING_WITH_LEN(" GENERATED BY DEFAULT FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP")); - warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name); - } - else - warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name); - break; - case TIMESTAMP_AUTO_SET_ON_BOTH: - if (osVersion.v >= 6 && - !field->is_null()) - mapping.append(STRING_WITH_LEN(" GENERATED BY DEFAULT FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP")); - else - { - mapping.append(STRING_WITH_LEN(" DEFAULT CURRENT_TIMESTAMP")); - warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name); - } - break; - } - } - else - defaultNeedsQuotes = true; - break; - case MYSQL_TYPE_YEAR: - if (yearFormat == CHAR4) - { - mapping.append(STRING_WITH_LEN("CHAR(4) CCSID 1208")); - defaultNeedsQuotes = true; - } - else - { - mapping.append(STRING_WITH_LEN("SMALLINT")); - defaultNeedsQuotes = false; - } - break; - case MYSQL_TYPE_BIT: - sprintf(stringBuildBuffer, "BINARY(%d)", (field->max_display_length() / 8) + 1); - mapping.append(stringBuildBuffer); - break; - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_STRING: - { - if (field->real_type() == MYSQL_TYPE_ENUM || - field->real_type() == MYSQL_TYPE_SET) - { - mapping.append(STRING_WITH_LEN("BIGINT")); - } - else - { - defaultNeedsQuotes = true; - - fieldLength = field->max_display_length(); // Get field byte length - - if (fieldCharSet == &my_charset_bin) - { - if (field->type() == MYSQL_TYPE_STRING) - { - sprintf(stringBuildBuffer, "BINARY(%d)", max(fieldLength, 1)); - } - else - { - if (fieldLength <= MAX_VARCHAR_LENGTH) - { - sprintf(stringBuildBuffer, "VARBINARY(%d)", max(fieldLength, 1)); - } - else if (blobMapping == AS_VARCHAR && - (field->flags & PART_KEY_FLAG)) - { - sprintf(stringBuildBuffer, "LONG VARBINARY "); - } - else - { - fieldLength = min(MAX_BLOB_LENGTH, fieldLength); - sprintf(stringBuildBuffer, "BLOB(%d)", max(fieldLength, 1)); - } - } - mapping.append(stringBuildBuffer); - } - else - { - if (field->type() == MYSQL_TYPE_STRING) - { - if (fieldLength > MAX_CHAR_LENGTH) - return 1; - if (fieldCharSet->mbmaxlen > 1) - { - if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2 - { - sprintf(stringBuildBuffer, "GRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 13488; - } - else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 && - strcmp(fieldCharSet->name, "utf8_general_ci") != 0) - { - sprintf(stringBuildBuffer, "CHAR(%d)", max(fieldLength, 1)); // Number of bytes - db2Ccsid = 1208; - } - else - { - sprintf(stringBuildBuffer, "GRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 1200; - } - } - else - { - sprintf(stringBuildBuffer, "CHAR(%d)", max(fieldLength, 1)); - } - mapping.append(stringBuildBuffer); - } - else - { - if (fieldLength <= MAX_VARCHAR_LENGTH) - { - if (fieldCharSet->mbmaxlen > 1) - { - if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2 - { - sprintf(stringBuildBuffer, "VARGRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 13488; - } - else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 && - strcmp(fieldCharSet->name, "utf8_general_ci") != 0) - { - sprintf(stringBuildBuffer, "VARCHAR(%d)", max(fieldLength, 1)); // Number of bytes - db2Ccsid = 1208; - } - else - { - sprintf(stringBuildBuffer, "VARGRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 1200; - } - } - else - { - sprintf(stringBuildBuffer, "VARCHAR(%d)", max(fieldLength, 1)); - } - } - else if (blobMapping == AS_VARCHAR && - (field->flags & PART_KEY_FLAG)) - { - if (fieldCharSet->mbmaxlen > 1) - { - if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2 - { - sprintf(stringBuildBuffer, "LONG VARGRAPHIC "); - db2Ccsid = 13488; - } - else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 && - strcmp(fieldCharSet->name, "utf8_general_ci") != 0) - { - sprintf(stringBuildBuffer, "LONG VARCHAR "); - db2Ccsid = 1208; - } - else - { - sprintf(stringBuildBuffer, "LONG VARGRAPHIC "); - db2Ccsid = 1200; - } - } - else - { - sprintf(stringBuildBuffer, "LONG VARCHAR "); - } - } - else - { - fieldLength = min(MAX_BLOB_LENGTH, fieldLength); - - if (fieldCharSet->mbmaxlen > 1) - { - if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2 - { - sprintf(stringBuildBuffer, "DBCLOB(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 13488; - } - else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 && - strcmp(fieldCharSet->name, "utf8_general_ci") != 0) - { - sprintf(stringBuildBuffer, "CLOB(%d)", max(fieldLength, 1)); // Number of bytes - db2Ccsid = 1208; - } - else - { - sprintf(stringBuildBuffer, "DBCLOB(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters - db2Ccsid = 1200; - } - } - else - { - sprintf(stringBuildBuffer, "CLOB(%d)", max(fieldLength, 1)); // Number of characters - } - } - - mapping.append(stringBuildBuffer); - } - if (db2Ccsid == 0) // If not overriding CCSID - { - int32 rtnCode = convertIANAToDb2Ccsid(fieldCharSet->csname, &db2Ccsid); - if (rtnCode) - return rtnCode; - } - - if (db2Ccsid != 1208 && - db2Ccsid != 13488) - { - // Check whether there is a character conversion available. - iconv_t temp; - int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp); - if (unlikely(rc)) - return rc; - } - - sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid); - mapping.append(stringBuildBuffer); - } - } - } - break; - - } - - if (propagateDefaults) - get_field_default_value(field, - mapping, - defaultNeedsQuotes, - db2Ccsid, - (zeroDateHandling==SUBSTITUTE_0001_01_01)); - - return 0; -} - - -/** - Convert MySQL field data into the equivalent DB2 format - - @param field The MySQL field to be converted - @param db2Field The corresponding DB2 field definition - @param db2Buf The buffer to receive the converted data - @param data NULL if field points to the correct data; otherwise, - the data to be converted (for use with keys) -*/ -int32 ha_ibmdb2i::convertMySQLtoDB2(Field* field, const DB2Field& db2Field, char* db2Buf, const uchar* data) -{ - enum_field_types fieldType = field->type(); - switch (fieldType) - { - case MYSQL_TYPE_NEWDECIMAL: - { - uint precision= ((Field_new_decimal*)field)->precision; - uint scale= field->decimals(); - uint db2Precision = min(precision, MAX_DEC_PRECISION); - uint truncationAmount = precision - db2Precision; - - if (scale >= truncationAmount) - { - String tempString(precision+2); - - if (data == NULL) - { - field->val_str((String*)&tempString, (String*)(NULL)); - } - else - { - field->val_str(&tempString, data); - } - const char* temp = tempString.ptr(); - char packed[32]; - memset(&packed, 0, sizeof(packed)); - - int bcdPos = db2Precision - (db2Precision % 2 ? 1 : 0); - bcdAssign(packed, bcdPos+1, (temp[0] == '-' ? 0xD : 0xF)); - - int strPos=tempString.length() - 1 - truncationAmount; - - for (;strPos >= 0 && bcdPos >= 0; strPos--) - { - if (my_isdigit(&my_charset_latin1, temp[strPos])) - { - bcdAssign(packed, bcdPos, temp[strPos]-'0'); - --bcdPos; - } - } - memcpy(db2Buf, &packed, (db2Precision/2)+1); - } - - } - break; - case MYSQL_TYPE_TINY: - { - int16 temp = (data == NULL ? field->val_int() : field->val_int(data)); - memcpy(db2Buf , &temp, sizeof(temp)); - } - break; - case MYSQL_TYPE_SHORT: - { - if (((Field_num*)field)->unsigned_flag) - { - memset(db2Buf, 0, 2); - memcpy(db2Buf+2, (data == NULL ? field->ptr : data), 2); - } - else - { - memcpy(db2Buf, (data == NULL ? field->ptr : data), 2); - } - } - break; - case MYSQL_TYPE_LONG: - { - if (((Field_num*)field)->unsigned_flag) - { - memset(db2Buf, 0, 4); - memcpy(db2Buf+4, (data == NULL ? field->ptr : data), 4); - } - else - { - memcpy(db2Buf, (data == NULL ? field->ptr : data), 4); - } - } - break; - case MYSQL_TYPE_FLOAT: - { - memcpy(db2Buf, (data == NULL ? field->ptr : data), 4); - } - break; - case MYSQL_TYPE_DOUBLE: - { - memcpy(db2Buf, (data == NULL ? field->ptr : data), 8); - } - break; - case MYSQL_TYPE_TIMESTAMP: - case MYSQL_TYPE_DATETIME: - { - String tempString(27); - if (data == NULL) - { - field->val_str(&tempString, &tempString); - } - else - { - field->val_str(&tempString, data); - } - memset(db2Buf, '0', 26); - memcpy(db2Buf, tempString.ptr(), tempString.length()); - if (strncmp(db2Buf,ZERO_DATETIME_VALUE,strlen(ZERO_DATETIME_VALUE)) == 0) - { - if (cachedZeroDateOption == SUBSTITUTE_0001_01_01) - memcpy(db2Buf, ZERO_DATETIME_VALUE_SUBST, sizeof(ZERO_DATETIME_VALUE_SUBST)); - else - { - getErrTxt(DB2I_ERR_INVALID_COL_VALUE, field->field_name); - return(DB2I_ERR_INVALID_COL_VALUE); - } - } - (db2Buf)[10] = '-'; - (db2Buf)[13] = (db2Buf)[16] = (db2Buf)[19] = '.'; - - convertNumericToEbcdicFast(db2Buf, 26); - } - break; - case MYSQL_TYPE_LONGLONG: - { - if (((Field_num*)field)->unsigned_flag) - { - char temp[23]; - String tempString(temp, sizeof(temp), &my_charset_latin1); - - if (data == NULL) - { - field->val_str((String*)&tempString, (String*)(NULL)); - } - else - { - field->val_str(&tempString, data); - } - char packed[11]; - memset(packed, 0, sizeof(packed)); - bcdAssign(packed, 21, (temp[0] == '-' ? 0xD : 0xF)); - int strPos=tempString.length()-1; - int bcdPos=20; - - for (;strPos >= 0; strPos--) - { - if (my_isdigit(&my_charset_latin1, temp[strPos])) - { - bcdAssign(packed, bcdPos, temp[strPos]-'0'); - --bcdPos; - } - } - memcpy(db2Buf, &packed, 11); - } - else - { - *(uint64*)db2Buf = *(uint64*)(data == NULL ? field->ptr : data); - } - } - break; - case MYSQL_TYPE_INT24: - { - int32 temp= (data == NULL ? field->val_int() : field->val_int(data)); - memcpy(db2Buf , &temp, sizeof(temp)); - } - break; - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_NEWDATE: - { - String tempString(11); - if (data == NULL) - { - field->val_str(&tempString, (String*)NULL); - } - else - { - field->val_str(&tempString, data); - } - memcpy(db2Buf, tempString.ptr(), 10); - if (strncmp(db2Buf,ZERO_DATE_VALUE,strlen(ZERO_DATE_VALUE)) == 0) - { - if (cachedZeroDateOption == SUBSTITUTE_0001_01_01) - memcpy(db2Buf, ZERO_DATE_VALUE_SUBST, sizeof(ZERO_DATE_VALUE_SUBST)); - else - { - getErrTxt(DB2I_ERR_INVALID_COL_VALUE,field->field_name); - return(DB2I_ERR_INVALID_COL_VALUE); - } - } - - convertNumericToEbcdicFast(db2Buf,10); - } - break; - case MYSQL_TYPE_TIME: - { - if (db2Field.getType() == QMY_TIME) - { - String tempString(10); - if (data == NULL) - { - field->val_str(&tempString, (String*)NULL); - } - else - { - field->val_str(&tempString, data); - } - memcpy(db2Buf, tempString.ptr(), 8); - (db2Buf)[2]=(db2Buf)[5] = '.'; - - convertNumericToEbcdicFast(db2Buf, 8); - } - else - { - int32 temp = sint3korr(data == NULL ? field->ptr : data); - memcpy(db2Buf, &temp, sizeof(temp)); - } - } - break; - case MYSQL_TYPE_YEAR: - { - String tempString(5); - if (db2Field.getType() == QMY_CHAR) - { - if (data == NULL) - { - field->val_str(&tempString, (String*)NULL); - } - else - { - field->val_str(&tempString, data); - } - memcpy(db2Buf, tempString.ptr(), 4); - } - else - { - uint8 temp = *(uint8*)(data == NULL ? field->ptr : data); - *(uint16*)(db2Buf) = (temp ? temp + 1900 : 0); - } - } - break; - case MYSQL_TYPE_BIT: - { - int bytesToCopy = db2Field.getByteLengthInRecord(); - - if (data == NULL) - { - uint64 temp = field->val_int(); - memcpy(db2Buf, - ((char*)&temp) + (sizeof(temp) - bytesToCopy), - bytesToCopy); - } - else - { - memcpy(db2Buf, - data, - bytesToCopy); - } - } - break; - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_BLOB: - { - if (field->real_type() == MYSQL_TYPE_ENUM || - field->real_type() == MYSQL_TYPE_SET) - { - int64 temp= (data == NULL ? field->val_int() : field->val_int(data)); - *(int64*)db2Buf = temp; - } - else - { - const uchar* dataToStore; - uint32 bytesToStore; - uint32 bytesToPad = 0; - CHARSET_INFO* fieldCharSet = field->charset(); - uint32 maxDisplayLength = field->max_display_length(); - switch (fieldType) - { - case MYSQL_TYPE_STRING: - { - bytesToStore = maxDisplayLength; - if (data == NULL) - dataToStore = field->ptr; - else - dataToStore = data; - } - break; - case MYSQL_TYPE_VARCHAR: - { - - if (data == NULL) - { - bytesToStore = field->data_length(); - dataToStore = field->ptr + ((Field_varstring*)field)->length_bytes; - } - else - { - // Key lens are stored little-endian - bytesToStore = *(uint8*)data + ((*(uint8*)(data+1)) << 8); - dataToStore = data + 2; - } - bytesToPad = maxDisplayLength - bytesToStore; - } - break; - case MYSQL_TYPE_BLOB: - { - if (data == NULL) - { - bytesToStore = ((Field_blob*)field)->get_length(); - bytesToPad = maxDisplayLength - bytesToStore; - ((Field_blob*)field)->get_ptr((uchar**)&dataToStore); - } - else - { - // Key lens are stored little-endian - bytesToStore = *(uint8*)data + ((*(uint8*)(data+1)) << 8); - dataToStore = data + 2; - } - } - break; - } - - int32 rc; - uint16 db2FieldType = db2Field.getType(); - switch(db2FieldType) - { - case QMY_CHAR: - if (maxDisplayLength == 0) - bytesToPad = 1; - case QMY_VARCHAR: - if (db2FieldType == QMY_VARCHAR) - { - db2Buf += sizeof(uint16); - bytesToPad = 0; - } - - if (bytesToStore > db2Field.getDataLengthInRecord()) - { - bytesToStore = db2Field.getDataLengthInRecord(); - field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); - } - - if (fieldCharSet == &my_charset_bin) // If binary - { - if (bytesToStore) - memcpy(db2Buf, dataToStore, bytesToStore); - if (bytesToPad) - memset(db2Buf + bytesToStore, 0x00, bytesToPad); - } - else if (db2Field.getCCSID() == 1208) // utf8 - { - if (bytesToStore) - memcpy(db2Buf, dataToStore, bytesToStore); - if (bytesToPad) - memset(db2Buf + bytesToStore, ' ', bytesToPad); - } - else // single-byte ASCII to EBCDIC - { - DBUG_ASSERT(fieldCharSet->mbmaxlen == 1); - if (bytesToStore) - { - rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore, db2Buf, bytesToStore, bytesToStore, NULL); - if (rc) - return rc; - } - if (bytesToPad) - memset(db2Buf + bytesToStore, 0x40, bytesToPad); - } - - if (db2FieldType == QMY_VARCHAR) - *(uint16*)(db2Buf - sizeof(uint16)) = bytesToStore; - break; - case QMY_VARGRAPHIC: - db2Buf += sizeof(uint16); - bytesToPad = 0; - case QMY_GRAPHIC: - if (maxDisplayLength == 0 && db2FieldType == QMY_GRAPHIC) - bytesToPad = 2; - - if (db2Field.getCCSID() == 13488) - { - if (bytesToStore) - memcpy(db2Buf, dataToStore, bytesToStore); - if (bytesToPad) - memset16((db2Buf + bytesToStore), 0x0020, bytesToPad/2); - } - else - { - size_t db2BytesToStore; - size_t maxDb2BytesToStore; - - if (maxDisplayLength == 0 && db2FieldType == QMY_GRAPHIC) - maxDb2BytesToStore = 2; - else - maxDb2BytesToStore = min(((bytesToStore * 2) / fieldCharSet->mbminlen), - ((maxDisplayLength * 2) / fieldCharSet->mbmaxlen)); - - if (bytesToStore == 0) - db2BytesToStore = 0; - else - { - rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore, db2Buf, bytesToStore, maxDb2BytesToStore, &db2BytesToStore); - if (rc) - return rc; - bytesToStore = db2BytesToStore; - } - if (db2BytesToStore < maxDb2BytesToStore) // If need to pad - memset16((db2Buf + db2BytesToStore), 0x0020, (maxDb2BytesToStore - db2BytesToStore)/2); - } - - if (db2FieldType == QMY_VARGRAPHIC) - *(uint16*)(db2Buf-sizeof(uint16)) = bytesToStore/2; - break; - case QMY_BLOBCLOB: - case QMY_DBCLOB: - { - DBUG_ASSERT(data == NULL); - DB2LobField* lobField = (DB2LobField*)(db2Buf + db2Field.calcBlobPad()); - - if ((fieldCharSet == &my_charset_bin) || // binary or - (db2Field.getCCSID()==13488) || - (db2Field.getCCSID()==1208)) // binary UTF8 - { - } - else - { - char* temp; - int32 rc; - size_t db2BytesToStore; - if (fieldCharSet->mbmaxlen == 1) // single-byte ASCII to EBCDIC - { - temp = getCharacterConversionBuffer(field->field_index, bytesToStore); - rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore,temp,bytesToStore, bytesToStore, NULL); - if (rc) - return (rc); - } - else // Else Far East, special UTF8 or non-special UTF8/UCS2 - { - size_t maxDb2BytesToStore; - maxDb2BytesToStore = min(((bytesToStore * 2) / fieldCharSet->mbminlen), - ((maxDisplayLength * 2) / fieldCharSet->mbmaxlen)); - temp = getCharacterConversionBuffer(field->field_index, maxDb2BytesToStore); - rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore,temp,bytesToStore, maxDb2BytesToStore, &db2BytesToStore); - if (rc) - return (rc); - bytesToStore = db2BytesToStore; - } - dataToStore = (uchar*)temp; - } - - uint16 blobID = db2Table->getBlobIdFromField(field->field_index); - if (blobWriteBuffers[blobID] != (char*)dataToStore) - blobWriteBuffers[blobID].reassign((char*)dataToStore); - if ((void*)blobWriteBuffers[blobID]) - lobField->dataHandle = (ILEMemHandle)blobWriteBuffers[blobID]; - else - lobField->dataHandle = 0; - lobField->length = bytesToStore / (db2FieldType == QMY_DBCLOB ? 2 : 1); - } - break; - } - } - } - break; - default: - DBUG_ASSERT(0); - break; - } - - return (ha_thd()->is_error()); -} - - -/** - Convert DB2 field data into the equivalent MySQL format - - @param db2Field The DB2 field definition - @param field The MySQL field to receive the converted data - @param buf The DB2 data to be converted -*/ -int32 ha_ibmdb2i::convertDB2toMySQL(const DB2Field& db2Field, Field* field, const char* buf) -{ - int32 storeRC = 0; // Result of the field->store() operation - - const char* bufPtr = buf + db2Field.getBufferOffset(); - - switch (field->type()) - { - case MYSQL_TYPE_NEWDECIMAL: - { - uint precision= ((Field_new_decimal*)field)->precision; - uint scale= field->decimals(); - uint db2Precision = min(precision, MAX_DEC_PRECISION); - uint decimalPlace = precision-scale+1; - char temp[80]; - - if (precision <= MAX_DEC_PRECISION || - scale > precision - MAX_DEC_PRECISION) - { - uint numNibbles = db2Precision + (db2Precision % 2 ? 0 : 1); - - temp[0] = (bcdGet(bufPtr, numNibbles) == 0xD ? '-' : ' '); - int strPos=1; - int bcdPos=(db2Precision % 2 ? 0 : 1); - - for (;bcdPos < numNibbles; bcdPos++, strPos++) - { - if (strPos == decimalPlace) - { - temp[strPos] = '.'; - strPos++; - } - - temp[strPos] = bcdGet(bufPtr, bcdPos) + '0'; - } - - temp[strPos] = 0; - - storeRC = field->store(temp, strPos, &my_charset_latin1); - } - } - break; - case MYSQL_TYPE_TINY: - { - storeRC = field->store(*(int16*)bufPtr, ((Field_num*)field)->unsigned_flag); - } - break; - case MYSQL_TYPE_SHORT: - { - if (((Field_num*)field)->unsigned_flag) - { - storeRC = field->store(*(int32*)bufPtr, TRUE); - } - else - { - storeRC = field->store(*(int16*)bufPtr, FALSE); - } - } - break; - case MYSQL_TYPE_LONG: - { - if (((Field_num*)field)->unsigned_flag) - { - storeRC = field->store(*(int64*)bufPtr, TRUE); - } - else - { - storeRC = field->store(*(int32*)bufPtr, FALSE); - } - } - break; - case MYSQL_TYPE_FLOAT: - { - storeRC = field->store(*(float*)bufPtr); - } - break; - case MYSQL_TYPE_DOUBLE: - { - storeRC = field->store(*(double*)bufPtr); - } - break; - case MYSQL_TYPE_LONGLONG: - { - char temp[23]; - if (((Field_num*)field)->unsigned_flag) - { - temp[0] = (bcdGet(bufPtr, 21) == 0xD ? '-' : ' '); - int strPos=1; - int bcdPos=0; - - for (;bcdPos <= 20; bcdPos++, strPos++) - { - temp[strPos] = bcdGet(bufPtr, bcdPos) + '0'; - } - - temp[strPos] = 0; - - storeRC = field->store(temp, strPos, &my_charset_latin1); - } - else - { - storeRC = field->store(*(int64*)bufPtr, FALSE); - } - } - break; - case MYSQL_TYPE_INT24: - { - storeRC = field->store(*(int32*)bufPtr, ((Field_num*)field)->unsigned_flag); - } - break; - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_NEWDATE: - { - longlong value= a4toi_ebcdic((uchar*)bufPtr) * 10000 + - a2toi_ebcdic((uchar*)bufPtr+5) * 100 + - a2toi_ebcdic((uchar*)bufPtr+8); - - if (cachedZeroDateOption == SUBSTITUTE_0001_01_01 && - value == (10000 + 100 + 1)) - value = 0; - - storeRC = field->store(value); - } - break; - case MYSQL_TYPE_TIME: - { - if (db2Field.getType() == QMY_TIME) - { - longlong value= a2toi_ebcdic((uchar*)bufPtr) * 10000 + - a2toi_ebcdic((uchar*)bufPtr+3) * 100 + - a2toi_ebcdic((uchar*)bufPtr+6); - - storeRC = field->store(value); - } - else - storeRC = field->store(*((int32*)bufPtr)); - } - break; - case MYSQL_TYPE_TIMESTAMP: - case MYSQL_TYPE_DATETIME: - { - longlong value= (a4toi_ebcdic((uchar*)bufPtr) * 10000 + - a2toi_ebcdic((uchar*)bufPtr+5) * 100 + - a2toi_ebcdic((uchar*)bufPtr+8)) * 1000000LL + - (a2toi_ebcdic((uchar*)bufPtr+11) * 10000 + - a2toi_ebcdic((uchar*)bufPtr+14) * 100 + - a2toi_ebcdic((uchar*)bufPtr+17)); - - if (cachedZeroDateOption == SUBSTITUTE_0001_01_01 && - value == (10000 + 100 + 1) * 1000000LL) - value = 0; - - storeRC = field->store(value); - } - break; - case MYSQL_TYPE_YEAR: - { - if (db2Field.getType() == QMY_CHAR) - { - storeRC = field->store(bufPtr, 4, &my_charset_bin); - } - else - { - storeRC = field->store(*((uint16*)bufPtr)); - } - } - break; - case MYSQL_TYPE_BIT: - { - uint64 temp= 0; - int bytesToCopy= db2Field.getByteLengthInRecord(); - memcpy(((char*)&temp) + (sizeof(temp) - bytesToCopy), bufPtr, bytesToCopy); - storeRC = field->store(temp, TRUE); - } - break; - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_BLOB: - { - if (field->real_type() == MYSQL_TYPE_ENUM || - field->real_type() == MYSQL_TYPE_SET) - { - storeRC = field->store(*(int64*)bufPtr); - } - else - { - - const char* dataToStore = NULL; - uint32 bytesToStore = 0; - CHARSET_INFO* fieldCharSet = field->charset(); - switch(db2Field.getType()) - { - case QMY_CHAR: - case QMY_GRAPHIC: - { - bytesToStore = db2Field.getByteLengthInRecord(); - if (bytesToStore == 0) - bytesToStore = 1; - dataToStore = bufPtr; - } - break; - case QMY_VARCHAR: - { - bytesToStore = *(uint16*)bufPtr; - dataToStore = bufPtr+sizeof(uint16); - } - break; - case QMY_VARGRAPHIC: - { - /* For VARGRAPHIC, convert the number of double-byte characters - to the number of bytes. */ - bytesToStore = (*(uint16*)bufPtr)*2; - dataToStore = bufPtr+sizeof(uint16); - } - break; - case QMY_DBCLOB: - case QMY_BLOBCLOB: - { - DB2LobField* lobField = (DB2LobField* )(bufPtr + db2Field.calcBlobPad()); - bytesToStore = lobField->length * (db2Field.getType() == QMY_DBCLOB ? 2 : 1); - dataToStore = (char*)blobReadBuffers->getBufferPtr(field->field_index); - } - break; - - } - - if ((fieldCharSet != &my_charset_bin) && // not binary & - (db2Field.getCCSID() != 13488) && // not UCS2 & - (db2Field.getCCSID() != 1208)) - { - char* temp; - size_t db2BytesToStore; - int rc; - if (fieldCharSet->mbmaxlen > 1) - { - size_t maxDb2BytesToStore = ((bytesToStore / 2) * fieldCharSet->mbmaxlen); // Worst case for number of bytes - temp = getCharacterConversionBuffer(field->field_index, maxDb2BytesToStore); - rc = convertFieldChars(toMySQL, field->field_index, dataToStore, temp, bytesToStore, maxDb2BytesToStore, &db2BytesToStore); - bytesToStore = db2BytesToStore; - } - else // single-byte ASCII to EBCDIC - { - temp = getCharacterConversionBuffer(field->field_index, bytesToStore); - rc = convertFieldChars(toMySQL, field->field_index, dataToStore, temp, bytesToStore, bytesToStore, NULL); - } - if (rc) - return (rc); - dataToStore = temp; - } - - if ((field)->flags & BLOB_FLAG) - ((Field_blob*)(field))->set_ptr(bytesToStore, (uchar*)dataToStore); - else - storeRC = field->store(dataToStore, bytesToStore, &my_charset_bin); - } - } - break; - default: - DBUG_ASSERT(0); - break; - - } - - if (storeRC) - { - invalidDataFound = true; - } - - return 0; -} diff --git a/storage/ibmdb2i/db2i_errors.cc b/storage/ibmdb2i/db2i_errors.cc deleted file mode 100644 index dd50e40e61b..00000000000 --- a/storage/ibmdb2i/db2i_errors.cc +++ /dev/null @@ -1,297 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "db2i_errors.h" -#include "db2i_ileBridge.h" -#include "db2i_charsetSupport.h" -#include "mysql_priv.h" -#include "stdarg.h" - -#define MAX_MSGSTRING 109 - -/* - The following strings are associated with errors that can be produced - within the storage engine proper. -*/ -static const char* engineErrors[MAX_MSGSTRING] = -{ - {""}, - {"Error opening codeset conversion from %.64s to %.64s (errno = %d)"}, - {"Invalid %-.10s name '%-.128s'"}, - {"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"}, - {"The %-.64s character set is not supported."}, - {"Auto_increment is not allowed for a partitioned table"}, - {"Character set conversion error due to unknown encoding scheme %d"}, - {""}, - {"Table '%-.128s' was not found by the storage engine"}, - {"Could not resolve to %-.128s in library %-.10s type %-.10s (errno = %d)"}, - {"Error on _PGMCALL for program %-.10s in library %-.10s (error = %d)"}, - {"Error on _ILECALL for API '%.128s' (error = %d)"}, - {"Error in iconv() function during character set conversion (errno = %d)"}, - {"Error from Get Encoding Scheme (QTQGESP) API: %d, %d, %d"}, - {"Error from Get Related Default CCSID (QTQGRDC) API: %d, %d, %d"}, - {"Data out of range for column '%.192s'"}, - {"Schema name '%.128s' exceeds maximum length of %d characters"}, - {"Multiple collations not supported in a single index or constraint"}, - {"Sort sequence was not found"}, - {"One or more characters in column %.128s were substituted during conversion"}, - {"A decimal column exceeded the maximum precision. Data may be truncated."}, - {"Some data returned by DB2 for table %s could not be converted for MySQL"}, - {""}, - {"Column %.128s contains characters that cannot be converted"}, - {"An invalid name was specified for ibmdb2i_rdb_name."}, - {"A duplicate key was encountered for index '%.128s'"}, - {"A table with the same name exists but has incompatible column definitions."}, - {"The created table was discovered as an existing DB2 object."}, - {"Some attribute(s) defined for column '%.128s' may not be honored by accesses from DB2."}, -}; - -/* - The following strings are associated with errors that can be returned - by the operating system via the QMY_* APIs. Most are very uncommon and - indicate a bug somewhere. -*/ -static const char* systemErrors[MAX_MSGSTRING] = -{ - {"Thread ID is too long"}, - {"Error creating a SPACE memory object"}, - {"Error creating a FILE memory object"}, - {"Error creating a SPACE synchronization token"}, - {"Error creating a FILE synchronization token"}, - {"See message %-.7s in joblog for job %-.6s/%-.10s/%-.10s."}, - {"Error unlocking a synchronization token when closing a connection"}, - {"Invalid action specified for an 'object lock' request"}, - {"Invalid action specified for a savepoint request"}, - {"Partial keys are not supported with an ICU sort sequence"}, - {"Error retrieving an ICU sort key"}, - {"Error converting single-byte sort sequence to UCS-2"}, - {"An unsupported collation was specified"}, - {"Validation failed for referenced table of foreign key constraint"}, - {"Error extracting table for constraint information"}, - {"Error extracting referenced table for constraint information"}, - {"Invalid action specified for a 'commitment control' request"}, - {"Invalid commitment control isolation level specified on 'open' request"}, - {"Invalid file handle"}, - {" "}, - {"Invalid option specified for returning data on 'read' request"}, - {"Invalid orientation specified for 'read' request"}, - {"Invalid option type specified for 'read' request"}, - {"Invalid isolation level for starting commitment control"}, - {"Error unlocking a synchronization token in module QMYALC"}, - {"Length of space for returned format is not long enough"}, - {"SQL XA transactions are currently unsupported by this interface"}, - {"The associated QSQSRVR job was killed or ended unexpectedly."}, - {"Error unlocking a synchronization token in module QMYSEI"}, - {"Error unlocking a synchronization token in module QMYSPO"}, - {"Error converting input CCSID from short form to long form"}, - {" "}, - {"Error getting associated CCSID for CCSID conversion"}, - {"Error converting a string from one CCSID to another"}, - {"Error unlocking a synchronization token"}, - {"Error destroying a synchronization token"}, - {"Error locking a synchronization token"}, - {"Error recreating a synchronization token"}, - {"A space handle was not specified for a constraint request"}, - {"An SQL cursor was specified for a delete request"}, - {" "}, - {"Error on delete request because current UFCB for connection is not open"}, - {"An SQL cursor was specified for an object initialization request"}, - {"An SQL cursor was specified for an object override request"}, - {"A space handle was not specified for an object override request"}, - {"An SQL cursor was specified for an information request"}, - {"An SQL cursor was specified for an object lock request"}, - {"An SQL cursor was specified for an optimize request"}, - {"A data handle was not specified for a read request"}, - {"A row number handle was not specified for a read request"}, - {"A key handle was not specified for a read request"}, - {"An SQL cursor was specified for an row estimation request"}, - {"A space handle was not specified for a row estimation request"}, - {"An SQL cursor was specified for a release record request"}, - {"A statement handle was not specified for an 'execute immediate' request"}, - {"A statement handle was not specified for a 'prepare open' request"}, - {"An SQL cursor was specified for an update request"}, - {"The UFCB was not open for read"}, - {"Error on update request because current UFCB for connection is not open"}, - {"A data handle was not specified for an update request"}, - {"An SQL cursor was specified for a write request"}, - {"A data handle was not specified for a write request"}, - {"An unknown function was specified on a process request"}, - {"A share definition was not specified for an 'allocate share' request"}, - {"A share handle was not specified for an 'allocate share' request"}, - {"A use count handle was not specified for an 'allocate share' request"}, - {"A 'records per key' handle was not specified for an information request"}, - {"Error resolving LOB addresss"}, - {"Length of a LOB space is too small"}, - {"An unknown function was specified for a server request"}, - {"Object authorization failed. See message %-.7s in joblog for job %-.6s/%-.10s/%-.10s. for more information."}, - {" "}, - {"Error locking mutex on server"}, - {"Error unlocking mutex on server"}, - {"Error checking for RDB name in RDB Directory"}, - {"Error creating mutex on server"}, - {"A table with that name already exists"}, - {" "}, - {"Error unlocking mutex"}, - {"Error connecting to server job"}, - {"Error connecting to server job"}, - {" "}, - {"Function check occurred while registering parameter spaces. See joblog."}, - {" "}, - {" "}, - {"End of block"}, - {"The file has changed and might not be compatible with the MySQL table definition"}, - {"Error giving pipe to server job"}, - {"There are open object locks when attempting to deallocate"}, - {"There is no open lock"}, - {" "}, - {" "}, - {"The maximum value for the auto_increment data type was exceeded"}, - {"Error occurred closing the pipe "}, - {"Error occurred taking a descriptor for the pipe"}, - {"Error writing to pipe "}, - {"Server was interrupted "}, - {"No pipe descriptor exists for reuse "}, - {"Error occurred during an SQL prepare statement "}, - {"Error occurred during an SQL open "}, - {" "}, - {" "}, - {" "}, - {" "}, - {" "}, - {" "}, - {"An unspecified error was returned from the system."}, - {" "} -}; - -/** - This function builds the text string for an error code, and substitutes - a variable number of replacement variables into the string. -*/ -void getErrTxt(int errCode, ...) -{ - va_list args; - va_start(args,errCode); - char* buffer = db2i_ileBridge::getBridgeForThread()->getErrorStorage(); - const char* msg; - - if (errCode >= QMY_ERR_MIN && errCode <= QMY_ERR_SQ_OPEN) - msg = systemErrors[errCode - QMY_ERR_MIN]; - else - { - DBUG_ASSERT(errCode >= DB2I_FIRST_ERR && errCode <= DB2I_LAST_ERR); - msg = engineErrors[errCode - DB2I_FIRST_ERR]; - } - - (void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args); - va_end(args); - fprintf(stderr,"ibmdb2i error %d: %s\n",errCode,buffer); - DBUG_PRINT("error", ("ibmdb2i error %d: %s",errCode,buffer)); -} - -static inline void trimSpace(char* str) -{ - char* end = strchr(str, ' '); - if (end) *end = 0; -} - - -/** - Generate the error text specific to an API error returned by a QMY_* API. - - @parm errCode The error value - @parm errInfo The structure containing the message and job identifiers. -*/ -void reportSystemAPIError(int errCode, const Qmy_Error_output *errInfo) -{ - if (errCode >= QMY_ERR_MIN && errCode <= QMY_ERR_SQ_OPEN) - { - switch(errCode) - { - case QMY_ERR_MSGID: - case QMY_ERR_NOT_AUTH: - { - DBUG_ASSERT(errInfo); - char jMsg[8]; // Error message ID - char jName[11]; // Job name - char jUser[11]; // Job user - char jNbr[7]; // Job number - memset(jMsg, 0, sizeof(jMsg)); - memset(jName, 0, sizeof(jMsg)); - memset(jUser, 0, sizeof(jMsg)); - memset(jMsg, 0, sizeof(jMsg)); - - convFromEbcdic(errInfo->MsgId,jMsg,sizeof(jMsg)-1); - convFromEbcdic(errInfo->JobName,jName,sizeof(jName)-1); - trimSpace(jName); - convFromEbcdic(errInfo->JobUser,jUser,sizeof(jUser)-1); - trimSpace(jUser); - convFromEbcdic(errInfo->JobNbr,jNbr,sizeof(jNbr)-1); - getErrTxt(errCode,jMsg,jNbr,jUser,jName); - } - break; - case QMY_ERR_RTNFMT: - { - getErrTxt(QMY_ERR_LVLID_MISMATCH); - } - break; - default: - getErrTxt(errCode); - break; - } - } -} - - -/** - Generate a warning for the specified error. -*/ -void warning(THD *thd, int errCode, ...) -{ - va_list args; - va_start(args,errCode); - char buffer[MYSQL_ERRMSG_SIZE]; - const char* msg; - - DBUG_ASSERT(errCode >= DB2I_FIRST_ERR && errCode <= DB2I_LAST_ERR); - msg = engineErrors[errCode - DB2I_FIRST_ERR]; - - (void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args); - va_end(args); - DBUG_PRINT("warning", ("ibmdb2i warning %d: %s",errCode,buffer)); - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, errCode, buffer); -} - - diff --git a/storage/ibmdb2i/db2i_errors.h b/storage/ibmdb2i/db2i_errors.h deleted file mode 100644 index b6dd314ef50..00000000000 --- a/storage/ibmdb2i/db2i_errors.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_ERRORS_H -#define DB2I_ERRORS_H - -#include "qmyse.h" -class THD; - -/** - @enum DB2I_errors - - @brief These are the errors that can be returned by the storage engine proper - and that are specific to the engine. Refer to db2i_errors.cc for text - descriptions of the errors. -*/ - -enum DB2I_errors -{ - DB2I_FIRST_ERR = 2500, - DB2I_ERR_ICONV_OPEN, - DB2I_ERR_INVALID_NAME, - DB2I_ERR_RENAME_MOVE, - DB2I_ERR_UNSUPP_CHARSET, - DB2I_ERR_PART_AUTOINC, - DB2I_ERR_UNKNOWN_ENCODING, - DB2I_ERR_RESERVED, - DB2I_ERR_TABLE_NOT_FOUND, - DB2I_ERR_RESOLVE_OBJ, - DB2I_ERR_PGMCALL, - DB2I_ERR_ILECALL, - DB2I_ERR_ICONV, - DB2I_ERR_QTQGESP, - DB2I_ERR_QTQGRDC, - DB2I_ERR_INVALID_COL_VALUE, - DB2I_ERR_TOO_LONG_SCHEMA, - DB2I_ERR_MIXED_COLLATIONS, - DB2I_ERR_SRTSEQ, - DB2I_ERR_SUB_CHARS, - DB2I_ERR_PRECISION, - DB2I_ERR_INVALID_DATA, - DB2I_ERR_RESERVED2, - DB2I_ERR_ILL_CHAR, - DB2I_ERR_BAD_RDB_NAME, - DB2I_ERR_UNKNOWN_IDX, - DB2I_ERR_DISCOVERY_MISMATCH, - DB2I_ERR_WARN_CREATE_DISCOVER, - DB2I_ERR_WARN_COL_ATTRS, - DB2I_LAST_ERR = DB2I_ERR_WARN_COL_ATTRS -}; - -void getErrTxt(int errcode, ...); -void reportSystemAPIError(int errCode, const Qmy_Error_output *errInfo); -void warning(THD *thd, int errCode, ...); - -const char* DB2I_SQL0350 = "\xE2\xD8\xD3\xF0\xF3\xF5\xF0"; // SQL0350 in EBCDIC -const char* DB2I_CPF503A = "\xC3\xD7\xC6\xF5\xF0\xF3\xC1"; // CPF503A in EBCDIC -const char* DB2I_SQL0538 = "\xE2\xD8\xD3\xF0\xF5\xF3\xF8"; // SQL0538 in EBCDIC - -#endif diff --git a/storage/ibmdb2i/db2i_file.cc b/storage/ibmdb2i/db2i_file.cc deleted file mode 100644 index 2d83248eea7..00000000000 --- a/storage/ibmdb2i/db2i_file.cc +++ /dev/null @@ -1,553 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#include "db2i_file.h" -#include "db2i_charsetSupport.h" -#include "db2i_collationSupport.h" -#include "db2i_misc.h" -#include "db2i_errors.h" -#include "my_dir.h" - -db2i_table::db2i_table(const TABLE_SHARE* myTable, const char* path) : - mysqlTable(myTable), - db2StartId(0), - blobFieldCount(0), - blobFields(NULL), - blobFieldActualSizes(NULL), - logicalFiles(NULL), - physicalFile(NULL), - db2TableNameSQLAscii(NULL), - db2LibNameSQLAscii(NULL) -{ - char asciiLibName[MAX_DB2_SCHEMANAME_LENGTH + 1]; - getDB2LibNameFromPath(path, asciiLibName, ASCII_NATIVE); - - char asciiFileName[MAX_DB2_FILENAME_LENGTH + 1]; - getDB2FileNameFromPath(path, asciiFileName, ASCII_NATIVE); - - size_t libNameLen = strlen(asciiLibName); - size_t fileNameLen = strlen(asciiFileName); - - db2LibNameEbcdic=(char *) - my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &db2LibNameEbcdic, libNameLen+1, - &db2LibNameAscii, libNameLen+1, - &db2LibNameSQLAscii, libNameLen*2 + 1, - &db2TableNameEbcdic, fileNameLen+1, - &db2TableNameAscii, fileNameLen+1, - &db2TableNameSQLAscii, fileNameLen*2 + 1, - NullS); - - if (likely(db2LibNameEbcdic)) - { - memcpy(db2LibNameAscii, asciiLibName, libNameLen); - convertNativeToSQLName(db2LibNameAscii, db2LibNameSQLAscii); - convToEbcdic(db2LibNameAscii, db2LibNameEbcdic, libNameLen); - memcpy(db2TableNameAscii, asciiFileName, fileNameLen); - convertNativeToSQLName(db2TableNameAscii, db2TableNameSQLAscii); - convToEbcdic(db2TableNameAscii, db2TableNameEbcdic, fileNameLen); - } - - conversionDefinitions[toMySQL] = NULL; - conversionDefinitions[toDB2] = NULL; - - isTemporaryTable = (strstr(mysqlTable->path.str, mysql_tmpdir) == mysqlTable->path.str); -} - - -int32 db2i_table::initDB2Objects(const char* path) -{ - uint fileObjects = 1 + mysqlTable->keys; - ValidatedPointer<ShrDef> fileDefnSpace(sizeof(ShrDef) * fileObjects); - - physicalFile = new db2i_file(this); - physicalFile->fillILEDefn(&fileDefnSpace[0], true); - - logicalFileCount = mysqlTable->keys; - if (logicalFileCount > 0) - { - logicalFiles = new db2i_file*[logicalFileCount]; - for (int k = 0; k < logicalFileCount; k++) - { - logicalFiles[k] = new db2i_file(this, k); - logicalFiles[k]->fillILEDefn(&fileDefnSpace[k+1], false); - } - } - - ValidatedPointer<FILE_HANDLE> fileDefnHandles(sizeof(FILE_HANDLE) * fileObjects); - size_t formatSpaceLen = sizeof(format_hdr_t) + mysqlTable->fields * sizeof(DB2Field); - formatSpace.alloc(formatSpaceLen); - - int rc = db2i_ileBridge::getBridgeForThread()-> - expectErrors(QMY_ERR_RTNFMT)-> - allocateFileDefn(fileDefnSpace, - fileDefnHandles, - fileObjects, - db2LibNameEbcdic, - strlen(db2LibNameEbcdic), - formatSpace, - formatSpaceLen); - - if (rc) - { - // We have to handle a format space error as a special case of a FID - // mismatch. We should only get the space error if columns have been added - // to the DB2 table without MySQL's knowledge, which is effectively a - // FID problem. - if (rc == QMY_ERR_RTNFMT) - { - rc = QMY_ERR_LVLID_MISMATCH; - getErrTxt(rc); - } - return rc; - } - - convFromEbcdic(((format_hdr_t*)formatSpace)->FilLvlId, fileLevelID, sizeof(fileLevelID)); - - if (!doFileIDsMatch(path)) - { - getErrTxt(QMY_ERR_LVLID_MISMATCH); - return QMY_ERR_LVLID_MISMATCH; - } - - physicalFile->setMasterDefnHandle(fileDefnHandles[0]); - for (int k = 0; k < mysqlTable->keys; k++) - { - logicalFiles[k]->setMasterDefnHandle(fileDefnHandles[k+1]); - } - - db2StartId = (uint64)(((format_hdr_t*)formatSpace)->StartIdVal); - db2Fields = (DB2Field*)((char*)(void*)formatSpace + ((format_hdr_t*)formatSpace)->ColDefOff); - - uint fields = mysqlTable->fields; - for (int i = 0; i < fields; ++i) - { - if (db2Field(i).isBlob()) - { - blobFieldCount++; - } - } - - if (blobFieldCount) - { - blobFieldActualSizes = (uint*)my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &blobFieldActualSizes, blobFieldCount * sizeof(uint), - &blobFields, blobFieldCount * sizeof(uint16), - NullS); - - int b = 0; - for (int i = 0; i < fields; ++i) - { - if (db2Field(i).isBlob()) - { - blobFields[b++] = i; - } - } - } - - my_multi_malloc(MYF(MY_WME), - &conversionDefinitions[toMySQL], fields * sizeof(iconv_t), - &conversionDefinitions[toDB2], fields * sizeof(iconv_t), - NullS); - for (int i = 0; i < fields; ++i) - { - conversionDefinitions[toMySQL][i] = (iconv_t)(-1); - conversionDefinitions[toDB2][i] = (iconv_t)(-1); - } - - return 0; -} - -int db2i_table::fastInitForCreate(const char* path) -{ - ValidatedPointer<ShrDef> fileDefnSpace(sizeof(ShrDef)); - - physicalFile = new db2i_file(this); - physicalFile->fillILEDefn(fileDefnSpace, true); - - ValidatedPointer<FILE_HANDLE> fileDefnHandles(sizeof(FILE_HANDLE)); - - size_t formatSpaceLen = sizeof(format_hdr_t) + - mysqlTable->fields * sizeof(DB2Field); - formatSpace.alloc(formatSpaceLen); - - int rc = db2i_ileBridge::getBridgeForThread()->allocateFileDefn(fileDefnSpace, - fileDefnHandles, - 1, - db2LibNameEbcdic, - strlen(db2LibNameEbcdic), - formatSpace, - formatSpaceLen); - - if (rc) - return rc; - - convFromEbcdic(((format_hdr_t*)formatSpace)->FilLvlId, fileLevelID, sizeof(fileLevelID)); - doFileIDsMatch(path); - - return 0; -} - -bool db2i_table::doFileIDsMatch(const char* path) -{ - char name_buff[FN_REFLEN]; - - fn_format(name_buff, path, "", FID_EXT, (MY_REPLACE_EXT | MY_UNPACK_FILENAME)); - - File fd = my_open(name_buff, O_RDONLY, MYF(0)); - - if (fd == -1) - { - if (errno == ENOENT) - { - fd = my_create(name_buff, 0, O_WRONLY, MYF(MY_WME)); - - if (fd == -1) - { - // TODO: Report errno here - return false; - } - my_write(fd, (uchar*)fileLevelID, sizeof(fileLevelID), MYF(MY_WME)); - my_close(fd, MYF(0)); - return true; - } - else - { - // TODO: Report errno here - return false; - } - } - - char diskFID[sizeof(fileLevelID)]; - - bool match = false; - - if (my_read(fd, (uchar*)diskFID, sizeof(diskFID), MYF(MY_WME)) == sizeof(diskFID) && - (memcmp(diskFID, fileLevelID, sizeof(diskFID)) == 0)) - match = true; - - my_close(fd, MYF(0)); - - return match; -} - -void db2i_table::deleteAssocFiles(const char* name) -{ - char name_buff[FN_REFLEN]; - fn_format(name_buff, name, "", FID_EXT, (MY_REPLACE_EXT | MY_UNPACK_FILENAME)); - my_delete(name_buff, MYF(0)); -} - -void db2i_table::renameAssocFiles(const char* from, const char* to) -{ - rename_file_ext(from, to, FID_EXT); -} - - -db2i_table::~db2i_table() -{ - my_free(blobFieldActualSizes); - my_free(conversionDefinitions[toMySQL]); - - if (logicalFiles) - { - for (int k = 0; k < logicalFileCount; ++k) - { - delete logicalFiles[k]; - } - - delete[] logicalFiles; - } - delete physicalFile; - - my_free(db2LibNameEbcdic); -} - -void db2i_table::getDB2QualifiedName(char* to) -{ - strcat(to, getDB2LibName(ASCII_SQL)); - strcat(to, "."); - strcat(to, getDB2TableName(ASCII_SQL)); -} - - -void db2i_table::getDB2QualifiedNameFromPath(const char* path, char* to) -{ - getDB2LibNameFromPath(path, to); - strcat(to, "."); - getDB2FileNameFromPath(path, strend(to)); -} - - -size_t db2i_table::smartFilenameToTableName(const char *in, char* out, size_t outlen) -{ - if (strchr(in, '@') == NULL) - { - return filename_to_tablename(in, out, outlen); - } - - char* test = (char*) my_malloc(outlen, MYF(MY_WME)); - - filename_to_tablename(in, test, outlen); - - char* cur = test; - - while (*cur) - { - if ((*cur <= 0x20) || (*cur >= 0x80)) - { - strncpy(out, in, outlen); - my_free(test); - return min(outlen, strlen(out)); - } - ++cur; - } - - strncpy(out, test, outlen); - my_free(test); - return min(outlen, strlen(out)); -} - -void db2i_table::filenameToTablename(const char* in, char* out, size_t outlen) -{ - if (strchr(in, '#') == NULL) - { - smartFilenameToTableName(in, out, outlen); - return; - } - - char* temp = (char*)sql_alloc(outlen); - - const char* part1, *part2, *part3, *part4; - part1 = in; - part2 = strstr(part1, "#P#"); - if (part2); - { - part3 = part2 + 3; - part4 = strchr(part3, '#'); - if (!part4) - part4 = strend(in); - } - - memcpy(temp, part1, min(outlen, part2 - part1)); - temp[min(outlen-1, part2-part1)] = 0; - - int32 accumLen = smartFilenameToTableName(temp, out, outlen); - - if (part2 && (accumLen + 4 < outlen)) - { - strcat(out, "#P#"); - accumLen += 4; - - memset(temp, 0, min(outlen, part2-part1)); - memcpy(temp, part3, min(outlen, part4-part3)); - temp[min(outlen-1, part4-part3)] = 0; - - accumLen += smartFilenameToTableName(temp, strend(out), outlen-accumLen); - - if (part4 && (accumLen + (strend(in) - part4 + 1) < outlen)) - { - strcat(out, part4); - } - } -} - -void db2i_table::getDB2LibNameFromPath(const char* path, char* lib, NameFormatFlags format) -{ - if (strstr(path, mysql_tmpdir) == path) - { - strcpy(lib, DB2I_TEMP_TABLE_SCHEMA); - } - else - { - const char* c = strend(path) - 1; - while (c > path && *c != '\\' && *c != '/') - --c; - - if (c != path) - { - const char* dbEnd = c; - do { - --c; - } while (c >= path && *c != '\\' && *c != '/'); - - if (c >= path) - { - const char* dbStart = c+1; - char fileName[FN_REFLEN]; - memcpy(fileName, dbStart, dbEnd - dbStart); - fileName[dbEnd-dbStart] = 0; - - char dbName[MAX_DB2_SCHEMANAME_LENGTH+1]; - filenameToTablename(fileName, dbName , sizeof(dbName)); - - convertMySQLNameToDB2Name(dbName, lib, sizeof(dbName), true, (format==ASCII_SQL) ); - } - else - DBUG_ASSERT(0); // This should never happen! - } - } -} - -void db2i_table::getDB2FileNameFromPath(const char* path, char* file, NameFormatFlags format) -{ - const char* fileEnd = strend(path); - const char* c = fileEnd; - while (c > path && *c != '\\' && *c != '/') - --c; - - if (c != path) - { - const char* fileStart = c+1; - char fileName[FN_REFLEN]; - memcpy(fileName, fileStart, fileEnd - fileStart); - fileName[fileEnd - fileStart] = 0; - char db2Name[MAX_DB2_FILENAME_LENGTH+1]; - filenameToTablename(fileName, db2Name, sizeof(db2Name)); - convertMySQLNameToDB2Name(db2Name, file, sizeof(db2Name), true, (format==ASCII_SQL) ); - } -} - -// Generates the DB2 index name when given the MySQL index and table names. -int32 db2i_table::appendQualifiedIndexFileName(const char* indexName, - const char* tableName, - String& to, - NameFormatFlags format, - enum_DB2I_INDEX_TYPE type) -{ - char generatedName[MAX_DB2_FILENAME_LENGTH+1]; - strncpy(generatedName, indexName, DB2I_INDEX_NAME_LENGTH_TO_PRESERVE); - generatedName[DB2I_INDEX_NAME_LENGTH_TO_PRESERVE] = 0; - char* endOfGeneratedName; - - if (type == typeDefault) - { - strcat(generatedName, DB2I_DEFAULT_INDEX_NAME_DELIMITER); - endOfGeneratedName = strend(generatedName); - } - else if (type != typeNone) - { - strcat(generatedName, DB2I_ADDL_INDEX_NAME_DELIMITER); - endOfGeneratedName = strend(generatedName); - *(endOfGeneratedName-2) = char(type); - } - - uint lenWithoutFile = endOfGeneratedName - generatedName; - - char strippedTableName[MAX_DB2_FILENAME_LENGTH+1]; - if (format == ASCII_SQL) - { - strcpy(strippedTableName, tableName); - stripExtraQuotes(strippedTableName+1, sizeof(strippedTableName)); - tableName = strippedTableName; - } - - if (strlen(tableName) > (MAX_DB2_FILENAME_LENGTH-lenWithoutFile)) - return -1; - - strncat(generatedName, - tableName+1, - min(strlen(tableName), (MAX_DB2_FILENAME_LENGTH-lenWithoutFile))-2 ); - - char finalName[MAX_DB2_FILENAME_LENGTH+1]; - convertMySQLNameToDB2Name(generatedName, finalName, sizeof(finalName), true, (format==ASCII_SQL)); - to.append(finalName); - - return 0; -} - - -void db2i_table::findConversionDefinition(enum_conversionDirection direction, uint16 fieldID) -{ - getConversion(direction, - mysqlTable->field[fieldID]->charset(), - db2Field(fieldID).getCCSID(), - conversionDefinitions[direction][fieldID]); -} - - -db2i_file::db2i_file(db2i_table* table) : db2Table(table) -{ - commonCtorInit(); - - DBUG_ASSERT(table->getMySQLTable()->table_name.length <= MAX_DB2_FILENAME_LENGTH-2); - - db2FileName = (char*)table->getDB2TableName(db2i_table::EBCDIC_NATIVE); -} - -db2i_file::db2i_file(db2i_table* table, int index) : db2Table(table) -{ - commonCtorInit(); - - if ((index == table->getMySQLTable()->primary_key) && !table->isTemporary()) - { - db2FileName = (char*)table->getDB2TableName(db2i_table::EBCDIC_NATIVE); - } - else - { - // Generate the index name (in index___table form); quote and EBCDICize it. - String qualifiedPath; - qualifiedPath.length(0); - - const char* asciiFileName = table->getDB2TableName(db2i_table::ASCII_NATIVE); - - db2i_table::appendQualifiedIndexFileName(table->getMySQLTable()->key_info[index].name, - asciiFileName, - qualifiedPath, - db2i_table::ASCII_NATIVE, - typeDefault); - - db2FileName = (char*)my_malloc(qualifiedPath.length()+1, MYF(MY_WME | MY_ZEROFILL)); - convToEbcdic(qualifiedPath.ptr(), db2FileName, qualifiedPath.length()); - } -} - -void db2i_file::commonCtorInit() -{ - masterDefn = 0; - memset(&formats, 0, maxRowFormats*sizeof(RowFormat)); -} - - -void db2i_file::fillILEDefn(ShrDef* defn, bool readInArrivalSeq) -{ - defn->ObjNamLen = strlen(db2FileName); - DBUG_ASSERT(defn->ObjNamLen <= sizeof(defn->ObjNam)); - memcpy(defn->ObjNam, db2FileName, defn->ObjNamLen); - defn->ArrSeq[0] = (readInArrivalSeq ? QMY_YES : QMY_NO); -} - diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h deleted file mode 100644 index 6cc6ae8947b..00000000000 --- a/storage/ibmdb2i/db2i_file.h +++ /dev/null @@ -1,446 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_FILE_H -#define DB2I_FILE_H - -#include "db2i_global.h" -#include "db2i_ileBridge.h" -#include "db2i_validatedPointer.h" -#include "my_atomic.h" -#include "db2i_iconv.h" -#include "db2i_charsetSupport.h" - -const char FID_EXT[] = ".FID"; - -class db2i_file; - -#pragma pack(1) -struct DB2LobField -{ - char reserved1; - uint32 length; - char reserved2[4]; - uint32 ordinal; - ILEMemHandle dataHandle; - char reserved3[8]; -}; -#pragma pack(pop) - -class DB2Field -{ - public: - uint16 getType() const { return *(uint16*)(&definition.ColType); } - uint16 getByteLengthInRecord() const { return definition.ColLen; } - uint16 getDataLengthInRecord() const - { - return (getType() == QMY_VARCHAR || getType() == QMY_VARGRAPHIC ? definition.ColLen - 2 : definition.ColLen); - } - uint16 getCCSID() const { return *(uint16*)(&definition.ColCCSID); } - bool isBlob() const - { - uint16 type = getType(); - return (type == QMY_BLOBCLOB || type == QMY_DBCLOB); - } - uint16 getBufferOffset() const { return definition.ColBufOff; } - uint16 calcBlobPad() const - { - DBUG_ASSERT(isBlob()); - return getByteLengthInRecord() - sizeof (DB2LobField); - } - DB2LobField* asBlobField(char* buf) const - { - DBUG_ASSERT(isBlob()); - return (DB2LobField*)(buf + getBufferOffset() + calcBlobPad()); - } - private: - col_def_t definition; -}; - - -/** - @class db2i_table - - @details - This class describes the logical SQL table provided by DB2. - It stores "table-scoped" information such as the name of the - DB2 schema, BLOB descriptions, and the corresponding MySQL table definition. - Only one instance exists per SQL table. -*/ -class db2i_table -{ - public: - enum NameFormatFlags - { - ASCII_SQL, - ASCII_NATIVE, - EBCDIC_NATIVE - }; - - db2i_table(const TABLE_SHARE* myTable, const char* path = NULL); - - ~db2i_table(); - - int32 initDB2Objects(const char* path); - - const TABLE_SHARE* getMySQLTable() const - { - return mysqlTable; - } - - uint64 getStartId() const - { - return db2StartId; - } - - void updateStartId(uint64 newStartId) - { - db2StartId = newStartId; - } - - bool hasBlobs() const - { - return (blobFieldCount > 0); - } - - uint16 getBlobCount() const - { - return blobFieldCount; - } - - uint getBlobFieldActualSize(uint fieldIndex) const - { - return blobFieldActualSizes[getBlobIdFromField(fieldIndex)]; - } - - void updateBlobFieldActualSize(uint fieldIndex, uint32 newSize) - { - // It's OK that this isn't threadsafe, since this is just an advisory - // value. If a race condition causes the lesser of two values to be stored, - // that's OK. - uint16 blobID = getBlobIdFromField(fieldIndex); - DBUG_ASSERT(blobID < blobFieldCount); - - if (blobFieldActualSizes[blobID] < newSize) - { - blobFieldActualSizes[blobID] = newSize; - } - } - - - - const char* getDB2LibName(NameFormatFlags format = EBCDIC_NATIVE) - { - switch (format) - { - case EBCDIC_NATIVE: - return db2LibNameEbcdic; break; - case ASCII_NATIVE: - return db2LibNameAscii; break; - case ASCII_SQL: - return db2LibNameSQLAscii; break; - default: - DBUG_ASSERT(0); - } - return NULL; - } - - const char* getDB2TableName(NameFormatFlags format = EBCDIC_NATIVE) const - { - switch (format) - { - case EBCDIC_NATIVE: - return db2TableNameEbcdic; break; - case ASCII_NATIVE: - return db2TableNameAscii; break; - case ASCII_SQL: - return db2TableNameAscii; break; - break; - default: - DBUG_ASSERT(0); - } - return NULL; - } - - DB2Field& db2Field(int fieldID) const { return db2Fields[fieldID]; } - DB2Field& db2Field(const Field* field) const { return db2Field(field->field_index); } - - void processFormatSpace(); - - void* getFormatSpace(size_t& spaceNeeded) - { - DBUG_ASSERT(formatSpace == NULL); - spaceNeeded = sizeof(format_hdr_t) + mysqlTable->fields * sizeof(DB2Field); - formatSpace.alloc(spaceNeeded); - return (void*)formatSpace; - } - - bool isTemporary() const - { - return isTemporaryTable; - } - - void getDB2QualifiedName(char* to); - static void getDB2LibNameFromPath(const char* path, char* lib, NameFormatFlags format=ASCII_SQL); - static void getDB2FileNameFromPath(const char* path, char* file, NameFormatFlags format=ASCII_SQL); - static void getDB2QualifiedNameFromPath(const char* path, char* to); - static int32 appendQualifiedIndexFileName(const char* indexName, - const char* tableName, - String& to, - NameFormatFlags format=ASCII_SQL, - enum_DB2I_INDEX_TYPE type=typeDefault); - - uint16 getBlobIdFromField(uint16 fieldID) const - { - for (int i = 0; i < blobFieldCount; ++i) - { - if (blobFields[i] == fieldID) - return i; - } - DBUG_ASSERT(0); - return 0; - } - - iconv_t& getConversionDefinition(enum_conversionDirection direction, - uint16 fieldID) - { - if (conversionDefinitions[direction][fieldID] == (iconv_t)(-1)) - findConversionDefinition(direction, fieldID); - - return conversionDefinitions[direction][fieldID]; - } - - const db2i_file* dataFile() const - { - return physicalFile; - } - - const db2i_file* indexFile(uint idx) const - { - return logicalFiles[idx]; - } - - const char* getFileLevelID() const - { - return fileLevelID; - } - - static void deleteAssocFiles(const char* name); - static void renameAssocFiles(const char* from, const char* to); - - int fastInitForCreate(const char* path); - int initDiscoveredTable(const char* path); - - uint16* blobFields; - -private: - - void findConversionDefinition(enum_conversionDirection direction, uint16 fieldID); - static void filenameToTablename(const char* in, char* out, size_t outlen); - static size_t smartFilenameToTableName(const char *in, char* out, size_t outlen); - void convertNativeToSQLName(const char* input, - char* output) - { - - output[0] = input[0]; - - uint o = 1; - uint i = 1; - do - { - output[o++] = input[i]; - if (input[i] == '"' && input[i+1]) - output[o++] = '"'; - } while (input[++i]); - - output[o] = 0; // This isn't the most user-friendly way to handle overflows, - // but at least its safe. - } - - bool doFileIDsMatch(const char* path); - - ValidatedPointer<format_hdr_t> formatSpace; - DB2Field* db2Fields; - uint64 db2StartId; // Starting value for identity column - uint16 blobFieldCount; // Count of LOB fields in the DB2 table - uint* blobFieldActualSizes; // Array of LOB field lengths (actual vs. allocated). - // This is updated as LOBs are read and will contain - // the length of the longest known LOB in that field. - iconv_t* conversionDefinitions[2]; - - const TABLE_SHARE* mysqlTable; - uint16 logicalFileCount; - char* db2LibNameEbcdic; // Quoted and in EBCDIC - char* db2LibNameAscii; - char* db2TableNameEbcdic; - char* db2TableNameAscii; - char* db2TableNameSQLAscii; - char* db2LibNameSQLAscii; - - db2i_file* physicalFile; - db2i_file** logicalFiles; - - bool isTemporaryTable; - char fileLevelID[13]; -}; - -/** - @class db2i_file - - @details This class describes a file object underlaying a particular SQL - table. Both "physical files" (data) and "logical files" (indices) are - described by this class. Only one instance of the class exists per DB2 file - object. The single instance is responsible for de/allocating the multiple - handles used by the handlers. -*/ -class db2i_file -{ - -public: - struct RowFormat - { - uint16 readRowLen; - uint16 readRowNullOffset; - uint16 writeRowLen; - uint16 writeRowNullOffset; - char inited; - }; - -public: - - // Construct an instance for a physical file. - db2i_file(db2i_table* table); - - // Construct an instance for a logical file. - db2i_file(db2i_table* table, int index); - - ~db2i_file() - { - if (masterDefn) - db2i_ileBridge::getBridgeForThread()->deallocateFile(masterDefn); - - if (db2FileName != (char*)db2Table->getDB2TableName(db2i_table::EBCDIC_NATIVE)) - my_free(db2FileName); - } - - // This is roughly equivalent to an "open". It tells ILE to allocate a descriptor - // for the file. The associated handle is returned to the caller. - int allocateNewInstance(FILE_HANDLE* newHandle, ILEMemHandle inuseSpace) const - { - int rc; - - rc = db2i_ileBridge::getBridgeForThread()->allocateFileInstance(masterDefn, - inuseSpace, - newHandle); - - if (rc) *newHandle = 0; - - return rc; - } - - // This obtains the row layout associated with a particular access intent for - // an open instance of the file. - int obtainRowFormat(FILE_HANDLE instanceHandle, - char intent, - char commitLevel, - const RowFormat** activeFormat) const - { - DBUG_ENTER("db2i_file::obtainRowFormat"); - RowFormat* rowFormat; - - if (intent == QMY_UPDATABLE) - rowFormat = &(formats[readWrite]); - else if (intent == QMY_READ_ONLY) - rowFormat = &(formats[readOnly]); - - if (unlikely(!rowFormat->inited)) - { - int rc = db2i_ileBridge::getBridgeForThread()-> - initFileForIO(instanceHandle, - intent, - commitLevel, - &(rowFormat->writeRowLen), - &(rowFormat->writeRowNullOffset), - &(rowFormat->readRowLen), - &(rowFormat->readRowNullOffset)); - if (rc) DBUG_RETURN(rc); - rowFormat->inited = 1; - } - - *activeFormat = rowFormat; - DBUG_RETURN(0); - } - - const char* getDB2FileName() const - { - return db2FileName; - } - - void fillILEDefn(ShrDef* defn, bool readInArrivalSeq); - - void setMasterDefnHandle(FILE_HANDLE handle) - { - masterDefn = handle; - } - - FILE_HANDLE getMasterDefnHandle() const - { - return masterDefn; - } - -private: - enum RowFormats - { - readOnly = 0, - readWrite, - maxRowFormats - }; - - mutable RowFormat formats[maxRowFormats]; - - void commonCtorInit(); - - char* db2FileName; // Quoted and in EBCDIC - - db2i_table* db2Table; // The logical SQL table contained by this file. - - bool db2CanSort; - - FILE_HANDLE masterDefn; -}; - - -#endif diff --git a/storage/ibmdb2i/db2i_global.h b/storage/ibmdb2i/db2i_global.h deleted file mode 100644 index 1cf8a9a7c61..00000000000 --- a/storage/ibmdb2i/db2i_global.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_GLOBAL_H -#define DB2I_GLOBAL_H - -#define MYSQL_SERVER 1 - -#include "my_global.h" -#include "my_sys.h" - -const uint MAX_DB2_KEY_PARTS=120; -const int MAX_DB2_V5R4_LIBNAME_LENGTH = 10; -const int MAX_DB2_V6R1_LIBNAME_LENGTH = 30; -const int MAX_DB2_SCHEMANAME_LENGTH=258; -const int MAX_DB2_FILENAME_LENGTH=258; -const int MAX_DB2_COLNAME_LENGTH=128; -const int MAX_DB2_SAVEPOINTNAME_LENGTH=128; -const int MAX_DB2_QUALIFIEDNAME_LENGTH=MAX_DB2_V6R1_LIBNAME_LENGTH + 1 + MAX_DB2_FILENAME_LENGTH; -const uint32 MAX_CHAR_LENGTH = 32765; -const uint32 MAX_VARCHAR_LENGTH = 32739; -const uint32 MAX_DEC_PRECISION = 63; -const uint32 MAX_BLOB_LENGTH = 2147483646; -const uint32 MAX_BINARY_LENGTH = MAX_CHAR_LENGTH; -const uint32 MAX_VARBINARY_LENGTH = MAX_VARCHAR_LENGTH; -const uint32 MAX_FULL_ALLOCATE_BLOB_LENGTH = 65536; -const uint32 MAX_FOREIGN_LEN = 64000; -const char* DB2I_TEMP_TABLE_SCHEMA = "QTEMP"; -const char DB2I_ADDL_INDEX_NAME_DELIMITER[5] = {'_','_','_','_','_'}; -const char DB2I_DEFAULT_INDEX_NAME_DELIMITER[3] = {'_','_','_'}; -const int DB2I_INDEX_NAME_LENGTH_TO_PRESERVE = 110; - -enum enum_DB2I_INDEX_TYPE -{ - typeNone = 0, - typeDefault = 'D', - typeHex = 'H', - typeAscii = 'A' -}; - -void* roundToQuadWordBdy(void* ptr) -{ - return (void*)(((uint64)(ptr)+0xf) & ~0xf); -} - -typedef uint64_t ILEMemHandle; - -struct OSVersion -{ - uint8 v; - uint8 r; -}; -extern OSVersion osVersion; - - -/** - Allocate 16-byte aligned space using the MySQL heap allocator - - @details Many of the spaces used by the QMY_* APIS are required to be - aligned on 16 byte boundaries. The standard system malloc will do this - alignment by default. However, in order to use the heap debug and tracking - features of the mysql allocator, we chose to implement an aligning wrapper - around my_malloc. Essentially, we overallocate the storage space, find the - first aligned address in the space, store a pointer to the true malloc - allocation in the bytes immediately preceding the aligned address, and return - the aligned address to the caller. - - @parm size The size of heap storage needed - - @return A 16-byte aligned pointer to the storage requested. -*/ -void* malloc_aligned(size_t size) -{ - char* p; - char* base; - base = (char*)my_malloc(size + sizeof(void*) + 15, MYF(MY_WME)); - if (likely(base)) - { - p = (char*)roundToQuadWordBdy(base + sizeof(void*)); - char** p2 = (char**)(p - sizeof(void*)); - *p2 = base; - } - else - p = NULL; - - return p; -} - -/** - Free a 16-byte aligned space alloced by malloc_aligned - - @details We know that a pointer to the true malloced storage immediately - precedes the aligned address, so we pull that out and call my_free(). - - @parm p A 16-byte aligned pointer generated by malloc_aligned -*/ -void free_aligned(void* p) -{ - if (likely(p)) - { - my_free(*(char**)((char*)p-sizeof(void*))); - } -} - -#endif diff --git a/storage/ibmdb2i/db2i_iconv.h b/storage/ibmdb2i/db2i_iconv.h deleted file mode 100644 index 9fc6e4ed636..00000000000 --- a/storage/ibmdb2i/db2i_iconv.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -/** - @file - - @brief Used to redefine iconv symbols to the optimized "myconv" ones -*/ - -#ifndef DB2I_ICONV_H -#define DB2I_ICONV_H - -#include "db2i_myconv.h" -#define iconv_open(A, B) myconv_open(A, B, CONVERTER_DMAP) -#define iconv_close myconv_close -#define iconv myconv_dmap -#define iconv_t myconv_t - -#endif diff --git a/storage/ibmdb2i/db2i_ileBridge.cc b/storage/ibmdb2i/db2i_ileBridge.cc deleted file mode 100644 index fac98dd7107..00000000000 --- a/storage/ibmdb2i/db2i_ileBridge.cc +++ /dev/null @@ -1,1342 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#include "db2i_ileBridge.h" -#include "my_dbug.h" -#include "db2i_global.h" -#include "db2i_charsetSupport.h" -#include "db2i_errors.h" - - -// static class member data -ILEpointer* db2i_ileBridge::functionSymbols; -db2i_ileBridge* db2i_ileBridge::globalBridge; -#ifndef DBUG_OFF -uint32 db2i_ileBridge::registeredPtrs; -#endif - -pthread_key(IleParms*, THR_ILEPARMS); - -static void ileParmsDtor(void* parmsToFree) -{ - if (parmsToFree) - { - free_aligned(parmsToFree); - DBUG_PRINT("db2i_ileBridge", ("Freeing space for parms")); - } -} - - -/** - Convert a timestamp in ILE time format into a unix time_t -*/ -static inline time_t convertILEtime(const ILE_time_t& input) -{ - tm temp; - - temp.tm_sec = input.Second; - temp.tm_min = input.Minute; - temp.tm_hour = input.Hour; - temp.tm_mday = input.Day; - temp.tm_mon = input.Month-1; - temp.tm_year = input.Year - 1900; - temp.tm_isdst = -1; - - return mktime(&temp); -} - -/** - Allocate and intialize a new bridge structure -*/ -db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE connID) -{ - DBUG_PRINT("db2i_ileBridge::createNewBridge",("Building new bridge...")); - db2i_ileBridge* newBridge = (db2i_ileBridge*)my_malloc(sizeof(db2i_ileBridge), MYF(MY_WME)); - - if (unlikely(newBridge == NULL)) - return NULL; - - newBridge->stmtTxActive = false; - newBridge->connErrText = NULL; - newBridge->pendingLockedHandles.head = NULL; - newBridge->cachedConnectionID = connID; - - return newBridge; -} - - -void db2i_ileBridge::destroyBridge(db2i_ileBridge* bridge) -{ - bridge->freeErrorStorage(); - my_free(bridge); -} - - -void db2i_ileBridge::destroyBridgeForThread(const THD* thd) -{ - void* thdData = *thd_ha_data(thd, ibmdb2i_hton); - if (thdData != NULL) - { - destroyBridge((db2i_ileBridge*)thdData); - } -} - - -void db2i_ileBridge::registerPtr(const void* ptr, ILEMemHandle* receiver) -{ - static const arg_type_t ileSignature[] = { ARG_MEMPTR, ARG_END }; - - if (unlikely(ptr == NULL)) - { - *receiver = 0; - return; - } - - struct ArgList - { - ILEarglist_base base; - ILEpointer ptr; - } *arguments; - - char argBuf[sizeof(ArgList)+15]; - arguments = (ArgList*)roundToQuadWordBdy(argBuf); - - arguments->ptr.s.addr = (address64_t)(ptr); - - _ILECALL(&functionSymbols[funcRegisterSpace], - &arguments->base, - ileSignature, - RESULT_INT64); - -#ifndef DBUG_OFF - uint32 truncHandle = arguments->base.result.r_uint64; - DBUG_PRINT("db2i_ileBridge::registerPtr",("Register 0x%p with handle %d", ptr, truncHandle)); - getBridgeForThread()->registeredPtrs++; -#endif - - *receiver = arguments->base.result.r_uint64; - return; -} - -void db2i_ileBridge::unregisterPtr(ILEMemHandle handle) -{ - static const arg_type_t ileSignature[] = { ARG_UINT64, ARG_END }; - - if (unlikely(handle == NULL)) - return; - - struct ArgList - { - ILEarglist_base base; - uint64 handle; - } *arguments; - - char argBuf[sizeof(ArgList)+15]; - arguments = (ArgList*)roundToQuadWordBdy(argBuf); - - arguments->handle = (uint64)(handle); - - _ILECALL(&functionSymbols[funcUnregisterSpace], - &arguments->base, - ileSignature, - RESULT_VOID); - -#ifndef DBUG_OFF - DBUG_PRINT("db2i_ileBridge::unregisterPtr",("Unregister handle %d", (uint32)handle)); - getBridgeForThread()->registeredPtrs--; -#endif -} - - - -/** - Initialize the bridge component - - @details Resolves srvpgm and function names of the APIs. If this fails, - the approrpiate operating system support (PTFs) is probably not installed. - - WARNING: - Must be called before any other functions in this class are used!!!! - Can only be called by a single thread! -*/ -int db2i_ileBridge::setup() -{ - static const char funcNames[db2i_ileBridge::funcListEnd][32] = - { - {"QmyRegisterParameterSpaces"}, - {"QmyRegisterSpace"}, - {"QmyUnregisterSpace"}, - {"QmyProcessRequest"} - }; - - DBUG_ENTER("db2i_ileBridge::setup"); - - int actmark = _ILELOAD("QSYS/QMYSE", ILELOAD_LIBOBJ); - if ( actmark == -1 ) - { - DBUG_PRINT("db2i_ileBridge::setup", ("srvpgm activation failed")); - DBUG_RETURN(1); - } - - functionSymbols = (ILEpointer*)malloc_aligned(sizeof(ILEpointer) * db2i_ileBridge::funcListEnd); - - for (int i = 0; i < db2i_ileBridge::funcListEnd; i++) - { - if (_ILESYM(&functionSymbols[i], actmark, funcNames[i]) == -1) - { - DBUG_PRINT("db2i_ileBridge::setup", - ("resolve of %s failed", funcNames[i])); - DBUG_RETURN(errno); - } - } - - pthread_key_create(&THR_ILEPARMS, &ileParmsDtor); - -#ifndef DBUG_OFF - registeredPtrs = 0; -#endif - - globalBridge = createNewBridge(0); - - DBUG_RETURN(0); -} - -/** - Cleanup any resources before shutting down plug-in -*/ -void db2i_ileBridge::takedown() -{ - if (globalBridge) - destroyBridge(globalBridge); - free_aligned(functionSymbols); -} - -/** - Call off to QmyProcessRequest to perform the API that the caller prepared -*/ -inline int32 db2i_ileBridge::doIt() -{ - static const arg_type_t ileSignature[] = {ARG_END}; - - struct ArgList - { - ILEarglist_base base; - } *arguments; - - char argBuf[sizeof(ArgList)+15]; - arguments = (ArgList*)roundToQuadWordBdy(argBuf); - - _ILECALL(&functionSymbols[funcProcessRequest], - &arguments->base, - ileSignature, - RESULT_INT32); - - return translateErrorCode(arguments->base.result.s_int32.r_int32); -} - -/** - Call off to QmyProcessRequest to perform the API that the caller prepared and - log any errors that may occur. -*/ -inline int32 db2i_ileBridge::doItWithLog() -{ - int32 rc = doIt(); - - if (unlikely(rc)) - { - // Only report errors that we weren't expecting - if (rc != tacitErrors[0] && - rc != tacitErrors[1] && - rc != QMY_ERR_END_OF_BLOCK) - reportSystemAPIError(rc, (Qmy_Error_output_t*)parms()->outParms); - } - memset(tacitErrors, 0, sizeof(tacitErrors)); - - return rc; -} - - -/** - Interface to QMY_ALLOCATE_SHARE API - - See QMY_ALLOCATE_SHARE documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::allocateFileDefn(ILEMemHandle definitionSpace, - ILEMemHandle handleSpace, - uint16 fileCount, - const char* schemaName, - uint16 schemaNameLength, - ILEMemHandle formatSpace, - uint32 formatSpaceLen) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - - IleParms* parmBlock = parms(); - Qmy_MAOS0100 *input = (Qmy_MAOS0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_ALLOCATE_SHARE; - input->ShrDefSpcHnd = definitionSpace; - input->ShrHndSpcHnd = handleSpace; - input->ShrDefCnt = fileCount; - input->FmtSpcHnd = formatSpace; - input->FmtSpcLen = formatSpaceLen; - - if (schemaNameLength > sizeof(input->SchNam)) - { - // This should never happen! - DBUG_ASSERT(0); - return HA_ERR_GENERIC; - } - - memcpy(input->SchNam, schemaName, schemaNameLength); - input->SchNamLen = schemaNameLength; - - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_ALLOCATE_INSTANCE API - - See QMY_ALLOCATE_INSTANCE documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::allocateFileInstance(FILE_HANDLE defnHandle, - ILEMemHandle inuseSpace, - FILE_HANDLE* instance) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - - IleParms* parmBlock = parms(); - Qmy_MAOI0100 *input = (Qmy_MAOI0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_ALLOCATE_INSTANCE; - input->ShrHnd = defnHandle; - input->CnnHnd = cachedConnectionID; - input->UseSpcHnd = inuseSpace; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MAOI0100_output* output = (Qmy_MAOI0100_output*)parmBlock->outParms; - DBUG_ASSERT(instance); - *instance = output->ObjHnd; - } - - return rc; -} - - -/** - Interface to QMY_DEALLOCATE_OBJECT API - - See QMY_DEALLOCATE_OBJECT documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::deallocateFile(FILE_HANDLE rfileHandle, - bool postDropTable) -{ - IleParms* parmBlock = parms(); - Qmy_MDLC0100 *input = (Qmy_MDLC0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DEALLOCATE_OBJECT; - input->ObjHnd = rfileHandle; - input->ObjDrp[0] = (postDropTable ? QMY_YES : QMY_NO); - - DBUG_PRINT("db2i_ileBridge::deallocateFile", ("Deallocating %d", (uint32)rfileHandle)); - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_OBJECT_INITIALIZATION API - - See QMY_OBJECT_INITIALIZATION documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::initFileForIO(FILE_HANDLE rfileHandle, - char accessIntent, - char commitLevel, - uint16* inRecSize, - uint16* inRecNullOffset, - uint16* outRecSize, - uint16* outRecNullOffset) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MOIX0100 *input = (Qmy_MOIX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_OBJECT_INITIALIZATION; - input->CmtLvl[0] = commitLevel; - input->Intent[0] = accessIntent; - input->ObjHnd = rfileHandle; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MOIX0100_output* output = (Qmy_MOIX0100_output*)parmBlock->outParms; - *inRecSize = output->InNxtRowOff; - *inRecNullOffset = output->InNullMapOff; - *outRecSize = output->OutNxtRowOff; - *outRecNullOffset = output->OutNullMapOff; - } - - return rc; -} - - -/** - Interface to QMY_READ_ROWS API for reading a row with a specific RRN. - - See QMY_READ_ROWS documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::readByRRN(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - uint32 inRRN, - char accessIntent, - char commitLevel) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MRDX0100 *input = (Qmy_MRDX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_READ_ROWS; - input->CmtLvl[0] = commitLevel; - input->ObjHnd = rfileHandle; - input->Intent[0] = accessIntent; - input->OutSpcHnd = (uint64)buf; - input->RelRowNbr = inRRN; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - if (rc == QMY_ERR_END_OF_BLOCK) - { - rc = 0; - DBUG_PRINT("db2i_ileBridge::readByRRN", ("End of block signalled")); - } - - return rc; -} - - -/** - Interface to QMY_WRITE_ROWS API. - - See QMY_WRITE_ROWS documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::writeRows(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - char commitLevel, - int64* outIdVal, - bool* outIdGen, - uint32* dupKeyRRN, - char** dupKeyName, - uint32* dupKeyNameLen, - uint32* outIdIncrement) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MWRT0100 *input = (Qmy_MWRT0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_WRITE_ROWS; - input->CmtLvl[0] = commitLevel; - - input->ObjHnd = rfileHandle; - input->InSpcHnd = (uint64_t) buf; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - Qmy_MWRT0100_output_t* output = (Qmy_MWRT0100_output_t*)parmBlock->outParms; - if (likely(rc == 0 || rc == HA_ERR_FOUND_DUPP_KEY)) - { - DBUG_ASSERT(dupKeyRRN && dupKeyName && dupKeyNameLen && outIdGen && outIdIncrement && outIdVal); - *dupKeyRRN = output->DupRRN; - *dupKeyName = (char*)parmBlock->outParms + output->DupObjNamOff; - *dupKeyNameLen = output->DupObjNamLen; - *outIdGen = (output->NewIdGen[0] == QMY_YES ? TRUE : FALSE); - if (*outIdGen == TRUE) - { - *outIdIncrement = output->IdIncrement; - *outIdVal = output->NewIdVal; - } - } - - return rc; - -} - -/** - Interface to QMY_EXECUTE_IMMEDIATE API. - - See QMY_EXECUTE_IMMEDIATE documentation for more information about - parameters and return codes. -*/ -uint32 db2i_ileBridge::execSQL(const char* statement, - uint32 statementCount, - uint8 commitLevel, - bool autoCreateSchema, - bool dropSchema, - bool noCommit, - FILE_HANDLE fileHandle) - -{ - IleParms* parmBlock = parms(); - Qmy_MSEI0100 *input = (Qmy_MSEI0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_EXECUTE_IMMEDIATE; - - registerPtr(statement, &input->StmtsSpcHnd); - - input->NbrStmts = statementCount; - *(uint16*)(&input->StmtCCSID) = 850; - input->AutoCrtSchema[0] = (autoCreateSchema == TRUE ? QMY_YES : QMY_NO); - input->DropSchema[0] = (dropSchema == TRUE ? QMY_YES : QMY_NO); - input->CmtLvl[0] = commitLevel; - if ((commitLevel == QMY_NONE && statementCount == 1) || noCommit) - { - input->CmtBefore[0] = QMY_NO; - input->CmtAfter[0] = QMY_NO; - } - else - { - input->CmtBefore[0] = QMY_YES; - input->CmtAfter[0] = QMY_YES; - } - input->CnnHnd = current_thd->thread_id; - input->ObjHnd = fileHandle; - - int32 rc = doItWithLog(); - - unregisterPtr(input->StmtsSpcHnd); - - return rc; -} - -/** - Interface to QMY_PREPARE_OPEN_CURSOR API. - - See QMY_PREPARE_OPEN_CURSOR documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::prepOpen(const char* statement, - FILE_HANDLE* rfileHandle, - uint32* recLength) -{ - IleParms* parmBlock = parms(); - Qmy_MSPO0100 *input = (Qmy_MSPO0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_PREPARE_OPEN_CURSOR; - - registerPtr(statement, &input->StmtsSpcHnd ); - *(uint16*)(&input->StmtCCSID) = 850; - input->CnnHnd = current_thd->thread_id; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MSPO0100_output* output = (Qmy_MSPO0100_output*)parmBlock->outParms; - *rfileHandle = output->ObjHnd; - *recLength = max(output->InNxtRowOff, output->OutNxtRowOff); - } - - - unregisterPtr(input->StmtsSpcHnd); - - return rc; -} - - -/** - Interface to QMY_DELETE_ROW API. - - See QMY_DELETE_ROW documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::deleteRow(FILE_HANDLE rfileHandle, - uint32 rrn) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MDLT0100 *input = (Qmy_MDLT0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DELETE_ROW; - input->ObjHnd = rfileHandle; - input->RelRowNbr = rrn; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_UPDATE_ROW API. - - See QMY_UPDATE_ROW documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::updateRow(FILE_HANDLE rfileHandle, - uint32 rrn, - ILEMemHandle buf, - uint32* dupKeyRRN, - char** dupKeyName, - uint32* dupKeyNameLen) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MUPD0100 *input = (Qmy_MUPD0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_UPDATE_ROW; - input->ObjHnd = rfileHandle; - input->InSpcHnd = (uint64)buf; - input->RelRowNbr = rrn; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - if (rc == HA_ERR_FOUND_DUPP_KEY) - { - Qmy_MUPD0100_output* output = (Qmy_MUPD0100_output*)parmBlock->outParms; - DBUG_ASSERT(dupKeyRRN && dupKeyName && dupKeyNameLen); - *dupKeyRRN = output->DupRRN; - *dupKeyName = (char*)parmBlock->outParms + output->DupObjNamOff; - *dupKeyNameLen = output->DupObjNamLen; - } - - return rc; -} - -/** - Interface to QMY_DESCRIBE_RANGE API. - - See QMY_DESCRIBE_RANGE documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::recordsInRange(FILE_HANDLE defnHandle, - ILEMemHandle inSpc, - uint32 inKeyCnt, - uint32 inLiteralCnt, - uint32 inBoundsOff, - uint32 inLitDefOff, - uint32 inLiteralsOff, - uint32 inCutoff, - uint32 inSpcLen, - uint16 inEndByte, - uint64* outRecCnt, - uint16* outRtnCode) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - - IleParms* parmBlock = parms(); - Qmy_MDRG0100 *input = (Qmy_MDRG0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DESCRIBE_RANGE; - input->ShrHnd = defnHandle; - input->SpcHnd = (uint64)inSpc; - input->KeyCnt = inKeyCnt; - input->LiteralCnt = inLiteralCnt; - input->BoundsOff = inBoundsOff; - input->LitDefOff = inLitDefOff; - input->LiteralsOff = inLiteralsOff; - input->Cutoff = inCutoff; - input->SpcLen = inSpcLen; - input->EndByte = inEndByte; - input->CnnHnd = cachedConnectionID; - - int rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MDRG0100_output* output = (Qmy_MDRG0100_output*)parmBlock->outParms; - DBUG_ASSERT(outRecCnt && outRtnCode); - *outRecCnt = output->RecCnt; - *outRtnCode = output->RtnCode; - } - - return rc; -} - - -/** - Interface to QMY_RELEASE_ROW API. - - See QMY_RELEASE_ROW documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::rrlslck(FILE_HANDLE rfileHandle, char accessIntent) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - - IleParms* parmBlock = parms(); - Qmy_MRRX0100 *input = (Qmy_MRRX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_RELEASE_ROW; - - input->ObjHnd = rfileHandle; - input->CnnHnd = cachedConnectionID; - input->Intent[0] = accessIntent; - - int32 rc = doItWithLog(); - - return rc; -} - -/** - Interface to QMY_LOCK_OBJECT API. - - See QMY_LOCK_OBJECT documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::lockObj(FILE_HANDLE defnHandle, - uint64 lockVal, - char lockAction, - char lockType, - char lockTimeout) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MOLX0100 *input = (Qmy_MOLX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_LOCK_OBJECT; - input->ShrHnd = defnHandle; - input->LckTimeoutVal = lockVal; - input->Action[0] = lockAction; - input->LckTyp[0] = lockType; - input->LckTimeout[0] = lockTimeout; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - -/** - Interface to QMY_DESCRIBE_CONSTRAINTS API. - - See QMY_DESCRIBE_CONSTRAINTS documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::constraints(FILE_HANDLE defnHandle, - ILEMemHandle inSpc, - uint32 inSpcLen, - uint32* outLen, - uint32* outCnt) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MDCT0100 *input = (Qmy_MDCT0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DESCRIBE_CONSTRAINTS; - input->ShrHnd = defnHandle; - input->CstSpcHnd = (uint64)inSpc; - input->CstSpcLen = inSpcLen; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MDCT0100_output* output = (Qmy_MDCT0100_output*)parmBlock->outParms; - DBUG_ASSERT(outLen && outCnt); - *outLen = output->NeededLen; - *outCnt = output->CstCnt; - } - - return rc; -} - - -/** - Interface to QMY_REORGANIZE_TABLE API. - - See QMY_REORGANIZE_TABLE documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::optimizeTable(FILE_HANDLE defnHandle) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MRGX0100 *input = (Qmy_MRGX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_REORGANIZE_TABLE; - input->ShrHnd = defnHandle; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_PROCESS_COMMITMENT_CONTROL API. - - See QMY_PROCESS_COMMITMENT_CONTROL documentation for more information about - parameters and return codes. -*/ -int32 db2i_ileBridge::commitmentControl(uint8 function) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MCCX0100 *input = (Qmy_MCCX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_PROCESS_COMMITMENT_CONTROL; - input->Function[0] = function; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_PROCESS_SAVEPOINT API. - - See QMY_PROCESS_SAVEPOINT documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::savepoint(uint8 function, - const char* savepointName) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - DBUG_PRINT("db2i_ileBridge::savepoint",("%d %s", (uint32)function, savepointName)); - - IleParms* parmBlock = parms(); - Qmy_MSPX0100 *input = (Qmy_MSPX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - char* savPtNam = (char*)(input+1); - - input->Format = QMY_PROCESS_SAVEPOINT; - - if (strlen(savepointName) > MAX_DB2_SAVEPOINTNAME_LENGTH) - { - DBUG_ASSERT(0); - return HA_ERR_GENERIC; - } - strcpy(savPtNam, savepointName); - - input->Function[0] = function; - input->SavPtNamOff = savPtNam - (char*)(input); - input->SavPtNamLen = strlen(savepointName); - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - -static ILEMemHandle traceSpcHandle; -/** - Do initialization for the QMY_* APIs. - - @parm aspName The name of the relational database to use for all - connections. - - @return 0 if successful; error otherwise -*/ -int32 db2i_ileBridge::initILE(const char* aspName, - uint16* traceCtlPtr) -{ - // We forego the typical thread-based parms space because MySQL doesn't - // allow us to clean it up before checking for memory leaks. As a result - // we get a complaint about leaked memory on server shutdown. - int32 rc; - char inParms[db2i_ileBridge_MAX_INPARM_SIZE]; - char outParms[db2i_ileBridge_MAX_OUTPARM_SIZE]; - if (rc = registerParmSpace(inParms, outParms)) - { - reportSystemAPIError(rc, NULL); - return rc; - } - - registerPtr(traceCtlPtr, &traceSpcHandle); - - struct ParmBlock - { - Qmy_MINI0100 parms; - } *parmBlock = (ParmBlock*)inParms; - - memset(inParms, 0, sizeof(ParmBlock)); - - parmBlock->parms.Format = QMY_INITIALIZATION; - - char paddedName[18]; - if (strlen(aspName) > sizeof(paddedName)) - { - getErrTxt(DB2I_ERR_BAD_RDB_NAME); - return DB2I_ERR_BAD_RDB_NAME; - } - - memset(paddedName, ' ', sizeof(paddedName)); - memcpy(paddedName, aspName, strlen(aspName)); - convToEbcdic(paddedName, parmBlock->parms.RDBName, strlen(paddedName)); - - parmBlock->parms.RDBNamLen = strlen(paddedName); - parmBlock->parms.TrcSpcHnd = traceSpcHandle; - - rc = doIt(); - - if (rc) - { - reportSystemAPIError(rc, (Qmy_Error_output_t*)outParms); - } - - return rc; -} - -/** - Signal to the QMY_ APIs to perform any cleanup they need to do. -*/ -int32 db2i_ileBridge::exitILE() -{ - IleParms* parmBlock = parms(); - Qmy_MCLN0100 *input = (Qmy_MCLN0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_CLEANUP; - - int32 rc = doIt(); - - if (rc) - { - reportSystemAPIError(rc, (Qmy_Error_output_t*)parmBlock->outParms); - } - - unregisterPtr(traceSpcHandle); - - DBUG_PRINT("db2i_ileBridge::exitILE", ("Registered ptrs remaining: %d", registeredPtrs)); -#ifndef DBUG_OFF - if (registeredPtrs != 0) - printf("Oh no! IBMDB2I left some pointers registered. Count was %d.\n", registeredPtrs); -#endif - - // This is needed to prevent SAFE_MALLOC from complaining at process termination. - my_pthread_setspecific_ptr(THR_ILEPARMS, NULL); - free_aligned(parmBlock); - - return rc; - -} - - -/** - Designate the specified addresses as parameter passing buffers. - - @parm in Input to the API will go here; format is defined by the individual API - @parm out Output from the API will be; format is defined by the individual API - - @return 0 if success; error otherwise -*/ -int db2i_ileBridge::registerParmSpace(char* in, char* out) -{ - static const arg_type_t ileSignature[] = { ARG_MEMPTR, ARG_MEMPTR, ARG_END }; - - struct ArgList - { - ILEarglist_base base; - ILEpointer input; - ILEpointer output; - } *arguments; - - char argBuf[sizeof(ArgList)+15]; - arguments = (ArgList*)roundToQuadWordBdy(argBuf); - - arguments->input.s.addr = (address64_t)(in); - arguments->output.s.addr = (address64_t)(out); - - _ILECALL(&functionSymbols[funcRegisterParameterSpaces], - &arguments->base, - ileSignature, - RESULT_INT32); - - return arguments->base.result.s_int32.r_int32; -} - - -/** - Interface to QMY_OBJECT_OVERRIDE API. - - See QMY_OBJECT_OVERRIDE documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::objectOverride(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - uint32 recordWidth) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MOOX0100 *input = (Qmy_MOOX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_OBJECT_OVERRIDE; - input->ObjHnd = rfileHandle; - input->OutSpcHnd = (uint64)buf; - input->NxtRowOff = recordWidth; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - return rc; -} - -/** - Interface to QMY_DESCRIBE_OBJECT API for obtaining table stats. - - See QMY_DESCRIBE_OBJECT documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::retrieveTableInfo(FILE_HANDLE defnHandle, - uint16 dataRequested, - ha_statistics& stats, - ILEMemHandle inSpc) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MDSO0100 *input = (Qmy_MDSO0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DESCRIBE_OBJECT; - input->ShrHnd = defnHandle; - input->CnnHnd = cachedConnectionID; - - if (dataRequested & objLength) - input->RtnObjLen[0] = QMY_YES; - if (dataRequested & rowCount) - input->RtnRowCnt[0] = QMY_YES; - if (dataRequested & deletedRowCount) - input->RtnDltRowCnt[0] = QMY_YES; - if (dataRequested & rowsPerKey) - { - input->RowKeyHnd = (uint64)inSpc; - input->RtnRowKey[0] = QMY_YES; - } - if (dataRequested & meanRowLen) - input->RtnMeanRowLen[0] = QMY_YES; - if (dataRequested & lastModTime) - input->RtnModTim[0] = QMY_YES; - if (dataRequested & createTime) - input->RtnCrtTim[0] = QMY_YES; - if (dataRequested & ioCount) - input->RtnEstIoCnt[0] = QMY_YES; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MDSO0100_output* output = (Qmy_MDSO0100_output*)parmBlock->outParms; - if (dataRequested & objLength) - stats.data_file_length = output->ObjLen; - if (dataRequested & rowCount) - stats.records= output->RowCnt; - if (dataRequested & deletedRowCount) - stats.deleted = output->DltRowCnt; - if (dataRequested & meanRowLen) - stats.mean_rec_length = output->MeanRowLen; - if (dataRequested & lastModTime) - stats.update_time = convertILEtime(output->ModTim); - if (dataRequested & createTime) - stats.create_time = convertILEtime(output->CrtTim); - if (dataRequested & ioCount) - stats.data_file_length = output->EstIoCnt; - } - - return rc; -} - -/** - Interface to QMY_DESCRIBE_OBJECT API for finding index size. - - See QMY_DESCRIBE_OBJECT documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::retrieveIndexInfo(FILE_HANDLE defnHandle, - uint64* outPageCnt) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MDSO0100 *input = (Qmy_MDSO0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_DESCRIBE_OBJECT; - input->ShrHnd = defnHandle; - input->CnnHnd = cachedConnectionID; - input->RtnPageCnt[0] = QMY_YES; - - int32 rc = doItWithLog(); - - if (likely(rc == 0)) - { - Qmy_MDSO0100_output* output = (Qmy_MDSO0100_output*)parmBlock->outParms; - *outPageCnt = output->PageCnt; - } - - return rc; -} - - -/** - Interface to QMY_CLOSE_CONNECTION API - - See QMY_CLOSE_CONNECTION documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::closeConnection(CONNECTION_HANDLE conn) -{ - IleParms* parmBlock = parms(); - Qmy_MCCN0100 *input = (Qmy_MCCN0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_CLOSE_CONNECTION; - input->CnnHnd = conn; - - int32 rc = doItWithLog(); - - return rc; -} - - -/** - Interface to QMY_INTERRUPT API - - See QMY_INTERRUPT documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::readInterrupt(FILE_HANDLE fileHandle) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MINT0100 *input = (Qmy_MINT0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_INTERRUPT; - input->CnnHnd = cachedConnectionID; - input->ObjHnd = fileHandle; - - int32 rc = doItWithLog(); - - if (rc == QMY_ERR_END_OF_BLOCK) - { - rc = 0; - DBUG_PRINT("db2i_ileBridge::readInterrupt", ("End of block signalled")); - } - - return rc; -} - -/** - Interface to QMY_READ_ROWS API - - See QMY_READ_ROWS documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::read(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - char accessIntent, - char commitLevel, - char orientation, - bool asyncRead, - ILEMemHandle rrn, - ILEMemHandle key, - uint32 keylen, - uint16 keyParts, - int pipeFD) -{ - DBUG_ASSERT(cachedStateIsCoherent()); - IleParms* parmBlock = parms(); - Qmy_MRDX0100 *input = (Qmy_MRDX0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_READ_ROWS; - input->CmtLvl[0] = commitLevel; - - input->ObjHnd = rfileHandle; - input->Intent[0] = accessIntent; - input->OutSpcHnd = (uint64)buf; - input->OutRRNSpcHnd = (uint64)rrn; - input->RtnData[0] = QMY_RETURN_DATA; - - if (key) - { - input->KeySpcHnd = (uint64)key; - input->KeyColsLen = keylen; - input->KeyColsNbr = keyParts; - } - - input->Async[0] = (asyncRead ? QMY_YES : QMY_NO); - input->PipeDesc = pipeFD; - input->Orientation[0] = orientation; - input->CnnHnd = cachedConnectionID; - - int32 rc = doItWithLog(); - - // QMY_ERR_END_OF_BLOCK is informational only, so we ignore it. - if (rc == QMY_ERR_END_OF_BLOCK) - { - rc = 0; - DBUG_PRINT("db2i_ileBridge::read", ("End of block signalled")); - } - - return rc; -} - - -/** - Interface to QMY_QUIESCE_OBJECT API - - See QMY_QUIESCE_OBJECT documentation for more information about parameters and - return codes. -*/ -int32 db2i_ileBridge::quiesceFileInstance(FILE_HANDLE rfileHandle) -{ - IleParms* parmBlock = parms(); - Qmy_MQSC0100 *input = (Qmy_MQSC0100*)&(parmBlock->inParms); - memset(input, 0, sizeof(*input)); - - input->Format = QMY_QUIESCE_OBJECT; - input->ObjHnd = rfileHandle; - - int32 rc = doItWithLog(); - -#ifndef DBUG_OFF - if (unlikely(rc)) - { - DBUG_ASSERT(0); - } -#endif - - return rc; -} - -void db2i_ileBridge::PreservedHandleList::add(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share) -{ - NameHandlePair *newPair = (NameHandlePair*)my_malloc(sizeof(NameHandlePair), MYF(MY_WME)); - - newPair->next = head; - head = newPair; - - strcpy(newPair->name, newname); - newPair->handle = newhandle; - newPair->share = share; - DBUG_PRINT("db2i_ileBridge", ("Added handle %d for %s", uint32(newhandle), newname)); -} - - -FILE_HANDLE db2i_ileBridge::PreservedHandleList::findAndRemove(const char* fileName, IBMDB2I_SHARE** share) -{ - NameHandlePair* current = head; - NameHandlePair* prev = NULL; - - while (current) - { - NameHandlePair* next = current->next; - if (strcmp(fileName, current->name) == 0) - { - FILE_HANDLE tmp = current->handle; - *share = current->share; - if (prev) - prev->next = next; - if (current == head) - head = next; - my_free(current); - DBUG_PRINT("db2i_ileBridge", ("Found handle %d for %s", uint32(tmp), fileName)); - return tmp; - } - prev = current; - current = next; - } - - return 0; -} - - -IleParms* db2i_ileBridge::initParmsForThread() -{ - - IleParms* p = (IleParms*)malloc_aligned(sizeof(IleParms)); - DBUG_ASSERT((uint64)(&(p->outParms))% 16 == 0); // Guarantee that outParms are aligned correctly - - if (likely(p)) - { - int32 rc = registerParmSpace((p->inParms), (p->outParms)); - if (likely(rc == 0)) - { - my_pthread_setspecific_ptr(THR_ILEPARMS, p); - DBUG_PRINT("db2i_ileBridge", ("Inited space for parms")); - return p; - } - else - reportSystemAPIError(rc, NULL); - } - - return NULL; -} - diff --git a/storage/ibmdb2i/db2i_ileBridge.h b/storage/ibmdb2i/db2i_ileBridge.h deleted file mode 100644 index 3a3ca141f69..00000000000 --- a/storage/ibmdb2i/db2i_ileBridge.h +++ /dev/null @@ -1,499 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_ILEBRIDGE_H -#define DB2I_ILEBRIDGE_H - -#include "db2i_global.h" -#include "mysql_priv.h" -#include "as400_types.h" -#include "as400_protos.h" -#include "qmyse.h" -#include "db2i_errors.h" - -typedef uint64_t FILE_HANDLE; -typedef my_thread_id CONNECTION_HANDLE; -const char SAVEPOINT_NAME[] = {0xD4,0xE2,0xD7,0xC9,0xD5,0xE3,0xC5,0xD9,0xD5,0x0}; -const uint32 TACIT_ERRORS_SIZE=2; - -enum db2i_InfoRequestSpec -{ - objLength = 1, - rowCount = 2, - deletedRowCount = 4, - rowsPerKey = 8, - meanRowLen = 16, - lastModTime = 32, - createTime = 64, - ioCount = 128 -}; - -extern handlerton *ibmdb2i_hton; -struct IBMDB2I_SHARE; - -const uint32 db2i_ileBridge_MAX_INPARM_SIZE = 512; -const uint32 db2i_ileBridge_MAX_OUTPARM_SIZE = 512; - -extern pthread_key(IleParms*, THR_ILEPARMS); -struct IleParms -{ - char inParms[db2i_ileBridge_MAX_INPARM_SIZE]; - char outParms[db2i_ileBridge_MAX_OUTPARM_SIZE]; -}; - -/** - @class db2i_ileBridge - - Implements a connection-based interface to the QMY_* APIs - - @details Each client connection that touches an IBMDB2I table has a "bridge" - associated with it. This bridge is constructed on first use and provides a - more C-like interface to the APIs. As well, it is reponsible for tracking - connection scoped information such as statement transaction state and error - message text. The bridge is destroyed when the connection ends. -*/ -class db2i_ileBridge -{ - enum ileFuncs - { - funcRegisterParameterSpaces, - funcRegisterSpace, - funcUnregisterSpace, - funcProcessRequest, - funcListEnd - }; - - static db2i_ileBridge* globalBridge; -public: - - - static int setup(); - static void takedown(); - - /** - Obtain a pointer to the bridge for the current connection. - - If a MySQL client connection is on the stack, we get the associated brideg. - Otherwise, we use the globalBridge. - */ - static db2i_ileBridge* getBridgeForThread() - { - THD* thd = current_thd; - if (likely(thd)) - return getBridgeForThread(thd); - - return globalBridge; - } - - /** - Obtain a pointer to the bridge for the specified connection. - - If a bridge exists already, we return it immediately. Otherwise, prepare - a new bridge for the connection. - */ - static db2i_ileBridge* getBridgeForThread(const THD* thd) - { - void* thdData = *thd_ha_data(thd, ibmdb2i_hton); - if (likely(thdData != NULL)) - return (db2i_ileBridge*)(thdData); - - db2i_ileBridge* newBridge = createNewBridge(thd->thread_id); - *thd_ha_data(thd, ibmdb2i_hton) = (void*)newBridge; - return newBridge; - } - - static void destroyBridgeForThread(const THD* thd); - static void registerPtr(const void* ptr, ILEMemHandle* receiver); - static void unregisterPtr(ILEMemHandle handle); - int32 allocateFileDefn(ILEMemHandle definitionSpace, - ILEMemHandle handleSpace, - uint16 fileCount, - const char* schemaName, - uint16 schemaNameLength, - ILEMemHandle formatSpace, - uint32 formatSpaceLen); - int32 allocateFileInstance(FILE_HANDLE defnHandle, - ILEMemHandle inuseSpace, - FILE_HANDLE* instance); - int32 deallocateFile(FILE_HANDLE fileHandle, - bool postDropTable=FALSE); - int32 read(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - char accessIntent, - char commitLevel, - char orientation, - bool asyncRead = FALSE, - ILEMemHandle rrn = 0, - ILEMemHandle key = 0, - uint32 keylen = 0, - uint16 keyParts = 0, - int pipeFD = -1); - int32 readByRRN(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - uint32 inRRN, - char accessIntent, - char commitLevel); - int32 writeRows(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - char commitLevel, - int64* outIdVal, - bool* outIdGen, - uint32* dupKeyRRN, - char** dupKeyName, - uint32* dupKeyNameLen, - uint32* outIdIncrement); - uint32 execSQL(const char* statement, - uint32 statementCount, - uint8 commitLevel, - bool autoCreateSchema = FALSE, - bool dropSchema = FALSE, - bool noCommit = FALSE, - FILE_HANDLE fileHandle = 0); - int32 prepOpen(const char* statement, - FILE_HANDLE* rfileHandle, - uint32* recLength); - int32 deleteRow(FILE_HANDLE rfileHandle, - uint32 rrn); - int32 updateRow(FILE_HANDLE rfileHandle, - uint32 rrn, - ILEMemHandle buf, - uint32* dupKeyRRN, - char** dupKeyName, - uint32* dupKeyNameLen); - int32 commitmentControl(uint8 function); - int32 savepoint(uint8 function, - const char* savepointName); - int32 recordsInRange(FILE_HANDLE rfileHandle, - ILEMemHandle inSpc, - uint32 inKeyCnt, - uint32 inLiteralCnt, - uint32 inBoundsOff, - uint32 inLitDefOff, - uint32 inLiteralsOff, - uint32 inCutoff, - uint32 inSpcLen, - uint16 inEndByte, - uint64* outRecCnt, - uint16* outRtnCode); - int32 rrlslck(FILE_HANDLE rfileHandle, - char accessIntent); - int32 lockObj(FILE_HANDLE rfileHandle, - uint64 inTimeoutVal, - char inAction, - char inLockType, - char inTimeout); - int32 constraints(FILE_HANDLE rfileHandle, - ILEMemHandle inSpc, - uint32 inSpcLen, - uint32* outLen, - uint32* outCnt); - int32 optimizeTable(FILE_HANDLE rfileHandle); - static int32 initILE(const char* aspName, - uint16* traceCtlPtr); - int32 initFileForIO(FILE_HANDLE rfileHandle, - char accessIntent, - char commitLevel, - uint16* inRecSize, - uint16* inRecNullOffset, - uint16* outRecSize, - uint16* outRecNullOffset); - int32 readInterrupt(FILE_HANDLE fileHandle); - static int32 exitILE(); - - int32 objectOverride(FILE_HANDLE rfileHandle, - ILEMemHandle buf, - uint32 recordWidth = 0); - - int32 retrieveTableInfo(FILE_HANDLE rfileHandle, - uint16 dataRequested, - ha_statistics& stats, - ILEMemHandle inSpc = NULL); - - int32 retrieveIndexInfo(FILE_HANDLE rfileHandle, - uint64* outPageCnt); - - int32 closeConnection(CONNECTION_HANDLE conn); - int32 quiesceFileInstance(FILE_HANDLE rfileHandle); - - /** - Mark the beginning of a "statement transaction" - - @detail MySQL "statement transactions" (see sql/handler.cc) are implemented - as DB2 savepoints having a predefined name. - - @return 0 if successful; error otherwise - */ - uint32 beginStmtTx() - { - DBUG_ENTER("db2i_ileBridge::beginStmtTx"); - if (stmtTxActive) - DBUG_RETURN(0); - - stmtTxActive = true; - - DBUG_RETURN(savepoint(QMY_SET_SAVEPOINT, SAVEPOINT_NAME)); - } - - /** - Commit a "statement transaction" - - @return 0 if successful; error otherwise - */ - uint32 commitStmtTx() - { - DBUG_ENTER("db2i_ileBridge::commitStmtTx"); - DBUG_ASSERT(stmtTxActive); - stmtTxActive = false; - DBUG_RETURN(savepoint(QMY_RELEASE_SAVEPOINT, SAVEPOINT_NAME)); - } - - /** - Roll back a "statement transaction" - - @return 0 if successful; error otherwise - */ - uint32 rollbackStmtTx() - { - DBUG_ENTER("db2i_ileBridge::rollbackStmtTx"); - DBUG_ASSERT(stmtTxActive); - stmtTxActive = false; - DBUG_RETURN(savepoint(QMY_ROLLBACK_SAVEPOINT, SAVEPOINT_NAME)); - } - - - /** - Provide storage for generating error messages. - - This storage must persist until the error message is retrieved from the - handler instance. It is for this reason that we associate it with the bridge. - - @return Pointer to heap storage of MYSQL_ERRMSG_SIZE bytes - */ - char* getErrorStorage() - { - if (!connErrText) - { - connErrText = (char*)my_malloc(MYSQL_ERRMSG_SIZE, MYF(MY_WME)); - if (connErrText) connErrText[0] = 0; - } - - return connErrText; - } - - /** - Free storage for generating error messages. - */ - void freeErrorStorage() - { - if (likely(connErrText)) - { - my_free(connErrText); - connErrText = NULL; - } - } - - - /** - Store a file handle for later retrieval. - - If deallocateFile encounters a lock when trying to perform its operation, - the file remains allocated but must be deallocated later. This function - provides a way for the connection to "remember" that this deallocation is - still needed. - - @param newname The name of the file to be added - @param newhandle The handle associated with newname - - */ - void preserveHandle(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share) - { - pendingLockedHandles.add(newname, newhandle, share); - } - - /** - Retrieve a file handle stored by preserveHandle(). - - @param name The name of the file to be retrieved. - - @return The handle associated with name - */ - FILE_HANDLE findAndRemovePreservedHandle(const char* name, IBMDB2I_SHARE** share) - { - FILE_HANDLE hdl = pendingLockedHandles.findAndRemove(name, share); - return hdl; - } - - /** - Indicate which error messages should be suppressed on the next API call - - These functions are useful for ensuring that the provided error numbers - are returned if a failure occurs but do not cause a spurious error message - to be returned. - - @return A pointer to this instance - */ - db2i_ileBridge* expectErrors(int32 er1) - { - tacitErrors[0]=er1; - return this; - } - - db2i_ileBridge* expectErrors(int32 er1, int32 er2) - { - tacitErrors[0]=er1; - tacitErrors[1]=er2; - return this; - } - - /** - Obtain the IBM i system message that accompanied the last API failure. - - @return A pointer to the 7 character message ID. - */ - static const char* getErrorMsgID() - { - return ((Qmy_Error_output_t*)parms()->outParms)->MsgId; - } - - /** - Convert an API error code into the equivalent MySQL error code (if any) - - @param rc The QMYSE API error code - - @return If an equivalent exists, the MySQL error code; else rc - */ - static int32 translateErrorCode(int32 rc) - { - if (likely(rc == 0)) - return 0; - - switch (rc) - { - case QMY_ERR_KEY_NOT_FOUND: - return HA_ERR_KEY_NOT_FOUND; - case QMY_ERR_DUP_KEY: - return HA_ERR_FOUND_DUPP_KEY; - case QMY_ERR_END_OF_FILE: - return HA_ERR_END_OF_FILE; - case QMY_ERR_LOCK_TIMEOUT: - return HA_ERR_LOCK_WAIT_TIMEOUT; - case QMY_ERR_CST_VIOLATION: - return HA_ERR_NO_REFERENCED_ROW; - case QMY_ERR_TABLE_NOT_FOUND: - return HA_ERR_NO_SUCH_TABLE; - case QMY_ERR_NON_UNIQUE_KEY: - return ER_DUP_ENTRY; - case QMY_ERR_MSGID: - { - if (memcmp(getErrorMsgID(), DB2I_CPF503A, 7) == 0) - return HA_ERR_ROW_IS_REFERENCED; - if (memcmp(getErrorMsgID(), DB2I_SQL0538, 7) == 0) - return HA_ERR_CANNOT_ADD_FOREIGN; - } - } - return rc; - } - -private: - - static db2i_ileBridge* createNewBridge(CONNECTION_HANDLE connID); - static void destroyBridge(db2i_ileBridge* bridge); - static int registerParmSpace(char* in, char* out); - static int32 doIt(); - int32 doItWithLog(); - - static _ILEpointer *functionSymbols; ///< Array of ILE function pointers - CONNECTION_HANDLE cachedConnectionID; ///< The associated connection - bool stmtTxActive; ///< Inside statement transaction - char *connErrText; ///< Storage for error message - int32 tacitErrors[TACIT_ERRORS_SIZE]; ///< List of errors to be suppressed - - static IleParms* initParmsForThread(); - - /** - Get space for passing parameters to the QMY_* APIs - - @details A fixed-length parameter passing space is associated with each - pthread. This space is allocated and registered by initParmsForThread() - the first time a pthread works with a bridge. The space is cached away - and remains available until the pthread ends. It became necessary to - disassociate the parameter space from the bridge in order to support - future enhancements to MySQL that sever the one-to-one relationship between - pthreads and user connections. The QMY_* APIs scope a registered parameter - space to the thread that executes the register operation. - */ - static IleParms* parms() - { - IleParms* p = my_pthread_getspecific_ptr(IleParms*, THR_ILEPARMS); - if (likely(p)) - return p; - - return initParmsForThread(); - } - - class PreservedHandleList - { - friend db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE); - public: - void add(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share); - FILE_HANDLE findAndRemove(const char* fileName, IBMDB2I_SHARE** share); - - private: - struct NameHandlePair - { - char name[FN_REFLEN]; - FILE_HANDLE handle; - IBMDB2I_SHARE* share; - NameHandlePair* next; - }* head; - } pendingLockedHandles; - - -#ifndef DBUG_OFF - bool cachedStateIsCoherent() - { - return (current_thd->thread_id == cachedConnectionID); - } - - friend void db2i_ileBridge::unregisterPtr(ILEMemHandle); - friend void db2i_ileBridge::registerPtr(const void*, ILEMemHandle*); - static uint32 registeredPtrs; -#endif -}; - - - -#endif diff --git a/storage/ibmdb2i/db2i_ioBuffers.cc b/storage/ibmdb2i/db2i_ioBuffers.cc deleted file mode 100644 index 9525a6e34b5..00000000000 --- a/storage/ibmdb2i/db2i_ioBuffers.cc +++ /dev/null @@ -1,332 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "db2i_ioBuffers.h" - -/** - Request another block of rows - - Request the next set of rows from DB2. This must only be called after - newReadRequest(). - - @param orientation The direction to use when reading through the table. -*/ -void IOAsyncReadBuffer::loadNewRows(char orientation) -{ - rewind(); - maxRows() = rowsToBlock; - - DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("Requesting %d rows, async = %d", rowsToBlock, readIsAsync)); - - rc = getBridge()->expectErrors(QMY_ERR_END_OF_BLOCK, QMY_ERR_LOB_SPACE_TOO_SMALL) - ->read(file, - ptr(), - accessIntent, - commitLevel, - orientation, - readIsAsync, - rrnList, - 0, - 0, - 0); - - DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("recordsRead: %d, rc: %d", (uint32)rowCount(), rc)); - - - *releaseRowNeeded = true; - - if (rc == QMY_ERR_END_OF_BLOCK) - { - // This is really just an informational error, so we ignore it. - rc = 0; - DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("End of block signalled")); - } - else if (rc == QMY_ERR_END_OF_FILE) - { - // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked. - rc = HA_ERR_END_OF_FILE; - *releaseRowNeeded = false; - } - else if (rc == QMY_ERR_KEY_NOT_FOUND) - { - rc = HA_ERR_KEY_NOT_FOUND; - *releaseRowNeeded = false; - } - - if (rc) closePipe(); -} - - -/** - Empty the message pipe to prepare for another read. -*/ -void IOAsyncReadBuffer::drainPipe() -{ - DBUG_ASSERT(pipeState == PendingFullBufferMsg); - PipeRpy_t msg[32]; - int bytes; - PipeRpy_t* lastMsg; - while ((bytes = read(msgPipe, msg, sizeof(msg))) > 0) - { - DBUG_PRINT("db2i_ioBuffers::drainPipe",("Pipe returned %d bytes", bytes)); - lastMsg = &msg[bytes / (sizeof(msg[0]))-1]; - if (lastMsg->CumRowCnt == maxRows() || - lastMsg->RtnCod != 0) - { - pipeState = ConsumedFullBufferMsg; - break; - } - - } - DBUG_PRINT("db2i_ioBuffers::drainPipe",("rc = %d, rows = %d, max = %d", lastMsg->RtnCod, lastMsg->CumRowCnt, (uint32)maxRows())); -} - - -/** - Poll the message pipe for async read messages - - Only valid in async - - @param orientation The direction to use when reading through the table. -*/ -void IOAsyncReadBuffer::pollNextRow(char orientation) -{ - DBUG_ASSERT(readIsAsync); - - // Handle the case in which the buffer is full. - if (rowCount() == maxRows()) - { - // If we haven't read to the end, exit here. - if (readCursor < rowCount()) - return; - - if (pipeState == PendingFullBufferMsg) - drainPipe(); - if (pipeState == ConsumedFullBufferMsg) - loadNewRows(orientation); - } - - if (!rc) - { - PipeRpy_t* lastMsg = NULL; - while (true) - { - PipeRpy_t msg[32]; - int bytes = read(msgPipe, msg, sizeof(msg)); - DBUG_PRINT("db2i_ioBuffers::pollNextRow",("Pipe returned %d bytes", bytes)); - - if (unlikely(bytes < 0)) - { - DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("Error")); - rc = errno; - break; - } - else if (bytes == 0) - break; - - DBUG_ASSERT(bytes % sizeof(msg[0]) == 0); - lastMsg = &msg[bytes / (sizeof(msg[0]))-1]; - - if (lastMsg->RtnCod || (lastMsg->CumRowCnt == usedRows())) - { - rc = lastMsg->RtnCod; - break; - } - } - - *releaseRowNeeded = true; - - if (rc == QMY_ERR_END_OF_BLOCK) - rc = 0; - else if (rc == QMY_ERR_END_OF_FILE) - { - // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked. - rc = HA_ERR_END_OF_FILE; - *releaseRowNeeded = false; - } - else if (rc == QMY_ERR_KEY_NOT_FOUND) - { - rc = HA_ERR_KEY_NOT_FOUND; - *releaseRowNeeded = false; - } - - if (lastMsg) - DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("Good data: rc=%d; rows=%d; usedRows=%d", lastMsg->RtnCod, lastMsg->CumRowCnt, (uint32)usedRows())); - if (lastMsg && likely(!rc)) - { - if (lastMsg->CumRowCnt < maxRows()) - pipeState = PendingFullBufferMsg; - else - pipeState = ConsumedFullBufferMsg; - - DBUG_ASSERT(lastMsg->CumRowCnt <= usedRows()); - - } - DBUG_ASSERT(rowCount() <= getRowCapacity()); - } - DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("filledRows: %d, rc: %d", rowCount(), rc)); - if (rc) closePipe(); -} - - -/** - Prepare for the destruction of the row buffer storage. -*/ -void IOAsyncReadBuffer::prepForFree() -{ - interruptRead(); - rewind(); - IORowBuffer::prepForFree(); -} - - -/** - Initialize the newly allocated storage. - - @param sizeChanged Indicates whether the storage capacity is being changed. -*/ -void IOAsyncReadBuffer::initAfterAllocate(bool sizeChanged) -{ - rewind(); - - if (sizeChanged || ((void*)rrnList == NULL)) - rrnList.realloc(getRowCapacity() * sizeof(uint32)); -} - - -/** - Send an initial read request - - @param infile The file (table/index) being read from - @param orientation The orientation to use for this read request - @param rowsToBuffer The number of rows to request each time - @param useAsync Whether reads should be performed asynchronously. - @param key The key to use (if any) - @param keyLength The length of key (if any) - @param keyParts The number of columns in the key (if any) - -*/ -void IOAsyncReadBuffer::newReadRequest(FILE_HANDLE infile, - char orientation, - uint32 rowsToBuffer, - bool useAsync, - ILEMemHandle key, - int keyLength, - int keyParts) -{ - DBUG_ENTER("db2i_ioBuffers::newReadRequest"); - DBUG_ASSERT(rowsToBuffer <= getRowCapacity()); -#ifndef DBUG_OFF - if (readCursor < rowCount()) - DBUG_PRINT("PERF:",("Wasting %d buffered rows!\n", rowCount() - readCursor)); -#endif - - int fildes[2]; - int ileDescriptor = QMY_REUSE; - - interruptRead(); - - if (likely(useAsync)) - { - if (rowsToBuffer == 1) - { - // Async provides little or no benefit for single row reads, so we turn it off - DBUG_PRINT("db2i_ioBuffers::newReadRequest", ("Disabling async")); - useAsync = false; - } - else - { - rc = pipe(fildes); - if (rc) DBUG_VOID_RETURN; - - // Translate the pipe write descriptor into the equivalent ILE descriptor - rc = fstatx(fildes[1], (struct stat*)&ileDescriptor, sizeof(ileDescriptor), STX_XPFFD_PASE); - if (rc) - { - close(fildes[0]); - close(fildes[1]); - DBUG_VOID_RETURN; - } - pipeState = Untouched; - msgPipe = fildes[0]; - - DBUG_PRINT("db2i_ioBuffers::newReadRequest", ("Opened pipe %d", fildes[0])); - } - } - - file = infile; - readIsAsync = useAsync; - rowsToBlock = rowsToBuffer; - - rewind(); - maxRows() = 1; - rc = getBridge()->expectErrors(QMY_ERR_END_OF_BLOCK, QMY_ERR_LOB_SPACE_TOO_SMALL) - ->read(file, - ptr(), - accessIntent, - commitLevel, - orientation, - useAsync, - rrnList, - key, - keyLength, - keyParts, - ileDescriptor); - - // Having shared the pipe with ILE, we relinquish our claim on the write end - // of the pipe. - if (useAsync) - close(fildes[1]); - - // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked. - if (rc == QMY_ERR_END_OF_FILE) - { - rc = HA_ERR_END_OF_FILE; - *releaseRowNeeded = false; - } - else if (rc == QMY_ERR_KEY_NOT_FOUND) - { - if (rowCount()) - rc = HA_ERR_END_OF_FILE; - else - rc = HA_ERR_KEY_NOT_FOUND; - *releaseRowNeeded = false; - } - else - *releaseRowNeeded = true; - - DBUG_VOID_RETURN; -} diff --git a/storage/ibmdb2i/db2i_ioBuffers.h b/storage/ibmdb2i/db2i_ioBuffers.h deleted file mode 100644 index 350d854f055..00000000000 --- a/storage/ibmdb2i/db2i_ioBuffers.h +++ /dev/null @@ -1,416 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -/** - @file db2i_ioBuffers.h - - @brief Buffer classes used for interacting with QMYSE read/write buffers. - -*/ - - -#include "db2i_validatedPointer.h" -#include "mysql_priv.h" -#include <sys/stat.h> -#include <fcntl.h> -#include <as400_types.h> - -// Needed for compilers which do not include fstatx in standard headers. -extern "C" int fstatx(int, struct stat *, int, int); - -/** - Basic row buffer - - Provides the basic structure and methods needed for communicating - with QMYSE I/O APIs. - - @details All QMYSE I/O apis use a buffer that is structured as two integer - row counts (max and used) and storage for some number of rows. The row counts - are both input and output for the API, and their usage depends on the - particular API invoked. This class encapsulates that buffer definition. -*/ -class IORowBuffer -{ - public: - IORowBuffer() : allocSize(0), rowLength(0) {;} - ~IORowBuffer() { freeBuf(); } - ValidatedPointer<char>& ptr() { return data; } - - /** - Sets up the buffer to hold the size indicated. - - @param rowLen length of the rows that will be stored in this buffer - @param nullMapOffset position of null map within each row - @param size buffer size requested - */ - void allocBuf(uint32 rowLen, uint16 nullMapOffset, uint32 size) - { - nullOffset = nullMapOffset; - uint32 newSize = size + sizeof(BufferHdr_t); - // If the internal structure of the row is changing, we need to - // remember this and notify the subclasses via initAfterAllocate(); - bool formatChanged = ((size/rowLen) != rowCapacity); - - if (newSize > allocSize) - { - this->freeBuf(); - data.alloc(newSize); - if (likely((void*)data)) - allocSize = newSize; - } - - if (likely((void*)data)) - { - DBUG_ASSERT((uint64)(void*)data % 16 == 0); - rowLength = rowLen; - rowCapacity = size / rowLength; - initAfterAllocate(formatChanged); - } - else - { - allocSize = 0; - rowCapacity = 0; - } - - DBUG_PRINT("db2i_ioBuffers::allocBuf",("rowCapacity = %d", rowCapacity)); - } - - void zeroBuf() - { - memset(data, 0, allocSize); - } - - void freeBuf() - { - if (likely(allocSize)) - { - prepForFree(); - DBUG_PRINT("IORowBuffer::freeBuf",("Freeing 0x%p", (char*)data)); - data.dealloc(); - } - } - - char* getRowN(uint32 n) - { - if (unlikely(n >= getRowCapacity())) - return NULL; - return (char*)data + sizeof(BufferHdr_t) + (rowLength * n); - }; - - uint32 getRowCapacity() const {return rowCapacity;} - uint32 getRowNullOffset() const {return nullOffset;} - uint32 getRowLength() const {return rowLength;} - - protected: - /** - Called prior to freeing buffer storage so that subclasses can do - any required cleanup - */ - virtual void prepForFree() - { - allocSize = 0; - rowCapacity = 0; - } - - /** - Called after buffer storage so that subclasses can do any required setup. - */ - virtual void initAfterAllocate(bool sizeChanged) { return;} - - ValidatedPointer<char> data; - uint32 allocSize; - uint32 rowCapacity; - uint32 rowLength; - uint16 nullOffset; - uint32& usedRows() const { return ((BufferHdr_t*)(char*)data)->UsedRowCnt; } - uint32& maxRows() const {return ((BufferHdr_t*)(char*)data)->MaxRowCnt; } -}; - - -/** - Write buffer - - Implements methods for inserting data into a row buffer for use with the - QMY_WRITE and QMY_UPDATE APIs. - - @details The max row count defines how many rows are in the buffer. The used - row count is updated by QMYSE to indicate how many rows have been - successfully written. -*/ -class IOWriteBuffer : public IORowBuffer -{ - public: - bool endOfBuffer() const {return (maxRows() == getRowCapacity());} - - char* addRow() - { - return getRowN(maxRows()++); - } - - void resetAfterWrite() - { - maxRows() = 0; - } - - void deleteRow() - { - --maxRows(); - } - - uint32 rowCount() const {return maxRows();} - - uint32 rowsWritten() const {return usedRows()-1;} - - private: - void initAfterAllocate(bool sizeChanged) {maxRows() = 0; usedRows() = 0;} -}; - - -/** - Read buffer - - Implements methods for reading data from and managing a row buffer for use - with the QMY_READ APIs. This is primarily for use with metainformation queries. -*/ -class IOReadBuffer : public IORowBuffer -{ - public: - - IOReadBuffer() {;} - IOReadBuffer(uint32 rows, uint32 rowLength) - { - allocBuf(rows, 0, rows * rowLength); - maxRows() = rows; - } - - uint32 rowCount() {return usedRows();} - void setRowsToProcess(uint32 rows) { maxRows() = rows; } -}; - - -/** - Read buffer - - Implements methods for reading data from and managing a row buffer for use - with the QMY_READ APIs. - - @details This class supports both sync and async read modes. The max row - count defines the number of rows that are requested to be read. The used row - count defines how many rows have been read. Sync mode is reasonably - straightforward, but async mode has a complex system of communicating with - QMYSE that is optimized for low latency. In async mode, the used row count is - updated continuously by QMYSE as rows are read. At the same time, messages are - sent to the associated pipe indicating that a row has been read. As long as - the internal read cursor lags behind the used row count, the pipe is never - consulted. But if the internal read cursor "catches up to" the used row count, - then we block on the pipe until we find a message indicating that a new row - has been read or that an error has occurred. -*/ -class IOAsyncReadBuffer : public IOReadBuffer -{ - public: - IOAsyncReadBuffer() : - file(0), readIsAsync(false), msgPipe(QMY_REUSE), bridge(NULL) - { - } - - ~IOAsyncReadBuffer() - { - interruptRead(); - rrnList.dealloc(); - } - - - /** - Signal read operation complete - - Indicates that the storage engine requires no more data from the table. - Must be called between calls to newReadRequest(). - */ - void endRead() - { -#ifndef DBUG_OFF - if (readCursor < rowCount()) - DBUG_PRINT("PERF:",("Wasting %d buffered rows!\n", rowCount() - readCursor)); -#endif - interruptRead(); - - file = 0; - bridge = NULL; - } - - /** - Update data that may change on each read operation - */ - void update(char newAccessIntent, - bool* newReleaseRowNeeded, - char commitLvl) - { - accessIntent = newAccessIntent; - releaseRowNeeded = newReleaseRowNeeded; - commitLevel = commitLvl; - } - - /** - Read the next row in the table. - - Return a pointer to the next row in the table, where "next" is defined - by the orientation. - - @param orientaton - @param[out] rrn The relative record number of the row returned. Not reliable - if NULL is returned by this function. - - @return Pointer to the row. Null if no more rows are available or an error - occurred. - */ - char* readNextRow(char orientation, uint32& rrn) - { - DBUG_PRINT("db2i_ioBuffers::readNextRow", ("readCursor: %d, filledRows: %d, rc: %d", readCursor, rowCount(), rc)); - - while (readCursor >= rowCount() && !rc) - { - if (!readIsAsync) - loadNewRows(orientation); - else - pollNextRow(orientation); - } - - if (readCursor >= rowCount()) - return NULL; - - rrn = rrnList[readCursor]; - return getRowN(readCursor++); - } - - /** - Retrieve the return code generated by the last operation. - - @return The return code, translated to the appropriate HA_ERR_* - value if possible. - */ - int32 lastrc() - { - return db2i_ileBridge::translateErrorCode(rc); - } - - void rewind() - { - readCursor = 0; - rc = 0; - usedRows() = 0; - } - - bool reachedEOD() { return EOD; } - - void newReadRequest(FILE_HANDLE infile, - char orientation, - uint32 rowsToBuffer, - bool useAsync, - ILEMemHandle key, - int keyLength, - int keyParts); - - private: - - /** - End any running async read operation. - */ - void interruptRead() - { - closePipe(); - if (file && readIsAsync && (rc == 0) && (rowCount() < getRowCapacity())) - { - DBUG_PRINT("IOReadBuffer::interruptRead", ("PERF: Interrupting %d", (uint32)file)); - getBridge()->readInterrupt(file); - } - } - - void closePipe() - { - if (msgPipe != QMY_REUSE) - { - DBUG_PRINT("db2i_ioBuffers::closePipe", ("Closing pipe %d", msgPipe)); - close(msgPipe); - msgPipe = QMY_REUSE; - } - } - - /** - Get a pointer to the active ILE bridge. - - Getting the bridge pointer is (relatively) expensive, so we cache - it off for each operation. - */ - db2i_ileBridge* getBridge() - { - if (unlikely(bridge == NULL)) - { - bridge = db2i_ileBridge::getBridgeForThread(); - } - return bridge; - } - - void drainPipe(); - void pollNextRow(char orientation); - void prepForFree(); - void initAfterAllocate(bool sizeChanged); - void loadNewRows(char orientation); - - - uint32 readCursor; // Read position within buffer - int32 rc; // Last return code received - ValidatedPointer<uint32> rrnList; // Receiver for list of rrns - char accessIntent; // The access intent for this read - char commitLevel; // What isolation level should be used - char EOD; // Whether end-of-data was hit - char readIsAsync; // Are reads to be done asynchronously? - bool* releaseRowNeeded; - /* Does the caller need to release the current row when finished reading */ - FILE_HANDLE file; // The file to be read - int msgPipe; - /* The read descriptor of the pipe used to pass messages during async reads */ - db2i_ileBridge* bridge; // Cached pointer to bridge - uint32 rowsToBlock; // Number of rows to request - enum - { - ConsumedFullBufferMsg, - PendingFullBufferMsg, - Untouched - } pipeState; - /* The state of the async read message pipe */ -}; - diff --git a/storage/ibmdb2i/db2i_misc.h b/storage/ibmdb2i/db2i_misc.h deleted file mode 100644 index f0b527aaad0..00000000000 --- a/storage/ibmdb2i/db2i_misc.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -#ifndef DB2I_MISC_H -#define DB2I_MISC_H - -/** - Undelimit quote-delimited DB2 names in-place -*/ -void stripExtraQuotes(char* name, uint maxLen) -{ - char* oldName = (char*)sql_strdup(name); - uint i = 0; - uint j = 0; - do - { - name[j] = oldName[i]; - if (oldName[i] == '"' && oldName[i+1] == '"') - ++i; - } while (++j < maxLen && oldName[++i]); - - if (j == maxLen) - --j; - name[j] = 0; -} - -/** - Convert a MySQL identifier name into a DB2 compatible format - - @parm input The MySQL name - @parm output The DB2 name - @parm outlen The amount of space allocated for output - @parm delimit Should delimiting quotes be placed around the converted name? - @parm delimitQuotes Should quotes in the MySQL be delimited with additional quotes? - - @return FALSE if output was too small and name was truncated; TRUE otherwise -*/ -bool convertMySQLNameToDB2Name(const char* input, - char* output, - size_t outlen, - bool delimit = true, - bool delimitQuotes = true) -{ - uint o = 0; - if (delimit) - output[o++] = '"'; - - uint i = 0; - do - { - output[o] = input[i]; - if (delimitQuotes && input[i] == '"') - output[++o] = '"'; - } while (++o < outlen-2 && input[++i]); - - if (delimit) - output[o++] = '"'; - output[min(o, outlen-1)] = 0; // This isn't the most user-friendly way to handle overflows, - // but at least its safe. - return (o <= outlen-1); -} - -bool isOrdinaryIdentifier(const char* s) -{ - while (*s) - { - if (my_isupper(system_charset_info, *s) || - my_isdigit(system_charset_info, *s) || - (*s == '_') || - (*s == '@') || - (*s == '$') || - (*s == '#') || - (*s == '"')) - ++s; - else - return false; - } - return true; -} - -/** - Fill memory with a 16-bit word. - - @param p Pointer to space to fill. - @param v Value to fill - @param l Length of space (in 16-bit words) -*/ -void memset16(void* p, uint16 v, size_t l) -{ - uint16* p2=(uint16*)p; - while (l--) - { - *(p2++) = v; - } -} - -#endif diff --git a/storage/ibmdb2i/db2i_myconv.cc b/storage/ibmdb2i/db2i_myconv.cc deleted file mode 100644 index 7be6e1236cd..00000000000 --- a/storage/ibmdb2i/db2i_myconv.cc +++ /dev/null @@ -1,1498 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -/** - @file - - @brief A direct map optimization of iconv and related functions - This was show to significantly reduce character conversion cost - for short strings when compared to calling iconv system code. -*/ - -#include <stdlib.h> -#include <stdio.h> -#include <wchar.h> -#include <errno.h> -#include <iconv.h> -#include <ctype.h> -#include <stdarg.h> -#include <string.h> -#include <as400_protos.h> - -#include "db2i_myconv.h" -#include "db2i_global.h" - -int32_t myconvDebug=0; - -static char szGetTimeString[20]; -static char * GetTimeString(time_t now) -{ - struct tm * tm; - - now = time(&now); - tm = (struct tm *) localtime(&now); - sprintf(szGetTimeString, "%04d/%02d/%02d %02d:%02d:%02d", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - - return szGetTimeString; -} - -static MEM_ROOT dmapMemRoot; - -void initMyconv() -{ - init_alloc_root(&dmapMemRoot, 0x200, 0); -} - -void cleanupMyconv() -{ - free_root(&dmapMemRoot,0); -} - - -#ifdef DEBUG -/* type: */ -#define STDOUT_WITH_TIME -1 /* to stdout with time */ -#define STDERR_WITH_TIME -2 /* to stderr with time */ -#define STDOUT_WO_TIME 1 /* : to stdout */ -#define STDERR_WO_TIME 2 /* : to stderr */ - - -static void MyPrintf(long type, - char * fmt, ...) -{ - char StdoutFN[256]; - va_list ap; - char * p; - time_t now; - FILE * fd=stderr; - - if (type < 0) - { - now = time(&now); - fprintf(fd, "%s ", GetTimeString(now)); - } - va_start(ap, fmt); - vfprintf(fd, fmt, ap); - va_end(ap); -} -#endif - - - - -#define MAX_CONVERTER 128 - -mycstoccsid(const char* pname) -{ - if (strcmp(pname, "UTF-16")==0) - return 1200; - else if (strcmp(pname, "big5")==0) - return 950; - else - return cstoccsid(pname); -} -#define cstoccsid mycstoccsid - -static struct __myconv_rec myconv_rec [MAX_CONVERTER]; -static struct __dmap_rec dmap_rec [MAX_CONVERTER]; - -static int dmap_open(const char * to, - const char * from, - const int32_t idx) -{ - if (myconvIsSBCS(from) && myconvIsSBCS(to)) { - dmap_rec[idx].codingSchema = DMAP_S2S; - if ((dmap_rec[idx].dmapS2S = (uchar *) alloc_root(&dmapMemRoot, 0x100)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_S2S, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapS2S, 0x00, 0x100); - myconv_rec[idx].allocatedSize=0x100; - - { - char dmapSrc[0x100]; - iconv_t cd; - int32_t i; - size_t inBytesLeft=0x100; - size_t outBytesLeft=0x100; - size_t len; - char * inBuf=dmapSrc; - char * outBuf=(char *) dmap_rec[idx].dmapS2S; - - if ((cd = iconv_open(to, from)) == (iconv_t) -1) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - inBytesLeft = 0x100; - for (i = 0; i < inBytesLeft; ++i) - dmapSrc[i]=i; - - do { - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d: iconv() returns %d, errno = %d in %s at %d\n", - to, from, idx, DMAP_S2S, len, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "inBytesLeft = %d, inBuf - dmapSrc = %d\n", inBytesLeft, inBuf-dmapSrc); - MyPrintf(STDERR_WITH_TIME, - "outBytesLeft = %d, outBuf - dmapS2S = %d\n", outBytesLeft, outBuf-(char *) dmap_rec[idx].dmapS2S); - } - if ((inBytesLeft == 86 || inBytesLeft == 64 || inBytesLeft == 1) && - memcmp(from, "IBM-1256", 9) == 0 && - memcmp(to, "IBM-420", 8) == 0) { - /* Known problem for IBM-1256_IBM-420 */ - --inBytesLeft; - ++inBuf; - *outBuf=0x00; - ++outBuf; - --outBytesLeft; - continue; - } else if ((inBytesLeft == 173 || inBytesLeft == 172 || - inBytesLeft == 74 || inBytesLeft == 73 || - inBytesLeft == 52 || inBytesLeft == 50 || - inBytesLeft == 31 || inBytesLeft == 20 || - inBytesLeft == 6) && - memcmp(to, "IBM-1256", 9) == 0 && - memcmp(from, "IBM-420", 8) == 0) { - /* Known problem for IBM-420_IBM-1256 */ - --inBytesLeft; - ++inBuf; - *outBuf=0x00; - ++outBuf; - --outBytesLeft; - continue; - } else if ((128 >= inBytesLeft) && - memcmp(to, "IBM-037", 8) == 0 && - memcmp(from, "IBM-367", 8) == 0) { - /* Known problem for IBM-367_IBM-037 */ - --inBytesLeft; - ++inBuf; - *outBuf=0x00; - ++outBuf; - --outBytesLeft; - continue; - } else if (((1 <= inBytesLeft && inBytesLeft <= 4) || (97 <= inBytesLeft && inBytesLeft <= 128)) && - memcmp(to, "IBM-838", 8) == 0 && - memcmp(from, "TIS-620", 8) == 0) { - /* Known problem for TIS-620_IBM-838 */ - --inBytesLeft; - ++inBuf; - *outBuf=0x00; - ++outBuf; - --outBytesLeft; - continue; - } - iconv_close(cd); - return -1; -#else - /* Tolerant to undefined conversions for any converter */ - --inBytesLeft; - ++inBuf; - *outBuf=0x00; - ++outBuf; - --outBytesLeft; - continue; -#endif - } - } while (inBytesLeft > 0); - - if (myconvIsISO(to)) - myconv_rec[idx].subS=0x1A; - else if (myconvIsASCII(to)) - myconv_rec[idx].subS=0x7F; - else if (myconvIsEBCDIC(to)) - myconv_rec[idx].subS=0x3F; - - if (myconvIsISO(from)) - myconv_rec[idx].srcSubS=0x1A; - else if (myconvIsASCII(from)) - myconv_rec[idx].srcSubS=0x7F; - else if (myconvIsEBCDIC(from)) - myconv_rec[idx].srcSubS=0x3F; - - iconv_close(cd); - } - } else if (((myconvIsSBCS(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_S2U)) || - ((myconvIsSBCS(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_S28))) { - int i; - - /* single byte mapping */ - if ((dmap_rec[idx].dmapD12U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_S2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapD12U, 0x00, 0x100 * 2); - myconv_rec[idx].allocatedSize=0x100 * 2; - - - { - char dmapSrc[2]; - iconv_t cd; - int32_t i; - size_t inBytesLeft; - size_t outBytesLeft; - size_t len; - char * inBuf; - char * outBuf; - char SS=0x1A; -#ifdef support_surrogate - if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) { -#else - if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - for (i = 0; i < 0x100; ++i) { - dmapSrc[0]=i; - inBuf=dmapSrc; - inBytesLeft=1; - outBuf=(char *) &(dmap_rec[idx].dmapD12U[i]); - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if ((errno == EILSEQ || errno == EINVAL) && - inBytesLeft == 1 && - outBytesLeft == 2) { - continue; - } else { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%02x,%d,%02x%02x,%d), errno = %d in %s at %d\n", - to, from, idx, dmapSrc[0], 1, - (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1], 2, - errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "inBytesLeft=%d, outBytesLeft=%d, %02x%02x\n", - inBytesLeft, outBytesLeft, - (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1]); - } -#endif - iconv_close(cd); - return -1; - } - dmap_rec[idx].dmapD12U[i]=0x0000; - } - if (dmap_rec[idx].dmapE02U[i] == 0x001A && /* pick the first one */ - myconv_rec[idx].srcSubS == 0x00) { - myconv_rec[idx].srcSubS=i; - } - } - iconv_close(cd); - } - myconv_rec[idx].subS=0x1A; - myconv_rec[idx].subD=0xFFFD; - - - } else if (((myconvIsUCS2(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_U2S)) || - ((myconvIsUTF16(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_T2S)) || - ((myconvIsUTF8(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_82S))) { - /* UTF-16 -> SBCS, the direct map a bit of waste of space, - * binary search may be reasonable alternative - */ - if ((dmap_rec[idx].dmapU2S = (uchar *) alloc_root(&dmapMemRoot, 0x10000 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_U2S, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapU2S, 0x00, 0x10000); - myconv_rec[idx].allocatedSize=(0x10000 * 2); - - { - iconv_t cd; - int32_t i; - -#ifdef support_surrogate - if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) { -#else - if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - for (i = 0; i < 0x100; ++i) { - UniChar dmapSrc[0x100]; - int32_t j; - for (j = 0; j < 0x100; ++j) { - dmapSrc[j]=i * 0x100 + j; - } - char * inBuf=(char *) dmapSrc; - char * outBuf=(char *) &(dmap_rec[idx].dmapU2S[i*0x100]); - size_t inBytesLeft=sizeof(dmapSrc); - size_t outBytesLeft=0x100; - size_t len; - - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (inBytesLeft == 0 && outBytesLeft == 0) { /* a number of substitution returns */ - continue; - } -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - from, to, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "iconv() retuns %d, errno=%d, InBytesLeft=%d, OutBytesLeft=%d\n", - len, errno, inBytesLeft, outBytesLeft, __FILE__,__LINE__); - } -#endif - iconv_close(cd); - return -1; - } - } - iconv_close(cd); - - myconv_rec[idx].subS = dmap_rec[idx].dmapU2S[0x1A]; - myconv_rec[idx].subD = dmap_rec[idx].dmapU2S[0xFFFD]; - myconv_rec[idx].srcSubS = 0x1A; - myconv_rec[idx].srcSubD = 0xFFFD; - } - - - - } else if (((myconvIsDBCS(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_D2U)) || - ((myconvIsDBCS(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_D28))) { - int i; - /* single byte mapping */ - if ((dmap_rec[idx].dmapD12U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_D2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapD12U, 0x00, 0x100 * 2); - - /* double byte mapping, assume 7 bit ASCII is not use as the first byte of DBCS. */ - if ((dmap_rec[idx].dmapD22U = (UniChar *) alloc_root(&dmapMemRoot, 0x8000 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_D2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapD22U, 0x00, 0x8000 * 2); - - myconv_rec[idx].allocatedSize=(0x100 + 0x8000) * 2; - - - { - char dmapSrc[2]; - iconv_t cd; - int32_t i; - size_t inBytesLeft; - size_t outBytesLeft; - size_t len; - char * inBuf; - char * outBuf; - char SS=0x1A; - -#ifdef support_surrogate - if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) { -#else - if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - for (i = 0; i < 0x100; ++i) { - dmapSrc[0]=i; - inBuf=dmapSrc; - inBytesLeft=1; - outBuf=(char *) (&dmap_rec[idx].dmapD12U[i]); - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if ((errno == EILSEQ || errno == EINVAL) && - inBytesLeft == 1 && - outBytesLeft == 2) { - continue; - } else { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%02x,%d,%02x%02x,%d), errno = %d in %s at %d\n", - to, from, idx, dmapSrc[0], 1, - (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1], 2, - errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "inBytesLeft=%d, outBytesLeft=%d, %02x%02x\n", - inBytesLeft, outBytesLeft, - (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1]); - } -#endif - iconv_close(cd); - return -1; - } - dmap_rec[idx].dmapD12U[i]=0x0000; - } - if (dmap_rec[idx].dmapD12U[i] == 0x001A && /* pick the first one */ - myconv_rec[idx].srcSubS == 0x00) { - myconv_rec[idx].srcSubS=i; - } - } - - - for (i = 0x80; i < 0x100; ++i) { - int j; - if (dmap_rec[idx].dmapD12U[i] != 0x0000) - continue; - for (j = 0x01; j < 0x100; ++j) { - dmapSrc[0]=i; - dmapSrc[1]=j; - int offset = i-0x80; - offset<<=8; - offset+=j; - - inBuf=dmapSrc; - inBytesLeft=2; - outBuf=(char *) &(dmap_rec[idx].dmapD22U[offset]); - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (inBytesLeft == 2 && outBytesLeft == 2 && (errno == EILSEQ || errno == EINVAL)) { - ; /* invalid DBCS character, dmapDD2U[offset] remains 0x0000 */ - } else { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%p,2,%p,2), errno = %d in %s at %d\n", - to, from, idx, - dmapSrc, &(dmap_rec[idx].dmapD22U[offset]), - errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, - "iconv(cd,0x%02x%02x,2,0x%04x,2) returns %d, inBytesLeft=%d, outBytesLeft=%d\n", - dmapSrc[0], dmapSrc[1], - dmap_rec[idx].dmapD22U[offset], - len, inBytesLeft, outBytesLeft); - } -#endif - iconv_close(cd); - return -1; - } - } else { -#ifdef TRACE_DMAP - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n", - to, from, idx, len, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf=%02X%02X%02X, outBytesLeft=%d\n", - i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1], - inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft); - MyPrintf(STDERR_WITH_TIME, - "&dmapSrc=%p, inBuf=%p, %p, outBuf=%p\n", - dmapSrc, inBuf, dmap_rec[idx].dmapU2M3 + (i - 0x80) * 2, outBuf); - } -#endif - } - } - if (dmap_rec[idx].dmapD12U[i] == 0xFFFD) { /* pick the last one */ - myconv_rec[idx].srcSubD=i* 0x100 + j; - } - } - iconv_close(cd); - } - - myconv_rec[idx].subS=0x1A; - myconv_rec[idx].subD=0xFFFD; - myconv_rec[idx].srcSubD=0xFCFC; - - - } else if (((myconvIsUCS2(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_U2D)) || - ((myconvIsUTF16(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_T2D)) || - ((myconvIsUTF8(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_82D))) { - /* UTF-16 -> DBCS single/double byte */ - /* A single table will cover all characters, assuming no second byte is 0x00. */ - if ((dmap_rec[idx].dmapU2D = (uchar *) alloc_root(&dmapMemRoot, 0x10000 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_U2D, errno, __FILE__,__LINE__); -#endif - return -1; - } - - memset(dmap_rec[idx].dmapU2D, 0x00, 0x10000 * 2); - myconv_rec[idx].allocatedSize=(0x10000 * 2); - - { - UniChar dmapSrc[1]; - iconv_t cd; - int32_t i; - size_t inBytesLeft; - size_t outBytesLeft; - size_t len; - char * inBuf; - char * outBuf; - -#ifdef support_surrogate - if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) { -#else - if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - /* easy implementation, convert 1 Unicode character at one time. */ - /* If the open performance is an issue, convert a chunk such as 128 chracters. */ - /* if the converted length is not the same as the original, convert one by one. */ - (dmap_rec[idx].dmapU2D)[0x0000]=0x00; - for (i = 1; i < 0x10000; ++i) { - dmapSrc[0]=i; - inBuf=(char *) dmapSrc; - inBytesLeft=2; - outBuf=(char *) &((dmap_rec[idx].dmapU2D)[2*i]); - outBytesLeft=2; - do { - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (len == 1 && inBytesLeft == 0 && outBytesLeft == 1 && (dmap_rec[idx].dmapU2D)[2*i] == 0x1A) { - /* UCS-2_TIS-620:0x0080 => 0x1A, converted to SBCS replacement character */ - (dmap_rec[idx].dmapU2D)[2*i+1]=0x00; - break; - } else if (len == 1 && inBytesLeft == 0 && outBytesLeft == 0) { - break; - } - if (errno == EILSEQ || errno == EINVAL) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, - "iconv(cd,%04x,2,%02x%02x,2) returns inBytesLeft=%d, outBytesLeft=%d\n", - dmapSrc[0], - (dmap_rec[idx].dmapU2D)[2*i], (dmap_rec[idx].dmapU2D)[2*i+1], - inBytesLeft, outBytesLeft); - if (outBuf - (char *) dmap_rec[idx].dmapU2M2 > 1) - MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]); - } -#endif - inBuf+=2; - inBytesLeft-=2; - memcpy(outBuf, (char *) &(myconv_rec[idx].subD), 2); - outBuf+=2; - outBytesLeft-=2; - } else { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "[%d] dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - i, to, from, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, - "iconv(cd,%04x,2,%02x%02x,2) returns %d inBytesLeft=%d, outBytesLeft=%d\n", - dmapSrc[0], - (dmap_rec[idx].dmapU2D)[2*i], - (dmap_rec[idx].dmapU2D)[2*i+1], - len, inBytesLeft,outBytesLeft); - if (i == 1) { - MyPrintf(STDERR_WO_TIME, - " inBuf [-1..2]=%02x%02x%02x%02x\n", - inBuf[-1],inBuf[0],inBuf[1],inBuf[2]); - MyPrintf(STDERR_WO_TIME, - " outBuf [-1..2]=%02x%02x%02x%02x\n", - outBuf[-1],outBuf[0],outBuf[1],outBuf[2]); - } else { - MyPrintf(STDERR_WO_TIME, - " inBuf [-2..2]=%02x%02x%02x%02x%02x\n", - inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]); - MyPrintf(STDERR_WO_TIME, - " outBuf [-2..2]=%02x%02x%02x%02x%02x\n", - outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]); - } -#endif - iconv_close(cd); - return -1; - } - if (len == 0 && inBytesLeft == 0 && outBytesLeft == 1) { /* converted to SBCS */ - (dmap_rec[idx].dmapU2D)[2*i+1]=0x00; - break; - } - } - } while (inBytesLeft > 0); - } - iconv_close(cd); - myconv_rec[idx].subS = dmap_rec[idx].dmapU2D[2*0x1A]; - myconv_rec[idx].subD = dmap_rec[idx].dmapU2D[2*0xFFFD] * 0x100 - + dmap_rec[idx].dmapU2D[2*0xFFFD+1]; - myconv_rec[idx].srcSubS = 0x1A; - myconv_rec[idx].srcSubD = 0xFFFD; - } - - - } else if (((myconvIsEUC(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_E2U)) || - ((myconvIsEUC(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_E28))) { - int i; - /* S0: 0x00 - 0x7F */ - if ((dmap_rec[idx].dmapE02U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapE02U, 0x00, 0x100 * 2); - - /* S1: 0xA0 - 0xFF, 0xA0 - 0xFF */ - if ((dmap_rec[idx].dmapE12U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x60 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapE12U, 0x00, 0x60 * 0x60 * 2); - - /* SS2: 0x8E + 0xA0 - 0xFF, 0xA0 - 0xFF */ - if ((dmap_rec[idx].dmapE22U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x61 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapE22U, 0x00, 0x60 * 0x61 * 2); - - /* SS3: 0x8F + 0xA0 - 0xFF, 0xA0 - 0xFF */ - if ((dmap_rec[idx].dmapE32U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x61 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapE32U, 0x00, 0x60 * 0x61 * 2); - - myconv_rec[idx].allocatedSize=(0x100 + 0x60 * 0x60 + 0x60 * 0x61* 2) * 2; - - - { - char dmapSrc[0x60 * 0x60 * 3]; - iconv_t cd; - int32_t i; - size_t inBytesLeft; - size_t outBytesLeft; - size_t len; - char * inBuf; - char * outBuf; - char SS=0x8E; - -#ifdef support_surrogate - if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) { -#else - if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - for (i = 0; i < 0x100; ++i) { - dmapSrc[0]=i; - inBuf=dmapSrc; - inBytesLeft=1; - outBuf=(char *) (&dmap_rec[idx].dmapE02U[i]); - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); - } -#endif - dmap_rec[idx].dmapE02U[i]=0x0000; - } - if (dmap_rec[idx].dmapE02U[i] == 0x001A && /* pick the first one */ - myconv_rec[idx].srcSubS == 0x00) { - myconv_rec[idx].srcSubS=i; - } - } - - - inBuf=dmapSrc; - for (i = 0; i < 0x60; ++i) { - int j; - for (j = 0; j < 0x60; ++j) { - *inBuf=i+0xA0; - ++inBuf; - *inBuf=j+0xA0; - ++inBuf; - } - } - inBuf=dmapSrc; - inBytesLeft=0x60 * 0x60 * 2; - outBuf=(char *) dmap_rec[idx].dmapE12U; - outBytesLeft=0x60 * 0x60 * 2; - do { - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (errno == EILSEQ) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft); - if (inBuf - dmapSrc > 1 && inBuf - dmapSrc <= sizeof(dmapSrc) - 2) - MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]); - if (outBuf - (char *) dmap_rec[idx].dmapE12U > 1) - MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]); - } -#endif - inBuf+=2; - inBytesLeft-=2; - outBuf[0]=0x00; - outBuf[1]=0x00; - outBuf+=2; - outBytesLeft-=2; - } else { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - iconv_close(cd); - return -1; - } - } - } while (inBytesLeft > 0); - - /* SS2: 0x8E + 1 or 2 bytes */ - /* SS3: 0x8E + 1 or 2 bytes */ - while (SS != 0x00) { - int32_t numSuccess=0; - for (i = 0; i < 0x60; ++i) { - inBuf=dmapSrc; - inBuf[0]=SS; - inBuf[1]=i+0xA0; - inBytesLeft=2; - if (SS == 0x8E) - outBuf=(char *) &(dmap_rec[idx].dmapE22U[i]); - else - outBuf=(char *) &(dmap_rec[idx].dmapE32U[i]); - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (SS == 0x8E) - dmap_rec[idx].dmapE22U[i]=0x0000; - else - dmap_rec[idx].dmapE32U[i]=0x0000; - } else { - ++numSuccess; - } - } - if (numSuccess == 0) { /* SS2 is 2 bytes */ - inBuf=dmapSrc; - for (i = 0; i < 0x60; ++i) { - int j; - for (j = 0; j < 0x60; ++j) { - *inBuf=SS; - ++inBuf; - *inBuf=i+0xA0; - ++inBuf; - *inBuf=j+0xA0; - ++inBuf; - } - } - inBuf=dmapSrc; - inBytesLeft=0x60 * 0x60 * 3; - if (SS == 0x8E) - outBuf=(char *) &(dmap_rec[idx].dmapE22U[0x60]); - else - outBuf=(char *) &(dmap_rec[idx].dmapE32U[0x60]); - outBytesLeft=0x60 * 0x60 * 2; - do { - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "%02X:dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - SS, to, from, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft); - if (inBuf - dmapSrc > 1 && inBuf - dmapSrc <= sizeof(dmapSrc) - 2) - MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]); - } -#endif - if (errno == EILSEQ || errno == EINVAL) { - inBuf+=3; - inBytesLeft-=3; - outBuf[0]=0x00; - outBuf[1]=0x00; - outBuf+=2; - outBytesLeft-=2; - } else { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "%02X:dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - SS, to, from, idx, errno, __FILE__,__LINE__); -#endif - iconv_close(cd); - return -1; - } - } - } while (inBytesLeft > 0); - } - if (SS == 0x8E) - SS=0x8F; - else - SS = 0x00; - } - iconv_close(cd); - - myconv_rec[idx].subS=0x1A; - myconv_rec[idx].subD=0xFFFD; - for (i = 0; i < 0x80; ++i) { - if (dmap_rec[idx].dmapE02U[i] == 0x001A) { - myconv_rec[idx].srcSubS=i; /* pick the first one */ - break; - } - } - - for (i = 0; i < 0x60 * 0x60; ++i) { - if (dmap_rec[idx].dmapE12U[i] == 0xFFFD) { - uchar byte1=i / 0x60; - uchar byte2=i % 0x60; - myconv_rec[idx].srcSubD=(byte1 + 0xA0) * 0x100 + (byte2 + 0xA0); /* pick the last one */ - } - } - - } - - } else if (((myconvIsUCS2(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_U2E)) || - ((myconvIsUTF16(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_T2E)) || - ((myconvIsUTF8(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_82E))) { - /* S0: 0x00 - 0xFF */ - if ((dmap_rec[idx].dmapU2S = (uchar *) alloc_root(&dmapMemRoot, 0x100)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapU2S, 0x00, 0x100); - - /* U0080 - UFFFF -> S1: 0xA0 - 0xFF, 0xA0 - 0xFF */ - if ((dmap_rec[idx].dmapU2M2 = (uchar *) alloc_root(&dmapMemRoot, 0xFF80 * 2)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapU2M2, 0x00, 0xFF80 * 2); - - /* U0080 - UFFFF -> SS2: 0x8E + 0xA0 - 0xFF, 0xA0 - 0xFF - * SS3: 0x8F + 0xA0 - 0xFF, 0xA0 - 0xFF */ - if ((dmap_rec[idx].dmapU2M3 = (uchar *) alloc_root(&dmapMemRoot, 0xFF80 * 3)) == NULL) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n", - to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__); -#endif - return -1; - } - memset(dmap_rec[idx].dmapU2M3, 0x00, 0xFF80 * 3); - myconv_rec[idx].allocatedSize=(0x100 + 0xFF80 * 2 + 0xFF80 * 3); - - { - UniChar dmapSrc[0x80]; - iconv_t cd; - int32_t i; - size_t inBytesLeft; - size_t outBytesLeft; - size_t len; - char * inBuf; - char * outBuf; - -#ifdef support_surrogate - if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) { -#else - if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) { -#endif -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - return -1; - } - - for (i = 0; i < 0x80; ++i) - dmapSrc[i]=i; - inBuf=(char *) dmapSrc; - inBytesLeft=0x80 * 2; - outBuf=(char *) dmap_rec[idx].dmapU2S; - outBytesLeft=0x80; - do { - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { -#ifdef DEBUG - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); -#endif - iconv_close(cd); - return -1; - } - } while (inBytesLeft > 0); - - myconv_rec[idx].srcSubS = 0x1A; - myconv_rec[idx].srcSubD = 0xFFFD; - myconv_rec[idx].subS = dmap_rec[idx].dmapU2S[0x1A]; - - outBuf=(char *) &(myconv_rec[idx].subD); - dmapSrc[0]=0xFFFD; - inBuf=(char *) dmapSrc; - inBytesLeft=2; - outBytesLeft=2; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n", - to, from, idx, len, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, "iconv(0x1A,1,%p,1) returns outBuf=%p, outBytesLeft=%d\n", - dmapSrc, outBuf, outBytesLeft); - } -#endif - if (outBytesLeft == 0) { - /* UCS-2_IBM-eucKR returns error. - myconv(iconv) rc=1, error=0, InBytesLeft=0, OutBytesLeft=18 - myconv(iconvRev) rc=-1, error=116, InBytesLeft=2, OutBytesLeft=20 - iconv: 0xFFFD => 0xAFFE => 0x rc=1,-1 sub=0,0 - */ - ; - } else { - iconv_close(cd); - return -1; - } - } - - for (i = 0x80; i < 0xFFFF; ++i) { - uchar eucBuf[3]; - dmapSrc[0]=i; - inBuf=(char *) dmapSrc; - inBytesLeft=2; - outBuf=(char *) eucBuf; - outBytesLeft=sizeof(eucBuf); - errno=0; - if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) { - if (len == 1 && errno == 0 && inBytesLeft == 0 && outBytesLeft == 1) { /* substitution occurred. */ continue; - } - - if (errno == EILSEQ) { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n", - to, from, idx, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft); - if (inBuf - (char *) dmapSrc > 1 && inBuf - (char *) dmapSrc <= sizeof(dmapSrc) - 2) - MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]); - if (outBuf - (char *) dmap_rec[idx].dmapU2M2 > 1) - MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]); - else - MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]); - } -#endif - inBuf+=2; - inBytesLeft-=2; - memcpy(outBuf, (char *) &(myconv_rec[idx].subD), 2); - outBuf+=2; - outBytesLeft-=2; - } else { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc = %d, errno = %d in %s at %d\n", - to, from, idx, len, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf[-2..0]=%02X%02X%02X, outBytesLeft=%d\n", - i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1], - inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft); - MyPrintf(STDERR_WITH_TIME, - "&dmapSrc=%p, inBuf=%p, dmapU2M2 + %d = %p, outBuf=%p\n", - dmapSrc, inBuf, (i - 0x80) * 2, dmap_rec[idx].dmapU2M2 + (i - 0x80) * 2, outBuf); - } -#endif - iconv_close(cd); - return -1; - } - } - if (sizeof(eucBuf) - outBytesLeft == 1) { - if (i < 0x100) { - (dmap_rec[idx].dmapU2S)[i]=eucBuf[0]; - } else { - dmap_rec[idx].dmapU2M2[(i - 0x80) * 2] = eucBuf[0]; - dmap_rec[idx].dmapU2M2[(i - 0x80) * 2 + 1] = 0x00; - } - } else if (sizeof(eucBuf) - outBytesLeft == 2) { /* 2 bytes */ - dmap_rec[idx].dmapU2M2[(i - 0x80) * 2] = eucBuf[0]; - dmap_rec[idx].dmapU2M2[(i - 0x80) * 2 + 1] = eucBuf[1]; - } else if (sizeof(eucBuf) - outBytesLeft == 3) { /* 3 byte SS2/SS3 */ - dmap_rec[idx].dmapU2M3[(i - 0x80) * 3] = eucBuf[0]; - dmap_rec[idx].dmapU2M3[(i - 0x80) * 3 + 1] = eucBuf[1]; - dmap_rec[idx].dmapU2M3[(i - 0x80) * 3 + 2] = eucBuf[2]; - } else { -#ifdef DEBUG - if (myconvDebug) { - MyPrintf(STDERR_WITH_TIME, - "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n", - to, from, idx, len, errno, __FILE__,__LINE__); - MyPrintf(STDERR_WITH_TIME, - "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf=%02X%02X%02X, outBytesLeft=%d\n", - i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1], - inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft); - MyPrintf(STDERR_WITH_TIME, - "&dmapSrc=%p, inBuf=%p, %p, outBuf=%p\n", - dmapSrc, inBuf, dmap_rec[idx].dmapU2M3 + (i - 0x80) * 2, outBuf); - } -#endif - return -1; - } - - } - iconv_close(cd); - } - - } else if (myconvIsUTF16(from) && myconvIsUTF8(to)) { - dmap_rec[idx].codingSchema = DMAP_T28; - - } else if (myconvIsUCS2(from) && myconvIsUTF8(to)) { - dmap_rec[idx].codingSchema = DMAP_U28; - - } else if (myconvIsUTF8(from) && myconvIsUnicode2(to)) { - dmap_rec[idx].codingSchema = DMAP_82U; - - } else if (myconvIsUnicode2(from) && myconvIsUnicode2(to)) { - dmap_rec[idx].codingSchema = DMAP_U2U; - - } else { - - return -1; - } - myconv_rec[idx].cnv_dmap=&(dmap_rec[idx]); - return 0; -} - - - -static int bins_open(const char * to, - const char * from, - const int32_t idx) -{ - return -1; -} - - - -static int32_t dmap_close(const int32_t idx) -{ - if (dmap_rec[idx].codingSchema == DMAP_S2S) { - if (dmap_rec[idx].dmapS2S != NULL) { - dmap_rec[idx].dmapS2S=NULL; - } - } else if (dmap_rec[idx].codingSchema = DMAP_E2U) { - if (dmap_rec[idx].dmapE02U != NULL) { - dmap_rec[idx].dmapE02U=NULL; - } - if (dmap_rec[idx].dmapE12U != NULL) { - dmap_rec[idx].dmapE12U=NULL; - } - if (dmap_rec[idx].dmapE22U != NULL) { - dmap_rec[idx].dmapE22U=NULL; - } - if (dmap_rec[idx].dmapE32U != NULL) { - dmap_rec[idx].dmapE32U=NULL; - } - } - - return 0; -} - - -static int32_t bins_close(const int32_t idx) -{ - return 0; -} - - -myconv_t myconv_open(const char * toCode, - const char * fromCode, - int32_t converter) -{ - int32 i; - for (i = 0; i < MAX_CONVERTER; ++i) { - if (myconv_rec[i].converterType == 0) - break; - } - if (i >= MAX_CONVERTER) - return ((myconv_t) -1); - - myconv_rec[i].converterType = converter; - myconv_rec[i].index=i; - myconv_rec[i].fromCcsid=cstoccsid(fromCode); - if (myconv_rec[i].fromCcsid == 0 && memcmp(fromCode, "big5",5) == 0) - myconv_rec[i].fromCcsid=950; - myconv_rec[i].toCcsid=cstoccsid(toCode); - if (myconv_rec[i].toCcsid == 0 && memcmp(toCode, "big5",5) == 0) - myconv_rec[i].toCcsid=950; - strncpy(myconv_rec[i].from, fromCode, sizeof(myconv_rec[i].from)-1); - strncpy(myconv_rec[i].to, toCode, sizeof(myconv_rec[i].to)-1); - - if (converter == CONVERTER_ICONV) { - if ((myconv_rec[i].cnv_iconv=iconv_open(toCode, fromCode)) == (iconv_t) -1) { - return ((myconv_t) -1); - } - myconv_rec[i].allocatedSize = -1; - myconv_rec[i].srcSubS=myconvGetSubS(fromCode); - myconv_rec[i].srcSubD=myconvGetSubD(fromCode); - myconv_rec[i].subS=myconvGetSubS(toCode); - myconv_rec[i].subD=myconvGetSubD(toCode); - return &(myconv_rec[i]); - } else if (converter == CONVERTER_DMAP && - dmap_open(toCode, fromCode, i) != -1) { - return &(myconv_rec[i]); - } - return ((myconv_t) -1); -} - - - -int32_t myconv_close(myconv_t cd) -{ - int32_t ret=0; - - if (cd->converterType == CONVERTER_ICONV) { - ret=iconv_close(cd->cnv_iconv); - } else if (cd->converterType == CONVERTER_DMAP) { - ret=dmap_close(cd->index); - } - memset(&(myconv_rec[cd->index]), 0x00, sizeof(myconv_rec[cd->index])); - return ret; -} - - - - -/* reference: http://www-306.ibm.com/software/globalization/other/es.jsp */ -/* systemCL would be expensive, and myconvIsXXXXX is called frequently. - need to cache entries */ -#define MAX_CCSID 256 -static int ccsidList [MAX_CCSID]; -static int esList [MAX_CCSID]; -int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme); -EXTERN int myconvGetES(CCSID ccsid) -{ - /* call QtqValidateCCSID in ILE to get encoding schema */ - /* return QtqValidateCCSID(ccsid); */ - int i; - for (i = 0; i < MAX_CCSID; ++i) { - if (ccsidList[i] == ccsid) - return esList[i]; - if (ccsidList[i] == 0x00) - break; - } - - if (i >= MAX_CCSID) { - i=MAX_CCSID-1; - } - - { - ccsidList[i]=ccsid; - getEncodingScheme(ccsid, esList[i]); -#ifdef DEBUG_PASE - if (myconvDebug) { - fprintf(stderr, "CCSID=%d, ES=0x%04X\n", ccsid, esList[i]); - } -#endif - return esList[i]; - } - return 0; -} - - -EXTERN int myconvIsEBCDIC(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x1100 || - es == 0x1200 || - es == 0x6100 || - es == 0x6200 || - es == 0x1301 ) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsISO(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x4100 || - es == 0x4105 || - es == 0x4155 || - es == 0x5100 || - es == 0x5150 || - es == 0x5200 || - es == 0x5404 || - es == 0x5409 || - es == 0x540A || - es == 0x5700) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsASCII(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x2100 || - es == 0x3100 || - es == 0x8100 || - es == 0x2200 || - es == 0x3200 || - es == 0x9200 || - es == 0x2300 || - es == 0x2305 || - es == 0x3300 || - es == 0x2900 || - es == 0x2A00) { - return TRUE; - } else if (memcmp(pName, "big5", 5) == 0) { - return TRUE; - } - return FALSE; -} - - - -EXTERN int myconvIsUCS2(const char * pName) -{ - if (cstoccsid(pName) == 13488) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsUTF16(const char * pName) -{ - if (cstoccsid(pName) == 1200) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsUnicode2(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x7200 || - es == 0x720B || - es == 0x720F) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsUTF8(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x7807) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsUnicode(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x7200 || - es == 0x720B || - es == 0x720F || - es == 0x7807) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsEUC(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x4403) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsDBCS(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x1200 || - es == 0x2200 || - es == 0x2300 || - es == 0x2305 || - es == 0x2A00 || - es == 0x3200 || - es == 0x3300 || - es == 0x5200 || - es == 0x6200 || - es == 0x9200) { - return TRUE; - } else if (memcmp(pName, "big5", 5) == 0) { - return TRUE; - } - return FALSE; -} - - -EXTERN int myconvIsSBCS(const char * pName) -{ - int es = myconvGetES(cstoccsid(pName)); - if (es == 0x1100 || - es == 0x2100 || - es == 0x3100 || - es == 0x4100 || - es == 0x4105 || - es == 0x5100 || - es == 0x5150 || - es == 0x6100 || - es == 0x8100) { - return TRUE; - } - return FALSE; -} - - - -EXTERN char myconvGetSubS(const char * code) -{ - if (myconvIsEBCDIC(code)) { - return 0x3F; - } else if (myconvIsASCII(code)) { - return 0x1A; - } else if (myconvIsISO(code)) { - return 0x1A; - } else if (myconvIsEUC(code)) { - return 0x1A; - } else if (myconvIsUCS2(code)) { - return 0x00; - } else if (myconvIsUTF8(code)) { - return 0x1A; - } - return 0x00; -} - - -EXTERN UniChar myconvGetSubD(const char * code) -{ - if (myconvIsEBCDIC(code)) { - return 0xFDFD; - } else if (myconvIsASCII(code)) { - return 0xFCFC; - } else if (myconvIsISO(code)) { - return 0x00; - } else if (myconvIsEUC(code)) { - return 0x00; - } else if (myconvIsUCS2(code)) { - return 0xFFFD; - } else if (myconvIsUTF8(code)) { - return 0x00; - } - return 0x00; -} - diff --git a/storage/ibmdb2i/db2i_myconv.h b/storage/ibmdb2i/db2i_myconv.h deleted file mode 100644 index 98032748148..00000000000 --- a/storage/ibmdb2i/db2i_myconv.h +++ /dev/null @@ -1,3201 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -/** - @file - - @brief A direct map optimization of iconv and related functions - This was show to significantly reduce character conversion cost - for short strings when compared to calling iconv system code. -*/ - -#ifndef DB2I_MYCONV_H -#define DB2I_MYCONV_H - - -#include <sys/time.h> -#include <stdlib.h> -#include <stdio.h> -#include <wchar.h> -#include <errno.h> -#include <iconv.h> -#include <ctype.h> -#include <time.h> -#include <stdarg.h> -#include <string.h> - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifdef __cplusplus -#define INTERN inline -#define EXTERN extern "C" -#else -#define INTERN static -#define EXTERN extern -#endif - - -/* ANSI integer data types */ -#if defined(__OS400_TGTVRM__) -/* for DTAMDL(*P128), datamodel(P128): int/long/pointer=4/4/16 */ -/* LLP64:4/4/8 is used for teraspace ?? */ -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef long long int64_t; -typedef unsigned long long uint64_t; -#elif defined(PASE) -/* PASE uses IPL32: int/long/pointer=4/4/4 + long long */ -#elif defined(__64BIT__) -/* AIX 64 bit uses LP64: int/long/pointer=4/8/8 */ -#endif - -#define CONVERTER_ICONV 1 -#define CONVERTER_DMAP 2 - -#define DMAP_S2S 10 -#define DMAP_S2U 20 -#define DMAP_D2U 30 -#define DMAP_E2U 40 -#define DMAP_U2S 120 -#define DMAP_T2S 125 -#define DMAP_U2D 130 -#define DMAP_T2D 135 -#define DMAP_U2E 140 -#define DMAP_T2E 145 -#define DMAP_S28 220 -#define DMAP_D28 230 -#define DMAP_E28 240 -#define DMAP_82S 310 -#define DMAP_82D 320 -#define DMAP_82E 330 -#define DMAP_U28 410 -#define DMAP_82U 420 -#define DMAP_T28 425 -#define DMAP_U2U 510 - - -typedef struct __dmap_rec *dmap_t; - -struct __dmap_rec -{ - uint32_t codingSchema; - unsigned char * dmapS2S; /* SBCS -> SBCS */ - /* The following conversion needs be followed by conversion from UCS-2/UTF-16 to UTF-8 */ - UniChar * dmapD12U; /* DBCS(non-EUC) -> UCS-2/UTF-16 */ - UniChar * dmapD22U; /* DBCS(non-EUC) -> UCS-2/UTF-16 */ - UniChar * dmapE02U; /* EUC/SS0 -> UCS-2/UTF-16 */ - UniChar * dmapE12U; /* EUC/SS1 -> UCS-2/UTF-16 */ - UniChar * dmapE22U; /* EUC/0x8E + SS2 -> UCS-2/UTF-16 */ - UniChar * dmapE32U; /* EUC/0x8F + SS3 -> UCS-2/UTF-16 */ - uchar * dmapU2D; /* UCS-2 -> DBCS */ - uchar * dmapU2S; /* UCS-2 -> EUC SS0 */ - uchar * dmapU2M2; /* UCS-2 -> EUC SS1 */ - uchar * dmapU2M3; /* UCS-2 -> EUC SS2/SS3 */ - /* All of these pointers/tables are not used at the same time. - * You may be able save some space if you consolidate them. - */ - uchar * dmapS28; /* SBCS -> UTF-8 */ - uchar * dmapD28; /* DBCS -> UTF-8 */ -}; - -typedef struct __myconv_rec *myconv_t; -struct __myconv_rec -{ - uint32_t converterType; - uint32_t index; /* for close */ - union { - iconv_t cnv_iconv; - dmap_t cnv_dmap; - }; - int32_t allocatedSize; - int32_t fromCcsid; - int32_t toCcsid; - UniChar subD; /* DBCS substitution char */ - char subS; /* SBCS substitution char */ - UniChar srcSubD; /* DBCS substitution char of src codepage */ - char srcSubS; /* SBCS substitution char of src codepage */ - char from [41+1]; /* codepage name is up to 41 bytes */ - char to [41+1]; /* codepage name is up to 41 bytes */ -#ifdef __64BIT__ - char reserved[10]; /* align 128 */ -#else - char reserved[14]; /* align 128 */ -#endif -}; - - -EXTERN int32_t myconvDebug; - - - -EXTERN int myconvGetES(CCSID); -EXTERN int myconvIsEBCDIC(const char *); -EXTERN int myconvIsASCII(const char *); -EXTERN int myconvIsUnicode(const char *); /* UTF-8, UTF-16, or UCS-2 */ -EXTERN int myconvIsUnicode2(const char *); /* 2 byte Unicode */ -EXTERN int myconvIsUCS2(const char *); -EXTERN int myconvIsUTF16(const char *); -EXTERN int myconvIsUTF8(const char *); -EXTERN int myconvIsEUC(const char *); -EXTERN int myconvIsISO(const char *); -EXTERN int myconvIsSBCS(const char *); -EXTERN int myconvIsDBCS(const char *); -EXTERN char myconvGetSubS(const char *); -EXTERN UniChar myconvGetSubD(const char *); - - -EXTERN myconv_t myconv_open(const char*, const char*, int32_t); -EXTERN int myconv_close(myconv_t); - -INTERN size_t myconv_iconv(myconv_t cd , - char** inBuf, - size_t* inBytesLeft, - char** outBuf, - size_t* outBytesLeft, - size_t* numSub) -{ - return iconv(cd->cnv_iconv, inBuf, inBytesLeft, outBuf, outBytesLeft); -} - -INTERN size_t myconv_dmap(myconv_t cd, - char** inBuf, - size_t* inBytesLeft, - char** outBuf, - size_t* outBytesLeft, - size_t* numSub) -{ - if (cd->cnv_dmap->codingSchema == DMAP_S2S) { - register unsigned char * dmapS2S=cd->cnv_dmap->dmapS2S; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register size_t numS=0; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - } else { - *pOut=dmapS2S[*pIn]; - if (*pOut == 0x00) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(*inBytesLeft-inLen); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - if (*pOut == subS) { - if ((*pOut=dmapS2S[*pIn]) == subS) { - if (*pIn != cd->srcSubS) - ++numS; - } - } - } - ++pIn; - --inLen; - ++pOut; - } - *outBytesLeft-=(*inBytesLeft-inLen); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_E2U) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapE02U=(uchar *) (cd->cnv_dmap->dmapE02U); - register uchar * dmapE12U=(uchar *) (cd->cnv_dmap->dmapE12U); - register uchar * dmapE22U=(uchar *) (cd->cnv_dmap->dmapE22U); - register uchar * dmapE32U=(uchar *) (cd->cnv_dmap->dmapE32U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - if (*pIn == 0x8E) { /* SS2 */ - if (inLen < 2) { - if (cd->fromCcsid == 33722 || /* IBM-eucJP */ - cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0); - offset<<=1; - if (dmapE22U[offset] == 0x00 && - dmapE22U[offset+1] == 0x00) { /* 2 bytes */ - if (inLen < 3) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0) * 0x60 + 0x60; - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE22U[offset] == 0x00 && - dmapE22U[offset+1] == 0x00) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - *pOut=dmapE22U[offset]; - ++pOut; - *pOut=dmapE22U[offset+1]; - ++pOut; - if (dmapE22U[offset] == 0xFF && - dmapE22U[offset+1] == 0xFD) { - if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=3; - } else { /* 1 bytes */ - *pOut=dmapE22U[offset]; - ++pOut; - *pOut=dmapE22U[offset+1]; - ++pOut; - ++pIn; - inLen-=2; - } - } else if (*pIn == 0x8F) { /* SS3 */ - if (inLen < 2) { - if (cd->fromCcsid == 33722) /* IBM-eucJP */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 970 || /* IBM-eucKR */ - cd->fromCcsid == 964 || /* IBM-eucTW */ - cd->fromCcsid == 1383 || /* IBM-eucCN */ - (cd->fromCcsid == 33722 && 3 <= inLen)) /* IBM-eucJP */ - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0); - offset<<=1; - if (dmapE32U[offset] == 0x00 && - dmapE32U[offset+1] == 0x00) { /* 0x8F + 2 bytes */ - if (inLen < 3) { - if (cd->fromCcsid == 33722) - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0) * 0x60 + 0x60; - ++pIn; - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE32U[offset] == 0x00 && - dmapE32U[offset+1] == 0x00) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - *pOut=dmapE32U[offset]; - ++pOut; - *pOut=dmapE32U[offset+1]; - ++pOut; - if (dmapE32U[offset] == 0xFF && - dmapE32U[offset+1] == 0xFD) { - if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=3; - } else { /* 0x8F + 1 bytes */ - *pOut=dmapE32U[offset]; - ++pOut; - *pOut=dmapE32U[offset+1]; - ++pOut; - ++pIn; - inLen-=2; - } - - } else { - offset=*pIn; - offset<<=1; - if (dmapE02U[offset] == 0x00 && - dmapE02U[offset+1] == 0x00) { /* SS1 */ - if (inLen < 2) { - if ((cd->fromCcsid == 33722 && (*pIn == 0xA0 || (0xA9 <= *pIn && *pIn <= 0xAF) || *pIn == 0xFF)) || - (cd->fromCcsid == 970 && (*pIn == 0xA0 || *pIn == 0xAD || *pIn == 0xAE || *pIn == 0xAF || *pIn == 0xFF)) || - (cd->fromCcsid == 964 && (*pIn == 0xA0 || (0xAA <= *pIn && *pIn <= 0xC1) || *pIn == 0xC3 || *pIn == 0xFE || *pIn == 0xFF)) || - (cd->fromCcsid == 1383 && (*pIn == 0xA0 || *pIn == 0xFF))) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - offset=(*pIn - 0xA0) * 0x60; - ++pIn; - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE12U[offset] == 0x00 && - dmapE12U[offset+1] == 0x00) { /* undefined mapping */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - *pOut=dmapE12U[offset]; - ++pOut; - *pOut=dmapE12U[offset+1]; - ++pOut; - if (dmapE12U[offset] == 0xFF && - dmapE12U[offset+1] == 0xFD) { - if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=2; - } else { - *pOut=dmapE02U[offset]; - ++pOut; - *pOut=dmapE02U[offset+1]; - ++pOut; - if (dmapE02U[offset] == 0x00 && - dmapE02U[offset+1] == 0x1A) { - if (*pIn != cd->srcSubS) - ++numS; - } - ++pIn; - --inLen; - } - } - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - - } else if (cd->cnv_dmap->codingSchema == DMAP_E28) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapE02U=(uchar *) (cd->cnv_dmap->dmapE02U); - register uchar * dmapE12U=(uchar *) (cd->cnv_dmap->dmapE12U); - register uchar * dmapE22U=(uchar *) (cd->cnv_dmap->dmapE22U); - register uchar * dmapE32U=(uchar *) (cd->cnv_dmap->dmapE32U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - register UniChar in; /* copy part of U28 */ - register UniChar ucs2; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - if (*pIn == 0x8E) { /* SS2 */ - if (inLen < 2) { - if (cd->fromCcsid == 33722 || /* IBM-eucJP */ - cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0); - offset<<=1; - if (dmapE22U[offset] == 0x00 && - dmapE22U[offset+1] == 0x00) { /* 2 bytes */ - if (inLen < 3) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0) * 0x60 + 0x60; - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE22U[offset] == 0x00 && - dmapE22U[offset+1] == 0x00) { - if (cd->fromCcsid == 964) /* IBM-eucTW */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - in=dmapE22U[offset]; - in<<=8; - in+=dmapE22U[offset+1]; - if (dmapE22U[offset] == 0xFF && - dmapE22U[offset+1] == 0xFD) { - if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=3; - } else { /* 1 bytes */ - in=dmapE22U[offset]; - in<<=8; - in+=dmapE22U[offset+1]; - ++pIn; - inLen-=2; - } - } else if (*pIn == 0x8F) { /* SS3 */ - if (inLen < 2) { - if (cd->fromCcsid == 33722) /* IBM-eucJP */ - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - ++pIn; - if (*pIn < 0xA0) { - if (cd->fromCcsid == 970 || /* IBM-eucKR */ - cd->fromCcsid == 964 || /* IBM-eucTW */ - cd->fromCcsid == 1383 || /* IBM-eucCN */ - (cd->fromCcsid == 33722 && 3 <= inLen)) /* IBM-eucJP */ - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0); - offset<<=1; - if (dmapE32U[offset] == 0x00 && - dmapE32U[offset+1] == 0x00) { /* 0x8F + 2 bytes */ - if (inLen < 3) { - if (cd->fromCcsid == 33722) - errno=EINVAL; /* 22 */ - else - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset=(*pIn - 0xA0) * 0x60 + 0x60; - ++pIn; - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE32U[offset] == 0x00 && - dmapE32U[offset+1] == 0x00) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - return -1; - } - in=dmapE32U[offset]; - in<<=8; - in+=dmapE32U[offset+1]; - if (dmapE32U[offset] == 0xFF && - dmapE32U[offset+1] == 0xFD) { - if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=3; - } else { /* 0x8F + 1 bytes */ - in=dmapE32U[offset]; - in<<=8; - in+=dmapE32U[offset+1]; - ++pIn; - inLen-=2; - } - - } else { - offset=*pIn; - offset<<=1; - if (dmapE02U[offset] == 0x00 && - dmapE02U[offset+1] == 0x00) { /* SS1 */ - if (inLen < 2) { - if ((cd->fromCcsid == 33722 && (*pIn == 0xA0 || (0xA9 <= *pIn && *pIn <= 0xAF) || *pIn == 0xFF)) || - (cd->fromCcsid == 970 && (*pIn == 0xA0 || *pIn == 0xAD || *pIn == 0xAE || *pIn == 0xAF || *pIn == 0xFF)) || - (cd->fromCcsid == 964 && (*pIn == 0xA0 || (0xAA <= *pIn && *pIn <= 0xC1) || *pIn == 0xC3 || *pIn == 0xFE || *pIn == 0xFF)) || - (cd->fromCcsid == 1383 && (*pIn == 0xA0 || *pIn == 0xFF))) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - offset=(*pIn - 0xA0) * 0x60; - ++pIn; - if (*pIn < 0xA0) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - offset+=(*pIn - 0xA0); - offset<<=1; - if (dmapE12U[offset] == 0x00 && - dmapE12U[offset+1] == 0x00) { /* undefined mapping */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - in=dmapE12U[offset]; - in<<=8; - in+=dmapE12U[offset+1]; - if (dmapE12U[offset] == 0xFF && - dmapE12U[offset+1] == 0xFD) { - if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=2; - } else { - in=dmapE02U[offset]; - in<<=8; - in+=dmapE02U[offset+1]; - if (dmapE02U[offset] == 0x00 && - dmapE02U[offset+1] == 0x1A) { - if (*pIn != cd->srcSubS) - ++numS; - } - ++pIn; - --inLen; - } - } - ucs2=in; - if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */ - *pOut=in; - ++pOut; - } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */ - register uchar byte; - in>>=6; - in&=0x001F; /* 0b0000000000011111 */ - in|=0x00C0; /* 0b0000000011000000 */ - *pOut=in; - ++pOut; - byte=ucs2; /* dmapD12U[offset+1]; */ - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } else if ((in & 0xFC00) == 0xD800) { - *pOut=0xEF; - ++pOut; - *pOut=0xBF; - ++pOut; - *pOut=0xBD; - ++pOut; - } else { - register uchar byte; - register uchar work; - byte=(ucs2>>8); /* dmapD12U[offset]; */ - byte>>=4; - byte|=0xE0; /* 0b11100000; */ - *pOut=byte; - ++pOut; - - byte=(ucs2>>8); /* dmapD12U[offset]; */ - byte<<=2; - work=ucs2; /* dmapD12U[offset+1]; */ - work>>=6; - byte|=work; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - - byte=ucs2; /* dmapD12U[offset+1]; */ - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } - /* end of U28 */ - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_U2E) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2; - register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - register size_t rc=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if (in < 0x100 && dmapU2S[in] != 0x0000) { - if ((*pOut=dmapU2S[in]) == subS) { - if (in != cd->srcSubS) - ++numS; - } - ++pOut; - } else { - in<<=1; - if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */ - in*=1.5; - if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/ - *pOut=pSubD[0]; - ++pOut; - *pOut=pSubD[1]; - ++pOut; - ++numS; - ++rc; - } else { - *pOut=dmapU2M3[in]; - ++pOut; - *pOut=dmapU2M3[1+in]; - ++pOut; - *pOut=dmapU2M3[2+in]; - ++pOut; - } - } else { - *pOut=dmapU2M2[in]; - ++pOut; - if (dmapU2M2[1+in] == 0x00) { - if (*pOut == subS) { - in>>=1; - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2M2[1+in]; - ++pOut; - if (memcmp(pOut-2, pSubD, 2) == 0) { - in>>=1; - if (in != cd->srcSubD) { - ++numS; - ++rc; - } - } - } - } - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return rc; /* compatibility to iconv() */ - - } else if (cd->cnv_dmap->codingSchema == DMAP_T2E) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2; - register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - register size_t rc=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen-1; - *outBuf=pOut; - *inBuf=pIn; - ++numS; - *numSub+=numS; - return 0; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if (0xD800 <= in && in <= 0xDBFF) { /* first byte of surrogate */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-2; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn+2; - ++numS; - *numSub+=numS; - return -1; - - } else if (0xDC00 <= in && in <= 0xDFFF) { /* second byte of surrogate */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - ++numS; - *numSub+=numS; - return -1; - - } else if (in < 0x100 && dmapU2S[in] != 0x0000) { - if ((*pOut=dmapU2S[in]) == subS) { - if (in != cd->srcSubS) - ++numS; - } - ++pOut; - } else { - in<<=1; - if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */ - in*=1.5; - if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/ - *pOut=pSubD[0]; - ++pOut; - *pOut=pSubD[1]; - ++pOut; - ++numS; - ++rc; - } else { - *pOut=dmapU2M3[in]; - ++pOut; - *pOut=dmapU2M3[1+in]; - ++pOut; - *pOut=dmapU2M3[2+in]; - ++pOut; - } - } else { - *pOut=dmapU2M2[in]; - ++pOut; - if (dmapU2M2[1+in] == 0x00) { - if (*pOut == subS) { - in>>=1; - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2M2[1+in]; - ++pOut; - if (memcmp(pOut-2, pSubD, 2) == 0) { - in>>=1; - if (in != cd->srcSubD) { - ++numS; - ++rc; - } - } - } - } - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_82E) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2; - register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - register size_t rc=0; - while (0 < inLen) { - register uint32_t in; - uint32_t in2; - if (pLastOutBuf < pOut) - break; - /* convert from UTF-8 to UCS-2 */ - if (*pIn == 0x00) { - in=0x0000; - ++pIn; - --inLen; - } else { /* 82U: */ - register uchar byte1=*pIn; - if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */ - /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/ - in=byte1; - ++pIn; - --inLen; - } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */ - if (inLen < 2) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - /* 2 bytes sequence: - 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */ - register uchar byte2; - ++pIn; - byte2=*pIn; - if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */ - register uchar work=byte1; - work<<=6; - byte2&=0x3F; /* 0b00111111; */ - byte2|=work; - - byte1&=0x1F; /* 0b00011111; */ - byte1>>=2; - in=byte1; - in<<=8; - in+=byte2; - inLen-=2; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */ - /* 3 bytes sequence: - 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */ - register uchar byte2; - register uchar byte3; - if (inLen < 3) { - if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - if ((byte2 & 0xC0) != 0x80 || - (byte3 & 0xC0) != 0x80 || - (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - *numSub+=numS; - return -1; - } - { - register uchar work=byte2; - work<<=6; - byte3&=0x3F; /* 0b00111111; */ - byte3|=work; - - byte2&=0x3F; /* 0b00111111; */ - byte2>>=2; - - byte1<<=4; - in=byte1 | byte2;; - in<<=8; - in+=byte3; - inLen-=3; - ++pIn; - } - } else if ((0xF0 <= byte1 && byte1 <= 0xF4)) { /* (bytes1 & 11111000) == 0x1110000 */ - /* 4 bytes sequence - 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx - where uuuuu = wwww + 1 */ - register uchar byte2; - register uchar byte3; - register uchar byte4; - if (inLen < 4) { - if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) || - (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) || - (cd->toCcsid == 13488) ) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - ++pIn; - byte4=*pIn; - if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */ - (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */ - (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */ - register uchar work=byte2; - if (byte1 == 0xF0 && byte2 < 0x90) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - /* iconv() returns 0 for 0xF4908080 and convert to 0x00 - } else if (byte1 == 0xF4 && byte2 > 0x8F) { - errno=EINVAL; - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - */ - } - - work&=0x30; /* 0b00110000; */ - work>>=4; - byte1&=0x07; /* 0b00000111; */ - byte1<<=2; - byte1+=work; /* uuuuu */ - --byte1; /* wwww */ - - work=byte1 & 0x0F; - work>>=2; - work+=0xD8; /* 0b11011011; */ - in=work; - in<<=8; - - byte1<<=6; - byte2<<=2; - byte2&=0x3C; /* 0b00111100; */ - work=byte3; - work>>=4; - work&=0x03; /* 0b00000011; */ - work|=byte1; - work|=byte2; - in+=work; - - work=byte3; - work>>=2; - work&=0x03; /* 0b00000011; */ - work|=0xDC; /* 0b110111xx; */ - in2=work; - in2<<=8; - - byte3<<=6; - byte4&=0x3F; /* 0b00111111; */ - byte4|=byte3; - in2+=byte4; - inLen-=4; - ++pIn; -#ifdef match_with_GBK - if ((0xD800 == in && in2 < 0xDC80) || - (0xD840 == in && in2 < 0xDC80) || - (0xD880 == in && in2 < 0xDC80) || - (0xD8C0 == in && in2 < 0xDC80) || - (0xD900 == in && in2 < 0xDC80) || - (0xD940 == in && in2 < 0xDC80) || - (0xD980 == in && in2 < 0xDC80) || - (0xD9C0 == in && in2 < 0xDC80) || - (0xDA00 == in && in2 < 0xDC80) || - (0xDA40 == in && in2 < 0xDC80) || - (0xDA80 == in && in2 < 0xDC80) || - (0xDAC0 == in && in2 < 0xDC80) || - (0xDB00 == in && in2 < 0xDC80) || - (0xDB40 == in && in2 < 0xDC80) || - (0xDB80 == in && in2 < 0xDC80) || - (0xDBC0 == in && in2 < 0xDC80)) { -#else - if ((0xD800 <= in && in <= 0xDBFF) && - (0xDC00 <= in2 && in2 <= 0xDFFF)) { -#endif - *pOut=subS; - ++pOut; - ++numS; - continue; - } - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } - } else if (0xF5 <= byte1 && byte1 <= 0xFF) { /* minic iconv() behavior */ - if (inLen < 4 || - (inLen >= 4 && byte1 == 0xF8 && pIn[1] < 0x90) || - pIn[1] < 0x80 || 0xBF < pIn[1] || - pIn[2] < 0x80 || 0xBF < pIn[2] || - pIn[3] < 0x80 || 0xBF < pIn[3] ) { - if (inLen == 1) - errno=EINVAL; /* 22 */ - else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else if (inLen >= 4 && (byte1 == 0xF8 || (pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } else if ((pIn[1] == 0x80 || pIn[1] == 0x90 || pIn[1] == 0xA0 || pIn[1] == 0xB0) && - pIn[2] < 0x82) { - *pOut=subS; /* Though returns replacement character, which iconv() does not return. */ - ++pOut; - ++numS; - pIn+=4; - inLen-=4; - continue; - } else { - *pOut=pSubD[0]; /* Though returns replacement character, which iconv() does not return. */ - ++pOut; - *pOut=pSubD[1]; - ++pOut; - ++numS; - pIn+=4; - inLen-=4; - continue; - /* iconv() returns 0 with strange 1 byte converted values */ - } - - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - } - /* end of UTF-8 to UCS-2 */ - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if (in < 0x100 && dmapU2S[in] != 0x0000) { - if ((*pOut=dmapU2S[in]) == subS) { - if (in != cd->srcSubS) - ++numS; - } - ++pOut; - } else { - in<<=1; - if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */ - in*=1.5; - if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/ - *pOut=pSubD[0]; - ++pOut; - *pOut=pSubD[1]; - ++pOut; - ++numS; - ++rc; - } else { - *pOut=dmapU2M3[in]; - ++pOut; - *pOut=dmapU2M3[1+in]; - ++pOut; - *pOut=dmapU2M3[2+in]; - ++pOut; - } - } else { - *pOut=dmapU2M2[in]; - ++pOut; - if (dmapU2M2[1+in] == 0x00) { - if (*pOut == subS) { - in>>=1; - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2M2[1+in]; - ++pOut; - if (memcmp(pOut-2, pSubD, 2) == 0) { - in>>=1; - if (in != cd->srcSubD) { - ++numS; - ++rc; - } - } - } - } - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_S2U) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - offset=*pIn; - offset<<=1; - *pOut=dmapD12U[offset]; - ++pOut; - *pOut=dmapD12U[offset+1]; - ++pOut; - if (dmapD12U[offset] == 0x00) { - if (dmapD12U[offset+1] == 0x1A) { - if (*pIn != cd->srcSubS) - ++numS; - } else if (dmapD12U[offset+1] == 0x00) { - pOut-=2; - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - } - ++pIn; - --inLen; - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_S28) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - register UniChar in; /* copy part of U28 */ - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - offset=*pIn; - offset<<=1; - in=dmapD12U[offset]; - in<<=8; - in+=dmapD12U[offset+1]; - if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */ - if (in == 0x000) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - *pOut=in; - ++pOut; - } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */ - register uchar byte; - in>>=6; - in&=0x001F; /* 0b0000000000011111 */ - in|=0x00C0; /* 0b0000000011000000 */ - *pOut=in; - ++pOut; - byte=dmapD12U[offset+1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } else if ((in & 0xFC00) == 0xD800) { /* There should not be no surrogate character in SBCS. */ - *pOut=0xEF; - ++pOut; - *pOut=0xBF; - ++pOut; - *pOut=0xBD; - ++pOut; - } else { - register uchar byte; - register uchar work; - byte=dmapD12U[offset]; - byte>>=4; - byte|=0xE0; /* 0b11100000; */ - *pOut=byte; - ++pOut; - - byte=dmapD12U[offset]; - byte<<=2; - work=dmapD12U[offset+1]; - work>>=6; - byte|=work; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - - byte=dmapD12U[offset+1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } - /* end of U28 */ - if (dmapD12U[offset] == 0x00) { - if (dmapD12U[offset+1] == 0x1A) { - if (*pIn != cd->srcSubS) - ++numS; - } - } - ++pIn; - --inLen; - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_U2S) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - - *inBytesLeft=inLen; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - } else { - if ((*pOut=dmapU2S[in]) == 0x00) { - *pOut=subS; - ++numS; - errno=EINVAL; /* 22 */ - } else if (*pOut == subS) { - if (in != cd->srcSubS) - ++numS; - } - } - ++pOut; - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return numS; - - } else if (cd->cnv_dmap->codingSchema == DMAP_T2S) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - ++numS; - *numSub+=numS; - return 0; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - - } else if (0xD800 <= in && in <= 0xDFFF) { /* 0xD800-0xDFFF, surrogate first and second values */ - if (0xDC00 <= in ) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - - } else if (inLen < 4) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-2; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn+2; - return -1; - - } else { - register uint32_t in2; - in2=pIn[2]; - in2<<=8; - in2+=pIn[3]; - if (0xDC00 <= in2 && in2 <= 0xDFFF) { /* second surrogate character =0xDC00 - 0xDFFF*/ - *pOut=subS; - ++numS; - pIn+=4; - } else { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - } - } else { - if ((*pOut=dmapU2S[in]) == 0x00) { - *pOut=subS; - ++numS; - errno=EINVAL; /* 22 */ - } else if (*pOut == subS) { - if (in != cd->srcSubS) - ++numS; - } - } - ++pOut; - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_82S) { - register uchar * dmapU2S=cd->cnv_dmap->dmapU2S; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - uint32_t in2; /* The second surrogate value */ - if (pLastOutBuf < pOut) - break; - /* convert from UTF-8 to UCS-2 */ - if (*pIn == 0x00) { - in=0x0000; - ++pIn; - --inLen; - } else { /* 82U: */ - register uchar byte1=*pIn; - if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */ - /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/ - in=byte1; - ++pIn; - --inLen; - } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */ - if (inLen < 2) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - /* 2 bytes sequence: - 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */ - register uchar byte2; - ++pIn; - byte2=*pIn; - if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */ - register uchar work=byte1; - work<<=6; - byte2&=0x3F; /* 0b00111111; */ - byte2|=work; - - byte1&=0x1F; /* 0b00011111; */ - byte1>>=2; - in=byte1; - in<<=8; - in+=byte2; - inLen-=2; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */ - /* 3 bytes sequence: - 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */ - register uchar byte2; - register uchar byte3; - if (inLen < 3) { - if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - if ((byte2 & 0xC0) != 0x80 || - (byte3 & 0xC0) != 0x80 || - (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - *numSub+=numS; - return -1; - } - { - register uchar work=byte2; - work<<=6; - byte3&=0x3F; /* 0b00111111; */ - byte3|=work; - - byte2&=0x3F; /* 0b00111111; */ - byte2>>=2; - - byte1<<=4; - in=byte1 | byte2;; - in<<=8; - in+=byte3; - inLen-=3; - ++pIn; - } - } else if ((0xF0 <= byte1 && byte1 <= 0xF4) || /* (bytes1 & 11111000) == 0x1110000 */ - ((byte1&=0xF7) && 0xF0 <= byte1 && byte1 <= 0xF4)) { /* minic iconv() behavior */ - /* 4 bytes sequence - 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx - where uuuuu = wwww + 1 */ - register uchar byte2; - register uchar byte3; - register uchar byte4; - if (inLen < 4) { - if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) || - (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) || - (cd->toCcsid == 13488) ) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - ++pIn; - byte4=*pIn; - if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */ - (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */ - (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */ - register uchar work=byte2; - if (byte1 == 0xF0 && byte2 < 0x90) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - /* iconv() returns 0 for 0xF4908080 and convert to 0x00 - } else if (byte1 == 0xF4 && byte2 > 0x8F) { - errno=EINVAL; - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - */ - } - - work&=0x30; /* 0b00110000; */ - work>>=4; - byte1&=0x07; /* 0b00000111; */ - byte1<<=2; - byte1+=work; /* uuuuu */ - --byte1; /* wwww */ - - work=byte1 & 0x0F; - work>>=2; - work+=0xD8; /* 0b11011011; */ - in=work; - in<<=8; - - byte1<<=6; - byte2<<=2; - byte2&=0x3C; /* 0b00111100; */ - work=byte3; - work>>=4; - work&=0x03; /* 0b00000011; */ - work|=byte1; - work|=byte2; - in+=work; - - work=byte3; - work>>=2; - work&=0x03; /* 0b00000011; */ - work|=0xDC; /* 0b110111xx; */ - in2=work; - in2<<=8; - - byte3<<=6; - byte4&=0x3F; /* 0b00111111; */ - byte4|=byte3; - in2+=byte4; - inLen-=4; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xF0) { /* minic iconv() behavior */ - if (inLen < 4 || - pIn[1] < 0x80 || 0xBF < pIn[1] || - pIn[2] < 0x80 || 0xBF < pIn[2] || - pIn[3] < 0x80 || 0xBF < pIn[3] ) { - if (inLen == 1) - errno=EINVAL; /* 22 */ - else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else if (inLen >= 4 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } else { - *pOut=subS; /* Though returns replacement character, which iconv() does not return. */ - ++pOut; - ++numS; - pIn+=4; - inLen-=4; - /* UTF-8_IBM-850 0xF0908080 : converted value does not match, iconv=0x00, dmap=0x7F - UTF-8_IBM-850 0xF0908081 : converted value does not match, iconv=0x01, dmap=0x7F - UTF-8_IBM-850 0xF0908082 : converted value does not match, iconv=0x02, dmap=0x7F - UTF-8_IBM-850 0xF0908083 : converted value does not match, iconv=0x03, dmap=0x7F - .... - UTF-8_IBM-850 0xF09081BE : converted value does not match, iconv=0x7E, dmap=0x7F - UTF-8_IBM-850 0xF09081BF : converted value does not match, iconv=0x1C, dmap=0x7F - UTF-8_IBM-850 0xF09082A0 : converted value does not match, iconv=0xFF, dmap=0x7F - UTF-8_IBM-850 0xF09082A1 : converted value does not match, iconv=0xAD, dmap=0x7F - .... - */ - continue; - /* iconv() returns 0 with strange 1 byte converted values */ - } - - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - } - /* end of UTF-8 to UCS-2 */ - if (in == 0x0000) { - *pOut=0x00; - } else { - if ((*pOut=dmapU2S[in]) == 0x00) { - *pOut=subS; - ++numS; - errno=EINVAL; /* 22 */ - } else if (*pOut == subS) { - if (in != cd->srcSubS) { - ++numS; - } - } - } - ++pOut; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_D2U) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U); - register uchar * dmapD22U=(uchar *) (cd->cnv_dmap->dmapD22U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - offset=*pIn; - offset<<=1; - if (dmapD12U[offset] == 0x00 && - dmapD12U[offset+1] == 0x00) { /* DBCS */ - if (inLen < 2) { - if (*pIn == 0x80 || *pIn == 0xFF || - (cd->fromCcsid == 943 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0xA0 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xEF || *pIn == 0xFD || *pIn == 0xFE)) || - (cd->fromCcsid == 932 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0x87 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xED || *pIn == 0xEE || *pIn == 0xEF)) || - (cd->fromCcsid == 1381 && ((0x85 <= *pIn && *pIn <= 0x8B) || (0xAA <= *pIn && *pIn <= 0xAF) || (0xF8 <= *pIn && *pIn <= 0xFE)))) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - offset-=0x100; - ++pIn; - offset<<=8; - offset+=(*pIn * 2); - if (dmapD22U[offset] == 0x00 && - dmapD22U[offset+1] == 0x00) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - *pOut=dmapD22U[offset]; - ++pOut; - *pOut=dmapD22U[offset+1]; - ++pOut; - if (dmapD22U[offset] == 0xFF && - dmapD22U[offset+1] == 0xFD) { - if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=2; - } else { /* SBCS */ - *pOut=dmapD12U[offset]; - ++pOut; - *pOut=dmapD12U[offset+1]; - ++pOut; - if (dmapD12U[offset] == 0x00 && - dmapD12U[offset+1] == 0x1A) { - if (*pIn != cd->srcSubS) - ++numS; - } - ++pIn; - --inLen; - } - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_D28) { - /* use uchar * instead of UniChar to avoid memcpy */ - register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U); - register uchar * dmapD22U=(uchar *) (cd->cnv_dmap->dmapD22U); - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register int offset; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - register UniChar in; /* copy part of U28 */ - register UniChar ucs2; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { - offset=*pIn; - offset<<=1; - if (dmapD12U[offset] == 0x00 && - dmapD12U[offset+1] == 0x00) { /* DBCS */ - if (inLen < 2) { - if (*pIn == 0x80 || *pIn == 0xFF || - (cd->fromCcsid == 943 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0xA0 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xEF || *pIn == 0xFD || *pIn == 0xFE)) || - (cd->fromCcsid == 932 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0x87 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xED || *pIn == 0xEE || *pIn == 0xEF)) || - (cd->fromCcsid == 1381 && ((0x85 <= *pIn && *pIn <= 0x8B) || (0xAA <= *pIn && *pIn <= 0xAF) || (0xF8 <= *pIn && *pIn <= 0xFE)))) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - offset-=0x100; - ++pIn; - offset<<=8; - offset+=(*pIn * 2); - if (dmapD22U[offset] == 0x00 && - dmapD22U[offset+1] == 0x00) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - return -1; - } - in=dmapD22U[offset]; - in<<=8; - in+=dmapD22U[offset+1]; - ucs2=in; - if (dmapD22U[offset] == 0xFF && - dmapD22U[offset+1] == 0xFD) { - if (in != cd->srcSubD) - ++numS; - } - ++pIn; - inLen-=2; - } else { /* SBCS */ - in=dmapD12U[offset]; - in<<=8; - in+=dmapD12U[offset+1]; - ucs2=in; - if (dmapD12U[offset] == 0x00 && - dmapD12U[offset+1] == 0x1A) { - if (in != cd->srcSubS) - ++numS; - } - ++pIn; - --inLen; - } - if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */ - *pOut=in; - ++pOut; - } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */ - register uchar byte; - in>>=6; - in&=0x001F; /* 0b0000000000011111 */ - in|=0x00C0; /* 0b0000000011000000 */ - *pOut=in; - ++pOut; - byte=ucs2; /* dmapD12U[offset+1]; */ - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } else if ((in & 0xFC00) == 0xD800) { /* There should not be no surrogate character in SBCS. */ - *pOut=0xEF; - ++pOut; - *pOut=0xBF; - ++pOut; - *pOut=0xBD; - ++pOut; - } else { - register uchar byte; - register uchar work; - byte=(ucs2>>8); /* dmapD12U[offset]; */ - byte>>=4; - byte|=0xE0; /* 0b11100000; */ - *pOut=byte; - ++pOut; - - byte=(ucs2>>8); /* dmapD12U[offset]; */ - byte<<=2; - work=ucs2; /* dmapD12U[offset+1]; */ - work>>=6; - byte|=work; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - - byte=ucs2; /* dmapD12U[offset+1]; */ - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } - /* end of U28 */ - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_U2D) { - register uchar * dmapU2D=cd->cnv_dmap->dmapU2D; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - - *inBytesLeft=inLen; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else { - in<<=1; - *pOut=dmapU2D[in]; - ++pOut; - if (dmapU2D[in+1] == 0x00) { /* SBCS */ - if (*pOut == subS) { - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2D[in+1]; - ++pOut; - if (dmapU2D[in] == pSubD[0] && - dmapU2D[in+1] == pSubD[1]) { - in>>=1; - if (in != cd->srcSubD) - ++numS; - } - } - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return numS; /* to minic iconv() behavior */ - - } else if (cd->cnv_dmap->codingSchema == DMAP_T2D) { - register uchar * dmapU2D=cd->cnv_dmap->dmapU2D; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - ++numS; - *numSub+=numS; - return 0; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if (0xD800 <= in && in <= 0xDBFF) { /* first byte of surrogate */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-2; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn+2; - ++numS; - *numSub+=numS; - return -1; - - } else if (0xDC00 <= in && in <= 0xDFFF) { /* second byte of surrogate */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - ++numS; - *numSub+=numS; - return -1; - - } else { - in<<=1; - *pOut=dmapU2D[in]; - ++pOut; - if (dmapU2D[in+1] == 0x00) { /* SBCS */ - if (*pOut == subS) { - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2D[in+1]; - ++pOut; - if (dmapU2D[in] == pSubD[0] && - dmapU2D[in+1] == pSubD[1]) { - in>>=1; - if (in != cd->srcSubD) - ++numS; - } - } - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; /* to minic iconv() behavior */ - - } else if (cd->cnv_dmap->codingSchema == DMAP_82D) { - register uchar * dmapU2D=cd->cnv_dmap->dmapU2D; - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register char subS=cd->subS; - register char * pSubD=(char *) &(cd->subD); - register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - uint32_t in2; - if (pLastOutBuf < pOut) - break; - /* convert from UTF-8 to UCS-2 */ - if (*pIn == 0x00) { - in=0x0000; - ++pIn; - --inLen; - } else { /* 82U: */ - register uchar byte1=*pIn; - if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */ - /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/ - in=byte1; - ++pIn; - --inLen; - } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */ - if (inLen < 2) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - /* 2 bytes sequence: - 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */ - register uchar byte2; - ++pIn; - byte2=*pIn; - if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */ - register uchar work=byte1; - work<<=6; - byte2&=0x3F; /* 0b00111111; */ - byte2|=work; - - byte1&=0x1F; /* 0b00011111; */ - byte1>>=2; - in=byte1; - in<<=8; - in+=byte2; - inLen-=2; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */ - /* 3 bytes sequence: - 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */ - register uchar byte2; - register uchar byte3; - if (inLen < 3) { - if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - if ((byte2 & 0xC0) != 0x80 || - (byte3 & 0xC0) != 0x80 || - (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - *numSub+=numS; - return -1; - } - { - register uchar work=byte2; - work<<=6; - byte3&=0x3F; /* 0b00111111; */ - byte3|=work; - - byte2&=0x3F; /* 0b00111111; */ - byte2>>=2; - - byte1<<=4; - in=byte1 | byte2;; - in<<=8; - in+=byte3; - inLen-=3; - ++pIn; - } - } else if ((0xF0 <= byte1 && byte1 <= 0xF4)) { /* (bytes1 & 11111000) == 0x1110000 */ - /* 4 bytes sequence - 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx - where uuuuu = wwww + 1 */ - register uchar byte2; - register uchar byte3; - register uchar byte4; - if (inLen < 4) { - if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) || - (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) || - (cd->toCcsid == 13488) ) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - ++pIn; - byte4=*pIn; - if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */ - (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */ - (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */ - register uchar work=byte2; - if (byte1 == 0xF0 && byte2 < 0x90) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - /* iconv() returns 0 for 0xF4908080 and convert to 0x00 - } else if (byte1 == 0xF4 && byte2 > 0x8F) { - errno=EINVAL; - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - */ - } - - work&=0x30; /* 0b00110000; */ - work>>=4; - byte1&=0x07; /* 0b00000111; */ - byte1<<=2; - byte1+=work; /* uuuuu */ - --byte1; /* wwww */ - - work=byte1 & 0x0F; - work>>=2; - work+=0xD8; /* 0b11011011; */ - in=work; - in<<=8; - - byte1<<=6; - byte2<<=2; - byte2&=0x3C; /* 0b00111100; */ - work=byte3; - work>>=4; - work&=0x03; /* 0b00000011; */ - work|=byte1; - work|=byte2; - in+=work; - - work=byte3; - work>>=2; - work&=0x03; /* 0b00000011; */ - work|=0xDC; /* 0b110111xx; */ - in2=work; - in2<<=8; - - byte3<<=6; - byte4&=0x3F; /* 0b00111111; */ - byte4|=byte3; - in2+=byte4; - inLen-=4; - ++pIn; -#ifdef match_with_GBK - if ((0xD800 == in && in2 < 0xDC80) || - (0xD840 == in && in2 < 0xDC80) || - (0xD880 == in && in2 < 0xDC80) || - (0xD8C0 == in && in2 < 0xDC80) || - (0xD900 == in && in2 < 0xDC80) || - (0xD940 == in && in2 < 0xDC80) || - (0xD980 == in && in2 < 0xDC80) || - (0xD9C0 == in && in2 < 0xDC80) || - (0xDA00 == in && in2 < 0xDC80) || - (0xDA40 == in && in2 < 0xDC80) || - (0xDA80 == in && in2 < 0xDC80) || - (0xDAC0 == in && in2 < 0xDC80) || - (0xDB00 == in && in2 < 0xDC80) || - (0xDB40 == in && in2 < 0xDC80) || - (0xDB80 == in && in2 < 0xDC80) || - (0xDBC0 == in && in2 < 0xDC80)) { -#else - if ((0xD800 <= in && in <= 0xDBFF) && - (0xDC00 <= in2 && in2 <= 0xDFFF)) { -#endif - *pOut=subS; - ++pOut; - ++numS; - continue; - } - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } - } else if (0xF5 <= byte1 && byte1 <= 0xFF) { /* minic iconv() behavior */ - if (inLen < 4 || - (inLen >= 4 && byte1 == 0xF8 && pIn[1] < 0x90) || - pIn[1] < 0x80 || 0xBF < pIn[1] || - pIn[2] < 0x80 || 0xBF < pIn[2] || - pIn[3] < 0x80 || 0xBF < pIn[3] ) { - if (inLen == 1) - errno=EINVAL; /* 22 */ - else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else if (inLen >= 4 && (byte1 == 0xF8 || (pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } else if ((pIn[1] == 0x80 || pIn[1] == 0x90 || pIn[1] == 0xA0 || pIn[1] == 0xB0) && - pIn[2] < 0x82) { - *pOut=subS; /* Though returns replacement character, which iconv() does not return. */ - ++pOut; - ++numS; - pIn+=4; - inLen-=4; - continue; - } else { - *pOut=pSubD[0]; /* Though returns replacement character, which iconv() does not return. */ - ++pOut; - *pOut=pSubD[1]; - ++pOut; - ++numS; - pIn+=4; - inLen-=4; - continue; - /* iconv() returns 0 with strange 1 byte converted values */ - } - - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - } - /* end of UTF-8 to UCS-2 */ - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else { - in<<=1; - *pOut=dmapU2D[in]; - ++pOut; - if (dmapU2D[in+1] == 0x00) { /* SBCS */ - if (dmapU2D[in] == subS) { - in>>=1; - if (in != cd->srcSubS) - ++numS; - } - } else { - *pOut=dmapU2D[in+1]; - ++pOut; - if (dmapU2D[in] == pSubD[0] && - dmapU2D[in+1] == pSubD[1]) { - in>>=1; - if (in != cd->srcSubD) - ++numS; - } - } - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_82U) { - /* See http://unicode.org/versions/corrigendum1.html */ - /* convert from UTF-8 to UTF-16 can cover all conversion from UTF-8 to UCS-2 */ - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - register size_t numS=0; - while (0 < inLen) { - if (pLastOutBuf < pOut) - break; - if (*pIn == 0x00) { - *pOut=0x00; - ++pOut; - *pOut=0x00; - ++pOut; - ++pIn; - --inLen; - } else { /* 82U: */ - register uchar byte1=*pIn; - if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */ - /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/ - *pOut=0x00; - ++pOut; - *pOut=byte1; - ++pOut; - ++pIn; - --inLen; - } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */ - if (inLen < 2) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - /* 2 bytes sequence: - 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */ - register uchar byte2; - ++pIn; - byte2=*pIn; - if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */ - register uchar work=byte1; - work<<=6; - byte2&=0x3F; /* 0b00111111; */ - byte2|=work; - - byte1&=0x1F; /* 0b00011111; */ - byte1>>=2; - *pOut=byte1; - ++pOut; - *pOut=byte2; - ++pOut; - inLen-=2; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-1; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */ - /* 3 bytes sequence: - 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */ - register uchar byte2; - register uchar byte3; - if (inLen < 3) { - if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - if ((byte2 & 0xC0) != 0x80 || - (byte3 & 0xC0) != 0x80 || - (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-2; - *numSub+=numS; - return -1; - } - { - register uchar work=byte2; - work<<=6; - byte3&=0x3F; /* 0b00111111; */ - byte3|=work; - - byte2&=0x3F; /* 0b00111111; */ - byte2>>=2; - - byte1<<=4; - *pOut=byte1 | byte2;; - ++pOut; - *pOut=byte3; - ++pOut; - inLen-=3; - ++pIn; - } - } else if ((0xF0 <= byte1 && byte1 <= 0xF4) || /* (bytes1 & 11111000) == 0x1110000 */ - ((byte1&=0xF7) && 0xF0 <= byte1 && byte1 <= 0xF4)) { /* minic iconv() behavior */ - /* 4 bytes sequence - 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx - where uuuuu = wwww + 1 */ - register uchar byte2; - register uchar byte3; - register uchar byte4; - if (inLen < 4 || cd->toCcsid == 13488) { - if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) || - (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) || - (cd->toCcsid == 13488) ) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - ++pIn; - byte2=*pIn; - ++pIn; - byte3=*pIn; - ++pIn; - byte4=*pIn; - if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */ - (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */ - (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */ - register uchar work=byte2; - if (byte1 == 0xF0 && byte2 < 0x90) { - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } else if (byte1 == 0xF4 && byte2 > 0x8F) { - errno=EINVAL; /* 22 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } - - work&=0x30; /* 0b00110000; */ - work>>=4; - byte1&=0x07; /* 0b00000111; */ - byte1<<=2; - byte1+=work; /* uuuuu */ - --byte1; /* wwww */ - - work=byte1 & 0x0F; - work>>=2; - work+=0xD8; /* 0b11011011; */ - *pOut=work; - ++pOut; - - byte1<<=6; - byte2<<=2; - byte2&=0x3C; /* 0b00111100; */ - work=byte3; - work>>=4; - work&=0x03; /* 0b00000011; */ - work|=byte1; - work|=byte2; - *pOut=work; - ++pOut; - - work=byte3; - work>>=2; - work&=0x03; /* 0b00000011; */ - work|=0xDC; /* 0b110111xx; */ - *pOut=work; - ++pOut; - - byte3<<=6; - byte4&=0x3F; /* 0b00111111; */ - byte4|=byte3; - *pOut=byte4; - ++pOut; - inLen-=4; - ++pIn; - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn-3; - *numSub+=numS; - return -1; - } - } else if ((byte1 & 0xF0) == 0xF0) { - if (cd->toCcsid == 13488) { - errno=EILSEQ; /* 116 */ - } else { - if (inLen == 1) - errno=EINVAL; /* 22 */ - else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80) - errno=EILSEQ; /* 116 */ - else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else if (inLen >= 4 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80)) - errno=EILSEQ; /* 116 */ - else - errno=EINVAL; /* 22 */ - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - - } else { /* invalid sequence */ - errno=EILSEQ; /* 116 */ - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return -1; - } - } - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - *numSub+=numS; - return 0; - } else if (cd->cnv_dmap->codingSchema == DMAP_U28) { - /* See http://unicode.org/versions/corrigendum1.html */ - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - // register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */ - *pOut=in; - ++pOut; - } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */ - register uchar byte; - in>>=6; - in&=0x001F; /* 0b0000000000011111 */ - in|=0x00C0; /* 0b0000000011000000 */ - *pOut=in; - ++pOut; - byte=pIn[1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } else { - register uchar byte; - register uchar work; - byte=pIn[0]; - byte>>=4; - byte|=0xE0; /* 0b11100000; */ - *pOut=byte; - ++pOut; - - byte=pIn[0]; - byte<<=2; - work=pIn[1]; - work>>=6; - byte|=work; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - - byte=pIn[1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - // *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_T28) { /* UTF-16_UTF-8 */ - /* See http://unicode.org/versions/corrigendum1.html */ - register int inLen=*inBytesLeft; - register char * pOut=*outBuf; - register char * pIn=*inBuf; - register char * pLastOutBuf = *outBuf + *outBytesLeft - 1; - // register size_t numS=0; - while (0 < inLen) { - register uint32_t in; - if (inLen == 1) { - errno=EINVAL; /* 22 */ - *inBytesLeft=0; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return 0; - } - if (pLastOutBuf < pOut) - break; - in=pIn[0]; - in<<=8; - in+=pIn[1]; - if (in == 0x0000) { - *pOut=0x00; - ++pOut; - } else if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */ - *pOut=in; - ++pOut; - } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */ - register uchar byte; - in>>=6; - in&=0x001F; /* 0b0000000000011111 */ - in|=0x00C0; /* 0b0000000011000000 */ - *pOut=in; - ++pOut; - byte=pIn[1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } else if ((in & 0xFC00) == 0xD800) { /* in & 0b1111110000000000 == 0b1101100000000000, first surrogate character */ - if (0xDC00 <= in ) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - - } else if (inLen < 4) { - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-2; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn+2; - return -1; - - } else if ((pIn[2] & 0xFC) != 0xDC) { /* pIn[2] & 0b11111100 == 0b11011100, second surrogate character */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-2; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn+2; - return -1; - - } else { - register uchar byte; - register uchar work; - in>>=6; - in&=0x000F; /* 0b0000000000001111 */ - byte=in; /* wwww */ - ++byte; /* uuuuu */ - work=byte; /* save uuuuu */ - byte>>=2; - byte|=0xF0; /* 0b11110000; */ - *pOut=byte; - ++pOut; - - byte=work; - byte&=0x03; /* 0b00000011; */ - byte<<=4; - byte|=0x80; /* 0b10000000; */ - work=pIn[1]; - work&=0x3C; /* 0b00111100; */ - work>>=2; - byte|=work; - *pOut=byte; - ++pOut; - - byte=pIn[1]; - byte&=0x03; /* 0b00000011; */ - byte<<=4; - byte|=0x80; /* 0b10000000; */ - work=pIn[2]; - work&=0x03; /* 0b00000011; */ - work<<=2; - byte|=work; - work=pIn[3]; - work>>=6; - byte|=work; - *pOut=byte; - ++pOut; - - byte=pIn[3]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - pIn+=2; - inLen-=2; - } - } else if ((in & 0xFC00) == 0xDC00) { /* in & 0b11111100 == 0b11011100, second surrogate character */ - errno=EINVAL; /* 22 */ - *inBytesLeft=inLen-1; - *outBytesLeft-=(pOut-*outBuf); - *outBuf=pOut; - *inBuf=pIn; - return -1; - - } else { - register uchar byte; - register uchar work; - byte=pIn[0]; - byte>>=4; - byte|=0xE0; /* 0b11100000; */ - *pOut=byte; - ++pOut; - - byte=pIn[0]; - byte<<=2; - work=pIn[1]; - work>>=6; - byte|=work; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - - byte=pIn[1]; - byte&=0x3F; /* 0b00111111; */ - byte|=0x80; /* 0b10000000; */ - *pOut=byte; - ++pOut; - } - pIn+=2; - inLen-=2; - } - *outBytesLeft-=(pOut-*outBuf); - *inBytesLeft=inLen; - *outBuf=pOut; - *inBuf=pIn; - // *numSub+=numS; - return 0; - - } else if (cd->cnv_dmap->codingSchema == DMAP_U2U) { /* UTF-16_UCS-2 */ - register int inLen=*inBytesLeft; - register int outLen=*outBytesLeft; - if (inLen <= outLen) { - memcpy(*outBuf, *inBuf, inLen); - (*outBytesLeft)-=inLen; - (*inBuf)+=inLen; - (*outBuf)+=inLen; - *inBytesLeft=0; - return 0; - } - memcpy(*outBuf, *inBuf, outLen); - (*outBytesLeft)=0; - (*inBuf)+=outLen; - (*outBuf)+=outLen; - *inBytesLeft-=outLen; - return (*inBytesLeft); - - } else { - return -1; - } - return 0; -} - - -#ifdef DEBUG -inline size_t myconv(myconv_t cd , - char** inBuf, - size_t* inBytesLeft, - char** outBuf, - size_t* outBytesLeft, - size_t* numSub) -{ - if (cd->converterType == CONVERTER_ICONV) { - return myconv_iconv(cd,inBuf,inBytesLeft,outBuf,outBytesLeft,numSub); - } else if (cd->converterType == CONVERTER_DMAP) { - return myconv_dmap(cd,inBuf,inBytesLeft,outBuf,outBytesLeft,numSub); - } - return -1; -} - -inline char * converterName(int32_t type) -{ - if (type == CONVERTER_ICONV) - return "iconv"; - else if (type == CONVERTER_DMAP) - return "dmap"; - - return "?????"; -} -#else -#define myconv(a,b,c,d,e,f) \ -(((a)->converterType == CONVERTER_ICONV)? myconv_iconv((a),(b),(c),(d),(e),(f)): (((a)->converterType == CONVERTER_DMAP)? myconv_dmap((a),(b),(c),(d),(e),(f)): -1)) - - -#define converterName(a) \ -(((a) == CONVERTER_ICONV)? "iconv": ((a) == CONVERTER_DMAP)? "dmap": "?????") -#endif - -void initMyconv(); -void cleanupMyconv(); - -#endif diff --git a/storage/ibmdb2i/db2i_rir.cc b/storage/ibmdb2i/db2i_rir.cc deleted file mode 100644 index 091c4d98383..00000000000 --- a/storage/ibmdb2i/db2i_rir.cc +++ /dev/null @@ -1,686 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "ha_ibmdb2i.h" - -/* Helper function for records_in_range. - Input: Bitmap of used key parts. - Output: Number of used key parts. */ - -static inline int getKeyCntFromMap(key_part_map keypart_map) -{ - int cnt = 0; - while (keypart_map) - { - keypart_map = keypart_map >> 1; - cnt++; - } - return (cnt); -} - -/** - @brief - Given a starting key and an ending key, estimate the number of rows that - will exist between the two keys. - - INPUT - inx Index to use - min_key Min key. Is NULL if no min range - max_key Max key. Is NULL if no max range - - NOTES - min_key.flag can have one of the following values: - HA_READ_KEY_EXACT Include the key in the range - HA_READ_AFTER_KEY Don't include key in range - - max_key.flag can have one of the following values: - HA_READ_BEFORE_KEY Don't include key in range - HA_READ_AFTER_KEY Include all 'end_key' values in the range - - RETURN - HA_POS_ERROR Error or the storage engine cannot estimate the number of rows - 1 There are no matching keys in the given range - n > 0 There are approximately n rows in the range -*/ -ha_rows ha_ibmdb2i::records_in_range(uint inx, - key_range *min_key, - key_range *max_key) -{ - DBUG_ENTER("ha_ibmdb2i::records_in_range"); - int rc = 0; // Return code - ha_rows rows = 0; // Row count returned to caller of this method - uint32 spcLen; // Length of space passed to DB2 - uint32 keyCnt; // Number of fields in the key composite - uint32 literalCnt = 0; // Number of literals - uint32 boundsOff; // Offset from beginning of space to range bounds - uint32 litDefOff; // Offset from beginning of space to literal definitions - uint32 literalsOff; // Offset from beginning of space to literal values - uint32 cutoff = 0; // Early exit cutoff (currently not used) - uint64 recCnt; // Row count from DB2 - uint16 rtnCode; // Return code from DB2 - Bounds* boundsPtr; // Pointer to a pair of range bounds - Bound* boundPtr; // Pointer to a single (high or low) range bound - LitDef* litDefPtr; // Pointer to a literal definition - char* literalsPtr; // Pointer to the start of all literal values - char* literalPtr; // Pointer to the start of this literal value - char* tempPtr; // Temporary pointer - char* tempMinPtr; // Temporary pointer into min_key - int minKeyCnt = 0; // Number of fields in the min_key composite - int maxKeyCnt = 0; // Number of fields in the max_key composite - size_t tempLen = 0; // Temporary length - uint16 DB2FieldWidth = 0; // DB2 field width - uint32 workFieldLen = 0; // Length of workarea needed for CCSID conversions - bool overrideInclusion; // Indicator for inclusion/exclusion - char* endOfLiteralPtr; // Pointer to the end of this literal - char* endOfMinPtr; // Pointer to end of min_key - uint16 endByte = 0; // End byte of char or graphic literal (padding not included) - bool reuseLiteral; // Indicator that hi and lo bounds use same literal - char* minPtr = NULL; // Work pointer for traversing min_key - char* maxPtr = NULL; // Work pointer for traversing max_key - /* - Handle the special case of 'x < null' anywhere in the key range. There are - no values less than null, but return 1 so that MySQL does not assume - the empty set for the query. - */ - if (min_key != NULL && max_key != NULL && - min_key->flag == HA_READ_AFTER_KEY && max_key->flag == HA_READ_BEFORE_KEY && - min_key->length == max_key->length && - (memcmp((uchar*)min_key->key,(uchar*)max_key->key,min_key->length)==0)) - { - DBUG_PRINT("ha_ibmdb2i::records_in_range",("Estimate 1 row for key %d; special case: < null", inx)); - DBUG_RETURN((ha_rows) 1 ); - } - /* - Determine the number of fields in the key composite. - */ - - if (min_key) - { - minKeyCnt = getKeyCntFromMap(min_key->keypart_map); - minPtr = (char*)min_key->key; - } - if (max_key) - { - maxKeyCnt = getKeyCntFromMap(max_key->keypart_map); - maxPtr = (char*)max_key->key; - } - keyCnt = maxKeyCnt >= minKeyCnt ? maxKeyCnt : minKeyCnt; - - /* - Handle the special case where MySQL does not pass either a min or max - key range. In this case, set the key count to 1 (knowing that there - is at least one key field) to flow through and create one bounds structure. - When both the min and max key ranges are nil, the bounds structure will - specify positive and negative infinity and DB2 will estimate the total - number of rows. */ - - if (keyCnt == 0) - keyCnt = 1; - - /* - Allocate the space needed to pass range information to DB2. The - space must be large enough to store the following: - - one pair of bounds (high and low) per field in the key composite - - one literal definition per literal value - - the literal values - - work area for literal CCSID conversions - Since we don't know yet how many of these structures are needed, - allocate enough space for the maximum that we will possibly need. - The workarea for the literal conversion must be big enough to hold the - largest of the DB2 key fields. - */ - KEY& curKey = table->key_info[inx]; - - for (int i = 0; i < keyCnt; i++) - { - DB2FieldWidth = - db2Table->db2Field(curKey.key_part[i].field->field_index).getByteLengthInRecord(); - if (DB2FieldWidth > workFieldLen) - workFieldLen = DB2FieldWidth; // Get length of largest DB2 field - tempLen = tempLen + DB2FieldWidth; // Tally the DB2 field lengths - } - spcLen = (sizeof(Bounds)*keyCnt) + (sizeof(LitDef)*keyCnt*2) + (tempLen*2) + workFieldLen; - - ValidatedPointer<char> spcPtr(spcLen); // Pointer to space passed to DB2 - memset(spcPtr, 0, spcLen); // Clear the allocated space - /* - Set addressability to the various sections of the DB2 interface space. - */ - boundsOff = 0; // Range bounds are at the start of the space - litDefOff = sizeof(Bounds) * keyCnt; // Literal defs follow all the range bounds - literalsOff = litDefOff + (sizeof(LitDef) * keyCnt * 2); // Literal values are last - boundsPtr = (Bounds_t*)(void*)spcPtr; // Address first bounds structure - tempPtr = (char*)((char*)spcPtr + litDefOff); - litDefPtr = (LitDef_t*)tempPtr; // Address first literal definition - tempPtr = (char*)((char*)spcPtr + literalsOff); - literalsPtr = (char*)tempPtr; // Address start of literal values - literalPtr = literalsPtr; // Address first literal value - /* - For each key part, build the low (min) and high (max) DB2 range bounds. - If literals are specified in the MySQL range, build DB2 literal - definitions and store the literal values for access by DB2. - - If no value is specified for a key part, assume infinity. Negative - infinity will cause processing to start at the first index entry. - Positive infinity will cause processing to end at the last index entry. - When infinity is specified in a bound, inclusion/exclusion and position - are ignored, and there is no literal definition or literal value for - the bound. - - If the keypart value is null, the null indicator is set in the range - bound and the other fields in the bound are ignored. When the bound is - null, only index entries with the null value will be included in the - estimate. If one bound is null, both bounds must be null. When the bound - is not null, the data offset and length must be set, and the literal - value stored for access by DB2. - */ - for (int partsInUse = 0; partsInUse < keyCnt; ++partsInUse) - { - Field *field= curKey.key_part[partsInUse].field; - overrideInclusion = false; - reuseLiteral = false; - endOfLiteralPtr = NULL; - /* - Build the low bound for the key range. - */ - if ((partsInUse + 1) > minKeyCnt) // if no min_key info for this part - boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where 3 between x and y - else - { - if ((curKey.key_part[partsInUse].null_bit) && (char*)minPtr[0]) - { // min_key is null - if (max_key == NULL || - ((partsInUse + 1) > maxKeyCnt)) // select...where x='ab' and y=null and z != 'c' - boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where x not null or - // select...where x > null - else // max_key is not null - { - if (min_key->flag == HA_READ_KEY_EXACT) - boundsPtr->LoBound.IsNull[0] = QMY_YES; // select...where x is null - else - { - if ((char*)maxPtr[0]) - boundsPtr->LoBound.IsNull[0] = QMY_YES; // select...where a = null and b < 5 (max-before) - // select...where a='a' and b is null and c !='a' (max-after) - else - boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where x < y - } - } // end min_key is null - } - else // min_key is not null - { - if (literalCnt) litDefPtr = litDefPtr + 1; - literalCnt = literalCnt + 1; - boundsPtr->LoBound.Position = literalCnt; - /* - Determine inclusion or exclusion. - */ - if (min_key->flag == HA_READ_KEY_EXACT || //select...where a like 'this%' - - /* An example for the following conditions is 'select...where a = 5 and b > null'. */ - - (max_key && - (memcmp((uchar*)minPtr,(uchar*)maxPtr, - curKey.key_part[partsInUse].store_length)==0))) - - { - if ((min_key->flag != HA_READ_KEY_EXACT) || - (max_key && - (memcmp((uchar*)minPtr,(uchar*)maxPtr, - curKey.key_part[partsInUse].store_length)==0))) - overrideInclusion = true; // Need inclusion for both min and max - } - else - boundsPtr->LoBound.Embodiment[0] = QMY_EXCLUSION; - litDefPtr->FieldNbr = field->field_index + 1; - DB2Field& db2Field = db2Table->db2Field(field->field_index); - litDefPtr->DataType = db2Field.getType(); - /* - Convert the literal to DB2 format - */ - if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data - (field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data - (litDefPtr->DataType == QMY_CHAR || - litDefPtr->DataType == QMY_VARCHAR || - litDefPtr->DataType == QMY_GRAPHIC || - litDefPtr->DataType == QMY_VARGRAPHIC)) - { - // Most of the code is required by the considerable wrangling needed - // to prepare partial keys for use by DB2 - // 1. UTF8 (CCSID 1208) data can be copied across unmodified if it is - // utf8_bin. Otherwise, we need to convert the min and max - // characters into the min and max characters employed - // by the DB2 sort sequence. This is complicated by the fact that - // the character widths are not always equal. - // 2. Likewise, UCS2 (CCSID 13488) data can be copied across unmodified - // if it is ucs2_bin or ucs2_general_ci. Otherwise, we need to - // convert the min and max characters into the min and max characters - // employed by the DB2 sort sequence. - // 3. All other data will use standard iconv conversions. If an - // unconvertible character is encountered, we assume it is the min - // char and fill the remainder of the DB2 key with 0s. This may not - // always be accurate, but it is probably sufficient for range - // estimations. - const char* keyData = minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0); - char* db2Data = literalPtr; - uint16 outLen = db2Field.getByteLengthInRecord(); - uint16 inLen; - if (litDefPtr->DataType == QMY_VARCHAR || - litDefPtr->DataType == QMY_VARGRAPHIC) - { - inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8); - keyData += 2; - outLen -= sizeof(uint16); - db2Data += sizeof(uint16); - } - else - { - inLen = field->max_display_length(); - } - - size_t convertedBytes = 0; - if (db2Field.getCCSID() == 1208) - { - DBUG_ASSERT(inLen <= outLen); - if (strcmp(field->charset()->name, "utf8_bin")) - { - const char* end = keyData+inLen; - const char* curKey = keyData; - char* curDB2 = db2Data; - uint32 min = field->charset()->min_sort_char; - while ((curKey < end) && (curDB2 < db2Data+outLen-3)) - { - my_wc_t temp; - int len = field->charset()->cset->mb_wc(field->charset(), - &temp, - (const uchar*)curKey, - (const uchar*)end); - if (temp != min) - { - DBUG_ASSERT(len <= 3); - switch (len) - { - case 3: *(curDB2+2) = *(curKey+2); - case 2: *(curDB2+1) = *(curKey+1); - case 1: *(curDB2) = *(curKey); - } - curDB2 += len; - } - else - { - *(curDB2++) = 0xEF; - *(curDB2++) = 0xBF; - *(curDB2++) = 0xBF; - } - curKey += len; - } - convertedBytes = curDB2 - db2Data; - } - else - { - memcpy(db2Data, keyData, inLen); - convertedBytes = inLen; - } - rc = 0; - } - else if (db2Field.getCCSID() == 13488) - { - DBUG_ASSERT(inLen <= outLen); - if (strcmp(field->charset()->name, "ucs2_bin") && - strcmp(field->charset()->name, "ucs2_general_ci")) - { - const char* end = keyData+inLen; - const uint16* curKey = (uint16*)keyData; - uint16* curDB2 = (uint16*)db2Data; - uint16 min = field->charset()->min_sort_char; - while (curKey < (uint16*)end) - { - if (*curKey != min) - *curDB2 = *curKey; - else - *curDB2 = 0xFFFF; - ++curKey; - ++curDB2; - } - } - else - { - memcpy(db2Data, keyData, inLen); - } - convertedBytes = inLen; - rc = 0; - } - else - { - rc = convertFieldChars(toDB2, - field->field_index, - keyData, - db2Data, - inLen, - outLen, - &convertedBytes, - true); - - if (rc == DB2I_ERR_ILL_CHAR) - { - // If an illegal character is encountered, we fill the remainder - // of the key with 0x00. This was implemented as a corollary to - // Bug#45012, though it should probably remain even after that - // bug is fixed. - memset(db2Data+convertedBytes, 0x00, outLen-convertedBytes); - convertedBytes = outLen; - rc = 0; - } - } - - if (!rc && - (litDefPtr->DataType == QMY_VARGRAPHIC || - litDefPtr->DataType == QMY_VARCHAR)) - { - *(uint16*)(db2Data-sizeof(uint16)) = - convertedBytes / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1); - } - - } - else // Non-character fields - { - rc = convertMySQLtoDB2(field, - db2Field, - literalPtr, - (uchar*)minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0)); - } - - if (rc != 0) break; - litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr); - litDefPtr->Length = db2Field.getByteLengthInRecord(); - literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal - } - /* If there is a max_key value for this field, and if the max_key value is - the same as the min_key value, then the low bound literal can be reused - for the high bound literal. This eliminates the overhead of copying and - converting the same value twice. */ - if (max_key && ((partsInUse + 1) <= maxKeyCnt) && - (memcmp((uchar*)minPtr,(uchar*)maxPtr, - curKey.key_part[partsInUse].store_length)==0 || endOfLiteralPtr)) - reuseLiteral = true; - minPtr += curKey.key_part[partsInUse].store_length; - } - /* - Build the high bound for the key range. - */ - if (max_key == NULL || ((partsInUse + 1) > maxKeyCnt)) - boundsPtr->HiBound.Infinity[0] = QMY_POS_INFINITY; - else - { - if ((curKey.key_part[partsInUse].null_bit) && (char*)maxPtr[0]) - { - if (min_key == NULL) - boundsPtr->HiBound.Infinity[0] = QMY_POS_INFINITY; - else - boundsPtr->HiBound.IsNull[0] = QMY_YES; // select...where x is null - } - else // max_key field is not null - { - if (boundsPtr->LoBound.IsNull[0] == QMY_YES) // select where x < 10 or x is null - { - rc = HA_POS_ERROR; - break; - } - if (!reuseLiteral) - { - if (literalCnt) - litDefPtr = litDefPtr + 1; - literalCnt = literalCnt + 1; - litDefPtr->FieldNbr = field->field_index + 1; - DB2Field& db2Field = db2Table->db2Field(field->field_index); - litDefPtr->DataType = db2Field.getType(); - /* - Convert the literal to DB2 format - */ - if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data - (field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data - (litDefPtr->DataType == QMY_CHAR || - litDefPtr->DataType == QMY_VARCHAR || - litDefPtr->DataType == QMY_GRAPHIC || - litDefPtr->DataType == QMY_VARGRAPHIC)) - { - // We need to handle char fields in a special way in order to account - // for partial keys. Refer to the note above for a description of the - // basic design. - char* keyData = maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0); - char* db2Data = literalPtr; - uint16 outLen = db2Field.getByteLengthInRecord(); - uint16 inLen; - if (litDefPtr->DataType == QMY_VARCHAR || - litDefPtr->DataType == QMY_VARGRAPHIC) - { - inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8); - keyData += 2; - outLen -= sizeof(uint16); - db2Data += sizeof(uint16); - } - else - { - inLen = field->max_display_length(); - } - - size_t convertedBytes; - if (db2Field.getCCSID() == 1208) - { - if (strcmp(field->charset()->name, "utf8_bin")) - { - const char* end = keyData+inLen; - const char* curKey = keyData; - char* curDB2 = db2Data; - uint32 max = field->charset()->max_sort_char; - while (curKey < end && (curDB2 < db2Data+outLen-3)) - { - my_wc_t temp; - int len = field->charset()->cset->mb_wc(field->charset(), &temp, (const uchar*)curKey, (const uchar*)end); - if (temp != max) - { - DBUG_ASSERT(len <= 3); - switch (len) - { - case 3: *(curDB2+2) = *(curKey+2); - case 2: *(curDB2+1) = *(curKey+1); - case 1: *(curDB2) = *(curKey); - } - curDB2 += len; - } - else - { - *(curDB2++) = 0xE4; - *(curDB2++) = 0xB6; - *(curDB2++) = 0xBF; - } - curKey += len; - } - convertedBytes = curDB2 - db2Data; - } - else - { - DBUG_ASSERT(inLen <= outLen); - memcpy(db2Data, keyData, inLen); - convertedBytes = inLen; - } - rc = 0; - } - else if (db2Field.getCCSID() == 13488) - { - if (strcmp(field->charset()->name, "ucs2_bin") && - strcmp(field->charset()->name, "ucs2_general_ci")) - { - char* end = keyData+inLen; - uint16* curKey = (uint16*)keyData; - uint16* curDB2 = (uint16*)db2Data; - uint16 max = field->charset()->max_sort_char; - while (curKey < (uint16*)end) - { - if (*curKey != max) - *curDB2 = *curKey; - else - *curDB2 = 0x4DBF; - ++curKey; - ++curDB2; - } - } - else - { - memcpy(db2Data, keyData, outLen); - } - rc = 0; - } - else - { - size_t substituteChars = 0; - rc = convertFieldChars(toDB2, - field->field_index, - keyData, - db2Data, - inLen, - outLen, - &convertedBytes, - true, - &substituteChars); - - if (rc == DB2I_ERR_ILL_CHAR) - { - // If an illegal character is encountered, we fill the remainder - // of the key with 0xFF. This was implemented to work around - // Bug#45012, though it should probably remain even after that - // bug is fixed. - memset(db2Data+convertedBytes, 0xFF, outLen-convertedBytes); - rc = 0; - } - else if ((substituteChars && - (litDefPtr->DataType == QMY_VARCHAR || - litDefPtr->DataType == QMY_CHAR)) || - strcmp(field->charset()->name, "cp1251_bulgarian_ci") == 0) - { - // When iconv translates the max_sort_char with a substitute - // character, we have no way to know whether this affects - // the sort order of the key. Therefore, to be safe, when - // we know that substitute characters have been used in a - // single-byte string, we traverse the translated key - // in reverse, replacing substitue characters with 0xFF, which - // always sorts with the greatest weight in DB2 sort sequences. - // cp1251_bulgarian_ci is also handled this way because the - // max_sort_char is a control character which does not sort - // equivalently in DB2. - DBUG_ASSERT(inLen == outLen); - char* tmpKey = keyData + inLen - 1; - char* tmpDB2 = db2Data + outLen - 1; - while (*tmpKey == field->charset()->max_sort_char && - *tmpDB2 != 0xFF) - { - *tmpDB2 = 0xFF; - --tmpKey; - --tmpDB2; - } - } - } - - if (!rc && - (litDefPtr->DataType == QMY_VARGRAPHIC || - litDefPtr->DataType == QMY_VARCHAR)) - { - *(uint16*)(db2Data-sizeof(uint16)) = - outLen / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1); - } - } - else - { - rc = convertMySQLtoDB2(field, - db2Field, - literalPtr, - (uchar*)maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0)); - } - if (rc != 0) break; - litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr); - litDefPtr->Length = db2Field.getByteLengthInRecord(); - literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal - } - boundsPtr->HiBound.Position = literalCnt; - if (max_key->flag == HA_READ_BEFORE_KEY && !overrideInclusion) - boundsPtr->HiBound.Embodiment[0] = QMY_EXCLUSION; - } - maxPtr += curKey.key_part[partsInUse].store_length; - } - /* - Bump to the next field in the key composite. - */ - - if ((partsInUse+1) < keyCnt) - boundsPtr = boundsPtr + 1; - } - - /* - Call DB2 to estimate the number of rows in the key range. - */ - if (rc == 0) - { - rc = db2i_ileBridge::getBridgeForThread()->recordsInRange((indexHandles[inx] ? indexHandles[inx] : db2Table->indexFile(inx)->getMasterDefnHandle()), - spcPtr, - keyCnt, - literalCnt, - boundsOff, - litDefOff, - literalsOff, - cutoff, - (uint32_t)(literalPtr - (char*)spcPtr), - endByte, - &recCnt, - &rtnCode); - } - /* - Set the row count and return. - Beware that if this method returns a zero row count, MySQL assumes the - result set for the query is zero; never return a zero row count. - */ - if ((rc == 0) && (rtnCode == QMY_SUCCESS || rtnCode == QMY_EARLY_EXIT)) - { - rows = recCnt ? (ha_rows)recCnt : 1; - } - - rows = (rows > 0 ? rows : HA_POS_ERROR); - - setIndexReadEstimate(inx, rows); - - DBUG_PRINT("ha_ibmdb2i::recordsInRange",("Estimate %d rows for key %d", uint32(rows), inx)); - - DBUG_RETURN(rows); -} diff --git a/storage/ibmdb2i/db2i_safeString.h b/storage/ibmdb2i/db2i_safeString.h deleted file mode 100644 index e353316c8fc..00000000000 --- a/storage/ibmdb2i/db2i_safeString.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - - -#ifndef DB2I_SAFESTRING_H -#define DB2I_SAFESTRING_H - - -#include <my_global.h> -#include <string.h> - -/** - @class SafeString - - This class was designed to provide safe, but lightweight, concatenation - operations C strings inside pre-allocated buffers. -*/ -class SafeString -{ -public: - SafeString(char* buffer, size_t size) : - allocSize(size), curPos(0), buf(buffer) - { - DBUG_ASSERT(size > 0); - buf[allocSize - 1] = 0xFF; // Set an overflow indicator - } - - char* ptr() { return buf; } - operator char*() { return buf; } - - SafeString& strcat(const char* str) - { - return this->strncat(str, strlen(str)); - } - - SafeString& strcat(char one) - { - if (curPos < allocSize - 2) - { - buf[curPos++] = one; - } - buf[curPos] = 0; - - return *this; - } - - SafeString& strncat(const char* str, size_t len) - { - uint64 amountToCopy = min((allocSize-1) - curPos, len); - memcpy(buf + curPos, str, amountToCopy); - curPos += amountToCopy; - buf[curPos] = 0; - return *this; - } - - bool overflowed() const { return (buf[allocSize - 1] == 0);} - -private: - char* buf; - uint64 curPos; - size_t allocSize; -}; - - -#endif diff --git a/storage/ibmdb2i/db2i_sqlStatementStream.cc b/storage/ibmdb2i/db2i_sqlStatementStream.cc deleted file mode 100644 index 92a8b03fd00..00000000000 --- a/storage/ibmdb2i/db2i_sqlStatementStream.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#include "db2i_sqlStatementStream.h" -#include "as400_types.h" - -/** - Add a statement to the statement stream, allocating additional memory as needed. - - @parm stmt The statement text - @parm length The length of the statement text - @parm fileSortSequence The DB2 sort sequence identifier, in EBCDIC - @parm fileSortSequenceLibrary The DB2 sort sequence library, in EBCDIC - - @return Reference to this object -*/ -SqlStatementStream& SqlStatementStream::addStatementInternal(const char* stmt, - uint32 length, - const char* fileSortSequence, - const char* fileSortSequenceLibrary) -{ - uint32 storageNeeded = length + sizeof(StmtHdr_t); - storageNeeded = (storageNeeded + 3) & ~3; // We have to be 4-byte aligned. - if (storageNeeded > storageRemaining()) - { - // We overallocate new storage to reduce number of times reallocation is - // needed. - int newSize = curSize + 2 * storageNeeded; - DBUG_PRINT("SqlStatementStream::addStatementInternal", - ("PERF: Had to realloc! Old size=%d. New size=%d", curSize, newSize)); - char* old_space = block; - char* new_space = (char*)getNewSpace(newSize); - memcpy(new_space, old_space, curSize); - ptr = new_space + (ptr - old_space); - curSize = newSize; - } - - DBUG_ASSERT((address64_t)ptr % 4 == 0); - - memcpy(((StmtHdr_t*)ptr)->SrtSeqNam, - fileSortSequence, - sizeof(((StmtHdr_t*)ptr)->SrtSeqNam)); - memcpy(((StmtHdr_t*)ptr)->SrtSeqSch, - fileSortSequenceLibrary, - sizeof(((StmtHdr_t*)ptr)->SrtSeqSch)); - ((StmtHdr_t*)ptr)->Length = length; - memcpy(ptr + sizeof(StmtHdr_t), stmt, length); - - ptr += storageNeeded; - ++statements; - - return *this; -} diff --git a/storage/ibmdb2i/db2i_sqlStatementStream.h b/storage/ibmdb2i/db2i_sqlStatementStream.h deleted file mode 100644 index 11db41a6c5d..00000000000 --- a/storage/ibmdb2i/db2i_sqlStatementStream.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -#ifndef DB2I_SQLSTATEMENTSTREAM_H -#define DB2I_SQLSTATEMENTSTREAM_H - -#include "db2i_charsetSupport.h" -#include "qmyse.h" - -/** - @class SqlStatementStream - - This class handles building the stream of SQL statements expected by the - QMY_EXECUTE_IMMEDIATE and QMY_PREPARE_OPEN_CURSOR APIs. - Memory allocation is handled internally. -*/ -class SqlStatementStream -{ - public: - /** - ctor to be used when multiple strings may be appended. - */ - SqlStatementStream(uint32 firstStringSize) : statements(0) - { - curSize = firstStringSize + sizeof(StmtHdr_t); - curSize = (curSize + 3) & ~3; - ptr = (char*) getNewSpace(curSize); - if (ptr == NULL) - curSize = 0; - } - - /** - ctor to be used when only a single statement will be executed. - */ - SqlStatementStream(const String& statement) : statements(0), block(NULL), curSize(0), ptr(0) - { - addStatement(statement); - } - - /** - ctor to be used when only a single statement will be executed. - */ - SqlStatementStream(const char* statement) : statements(0), block(NULL), curSize(0), ptr(0) - { - addStatement(statement); - } - - /** - Append an SQL statement, specifiying the DB2 sort sequence under which - the statement should be executed. This is important for CREATE TABLE - and CREATE INDEX statements. - */ - SqlStatementStream& addStatement(const String& append, const char* fileSortSequence, const char* fileSortSequenceLibrary) - { - char sortSeqEbcdic[10]; - char sortSeqLibEbcdic[10]; - - DBUG_ASSERT(strlen(fileSortSequence) <= 10 && - strlen(fileSortSequenceLibrary) <= 10); - memset(sortSeqEbcdic, 0x40, 10); - memset(sortSeqLibEbcdic, 0x40, 10); - convToEbcdic(fileSortSequence, sortSeqEbcdic, strlen(fileSortSequence)); - convToEbcdic(fileSortSequenceLibrary, sortSeqLibEbcdic, strlen(fileSortSequenceLibrary)); - - return addStatementInternal(append.ptr(), append.length(), sortSeqEbcdic, sortSeqLibEbcdic); - } - - /** - Append an SQL statement using default (*HEX) sort sequence. - */ - SqlStatementStream& addStatement(const String& append) - { - const char splatHEX[] = {0x5C, 0xC8, 0xC5, 0xE7, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // *HEX - const char blanks[] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // - - return addStatementInternal(append.ptr(), append.length(), splatHEX, blanks); - } - - /** - Append an SQL statement using default (*HEX) sort sequence. - */ - SqlStatementStream& addStatement(const char* stmt) - { - const char splatHEX[] = {0x5C, 0xC8, 0xC5, 0xE7, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // *HEX - const char blanks[] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // - - return addStatementInternal(stmt, strlen(stmt), splatHEX, blanks); - } - - char* getPtrToData() const { return block; } - uint32 getStatementCount() const { return statements; } - private: - SqlStatementStream& addStatementInternal(const char* stmt, - uint32 length, - const char* fileSortSequence, - const char* fileSortSequenceLibrary); - - uint32 storageRemaining() const - { - return (block == NULL ? 0 : curSize - (ptr - block)); - } - - char* getNewSpace(size_t size) - { - allocBase = (char*)sql_alloc(size + 15); - block = (char*)roundToQuadWordBdy(allocBase); - return block; - } - - uint32 curSize; // The size of the usable memory. - char* allocBase; // The allocated memory (with padding for aligment) - char* block; // The usable memory chunck (aligned for ILE) - char* ptr; // The current position within block. - uint32 statements; // The number of statements that have been appended. -}; - -#endif - diff --git a/storage/ibmdb2i/db2i_validatedPointer.h b/storage/ibmdb2i/db2i_validatedPointer.h deleted file mode 100644 index c4e31d1f11b..00000000000 --- a/storage/ibmdb2i/db2i_validatedPointer.h +++ /dev/null @@ -1,162 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -#ifndef DB2I_VALIDATEDPOINTER_H -#define DB2I_VALIDATEDPOINTER_H - -#include "db2i_ileBridge.h" - -/** - @class ValidatedPointer - @brief Encapsulates a pointer registered for usage by the QMYSE APIs - - @details As a performance optimization, to prevent pointer validation each - time a particular pointer is thunked across to ILE, QMYSE allows us to - "register" a pointer such that it is validated once and then subsequently - referenced on QMYSE APIs by means of a handle value. This class should be - used to manage memory allocation/registration/unregistration of these - pointers. Using the alloc function guarantees that the resulting storage is - 16-byte aligned, a requirement for many pointers passed to QMYSE. -*/ -template <class T> -class ValidatedPointer -{ -public: - ValidatedPointer<T>() : address(NULL), handle(NULL) {;} - - ValidatedPointer<T>(size_t size) - { - alloc(size); - } - - ValidatedPointer<T>(T* ptr) - { - assign(ptr); - } - - operator T*() - { - return address; - }; - - operator T*() const - { - return address; - }; - - operator void*() - { - return address; - }; - - operator ILEMemHandle() - { - return handle; - } - - void alloc(size_t size) - { - address = (T*)malloc_aligned(size); - if (address) - db2i_ileBridge::registerPtr(address, &handle); - mallocedHere = 1; - } - - void assign(T* ptr) - { - address = ptr; - db2i_ileBridge::registerPtr((void*)ptr, &handle); - mallocedHere = 0; - } - - void realloc(size_t size) - { - dealloc(); - alloc(size); - } - - void reassign(T* ptr) - { - dealloc(); - assign(ptr); - } - - void dealloc() - { - if (address) - { - db2i_ileBridge::unregisterPtr(handle); - - if (mallocedHere) - free_aligned((void*)address); - } - address = NULL; - handle = 0; - } - - ~ValidatedPointer() - { - dealloc(); - } - -private: - // Disable copy ctor and assignment operator, as these would break - // the registration guarantees provided by the class. - ValidatedPointer& operator= (const ValidatedPointer newVal); - ValidatedPointer(ValidatedPointer& newCopy); - - ILEMemHandle handle; - T* address; - char mallocedHere; -}; - - -/** - @class ValidatedObject - @brief This class allows users to instantiate and register a particular - object in a single step. -*/ -template<class T> -class ValidatedObject : public ValidatedPointer<T> -{ - public: - ValidatedObject<T>() : ValidatedPointer<T>(&value) {;} - - T& operator= (const T newVal) { value = newVal; return value; } - - private: - T value; -}; -#endif diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc deleted file mode 100644 index e5eccad1573..00000000000 --- a/storage/ibmdb2i/ha_ibmdb2i.cc +++ /dev/null @@ -1,3366 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - - -/** - @file ha_ibmdb2i.cc - - @brief - The ha_ibmdb2i storage engine provides an interface from MySQL to IBM DB2 for i. - -*/ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "ha_ibmdb2i.h" -#include "mysql_priv.h" -#include <mysql/plugin.h> -#include "db2i_ileBridge.h" -#include "db2i_charsetSupport.h" -#include <sys/utsname.h> -#include "db2i_safeString.h" - -static const char __NOT_NULL_VALUE_EBCDIC = 0xF0; // '0' -static const char __NULL_VALUE_EBCDIC = 0xF1; // '1' -static const char __DEFAULT_VALUE_EBCDIC = 0xC4; // 'D' -static const char BlankASPName[19] = " "; -static const int DEFAULT_MAX_ROWS_TO_BUFFER = 4096; - -static const char SAVEPOINT_PREFIX[] = {0xD4, 0xE8, 0xE2, 0xD7}; // MYSP (in EBCDIC) - -OSVersion osVersion; - - -// ================================================================ -// ================================================================ -// System variables -static char* ibmdb2i_rdb_name; -static MYSQL_SYSVAR_STR(rdb_name, ibmdb2i_rdb_name, - PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_READONLY, - "The name of the RDB to use", - NULL, - NULL, - BlankASPName); - -static MYSQL_THDVAR_BOOL(transaction_unsafe, - 0, - "Disable support for commitment control", - NULL, - NULL, - FALSE); - -static MYSQL_THDVAR_UINT(lob_alloc_size, - 0, - "Baseline allocation for lob read buffer", - NULL, - NULL, - 2*1024*1024, - 64*1024, - 128*1024*1024, - 1); - -static MYSQL_THDVAR_UINT(max_read_buffer_size, - 0, - "Maximum size of buffers used for read-ahead.", - NULL, - NULL, - 1*1024*1024, - 32*1024, - 16*1024*1024, - 1); - -static MYSQL_THDVAR_UINT(max_write_buffer_size, - 0, - "Maximum size of buffers used for bulk writes.", - NULL, - NULL, - 8*1024*1024, - 32*1024, - 64*1024*1024, - 1); - -static MYSQL_THDVAR_BOOL(compat_opt_time_as_duration, - 0, - "Control how new TIME columns should be defined in DB2. 0=time-of-day (default), 1=duration.", - NULL, - NULL, - FALSE); - -static MYSQL_THDVAR_UINT(compat_opt_year_as_int, - 0, - "Control how new YEAR columns should be defined in DB2. 0=CHAR(4) (default), 1=SMALLINT.", - NULL, - NULL, - 0, - 0, - 1, - 1); - -static MYSQL_THDVAR_UINT(compat_opt_blob_cols, - 0, - "Control how new TEXT and BLOB columns should be defined in DB2. 0=CLOB/BLOB (default), 1=VARCHAR/VARBINARY", - NULL, - NULL, - 0, - 0, - 1, - 1); - -static MYSQL_THDVAR_UINT(compat_opt_allow_zero_date_vals, - 0, - "Allow substitute values to be used when storing a column with a 0000-00-00 date component. 0=No substitution (default), 1=Substitute '0001-01-01'", - NULL, - NULL, - 0, - 0, - 1, - 1); - -static MYSQL_THDVAR_BOOL(propagate_default_col_vals, - 0, - "Should DEFAULT column values be propagated to the DB2 table definition.", - NULL, - NULL, - TRUE); - -static my_bool ibmdb2i_assume_exclusive_use; -static MYSQL_SYSVAR_BOOL(assume_exclusive_use, ibmdb2i_assume_exclusive_use, - 0, - "Can MySQL assume that this process is the only one modifying the DB2 tables. ", - NULL, - NULL, - FALSE); - -static MYSQL_THDVAR_BOOL(async_enabled, - 0, - "Should reads be done asynchronously when possible", - NULL, - NULL, - TRUE); - -static MYSQL_THDVAR_UINT(create_index_option, - 0, - "Control whether additional indexes are created. 0=No (default), 1=Create additional *HEX-based index", - NULL, - NULL, - 0, - 0, - 1, - 1); - -/* static MYSQL_THDVAR_UINT(discovery_mode, - 0, - "Unsupported", - NULL, - NULL, - 0, - 0, - 1, - 1); */ - -static uint32 ibmdb2i_system_trace; -static MYSQL_SYSVAR_UINT(system_trace_level, ibmdb2i_system_trace, - 0, - "Set system tracing level", - NULL, - NULL, - 0, - 0, - 63, - 1); - - -inline uint8 ha_ibmdb2i::getCommitLevel(THD* thd) -{ - if (!THDVAR(thd, transaction_unsafe)) - { - switch (thd_tx_isolation(thd)) - { - case ISO_READ_UNCOMMITTED: - return (accessIntent == QMY_READ_ONLY ? QMY_READ_UNCOMMITTED : QMY_REPEATABLE_READ); - case ISO_READ_COMMITTED: - return (accessIntent == QMY_READ_ONLY ? QMY_READ_COMMITTED : QMY_REPEATABLE_READ); - case ISO_REPEATABLE_READ: - return QMY_REPEATABLE_READ; - case ISO_SERIALIZABLE: - return QMY_SERIALIZABLE; - } - } - - return QMY_NONE; -} - -inline uint8 ha_ibmdb2i::getCommitLevel() -{ - return getCommitLevel(ha_thd()); -} - -//===================================================================== - -static handler *ibmdb2i_create_handler(handlerton *hton, - TABLE_SHARE *table, - MEM_ROOT *mem_root); -static void ibmdb2i_drop_database(handlerton *hton, char* path); -static int ibmdb2i_savepoint_set(handlerton *hton, THD* thd, void *sv); -static int ibmdb2i_savepoint_rollback(handlerton *hton, THD* thd, void *sv); -static int ibmdb2i_savepoint_release(handlerton *hton, THD* thd, void *sv); -static uint ibmdb2i_alter_table_flags(uint flags); - -handlerton *ibmdb2i_hton; -static bool was_ILE_inited; - -/* Tracks the number of open tables */ -static HASH ibmdb2i_open_tables; - -/* Mutex used to synchronize initialization of the hash */ -static pthread_mutex_t ibmdb2i_mutex; - - -/** - Create hash key for tracking open tables. -*/ - -static uchar* ibmdb2i_get_key(IBMDB2I_SHARE *share,size_t *length, - bool not_used __attribute__((unused))) -{ - *length=share->table_name_length; - return (uchar*) share->table_name; -} - - -int ibmdb2i_close_connection(handlerton* hton, THD *thd) -{ - DBUG_PRINT("ha_ibmdb2i::close_connection", ("Closing %d", thd->thread_id)); - db2i_ileBridge::getBridgeForThread(thd)->closeConnection(thd->thread_id); - db2i_ileBridge::destroyBridgeForThread(thd); - - return 0; -} - - -static int ibmdb2i_init_func(void *p) -{ - DBUG_ENTER("ibmdb2i_init_func"); - - utsname tempName; - uname(&tempName); - osVersion.v = atoi(tempName.version); - osVersion.r = atoi(tempName.release); - - was_ILE_inited = false; - ibmdb2i_hton= (handlerton *)p; - VOID(pthread_mutex_init(&ibmdb2i_mutex,MY_MUTEX_INIT_FAST)); - (void) my_hash_init(&ibmdb2i_open_tables,table_alias_charset,32,0,0, - (my_hash_get_key) ibmdb2i_get_key,0,0); - - ibmdb2i_hton->state= SHOW_OPTION_YES; - ibmdb2i_hton->create= ibmdb2i_create_handler; - ibmdb2i_hton->drop_database= ibmdb2i_drop_database; - ibmdb2i_hton->commit= ha_ibmdb2i::doCommit; - ibmdb2i_hton->rollback= ha_ibmdb2i::doRollback; - ibmdb2i_hton->savepoint_offset= 0; - ibmdb2i_hton->savepoint_set= ibmdb2i_savepoint_set; - ibmdb2i_hton->savepoint_rollback= ibmdb2i_savepoint_rollback; - ibmdb2i_hton->savepoint_release= ibmdb2i_savepoint_release; - ibmdb2i_hton->alter_table_flags=ibmdb2i_alter_table_flags; - ibmdb2i_hton->close_connection=ibmdb2i_close_connection; - - int rc; - - rc = initCharsetSupport(); - - if (!rc) - rc = db2i_ileBridge::setup(); - - if (!rc) - { - int nameLen = strlen(ibmdb2i_rdb_name); - for (int i = 0; i < nameLen; ++i) - { - ibmdb2i_rdb_name[i] = my_toupper(system_charset_info, (uchar)ibmdb2i_rdb_name[i]); - } - - rc = db2i_ileBridge::initILE(ibmdb2i_rdb_name, (uint16*)(((char*)&ibmdb2i_system_trace)+2)); - if (rc == 0) - { - was_ILE_inited = true; - } - } - - DBUG_RETURN(rc); -} - - -static int ibmdb2i_done_func(void *p) -{ - int error= 0; - DBUG_ENTER("ibmdb2i_done_func"); - - if (ibmdb2i_open_tables.records) - error= 1; - - if (was_ILE_inited) - db2i_ileBridge::exitILE(); - - db2i_ileBridge::takedown(); - - doneCharsetSupport(); - - my_hash_free(&ibmdb2i_open_tables); - pthread_mutex_destroy(&ibmdb2i_mutex); - - DBUG_RETURN(0); -} - - -IBMDB2I_SHARE *ha_ibmdb2i::get_share(const char *table_name, TABLE *table) -{ - IBMDB2I_SHARE *share; - uint length; - char *tmp_name; - - pthread_mutex_lock(&ibmdb2i_mutex); - length=(uint) strlen(table_name); - - if (!(share=(IBMDB2I_SHARE*) my_hash_search(&ibmdb2i_open_tables, - (uchar*)table_name, - length))) - { - if (!(share=(IBMDB2I_SHARE *) - my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length+1, - NullS))) - { - pthread_mutex_unlock(&ibmdb2i_mutex); - return NULL; - } - - share->use_count=0; - share->table_name_length=length; - share->table_name=tmp_name; - strmov(share->table_name,table_name); - if (my_hash_insert(&ibmdb2i_open_tables, (uchar*) share)) - goto error; - thr_lock_init(&share->lock); - pthread_mutexattr_t mutexattr = MY_MUTEX_INIT_FAST; - pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&share->mutex, &mutexattr); - - share->db2Table = new db2i_table(table->s, table_name); - int32 rc = share->db2Table->initDB2Objects(table_name); - - if (rc) - { - delete share->db2Table; - my_hash_delete(&ibmdb2i_open_tables, (uchar*) share); - thr_lock_delete(&share->lock); - my_errno = rc; - goto error; - } - - memset(&share->cachedStats, 0, sizeof(share->cachedStats)); - } - share->use_count++; - pthread_mutex_unlock(&ibmdb2i_mutex); - - db2Table = share->db2Table; - - return share; - -error: - pthread_mutex_destroy(&share->mutex); - my_free(share); - pthread_mutex_unlock(&ibmdb2i_mutex); - - return NULL; -} - - - -int ha_ibmdb2i::free_share(IBMDB2I_SHARE *share) -{ - pthread_mutex_lock(&ibmdb2i_mutex); - if (!--share->use_count) - { - delete share->db2Table; - db2Table = NULL; - - my_hash_delete(&ibmdb2i_open_tables, (uchar*) share); - thr_lock_delete(&share->lock); - pthread_mutex_destroy(&share->mutex); - my_free(share); - pthread_mutex_unlock(&ibmdb2i_mutex); - return 1; - } - pthread_mutex_unlock(&ibmdb2i_mutex); - - return 0; -} - -static handler* ibmdb2i_create_handler(handlerton *hton, - TABLE_SHARE *table, - MEM_ROOT *mem_root) -{ - return new (mem_root) ha_ibmdb2i(hton, table); -} - -static void ibmdb2i_drop_database(handlerton *hton, char* path) -{ - DBUG_ENTER("ha_ibmdb2i::ibmdb2i_drop_database"); - int rc = 0; - char queryBuffer[200]; - String query(queryBuffer, sizeof(queryBuffer), system_charset_info); - query.length(0); - query.append(STRING_WITH_LEN(" DROP SCHEMA \"")); - query.append(path+2, strchr(path+2, '/')-(path+2)); - query.append('"'); - - SqlStatementStream sqlStream(query); - - rc = db2i_ileBridge::getBridgeForThread()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - QMY_NONE, - FALSE, - TRUE); - DBUG_VOID_RETURN; -} - -inline static void genSavepointName(const void* sv, char* out) -{ - *(uint32*)out = *(uint32*)SAVEPOINT_PREFIX; - DBUG_ASSERT(sizeof(SAVEPOINT_PREFIX) == 4); - out += sizeof(SAVEPOINT_PREFIX); - - longlong2str((longlong)sv, out, 10); - while (*out) - { - out += 0xF0; - ++out; - } -} - - -/********************************************************************* -Sets a transaction savepoint. */ -static int ibmdb2i_savepoint_set(handlerton* hton, THD* thd, void* sv) -{ - DBUG_ENTER("ibmdb2i_savepoint_set"); - int rc = 0; - if (!THDVAR(thd ,transaction_unsafe)) - { - char name[64]; - genSavepointName(sv, name); - DBUG_PRINT("ibmdb2i_savepoint_set",("Setting %s", name)); - rc = ha_ibmdb2i::doSavepointSet(thd, name); - } - DBUG_RETURN(rc); -} - - -/********************************************************************* -Rollback a savepoint. */ -static int ibmdb2i_savepoint_rollback(handlerton* hton, THD* thd, void* sv) -{ - DBUG_ENTER("ibmdb2i_savepoint_rollback"); - int rc = 0; - if (!THDVAR(thd,transaction_unsafe)) - { - char name[64]; - genSavepointName(sv, name); - DBUG_PRINT("ibmdb2i_savepoint_rollback",("Rolling back %s", name)); - rc = ha_ibmdb2i::doSavepointRollback(thd, name); - } - DBUG_RETURN(rc); -} - - -/********************************************************************* -Release a savepoint. */ -static int ibmdb2i_savepoint_release(handlerton* hton, THD* thd, void* sv) -{ - DBUG_ENTER("ibmdb2i_savepoint_release"); - int rc = 0; - if (!THDVAR(thd,transaction_unsafe)) - { - char name[64]; - genSavepointName(sv, name); - DBUG_PRINT("ibmdb2i_savepoint_release",("Releasing %s", name)); - rc = ha_ibmdb2i::doSavepointRelease(thd, name); - } - DBUG_RETURN(rc); -} - -/* Thse flags allow for the online add and drop of an index via the CREATE INDEX, - DROP INDEX, and ALTER TABLE statements. These flags indicate that MySQL is not - required to lock the table before calling the storage engine to add or drop the - index(s). */ -static uint ibmdb2i_alter_table_flags(uint flags) -{ - return (HA_ONLINE_ADD_INDEX | HA_ONLINE_DROP_INDEX | - HA_ONLINE_ADD_UNIQUE_INDEX | HA_ONLINE_DROP_UNIQUE_INDEX | - HA_ONLINE_ADD_PK_INDEX | HA_ONLINE_DROP_PK_INDEX); -} - -ha_ibmdb2i::ha_ibmdb2i(handlerton *hton, TABLE_SHARE *table_arg) - :share(NULL), handler(hton, table_arg), - activeHandle(0), dataHandle(0), - activeReadBuf(NULL), activeWriteBuf(NULL), - blobReadBuffers(NULL), accessIntent(QMY_UPDATABLE), currentRRN(0), - releaseRowNeeded(FALSE), - indexReadSizeEstimates(NULL), - outstanding_start_bulk_insert(false), - last_rnd_init_rc(0), - last_index_init_rc(0), - last_start_bulk_insert_rc(0), - autoIncLockAcquired(false), - got_auto_inc_values(false), - next_identity_value(0), - indexHandles(0), - returnDupKeysImmediately(false), - onDupUpdate(false), - blobWriteBuffers(NULL), - forceSingleRowRead(false) - { - activeReferences = 0; - ref_length = sizeof(currentRRN); - if (table_share && table_share->keys > 0) - { - indexHandles = (FILE_HANDLE*)my_malloc(table_share->keys * sizeof(FILE_HANDLE), MYF(MY_WME | MY_ZEROFILL)); - } - clear_alloc_root(&conversionBufferMemroot); - } - - -ha_ibmdb2i::~ha_ibmdb2i() -{ - DBUG_ASSERT(activeReferences == 0 || outstanding_start_bulk_insert); - - if (indexHandles) - my_free(indexHandles); - if (indexReadSizeEstimates) - my_free(indexReadSizeEstimates); - - cleanupBuffers(); -} - - -static const char *ha_ibmdb2i_exts[] = { - FID_EXT, - NullS -}; - -const char **ha_ibmdb2i::bas_ext() const -{ - return ha_ibmdb2i_exts; -} - - -int ha_ibmdb2i::open(const char *name, int mode, uint test_if_locked) -{ - DBUG_ENTER("ha_ibmdb2i::open"); - - initBridge(); - - dataHandle = bridge()->findAndRemovePreservedHandle(name, &share); - - if (share) - db2Table = share->db2Table; - - if (!share && (!(share = get_share(name, table)))) - DBUG_RETURN(my_errno); - thr_lock_data_init(&share->lock,&lock,NULL); - - info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE); - - - DBUG_RETURN(0); -} - - - - -int ha_ibmdb2i::close(void) -{ - DBUG_ENTER("ha_ibmdb2i::close"); - int32 rc = 0; - bool preserveShare = false; - - db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(); - - if (dataHandle) - { - if (bridge->expectErrors(QMY_ERR_PEND_LOCKS)->deallocateFile(dataHandle, FALSE) == QMY_ERR_PEND_LOCKS) - { - bridge->preserveHandle(share->table_name, dataHandle, share); - preserveShare = true; - } - dataHandle = 0; - } - - for (int idx = 0; idx < table_share->keys; ++idx) - { - if (indexHandles[idx] != 0) - { - bridge->deallocateFile(indexHandles[idx], FALSE); - } - } - - cleanupBuffers(); - - if (!preserveShare) - { - if (free_share(share)) - share = NULL; - } - - DBUG_RETURN(rc); -} - - - -int ha_ibmdb2i::write_row(uchar * buf) -{ - - DBUG_ENTER("ha_ibmdb2i::write_row"); - - if (last_start_bulk_insert_rc) - DBUG_RETURN( last_start_bulk_insert_rc ); - - ha_statistic_increment(&SSV::ha_write_count); - int rc = 0; - - bool fileHandleNeedsRelease = false; - - if (!activeHandle) - { - rc = useDataFile(); - if (rc) DBUG_RETURN(rc); - fileHandleNeedsRelease = true; - } - - if (!outstanding_start_bulk_insert) - rc = prepWriteBuffer(1, getFileForActiveHandle()); - - if (!rc) - { - if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) - table->timestamp_field->set_time(); - - char* writeBuffer = activeWriteBuf->addRow(); - rc = prepareRowForWrite(writeBuffer, - writeBuffer+activeWriteBuf->getRowNullOffset(), - true); - if (rc == 0) - { - // If we are doing block inserts, if the MI is supposed to generate an auto_increment - // (i.e. identity column) value for this record, and if this is not the first record in - // the block, then store the value (that the MI will generate for the identity column) - // into the MySQL write buffer. We can predetermine the value because the file is locked. - - if ((autoIncLockAcquired) && (default_identity_value) && (got_auto_inc_values)) - { - if (unlikely((next_identity_value - 1) == - maxValueForField(table->next_number_field))) - { - rc = QMY_ERR_MAXVALUE; - } - else - { - rc = table->next_number_field->store((longlong) next_identity_value, TRUE); - next_identity_value = next_identity_value + incrementByValue; - } - } - // If the buffer is full, or if we locked the file and this is the first or last row - // of a blocked insert, then flush the buffer. - if (!rc && (activeWriteBuf->endOfBuffer()) || - ((autoIncLockAcquired) && - ((!got_auto_inc_values))) || - (returnDupKeysImmediately)) - rc = flushWrite(activeHandle, buf); - } - else - activeWriteBuf->deleteRow(); - } - - if (fileHandleNeedsRelease) - releaseActiveHandle(); - - DBUG_RETURN(rc); -} - -/** - @brief - Helper function used by write_row and update_row to prepare the MySQL - row for insertion into DB2. -*/ -int ha_ibmdb2i::prepareRowForWrite(char* data, char* nulls, bool honorIdentCols) -{ - int rc = 0; - - // set null map all to non nulls - memset(nulls,__NOT_NULL_VALUE_EBCDIC, table->s->fields); - default_identity_value = FALSE; - - ulong sql_mode = ha_thd()->variables.sql_mode; - - my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); - for (Field **field = table->field; *field && !rc; ++field) - { - int fieldIndex = (*field)->field_index; - if ((*field)->Field::is_null()) - { - nulls[fieldIndex] = __NULL_VALUE_EBCDIC; - } - if (honorIdentCols && ((*field)->flags & AUTO_INCREMENT_FLAG) && - *field == table->next_number_field) -// && ((!autoIncLockAcquired) || (!got_auto_inc_values))) - { - if (sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) - { - if (!table->auto_increment_field_not_null) - { - nulls[fieldIndex] = __DEFAULT_VALUE_EBCDIC; - default_identity_value = TRUE; - } - } - else if ((*field)->val_int() == 0) - { - nulls[fieldIndex] = __DEFAULT_VALUE_EBCDIC; - default_identity_value = TRUE; - } - } - - DB2Field& db2Field = db2Table->db2Field(fieldIndex); - if (nulls[fieldIndex] == __NOT_NULL_VALUE_EBCDIC || - db2Field.isBlob()) - { - rc = convertMySQLtoDB2(*field, db2Field, data + db2Field.getBufferOffset()); - } - } - - if (!rc && db2Table->hasBlobs()) - rc = db2i_ileBridge::getBridgeForThread()->objectOverride(activeHandle, - activeWriteBuf->ptr()); - - dbug_tmp_restore_column_map(table->read_set, old_map); - - return rc; -} - - - -int ha_ibmdb2i::update_row(const uchar * old_data, uchar * new_data) -{ - DBUG_ENTER("ha_ibmdb2i::update_row"); - ha_statistic_increment(&SSV::ha_update_count); - int rc; - - bool fileHandleNeedsRelease = false; - - if (!activeHandle) - { - rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle); - if (rc) DBUG_RETURN(rc); - fileHandleNeedsRelease = true; - } - - if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) - table->timestamp_field->set_time(); - - char* writeBuf = activeWriteBuf->addRow(); - rc = prepareRowForWrite(writeBuf, - writeBuf+activeWriteBuf->getRowNullOffset(), - onDupUpdate); - - char* lastDupKeyNamePtr = NULL; - uint32 lastDupKeyNameLen = 0; - - if (!rc) - { - rc = db2i_ileBridge::getBridgeForThread()->updateRow(activeHandle, - currentRRN, - activeWriteBuf->ptr(), - &lastDupKeyRRN, - &lastDupKeyNamePtr, - &lastDupKeyNameLen); - } - - if (lastDupKeyNameLen) - { - lastDupKeyID = getKeyFromName(lastDupKeyNamePtr, lastDupKeyNameLen); - rrnAssocHandle = activeHandle; - } - - if (fileHandleNeedsRelease) - releaseActiveHandle(); - - activeWriteBuf->resetAfterWrite(); - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::delete_row(const uchar * buf) -{ - DBUG_ENTER("ha_ibmdb2i::delete_row"); - ha_statistic_increment(&SSV::ha_delete_count); - - bool needReleaseFile = false; - int rc = 0; - - if (!activeHandle) // In some circumstances, MySQL comes here after - { // closing the active handle. We need to re-open. - rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle); - needReleaseFile = true; - } - - if (likely(!rc)) - { - rc = db2i_ileBridge::getBridgeForThread()->deleteRow(activeHandle, - currentRRN); - invalidateCachedStats(); - if (needReleaseFile) - releaseActiveHandle(); - } - - DBUG_RETURN(rc); -} - - - -int ha_ibmdb2i::index_init(uint idx, bool sorted) -{ - DBUG_ENTER("ha_ibmdb2i::index_init"); - - int& rc = last_index_init_rc; - rc = 0; - - invalidDataFound=false; - tweakReadSet(); - - active_index=idx; - - rc = useIndexFile(idx); - - if (!rc) - { -// THD* thd = ha_thd(); -// if (accessIntent == QMY_UPDATABLE && -// thd_tx_isolation(thd) == ISO_REPEATABLE_READ && -// !THDVAR(thd, transaction_unsafe)) -// { -// readAccessIntent = QMY_READ_ONLY; -// } -// else -// { - readAccessIntent = accessIntent; -// } - - if (!rc && accessIntent != QMY_READ_ONLY) - rc = prepWriteBuffer(1, db2Table->indexFile(idx)); - - if (rc) - releaseIndexFile(idx); - } - - rrnAssocHandle= 0; - - DBUG_RETURN(rc); -} - - - -int ha_ibmdb2i::index_read(uchar * buf, const uchar * key, - uint key_len, - enum ha_rkey_function find_flag) -{ - DBUG_ENTER("ha_ibmdb2i::index_read"); - - if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc); - - int rc; - - ha_rows estimatedRows = getIndexReadEstimate(active_index); - rc = prepReadBuffer(estimatedRows, db2Table->indexFile(active_index), readAccessIntent); - if (unlikely(rc)) DBUG_RETURN(rc); - - DBUG_ASSERT(activeReadBuf); - - keyBuf.allocBuf(activeReadBuf->getRowLength(), - activeReadBuf->getRowNullOffset(), - activeReadBuf->getRowLength()); - keyBuf.zeroBuf(); - - char* db2KeyBufPtr = keyBuf.ptr(); - char* nullKeyMap = db2KeyBufPtr + activeReadBuf->getRowNullOffset(); - - const uchar* keyBegin = key; - int partsInUse; - - KEY& curKey = table->key_info[active_index]; - - for (partsInUse = 0; partsInUse < curKey.key_parts, key - keyBegin < key_len; ++partsInUse) - { - Field* field = curKey.key_part[partsInUse].field; - if ((curKey.key_part[partsInUse].null_bit) && - (char*)key[0]) - { - if (field->flags & AUTO_INCREMENT_FLAG) - { - table->status = STATUS_NOT_FOUND; - DBUG_RETURN(HA_ERR_END_OF_FILE); - } - else - { - nullKeyMap[partsInUse] = __NULL_VALUE_EBCDIC; - } - } - else - { - nullKeyMap[partsInUse] = __NOT_NULL_VALUE_EBCDIC; - convertMySQLtoDB2(field, - db2Table->db2Field(field->field_index), - db2KeyBufPtr, - (uchar*)key+((curKey.key_part[partsInUse].null_bit)? 1 : 0) ); // + (curKey.key_parts+7) / 8); - } - - db2KeyBufPtr += db2Table->db2Field(field->field_index).getByteLengthInRecord(); - key += curKey.key_part[partsInUse].store_length; - } - - keyLen = db2KeyBufPtr - (char*)keyBuf.ptr(); - - DBUG_PRINT("ha_ibmdb2i::index_read", ("find_flag: %d", find_flag)); - - char readDirection = QMY_NEXT; - - switch (find_flag) - { - case HA_READ_AFTER_KEY: - doInitialRead(QMY_AFTER_EQUAL, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - break; - case HA_READ_BEFORE_KEY: - doInitialRead(QMY_BEFORE_EQUAL, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - break; - case HA_READ_KEY_OR_NEXT: - doInitialRead(QMY_AFTER_OR_EQUAL, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - break; - case HA_READ_KEY_OR_PREV: - DBUG_ASSERT(0); // This function is unused - doInitialRead(QMY_BEFORE_OR_EQUAL, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - break; - case HA_READ_PREFIX_LAST_OR_PREV: - doInitialRead(QMY_LAST_PREVIOUS, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - readDirection = QMY_PREVIOUS; - break; - case HA_READ_PREFIX_LAST: - doInitialRead(QMY_PREFIX_LAST, estimatedRows, - keyBuf.ptr(), keyLen, partsInUse); - readDirection = QMY_PREVIOUS; - break; - case HA_READ_KEY_EXACT: - doInitialRead(QMY_EQUAL, estimatedRows, keyBuf.ptr(), keyLen, partsInUse); - break; - default: - DBUG_ASSERT(0); - return HA_ERR_GENERIC; - break; - } - - ha_statistic_increment(&SSV::ha_read_key_count); - rc = readFromBuffer(buf, readDirection); - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::index_next(uchar * buf) -{ - DBUG_ENTER("ha_ibmdb2i::index_next"); - ha_statistic_increment(&SSV::ha_read_next_count); - - int rc = readFromBuffer(buf, QMY_NEXT); - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::index_next_same(uchar *buf, const uchar *key, uint keylen) -{ - DBUG_ENTER("ha_ibmdb2i::index_next_same"); - ha_statistic_increment(&SSV::ha_read_next_count); - - int rc = readFromBuffer(buf, QMY_NEXT_EQUAL); - - if (rc == HA_ERR_KEY_NOT_FOUND) - { - rc = HA_ERR_END_OF_FILE; - } - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - -int ha_ibmdb2i::index_read_last(uchar * buf, const uchar * key, uint key_len) -{ - DBUG_ENTER("ha_ibmdb2i::index_read_last"); - DBUG_RETURN(index_read(buf, key, key_len, HA_READ_PREFIX_LAST)); -} - - - -int ha_ibmdb2i::index_prev(uchar * buf) -{ - DBUG_ENTER("ha_ibmdb2i::index_prev"); - ha_statistic_increment(&SSV::ha_read_prev_count); - - int rc = readFromBuffer(buf, QMY_PREVIOUS); - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::index_first(uchar * buf) -{ - DBUG_ENTER("ha_ibmdb2i::index_first"); - - if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc); - - int rc = prepReadBuffer(DEFAULT_MAX_ROWS_TO_BUFFER, - db2Table->indexFile(active_index), - readAccessIntent); - - if (rc == 0) - { - doInitialRead(QMY_FIRST, DEFAULT_MAX_ROWS_TO_BUFFER); - ha_statistic_increment(&SSV::ha_read_first_count); - rc = readFromBuffer(buf, QMY_NEXT); - } - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::index_last(uchar * buf) -{ - DBUG_ENTER("ha_ibmdb2i::index_last"); - - if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc); - - int rc = prepReadBuffer(DEFAULT_MAX_ROWS_TO_BUFFER, - db2Table->indexFile(active_index), - readAccessIntent); - - if (rc == 0) - { - doInitialRead(QMY_LAST, DEFAULT_MAX_ROWS_TO_BUFFER); - ha_statistic_increment(&SSV::ha_read_last_count); - rc = readFromBuffer(buf, QMY_PREVIOUS); - } - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::rnd_init(bool scan) -{ - DBUG_ENTER("ha_ibmdb2i::rnd_init"); - - int& rc = last_rnd_init_rc; - rc = 0; - - tweakReadSet(); - invalidDataFound=false; - - uint32 rowsToBlockOnRead; - - if (!scan) - { - rowsToBlockOnRead = 1; - } - else - { - rowsToBlockOnRead = DEFAULT_MAX_ROWS_TO_BUFFER; - } - - rc = useDataFile(); - - if (!rc) - { -// THD* thd = ha_thd(); -// if (accessIntent == QMY_UPDATABLE && -// thd_tx_isolation(thd) == ISO_REPEATABLE_READ && -// !THDVAR(thd, transaction_unsafe)) -// { -// readAccessIntent = QMY_READ_ONLY; -// } -// else -// { - readAccessIntent = accessIntent; -// } - - rc = prepReadBuffer(rowsToBlockOnRead, db2Table->dataFile(), readAccessIntent); - - if (!rc && accessIntent != QMY_READ_ONLY) - rc = prepWriteBuffer(1, db2Table->dataFile()); - - if (!rc && scan) - doInitialRead(QMY_FIRST, rowsToBlockOnRead); - - if (rc) - releaseDataFile(); - } - - rrnAssocHandle= 0; - - DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing - // an assert in ha_rnd_end later on if we return a non-zero - // value here. -} - -int ha_ibmdb2i::rnd_end() -{ - DBUG_ENTER("ha_ibmdb2i::rnd_end"); - - warnIfInvalidData(); - if (likely(activeReadBuf)) - activeReadBuf->endRead(); - if (last_rnd_init_rc == 0) - releaseActiveHandle(); - last_rnd_init_rc = 0; - DBUG_RETURN(0); -} - - -int32 ha_ibmdb2i::mungeDB2row(uchar* record, const char* dataPtr, const char* nullMapPtr, bool skipLOBs) -{ - DBUG_ASSERT(dataPtr); - - my_bitmap_map *old_write_map= dbug_tmp_use_all_columns(table, table->write_set); - my_bitmap_map *old_read_map; - - if (unlikely(readAllColumns)) - old_read_map = tmp_use_all_columns(table, table->read_set); - - resetCharacterConversionBuffers(); - - my_ptrdiff_t old_ptr= (my_ptrdiff_t) (record - table->record[0]); - int fieldIndex = 0; - for (Field **field = table->field; *field; ++field, ++fieldIndex) - { - if (unlikely(old_ptr)) - (*field)->move_field_offset(old_ptr); - if (nullMapPtr[fieldIndex] == __NULL_VALUE_EBCDIC || - (!bitmap_is_set(table->read_set, fieldIndex)) || - (skipLOBs && db2Table->db2Field(fieldIndex).isBlob())) - { - (*field)->set_null(); - } - else - { - (*field)->set_notnull(); - convertDB2toMySQL(db2Table->db2Field(fieldIndex), *field, dataPtr); - } - if (unlikely(old_ptr)) - (*field)->move_field_offset(-old_ptr); - - } - - if (unlikely(readAllColumns)) - tmp_restore_column_map(table->read_set, old_read_map); - dbug_tmp_restore_column_map(table->write_set, old_write_map); - - return 0; -} - - -int ha_ibmdb2i::rnd_next(uchar *buf) -{ - DBUG_ENTER("ha_ibmdb2i::rnd_next"); - - if (unlikely(last_rnd_init_rc)) DBUG_RETURN(last_rnd_init_rc); - ha_statistic_increment(&SSV::ha_read_rnd_next_count); - - int rc; - - rc = readFromBuffer(buf, QMY_NEXT); - - table->status= (rc ? STATUS_NOT_FOUND: 0); - DBUG_RETURN(rc); -} - - -void ha_ibmdb2i::position(const uchar *record) -{ - DBUG_ENTER("ha_ibmdb2i::position"); - my_store_ptr(ref, ref_length, currentRRN); - DBUG_VOID_RETURN; -} - - -int ha_ibmdb2i::rnd_pos(uchar * buf, uchar *pos) -{ - DBUG_ENTER("ha_ibmdb2i::rnd_pos"); - if (unlikely(last_rnd_init_rc)) DBUG_RETURN( last_rnd_init_rc); - ha_statistic_increment(&SSV::ha_read_rnd_count); - - currentRRN = my_get_ptr(pos, ref_length); - - tweakReadSet(); - - int rc = 0; - - if (rrnAssocHandle && - (activeHandle != rrnAssocHandle)) - { - if (activeHandle) releaseActiveHandle(); - rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle); - } - - if (likely(rc == 0)) - { - rc = prepReadBuffer(1, getFileForActiveHandle(), accessIntent); - - if (likely(rc == 0) && accessIntent == QMY_UPDATABLE) - rc = prepWriteBuffer(1, getFileForActiveHandle()); - - if (likely(rc == 0)) - { - rc = db2i_ileBridge::getBridgeForThread()->readByRRN(activeHandle, - activeReadBuf->ptr(), - currentRRN, - accessIntent, - getCommitLevel()); - - if (likely(rc == 0)) - { - rrnAssocHandle = activeHandle; - const char* readBuf = activeReadBuf->getRowN(0); - rc = mungeDB2row(buf, readBuf, readBuf + activeReadBuf->getRowNullOffset(), false); - releaseRowNeeded = TRUE; - } - } - } - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::info(uint flag) -{ - DBUG_ENTER("ha_ibmdb2i::info"); - - uint16 infoRequested = 0; - ValidatedPointer<char> rowKeySpcPtr; // Space pointer passed to DB2 - uint32 rowKeySpcLen; // Length of space passed to DB2 - THD* thd = ha_thd(); - int command = thd_sql_command(thd); - - if (flag & HA_STATUS_AUTO) - stats.auto_increment_value = (ulonglong) 0; - - if (flag & HA_STATUS_ERRKEY) - { - errkey = lastDupKeyID; - my_store_ptr(dup_ref, ref_length, lastDupKeyRRN); - } - - if (flag & HA_STATUS_TIME) - { - if ((flag & HA_STATUS_NO_LOCK) && - ibmdb2i_assume_exclusive_use && - share && - (share->cachedStats.isInited(lastModTime))) - stats.update_time = share->cachedStats.getUpdateTime(); - else - infoRequested |= lastModTime; - } - - if (flag & HA_STATUS_CONST) - { - stats.block_size=4096; - infoRequested |= createTime; - - if (table->s->keys) - { - infoRequested |= rowsPerKey; - rowKeySpcLen = (table->s->keys) * MAX_DB2_KEY_PARTS * sizeof(uint64); - rowKeySpcPtr.alloc(rowKeySpcLen); - memset(rowKeySpcPtr, 0, rowKeySpcLen); // Clear the allocated space - } - } - - if (flag & HA_STATUS_VARIABLE) - { - if ((flag & HA_STATUS_NO_LOCK) && - (command != SQLCOM_SHOW_TABLE_STATUS) && - ibmdb2i_assume_exclusive_use && - share && - (share->cachedStats.isInited(rowCount | deletedRowCount | meanRowLen | ioCount)) && - (share->cachedStats.getRowCount() >= 2)) - { - stats.records = share->cachedStats.getRowCount(); - stats.deleted = share->cachedStats.getDelRowCount(); - stats.mean_rec_length = share->cachedStats.getMeanLength(); - stats.data_file_length = share->cachedStats.getAugmentedDataLength(); - } - else - { - infoRequested |= rowCount | deletedRowCount | meanRowLen; - if (command == SQLCOM_SHOW_TABLE_STATUS) - infoRequested |= objLength; - else - infoRequested |= ioCount; - } - } - - int rc = 0; - - if (infoRequested) - { - DBUG_PRINT("ha_ibmdb2i::info",("Retrieving fresh stats %d", flag)); - - initBridge(thd); - rc = bridge()->retrieveTableInfo((dataHandle ? dataHandle : db2Table->dataFile()->getMasterDefnHandle()), - infoRequested, - stats, - rowKeySpcPtr); - - if (!rc) - { - if ((flag & HA_STATUS_VARIABLE) && - (command != SQLCOM_SHOW_TABLE_STATUS)) - stats.data_file_length = stats.data_file_length * IO_SIZE; - - if ((ibmdb2i_assume_exclusive_use) && - (share) && - (command != SQLCOM_SHOW_TABLE_STATUS)) - { - if (flag & HA_STATUS_VARIABLE) - { - share->cachedStats.cacheRowCount(stats.records); - share->cachedStats.cacheDelRowCount(stats.deleted); - share->cachedStats.cacheMeanLength(stats.mean_rec_length); - share->cachedStats.cacheAugmentedDataLength(stats.data_file_length); - } - - if (flag & HA_STATUS_TIME) - { - share->cachedStats.cacheUpdateTime(stats.update_time); - } - } - - if (flag & HA_STATUS_CONST) - { - ulong i; // Loop counter for indexes - ulong j; // Loop counter for key parts - RowKey* rowKeyPtr; // Pointer to 'number of unique rows' array for this index - - rowKeyPtr = (RowKey_t*)(void*)rowKeySpcPtr; // Address first array of DB2 row counts - for (i = 0; i < table->s->keys; i++) // Do for each index, including primary - { - for (j = 0; j < table->key_info[i].key_parts; j++) - { - table->key_info[i].rec_per_key[j]= rowKeyPtr->RowKeyArray[j]; - } - rowKeyPtr = rowKeyPtr + 1; // Address next array of DB2 row counts - } - } - } - else if (rc == HA_ERR_LOCK_WAIT_TIMEOUT && share) - { - // If we couldn't retrieve the info because the object was locked, - // we'll do our best by returning the most recently cached data. - if ((infoRequested & rowCount) && - share->cachedStats.isInited(rowCount)) - stats.records = share->cachedStats.getRowCount(); - if ((infoRequested & deletedRowCount) && - share->cachedStats.isInited(deletedRowCount)) - stats.deleted = share->cachedStats.getDelRowCount(); - if ((infoRequested & meanRowLen) && - share->cachedStats.isInited(meanRowLen)) - stats.mean_rec_length = share->cachedStats.getMeanLength(); - if ((infoRequested & lastModTime) && - share->cachedStats.isInited(lastModTime)) - stats.update_time = share->cachedStats.getUpdateTime(); - - rc = 0; - } - } - - DBUG_RETURN(rc); -} - - -ha_rows ha_ibmdb2i::records() -{ - DBUG_ENTER("ha_ibmdb2i::records"); - int rc; - rc = bridge()->retrieveTableInfo((dataHandle ? dataHandle : db2Table->dataFile()->getMasterDefnHandle()), - rowCount, - stats); - - if (unlikely(rc)) - { - if (rc == HA_ERR_LOCK_WAIT_TIMEOUT && - share && - (share->cachedStats.isInited(rowCount))) - DBUG_RETURN(share->cachedStats.getRowCount()); - else - DBUG_RETURN(HA_POS_ERROR); - } - else if (share) - { - share->cachedStats.cacheRowCount(stats.records); - } - - DBUG_RETURN(stats.records); -} - - -int ha_ibmdb2i::extra(enum ha_extra_function operation) -{ - DBUG_ENTER("ha_ibmdb2i::extra"); - - switch(operation) - { - // Can these first five flags be replaced by attending to HA_EXTRA_WRITE_CACHE? - case HA_EXTRA_NO_IGNORE_DUP_KEY: - case HA_EXTRA_WRITE_CANNOT_REPLACE: - { - returnDupKeysImmediately = false; - onDupUpdate = false; - } - break; - case HA_EXTRA_INSERT_WITH_UPDATE: - { - returnDupKeysImmediately = true; - onDupUpdate = true; - } - break; - case HA_EXTRA_IGNORE_DUP_KEY: - case HA_EXTRA_WRITE_CAN_REPLACE: - returnDupKeysImmediately = true; - break; - case HA_EXTRA_FLUSH_CACHE: - if (outstanding_start_bulk_insert) - finishBulkInsert(); - break; - } - - - DBUG_RETURN(0); -} - -/** - @brief - The DB2 storage engine will ignore a MySQL generated value and will generate - a new value in SLIC. We arbitrarily set first_value to 1, and set the - interval to infinity for better performance on multi-row inserts. -*/ -void ha_ibmdb2i::get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values) -{ - DBUG_ENTER("ha_ibmdb2i::get_auto_increment"); - *first_value= 1; - *nb_reserved_values= ULONGLONG_MAX; -} - - - -void ha_ibmdb2i::update_create_info(HA_CREATE_INFO *create_info) -{ - DBUG_ENTER("ha_ibmdb2i::update_create_info"); - - if ((!(create_info->used_fields & HA_CREATE_USED_AUTO)) && - (table->found_next_number_field != NULL)) - { - initBridge(); - - create_info->auto_increment_value= 1; - - ha_rows rowCount = records(); - - if (rowCount == 0) - { - create_info->auto_increment_value = db2Table->getStartId(); - DBUG_VOID_RETURN; - } - else if (rowCount == HA_POS_ERROR) - { - DBUG_VOID_RETURN; - } - - getNextIdVal(&create_info->auto_increment_value); - } - DBUG_VOID_RETURN; -} - - -int ha_ibmdb2i::getNextIdVal(ulonglong *value) -{ - DBUG_ENTER("ha_ibmdb2i::getNextIdVal"); - - char queryBuffer[MAX_DB2_COLNAME_LENGTH + MAX_DB2_QUALIFIEDNAME_LENGTH + 64]; - strcpy(queryBuffer, " SELECT CAST(MAX( "); - convertMySQLNameToDB2Name(table->found_next_number_field->field_name, - strend(queryBuffer), - MAX_DB2_COLNAME_LENGTH+1); - strcat(queryBuffer, ") AS BIGINT) FROM "); - db2Table->getDB2QualifiedName(strend(queryBuffer)); - DBUG_ASSERT(strlen(queryBuffer) < sizeof(queryBuffer)); - - SqlStatementStream sqlStream(queryBuffer); - DBUG_PRINT("ha_ibmdb2i::getNextIdVal", ("Sent to DB2: %s",queryBuffer)); - - int rc = 0; - FILE_HANDLE fileHandle2; - uint32 db2RowDataLen2; - rc = bridge()->prepOpen(sqlStream.getPtrToData(), - &fileHandle2, - &db2RowDataLen2); - if (likely(rc == 0)) - { - IOReadBuffer rowBuffer(1, db2RowDataLen2); - rc = bridge()->read(fileHandle2, - rowBuffer.ptr(), - QMY_READ_ONLY, - QMY_NONE, - QMY_FIRST); - - if (likely(rc == 0)) - { - /* This check is here for the case where the table is not empty, - but the auto_increment starting value has been changed since - the last record was written. */ - - longlong maxIdVal = *(longlong*)(rowBuffer.getRowN(0)); - if ((maxIdVal + 1) > db2Table->getStartId()) - *value = maxIdVal + 1; - else - *value = db2Table->getStartId(); - } - - bridge()->deallocateFile(fileHandle2); - } - DBUG_RETURN(rc); -} - - -/* - Updates index cardinalities. -*/ -int ha_ibmdb2i::analyze(THD* thd, HA_CHECK_OPT *check_opt) -{ - DBUG_ENTER("ha_ibmdb2i::analyze"); - info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE); - DBUG_RETURN(0); -} - -int ha_ibmdb2i::optimize(THD* thd, HA_CHECK_OPT *check_opt) -{ - DBUG_ENTER("ha_ibmdb2i::optimize"); - - initBridge(thd); - - if (unlikely(records() == 0)) - DBUG_RETURN(0); // DB2 doesn't like to reorganize a table with no data. - - quiesceAllFileHandles(); - - int32 rc = bridge()->optimizeTable(db2Table->dataFile()->getMasterDefnHandle()); - info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE); - - DBUG_RETURN(rc); -} - - -/** - @brief - Determines if an ALTER TABLE is allowed to switch the storage engine - for this table. If the table has a foreign key or is referenced by a - foreign key, then it cannot be switched. -*/ -bool ha_ibmdb2i::can_switch_engines(void) -/*=================================*/ -{ - DBUG_ENTER("ha_ibmdb2i::can_switch_engines"); - - int rc = 0; - FILE_HANDLE queryFile = 0; - uint32 resultRowLen; - uint count = 0; - bool can_switch = FALSE; // 1 if changing storage engine is allowed - - const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL); - const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL); - - String query(256); - query.append(STRING_WITH_LEN(" SELECT COUNT(*) FROM SYSIBM.SQLFOREIGNKEYS WHERE ((PKTABLE_SCHEM = '")); - query.append(libName+1, strlen(libName)-2); // Remove quotes from parent schema name - query.append(STRING_WITH_LEN("' AND PKTABLE_NAME = '")); - query.append(fileName+1,strlen(fileName)-2); // Remove quotes from file name - query.append(STRING_WITH_LEN("') OR (FKTABLE_SCHEM = '")); - query.append(libName+1,strlen(libName)-2); // Remove quotes from child schema - query.append(STRING_WITH_LEN("' AND FKTABLE_NAME = '")); - query.append(fileName+1,strlen(fileName)-2); // Remove quotes from child name - query.append(STRING_WITH_LEN("'))")); - - SqlStatementStream sqlStream(query); - - rc = bridge()->prepOpen(sqlStream.getPtrToData(), - &queryFile, - &resultRowLen); - if (rc == 0) - { - IOReadBuffer rowBuffer(1, resultRowLen); - - rc = bridge()->read(queryFile, - rowBuffer.ptr(), - QMY_READ_ONLY, - QMY_NONE, - QMY_FIRST); - if (!rc) - { - count = *(uint*)(rowBuffer.getRowN(0)); - if (count == 0) - can_switch = TRUE; - } - - bridge()->deallocateFile(queryFile); - } - DBUG_RETURN(can_switch); -} - - - -bool ha_ibmdb2i::check_if_incompatible_data(HA_CREATE_INFO *info, - uint table_changes) -{ - DBUG_ENTER("ha_ibmdb2i::check_if_incompatible_data"); - uint i; - /* Check that auto_increment value and field definitions were - not changed. */ - if ((info->used_fields & HA_CREATE_USED_AUTO && - info->auto_increment_value != 0) || - table_changes != IS_EQUAL_YES) - DBUG_RETURN(COMPATIBLE_DATA_NO); - /* Check if any fields were renamed. */ - for (i= 0; i < table->s->fields; i++) - { - Field *field= table->field[i]; - if (field->flags & FIELD_IS_RENAMED) - { - DBUG_PRINT("info", ("Field has been renamed, copy table")); - DBUG_RETURN(COMPATIBLE_DATA_NO); - } - } - DBUG_RETURN(COMPATIBLE_DATA_YES); -} - -int ha_ibmdb2i::reset_auto_increment(ulonglong value) - { - DBUG_ENTER("ha_ibmdb2i::reset_auto_increment"); - - int rc = 0; - - quiesceAllFileHandles(); - - const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL); - const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL); - - String query(512); - query.append(STRING_WITH_LEN(" ALTER TABLE ")); - query.append(libName); - query.append('.'); - query.append(fileName); - query.append(STRING_WITH_LEN(" ALTER COLUMN ")); - char colName[MAX_DB2_COLNAME_LENGTH+1]; - convertMySQLNameToDB2Name(table->found_next_number_field->field_name, - colName, - sizeof(colName)); - query.append(colName); - - char restart_value[22]; - CHARSET_INFO *cs= &my_charset_bin; - uint len = (uint)(cs->cset->longlong10_to_str)(cs,restart_value,sizeof(restart_value), 10, value); - restart_value[len] = 0; - - query.append(STRING_WITH_LEN(" RESTART WITH ")); - query.append(restart_value); - - SqlStatementStream sqlStream(query); - DBUG_PRINT("ha_ibmdb2i::reset_auto_increment", ("Sent to DB2: %s",query.c_ptr())); - - rc = db2i_ileBridge::getBridgeForThread()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - QMY_NONE, //getCommitLevel(), - FALSE, - FALSE, - TRUE, //FALSE, - dataHandle); - if (rc == 0) - db2Table->updateStartId(value); - - DBUG_RETURN(rc); -} - - -/** - @brief - This function receives an error code that was previously set by the handler. - It returns to MySQL the error string associated with that error. -*/ -bool ha_ibmdb2i::get_error_message(int error, String *buf) -{ - DBUG_ENTER("ha_ibmdb2i::get_error_message"); - if ((error >= DB2I_FIRST_ERR && error <= DB2I_LAST_ERR) || - (error >= QMY_ERR_MIN && error <= QMY_ERR_MAX)) - { - db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(ha_thd()); - char* errMsg = bridge->getErrorStorage(); - buf->copy(errMsg, strlen(errMsg),system_charset_info); - bridge->freeErrorStorage(); - } - DBUG_RETURN(FALSE); -} - - -int ha_ibmdb2i::delete_all_rows() -{ - DBUG_ENTER("ha_ibmdb2i::delete_all_rows"); - int rc = 0; - char queryBuffer[MAX_DB2_QUALIFIEDNAME_LENGTH + 64]; - strcpy(queryBuffer, " DELETE FROM "); - db2Table->getDB2QualifiedName(strend(queryBuffer)); - DBUG_ASSERT(strlen(queryBuffer) < sizeof(queryBuffer)); - - SqlStatementStream sqlStream(queryBuffer); - DBUG_PRINT("ha_ibmdb2i::delete_all_rows", ("Sent to DB2: %s",queryBuffer)); - rc = bridge()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - getCommitLevel(), - false, - false, - true, - dataHandle); - - /* If this method was called on behalf of a TRUNCATE TABLE statement, and if */ - /* the table has an auto_increment field, then reset the starting value for */ - /* the auto_increment field to 1. - */ - if (rc == 0 && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE && - table->found_next_number_field ) - rc = reset_auto_increment(1); - - invalidateCachedStats(); - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::truncate() -{ - int error = delete_all_rows(); - return error ? error : reset_auto_increment(0); -} - - -int ha_ibmdb2i::external_lock(THD *thd, int lock_type) -{ - int rc = 0; - - DBUG_ENTER("ha_ibmdb2i::external_lock"); - DBUG_PRINT("ha_ibmdb2i::external_lock",("Lock type: %d", lock_type)); - - if (lock_type == F_RDLCK) - accessIntent = QMY_READ_ONLY; - else if (lock_type == F_WRLCK) - accessIntent = QMY_UPDATABLE; - - initBridge(thd); - int command = thd_sql_command(thd); - - if (!THDVAR(thd,transaction_unsafe)) - { - if (lock_type != F_UNLCK) - { - if (autoCommitIsOn(thd) == QMY_YES) - { - trans_register_ha(thd, FALSE, ibmdb2i_hton); - } - else - { - trans_register_ha(thd, TRUE, ibmdb2i_hton); - if (likely(command != SQLCOM_CREATE_TABLE)) - { - trans_register_ha(thd, FALSE, ibmdb2i_hton); - bridge()->beginStmtTx(); - } - } - } - } - - if (command == SQLCOM_LOCK_TABLES || - command == SQLCOM_ALTER_TABLE || - command == SQLCOM_UNLOCK_TABLES || - (accessIntent == QMY_UPDATABLE && - (command == SQLCOM_UPDATE || - command == SQLCOM_UPDATE_MULTI || - command == SQLCOM_DELETE || - command == SQLCOM_DELETE_MULTI || - command == SQLCOM_REPLACE || - command == SQLCOM_REPLACE_SELECT) && - getCommitLevel(thd) == QMY_NONE)) - { - char action; - char type; - if (lock_type == F_UNLCK) - { - action = QMY_UNLOCK; - type = accessIntent == QMY_READ_ONLY ? QMY_LSRD : QMY_LENR; - } - else - { - action = QMY_LOCK; - type = lock_type == F_RDLCK ? QMY_LSRD : QMY_LENR; - } - - DBUG_PRINT("ha_ibmdb2i::external_lock",("%socking table", action==QMY_LOCK ? "L" : "Unl")); - - if (!dataHandle) - rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection); - - rc = bridge()->lockObj(dataHandle, - 0, - action, - type, - (command == SQLCOM_LOCK_TABLES ? QMY_NO : QMY_YES)); - - } - - // Cache this away so we don't have to access it on each row operation - cachedZeroDateOption = (enum_ZeroDate)THDVAR(thd, compat_opt_allow_zero_date_vals); - - DBUG_RETURN(rc); -} - - -THR_LOCK_DATA **ha_ibmdb2i::store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type) -{ - if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) - { - if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) && !(thd->in_lock_tables && thd_sql_command(thd) == SQLCOM_LOCK_TABLES)) - lock_type= TL_WRITE_ALLOW_WRITE; - lock.type=lock_type; - } - *to++= &lock; - return to; -} - - -int ha_ibmdb2i::delete_table(const char *name) -{ - DBUG_ENTER("ha_ibmdb2i::delete_table"); - THD* thd = ha_thd(); - db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(thd); - - char db2Name[MAX_DB2_QUALIFIEDNAME_LENGTH]; - db2i_table::getDB2QualifiedNameFromPath(name, db2Name); - - String query(128); - query.append(STRING_WITH_LEN(" DROP TABLE ")); - query.append(db2Name); - - if (thd_sql_command(thd) == SQLCOM_DROP_TABLE && - thd->lex->drop_mode == DROP_RESTRICT) - query.append(STRING_WITH_LEN(" RESTRICT ")); - DBUG_PRINT("ha_ibmdb2i::delete_table", ("Sent to DB2: %s",query.c_ptr())); - - SqlStatementStream sqlStream(query); - - db2i_table::getDB2LibNameFromPath(name, db2Name); - bool isTemporary = (strcmp(db2Name, DB2I_TEMP_TABLE_SCHEMA) == 0 ? TRUE : FALSE); - - int rc = bridge->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - (isTemporary ? QMY_NONE : getCommitLevel(thd)), - FALSE, - FALSE, - isTemporary); - - if (rc == HA_ERR_NO_SUCH_TABLE) - { - warning(thd, DB2I_ERR_TABLE_NOT_FOUND, name); - rc = 0; - } - - if (rc == 0) - { - db2i_table::deleteAssocFiles(name); - } - - FILE_HANDLE savedHandle = bridge->findAndRemovePreservedHandle(name, &share); - while (savedHandle) - { - bridge->deallocateFile(savedHandle, TRUE); - DBUG_ASSERT(share); - if (free_share(share)) - share = NULL; - savedHandle = bridge->findAndRemovePreservedHandle(name, &share); - } - - my_errno = rc; - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::rename_table(const char * from, const char * to) -{ - DBUG_ENTER("ha_ibmdb2i::rename_table "); - - char db2FromFileName[MAX_DB2_FILENAME_LENGTH + 1]; - char db2ToFileName[MAX_DB2_FILENAME_LENGTH+1]; - char db2FromLibName[MAX_DB2_SCHEMANAME_LENGTH+1]; - char db2ToLibName[MAX_DB2_SCHEMANAME_LENGTH+1]; - - db2i_table::getDB2LibNameFromPath(from, db2FromLibName); - db2i_table::getDB2LibNameFromPath(to, db2ToLibName); - - if (strcmp(db2FromLibName, db2ToLibName) != 0 ) - { - getErrTxt(DB2I_ERR_RENAME_MOVE,from,to); - DBUG_RETURN(DB2I_ERR_RENAME_MOVE); - } - - db2i_table::getDB2FileNameFromPath(from, db2FromFileName, db2i_table::ASCII_NATIVE); - db2i_table::getDB2FileNameFromPath(to, db2ToFileName); - - char escapedFromFileName[2 * MAX_DB2_FILENAME_LENGTH + 1]; - - uint o = 0; - uint i = 1; - do - { - escapedFromFileName[o++] = db2FromFileName[i]; - if (db2FromFileName[i] == '+') - escapedFromFileName[o++] = '+'; - } while (db2FromFileName[++i]); - escapedFromFileName[o-1] = 0; - - - int rc = 0; - - char queryBuffer[sizeof(db2FromLibName) + 2 * sizeof(db2FromFileName) + 256]; - SafeString selectQuery(queryBuffer, sizeof(queryBuffer)); - selectQuery.strncat(STRING_WITH_LEN("SELECT CAST(INDEX_NAME AS VARCHAR(128) CCSID 1208) FROM QSYS2.SYSINDEXES WHERE INDEX_NAME LIKE '%+_+_+_%")); - selectQuery.strcat(escapedFromFileName); - selectQuery.strncat(STRING_WITH_LEN("' ESCAPE '+' AND TABLE_NAME='")); - selectQuery.strncat(db2FromFileName+1, strlen(db2FromFileName)-2); - selectQuery.strncat(STRING_WITH_LEN("' AND TABLE_SCHEMA='")); - selectQuery.strncat(db2FromLibName+1, strlen(db2FromLibName)-2); - selectQuery.strcat('\''); - DBUG_ASSERT(!selectQuery.overflowed()); - - SqlStatementStream indexQuery(selectQuery.ptr()); - - FILE_HANDLE queryFile = 0; - uint32 resultRowLen; - - initBridge(); - rc = bridge()->prepOpen(indexQuery.getPtrToData(), - &queryFile, - &resultRowLen); - - if (unlikely(rc)) - DBUG_RETURN(rc); - - IOReadBuffer rowBuffer(1, resultRowLen); - - int tableNameLen = strlen(db2FromFileName) - 2; - - SqlStatementStream renameQuery(64); - String query; - while (rc == 0) - { - query.length(0); - - rc = bridge()->read(queryFile, - rowBuffer.ptr(), - QMY_READ_ONLY, - QMY_NONE, - QMY_NEXT); - - if (!rc) - { - const char* rowData = rowBuffer.getRowN(0); - char indexFileName[MAX_DB2_FILENAME_LENGTH]; - memset(indexFileName, 0, sizeof(indexFileName)); - - uint16 fileNameLen = *(uint16*)(rowData); - strncpy(indexFileName, rowData + sizeof(uint16), fileNameLen); - - int bytesToRetain = fileNameLen - tableNameLen; - if (bytesToRetain <= 0) - /* We can't handle index names in which the MySQL index name and - the table name together are longer than the max index name. */ - { - getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*"); - DBUG_RETURN(DB2I_ERR_INVALID_NAME); - } - char indexName[MAX_DB2_FILENAME_LENGTH]; - memset(indexName, 0, sizeof(indexName)); - - strncpy(indexName, - indexFileName, - bytesToRetain); - - char db2IndexName[MAX_DB2_FILENAME_LENGTH+1]; - - convertMySQLNameToDB2Name(indexFileName, db2IndexName, sizeof(db2IndexName)); - - query.append(STRING_WITH_LEN("RENAME INDEX ")); - query.append(db2FromLibName); - query.append('.'); - query.append(db2IndexName); - query.append(STRING_WITH_LEN(" TO ")); - if (db2i_table::appendQualifiedIndexFileName(indexName, db2ToFileName, query, db2i_table::ASCII_SQL, typeNone) == -1) - { - getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*"); - DBUG_RETURN(DB2I_ERR_INVALID_NAME ); - } - renameQuery.addStatement(query); - DBUG_PRINT("ha_ibmdb2i::rename_table", ("Sent to DB2: %s",query.c_ptr_safe())); - } - } - - - if (queryFile) - bridge()->deallocateFile(queryFile); - - if (rc != HA_ERR_END_OF_FILE) - DBUG_RETURN(rc); - - char db2Name[MAX_DB2_QUALIFIEDNAME_LENGTH]; - - /* Rename the table */ - query.length(0); - query.append(STRING_WITH_LEN(" RENAME TABLE ")); - db2i_table::getDB2QualifiedNameFromPath(from, db2Name); - query.append(db2Name); - query.append(STRING_WITH_LEN(" TO ")); - query.append(db2ToFileName); - DBUG_PRINT("ha_ibmdb2i::rename_table", ("Sent to DB2: %s",query.c_ptr_safe())); - renameQuery.addStatement(query); - rc = bridge()->execSQL(renameQuery.getPtrToData(), - renameQuery.getStatementCount(), - getCommitLevel()); - - if (!rc) - db2i_table::renameAssocFiles(from, to); - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info) -{ - DBUG_ENTER("ha_ibmdb2i::create"); - - int rc; - char fileSortSequence[11] = "*HEX"; - char fileSortSequenceLibrary[11] = ""; - char fileSortSequenceType = ' '; - char libName[MAX_DB2_SCHEMANAME_LENGTH+1]; - char fileName[MAX_DB2_FILENAME_LENGTH+1]; - char colName[MAX_DB2_COLNAME_LENGTH+1]; - bool isTemporary; - ulong auto_inc_value; - - db2i_table::getDB2LibNameFromPath(name, libName); - db2i_table::getDB2FileNameFromPath(name, fileName); - - if (osVersion.v < 6) - { - if (strlen(libName) > - MAX_DB2_V5R4_LIBNAME_LENGTH + (isOrdinaryIdentifier(libName) ? 2 : 0)) - { - getErrTxt(DB2I_ERR_TOO_LONG_SCHEMA,libName, MAX_DB2_V5R4_LIBNAME_LENGTH); - DBUG_RETURN(DB2I_ERR_TOO_LONG_SCHEMA); - } - } - else if (strlen(libName) > MAX_DB2_V6R1_LIBNAME_LENGTH) - { - getErrTxt(DB2I_ERR_TOO_LONG_SCHEMA,libName, MAX_DB2_V6R1_LIBNAME_LENGTH); - DBUG_RETURN(DB2I_ERR_TOO_LONG_SCHEMA); - } - - String query(256); - - if (strcmp(libName, DB2I_TEMP_TABLE_SCHEMA)) - { - query.append(STRING_WITH_LEN("CREATE TABLE ")); - query.append(libName); - query.append('.'); - query.append(fileName); - isTemporary = FALSE; - } - else - { - query.append(STRING_WITH_LEN("DECLARE GLOBAL TEMPORARY TABLE ")); - query.append(fileName); - isTemporary = TRUE; - } - query.append(STRING_WITH_LEN(" (")); - - THD* thd = ha_thd(); - enum_TimeFormat timeFormat = (enum_TimeFormat)(THDVAR(thd, compat_opt_time_as_duration)); - enum_YearFormat yearFormat = (enum_YearFormat)(THDVAR(thd, compat_opt_year_as_int)); - enum_BlobMapping blobMapping = (enum_BlobMapping)(THDVAR(thd, compat_opt_blob_cols)); - enum_ZeroDate zeroDate = (enum_ZeroDate)(THDVAR(thd, compat_opt_allow_zero_date_vals)); - bool propagateDefaults = THDVAR(thd, propagate_default_col_vals); - - Field **field; - for (field= table_arg->field; *field; field++) - { - if ( field != table_arg->field ) // Not the first one - query.append(STRING_WITH_LEN(" , ")); - - if (!convertMySQLNameToDB2Name((*field)->field_name, colName, sizeof(colName))) - { - getErrTxt(DB2I_ERR_INVALID_NAME,"field",(*field)->field_name); - DBUG_RETURN(DB2I_ERR_INVALID_NAME ); - } - - query.append(colName); - query.append(' '); - - if (rc = getFieldTypeMapping(*field, - query, - timeFormat, - blobMapping, - zeroDate, - propagateDefaults, - yearFormat)) - DBUG_RETURN(rc); - - if ( (*field)->flags & NOT_NULL_FLAG ) - { - query.append(STRING_WITH_LEN(" NOT NULL ")); - } - if ( (*field)->flags & AUTO_INCREMENT_FLAG ) - { -#ifdef WITH_PARTITION_STORAGE_ENGINE - if (table_arg->part_info) - { - getErrTxt(DB2I_ERR_PART_AUTOINC); - DBUG_RETURN(DB2I_ERR_PART_AUTOINC); - } -#endif - query.append(STRING_WITH_LEN(" GENERATED BY DEFAULT AS IDENTITY ") ); - if (create_info->auto_increment_value != 0) - { - /* Query was ALTER TABLE...AUTO_INCREMENT = x; or - CREATE TABLE ...AUTO_INCREMENT = x; Set the starting - value for the auto_increment column. */ - char stringValue[22]; - CHARSET_INFO *cs= &my_charset_bin; - uint len = (uint)(cs->cset->longlong10_to_str)(cs,stringValue,sizeof(stringValue), 10, create_info->auto_increment_value); - stringValue[len] = 0; - query.append(STRING_WITH_LEN(" (START WITH ")); - query.append(stringValue); - - uint64 maxValue=maxValueForField(*field); - - if (maxValue) - { - len = (uint)(cs->cset->longlong10_to_str)(cs,stringValue,sizeof(stringValue), 10, maxValue); - stringValue[len] = 0; - query.append(STRING_WITH_LEN(" MAXVALUE ")); - query.append(stringValue); - } - - query.append(STRING_WITH_LEN(") ")); - } - - } - } - - String fieldDefinition(128); - - if (table_arg->s->primary_key != MAX_KEY && !isTemporary) - { - query.append(STRING_WITH_LEN(", PRIMARY KEY ")); - rc = buildIndexFieldList(fieldDefinition, - table_arg->key_info[table_arg->s->primary_key], - true, - &fileSortSequenceType, - fileSortSequence, - fileSortSequenceLibrary); - if (rc) DBUG_RETURN(rc); - query.append(fieldDefinition); - } - - rc = buildDB2ConstraintString(thd->lex, - query, - name, - table_arg->field, - &fileSortSequenceType, - fileSortSequence, - fileSortSequenceLibrary); - if (rc) DBUG_RETURN (rc); - - query.append(STRING_WITH_LEN(" ) ")); - - if (isTemporary) - query.append(STRING_WITH_LEN(" ON COMMIT PRESERVE ROWS ")); - - if (create_info->alias) - generateAndAppendRCDFMT(create_info->alias, query); - else if (((TABLE_LIST*)(thd->lex->select_lex.table_list.first))->table_name) - generateAndAppendRCDFMT((char*)((TABLE_LIST*)(thd->lex->select_lex.table_list.first))->table_name, query); - - DBUG_PRINT("ha_ibmdb2i::create", ("Sent to DB2: %s",query.c_ptr())); - SqlStatementStream sqlStream(query.length()); - sqlStream.addStatement(query,fileSortSequence,fileSortSequenceLibrary); - - if (table_arg->s->primary_key != MAX_KEY && - !isTemporary && - (THDVAR(thd, create_index_option)==1) && - (fileSortSequenceType != 'B') && - (fileSortSequenceType != ' ')) - { - rc = generateShadowIndex(sqlStream, - table_arg->key_info[table_arg->s->primary_key], - libName, - fileName, - fieldDefinition); - if (rc) DBUG_RETURN(rc); - } - for (uint i = 0; i < table_arg->s->keys; ++i) - { - if (i != table_arg->s->primary_key || isTemporary) - { - rc = buildCreateIndexStatement(sqlStream, - table_arg->key_info[i], - false, - libName, - fileName); - if (rc) DBUG_RETURN (rc); - } - } - - bool noCommit = isTemporary || ((!autoCommitIsOn(thd)) && (thd_sql_command(thd) == SQLCOM_ALTER_TABLE)); - - initBridge(); - -// if (THDVAR(thd, discovery_mode) == 1) -// bridge()->expectErrors(QMY_ERR_TABLE_EXISTS); - - rc = bridge()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - (isTemporary ? QMY_NONE : getCommitLevel(thd)), - TRUE, - FALSE, - noCommit ); - - if (unlikely(rc == QMY_ERR_MSGID) && - memcmp(bridge()->getErrorMsgID(), DB2I_SQL0350, 7) == 0) - { - my_error(ER_BLOB_USED_AS_KEY, MYF(0), "*unknown*"); - rc = ER_BLOB_USED_AS_KEY; - } -/* else if (unlikely(rc == QMY_ERR_TABLE_EXISTS) && - THDVAR(thd, discovery_mode) == 1) - { - db2i_table* temp = new db2i_table(table_arg->s, name); - int32 rc = temp->fastInitForCreate(name); - delete temp; - - if (!rc) - warning(thd, DB2I_ERR_WARN_CREATE_DISCOVER); - - DBUG_RETURN(rc); - } -*/ - - if (!rc && !isTemporary) - { - db2i_table* temp = new db2i_table(table_arg->s, name); - rc = temp->fastInitForCreate(name); - delete temp; - if (rc) - delete_table(name); - } - - DBUG_RETURN(rc); -} - - -/** - @brief - Add an index on-line to a table. This method is called on behalf of - a CREATE INDEX or ALTER TABLE statement. - It is implemented via a composed DDL statement passed to DB2. -*/ -int ha_ibmdb2i::add_index(TABLE *table_arg, - KEY *key_info, - uint num_of_keys) -{ - DBUG_ENTER("ha_ibmdb2i::add_index"); - - int rc; - SqlStatementStream sqlStream(256); - const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL); - const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL); - - quiesceAllFileHandles(); - - uint primaryKey = MAX_KEY; - if (table_arg->s->primary_key >= MAX_KEY && !db2Table->isTemporary()) - { - for (int i = 0; i < num_of_keys; ++i) - { - if (strcmp(key_info[i].name, "PRIMARY") == 0) - { - primaryKey = i; - break; - } - else if (primaryKey == MAX_KEY && - key_info[i].flags & HA_NOSAME) - { - primaryKey = i; - for (int j=0 ; j < key_info[i].key_parts ;j++) - { - uint fieldnr= key_info[i].key_part[j].fieldnr; - if (table_arg->s->field[fieldnr]->null_ptr || - table_arg->s->field[fieldnr]->key_length() != - key_info[i].key_part[j].length) - { - primaryKey = MAX_KEY; - break; - } - } - } - } - } - - - for (int i = 0; i < num_of_keys; ++i) - { - KEY& curKey= key_info[i]; - rc = buildCreateIndexStatement(sqlStream, - curKey, - (i == primaryKey), - libName, - fileName); - if (rc) DBUG_RETURN (rc); - } - - rc = bridge()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - getCommitLevel(), - FALSE, - FALSE, - FALSE, - dataHandle); - - /* Handle the case where a unique index is being created but an error occurs - because the file contains duplicate key values. */ - if (rc == ER_DUP_ENTRY) - print_keydup_error(MAX_KEY,ER(ER_DUP_ENTRY_WITH_KEY_NAME)); - - DBUG_RETURN(rc); -} - -/** - @brief - Drop an index on-line from a table. This method is called on behalf of - a DROP INDEX or ALTER TABLE statement. - It is implemented via a composed DDL statement passed to DB2. -*/ -int ha_ibmdb2i::prepare_drop_index(TABLE *table_arg, - uint *key_num, uint num_of_keys) -{ - DBUG_ENTER("ha_ibmdb2i::prepare_drop_index"); - int rc; - int i = 0; - String query(64); - SqlStatementStream sqlStream(64 * num_of_keys); - SqlStatementStream shadowStream(64 * num_of_keys); - - quiesceAllFileHandles(); - - const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL); - const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL); - - while (i < num_of_keys) - { - query.length(0); - DBUG_PRINT("info", ("ha_ibmdb2i::prepare_drop_index %u", key_num[i])); - KEY& curKey= table_arg->key_info[key_num[i]]; - if (key_num[i] == table->s->primary_key && !db2Table->isTemporary()) - { - query.append(STRING_WITH_LEN("ALTER TABLE ")); - query.append(libName); - query.append(STRING_WITH_LEN(".")); - query.append(fileName); - query.append(STRING_WITH_LEN(" DROP PRIMARY KEY")); - } - else - { - query.append(STRING_WITH_LEN("DROP INDEX ")); - query.append(libName); - query.append(STRING_WITH_LEN(".")); - db2i_table::appendQualifiedIndexFileName(curKey.name, fileName, query); - } - DBUG_PRINT("ha_ibmdb2i::prepare_drop_index", ("Sent to DB2: %s",query.c_ptr_safe())); - sqlStream.addStatement(query); - - query.length(0); - query.append(STRING_WITH_LEN("DROP INDEX ")); - query.append(libName); - query.append(STRING_WITH_LEN(".")); - db2i_table::appendQualifiedIndexFileName(curKey.name, fileName, query, db2i_table::ASCII_SQL, typeHex); - - DBUG_PRINT("ha_ibmdb2i::prepare_drop_index", ("Sent to DB2: %s",query.c_ptr_safe())); - shadowStream.addStatement(query); - - ++i; - } - - rc = bridge()->execSQL(sqlStream.getPtrToData(), - sqlStream.getStatementCount(), - getCommitLevel(), - FALSE, - FALSE, - FALSE, - dataHandle); - - if (rc == 0) - bridge()->execSQL(shadowStream.getPtrToData(), - shadowStream.getStatementCount(), - getCommitLevel()); - - DBUG_RETURN(rc); -} - - -void -ha_ibmdb2i::unlock_row() -{ - DBUG_ENTER("ha_ibmdb2i::unlock_row"); - DBUG_VOID_RETURN; -} - -int -ha_ibmdb2i::index_end() -{ - DBUG_ENTER("ha_ibmdb2i::index_end"); - warnIfInvalidData(); - last_index_init_rc = 0; - if (likely(activeReadBuf)) - activeReadBuf->endRead(); - if (likely(!last_index_init_rc)) - releaseIndexFile(active_index); - active_index= MAX_KEY; - DBUG_RETURN (0); -} - -int ha_ibmdb2i::doCommit(handlerton *hton, THD *thd, bool all) -{ - if (!THDVAR(thd, transaction_unsafe)) - { - if (all || autoCommitIsOn(thd)) - { - DBUG_PRINT("ha_ibmdb2i::doCommit",("Committing all")); - return (db2i_ileBridge::getBridgeForThread(thd)->commitmentControl(QMY_COMMIT)); - } - else - { - DBUG_PRINT("ha_ibmdb2i::doCommit",("Committing stmt")); - return (db2i_ileBridge::getBridgeForThread(thd)->commitStmtTx()); - } - } - - return (0); -} - - -int ha_ibmdb2i::doRollback(handlerton *hton, THD *thd, bool all) -{ - if (!THDVAR(thd,transaction_unsafe)) - { - if (all || autoCommitIsOn(thd)) - { - DBUG_PRINT("ha_ibmdb2i::doRollback",("Rolling back all")); - return ( db2i_ileBridge::getBridgeForThread(thd)->commitmentControl(QMY_ROLLBACK)); - } - else - { - DBUG_PRINT("ha_ibmdb2i::doRollback",("Rolling back stmt")); - return (db2i_ileBridge::getBridgeForThread(thd)->rollbackStmtTx()); - } - } - return (0); -} - - -void ha_ibmdb2i::start_bulk_insert(ha_rows rows) -{ - DBUG_ENTER("ha_ibmdb2i::start_bulk_insert"); - DBUG_PRINT("ha_ibmdb2i::start_bulk_insert",("Rows hinted %d", rows)); - int rc; - THD* thd = ha_thd(); - int command = thd_sql_command(thd); - - if (db2Table->hasBlobs() || - (command == SQLCOM_REPLACE || command == SQLCOM_REPLACE_SELECT)) - rows = 1; - else if (rows == 0) - rows = DEFAULT_MAX_ROWS_TO_BUFFER; // Shoot the moon - - // If we're doing a multi-row insert, binlogging is active, and the table has an - // auto_increment column, then we'll attempt to lock the file while we perform a 'fast path' blocked - // insert. If we can't get the lock, then we'll do a row-by-row 'slow path' insert instead. The reason is - // because the MI generates the auto_increment (identity value), and if we can't lock the file, - // then we can't predetermine what that value will be for insertion into the MySQL write buffer. - - if ((rows > 1) && // Multi-row insert - (thd->options & OPTION_BIN_LOG) && // Binlogging is on - (table->found_next_number_field)) // Table has an auto_increment column - { - if (!dataHandle) - rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection); - - rc = bridge()->lockObj(dataHandle, 1, QMY_LOCK, QMY_LEAR, QMY_YES); - if (rc==0) // Got the lock - { - autoIncLockAcquired = TRUE; - got_auto_inc_values = FALSE; - } - else // Didn't get the lock - rows = 1; // No problem, but don't block inserts - } - - if (activeHandle == 0) - { - last_start_bulk_insert_rc = useDataFile(); - if (last_start_bulk_insert_rc == 0) - last_start_bulk_insert_rc = prepWriteBuffer(rows, db2Table->dataFile()); - } - - if (last_start_bulk_insert_rc == 0) - outstanding_start_bulk_insert = true; - else - { - if (autoIncLockAcquired == TRUE) - { - bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LEAR, QMY_YES); - autoIncLockAcquired = FALSE; - } - } - - DBUG_VOID_RETURN; -} - - -int ha_ibmdb2i::end_bulk_insert() -{ - DBUG_ENTER("ha_ibmdb2i::end_bulk_insert"); - int rc = 0; - - if (outstanding_start_bulk_insert) - { - rc = finishBulkInsert(); - } - - my_errno = rc; - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::prepReadBuffer(ha_rows rowsToRead, const db2i_file* file, char intent) -{ - DBUG_ENTER("ha_ibmdb2i::prepReadBuffer"); - DBUG_ASSERT(rowsToRead > 0); - - THD* thd = ha_thd(); - char cmtLvl = getCommitLevel(thd); - - const db2i_file::RowFormat* format; - int rc = file->obtainRowFormat(activeHandle, intent, cmtLvl, &format); - - if (unlikely(rc)) DBUG_RETURN(rc); - - if (lobFieldsRequested()) - { - forceSingleRowRead = true; - rowsToRead = 1; - } - - rowsToRead = min(stats.records+1,min(rowsToRead, DEFAULT_MAX_ROWS_TO_BUFFER)); - - uint bufSize = min((format->readRowLen * rowsToRead), THDVAR(thd, max_read_buffer_size)); - multiRowReadBuf.allocBuf(format->readRowLen, format->readRowNullOffset, bufSize); - activeReadBuf = &multiRowReadBuf; - - if (db2Table->hasBlobs()) - { - if (!blobReadBuffers) - blobReadBuffers = new BlobCollection(db2Table, THDVAR(thd, lob_alloc_size)); - rc = prepareReadBufferForLobs(); - if (rc) DBUG_RETURN(rc); - } - -// if (accessIntent == QMY_UPDATABLE && -// thd_tx_isolation(thd) == ISO_REPEATABLE_READ && -// !THDVAR(thd, transaction_unsafe)) -// activeReadBuf->update(QMY_READ_ONLY, &releaseRowNeeded, QMY_REPEATABLE_READ); -// else - activeReadBuf->update(intent, &releaseRowNeeded, cmtLvl); - - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::prepWriteBuffer(ha_rows rowsToWrite, const db2i_file* file) -{ - DBUG_ENTER("ha_ibmdb2i::prepWriteBuffer"); - DBUG_ASSERT(accessIntent == QMY_UPDATABLE && rowsToWrite > 0); - - const db2i_file::RowFormat* format; - int rc = file->obtainRowFormat(activeHandle, - QMY_UPDATABLE, - getCommitLevel(ha_thd()), - &format); - - if (unlikely(rc)) DBUG_RETURN(rc); - - rowsToWrite = min(rowsToWrite, DEFAULT_MAX_ROWS_TO_BUFFER); - - uint bufSize = min((format->writeRowLen * rowsToWrite), THDVAR(ha_thd(), max_write_buffer_size)); - multiRowWriteBuf.allocBuf(format->writeRowLen, format->writeRowNullOffset, bufSize); - activeWriteBuf = &multiRowWriteBuf; - - if (!blobWriteBuffers && db2Table->hasBlobs()) - { - blobWriteBuffers = new ValidatedPointer<char>[db2Table->getBlobCount()]; - } - DBUG_RETURN(rc); -} - - -int ha_ibmdb2i::flushWrite(FILE_HANDLE fileHandle, uchar* buf ) -{ - DBUG_ENTER("ha_ibmdb2i::flushWrite"); - int rc; - int64 generatedIdValue = 0; - bool IdValueWasGenerated = FALSE; - char* lastDupKeyNamePtr = NULL; - uint32 lastDupKeyNameLen = 0; - int loopCnt = 0; - bool retry_dup = FALSE; - - while (loopCnt == 0 || retry_dup == TRUE) - { - rc = bridge()->writeRows(fileHandle, - activeWriteBuf->ptr(), - getCommitLevel(), - &generatedIdValue, - &IdValueWasGenerated, - &lastDupKeyRRN, - &lastDupKeyNamePtr, - &lastDupKeyNameLen, - &incrementByValue); - loopCnt++; - retry_dup = FALSE; - invalidateCachedStats(); - if (lastDupKeyNameLen) - { - rrnAssocHandle = fileHandle; - - int command = thd_sql_command(ha_thd()); - - if (command == SQLCOM_REPLACE || - command == SQLCOM_REPLACE_SELECT) - lastDupKeyID = 0; - else - { - lastDupKeyID = getKeyFromName(lastDupKeyNamePtr, lastDupKeyNameLen); - - if (likely(lastDupKeyID != MAX_KEY)) - { - uint16 failedRow = activeWriteBuf->rowsWritten()+1; - - if (buf && (failedRow != activeWriteBuf->rowCount())) - { - const char* badRow = activeWriteBuf->getRowN(failedRow-1); - bool savedReadAllColumns = readAllColumns; - readAllColumns = true; - mungeDB2row(buf, - badRow, - badRow + activeWriteBuf->getRowNullOffset(), - true); - readAllColumns = savedReadAllColumns; - - if (table->found_next_number_field) - { - table->next_number_field->store(next_identity_value - (incrementByValue * (activeWriteBuf->rowCount() - (failedRow - 1)))); - } - } - - if (default_identity_value && // Table has ID colm and generating a value - (!autoIncLockAcquired || !got_auto_inc_values) && - // Writing first or only row in block - loopCnt == 1 && // Didn't already retry - lastDupKeyID == table->s->next_number_index) // Autoinc column is in failed index - { - if (alterStartWith() == 0) // Reset next Identity value to max+1 - retry_dup = TRUE; // Rtry the write operation - } - } - else - { - char unknownIndex[MAX_DB2_FILENAME_LENGTH+1]; - convFromEbcdic(lastDupKeyNamePtr, unknownIndex, min(lastDupKeyNameLen, MAX_DB2_FILENAME_LENGTH)); - unknownIndex[min(lastDupKeyNameLen, MAX_DB2_FILENAME_LENGTH)] = 0; - getErrTxt(DB2I_ERR_UNKNOWN_IDX, unknownIndex); - } - } - } - } - - if ((rc == 0 || rc == HA_ERR_FOUND_DUPP_KEY) - && default_identity_value && IdValueWasGenerated && - (!autoIncLockAcquired || !got_auto_inc_values)) - { - /* Save the generated identity value for the MySQL last_insert_id() function. */ - insert_id_for_cur_row = generatedIdValue; - - /* Store the value into MySQL's buf for row-based replication - or for an 'on duplicate key update' clause. */ - table->next_number_field->store((longlong) generatedIdValue, TRUE); - if (autoIncLockAcquired) - { - got_auto_inc_values = TRUE; - next_identity_value = generatedIdValue + incrementByValue; - } - } - else - { - if (!autoIncLockAcquired) // Don't overlay value for first row of a block - insert_id_for_cur_row = 0; - } - - - activeWriteBuf->resetAfterWrite(); - DBUG_RETURN(rc); -} - -int ha_ibmdb2i::alterStartWith() -{ - DBUG_ENTER("ha_ibmdb2i::alterStartWith"); - int rc = 0; - ulonglong nextIdVal; - if (!dataHandle) - rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection); - if (!rc) {rc = bridge()->lockObj(dataHandle, 1, QMY_LOCK, QMY_LENR, QMY_YES);} - if (!rc) - { - rc = getNextIdVal(&nextIdVal); - if (!rc) {rc = reset_auto_increment(nextIdVal);} - bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LENR, QMY_YES); - } - DBUG_RETURN(rc); -} - -bool ha_ibmdb2i::lobFieldsRequested() -{ - if (!db2Table->hasBlobs()) - { - DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("No LOBs")); - return (false); - } - - if (readAllColumns) - { - DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("All cols requested")); - return (true); - } - - for (int i = 0; i < db2Table->getBlobCount(); ++i) - { - if (bitmap_is_set(table->read_set, db2Table->blobFields[i])) - { - DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("LOB requested")); - return (true); - } - } - - DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("No LOBs requested")); - return (false); -} - - -int ha_ibmdb2i::prepareReadBufferForLobs() -{ - DBUG_ENTER("ha_ibmdb2i::prepareReadBufferForLobs"); - DBUG_ASSERT(db2Table->hasBlobs()); - - uint32 activeLobFields = 0; - DB2LobField* lobField; - uint16 blobCount = db2Table->getBlobCount(); - - char* readBuf = activeReadBuf->getRowN(0); - - for (int i = 0; i < blobCount; ++i) - { - int fieldID = db2Table->blobFields[i]; - DB2Field& db2Field = db2Table->db2Field(fieldID); - lobField = db2Field.asBlobField(readBuf); - if (readAllColumns || - bitmap_is_set(table->read_set, fieldID)) - { - lobField->dataHandle = (ILEMemHandle)blobReadBuffers->getBufferPtr(fieldID); - activeLobFields++; - } - else - { - lobField->dataHandle = NULL; - } - } - - if (activeLobFields == 0) - { - for (int i = 0; i < blobCount; ++i) - { - DB2Field& db2Field = db2Table->db2Field(db2Table->blobFields[i]); - uint16 offset = db2Field.getBufferOffset() + db2Field.calcBlobPad(); - - for (int r = 1; r < activeReadBuf->getRowCapacity(); ++r) - { - lobField = (DB2LobField*)(activeReadBuf->getRowN(r) + offset); - lobField->dataHandle = NULL; - } - } - } - - activeReadBuf->setRowsToProcess((activeLobFields ? 1 : activeReadBuf->getRowCapacity())); - int rc = bridge()->objectOverride(activeHandle, - activeReadBuf->ptr(), - activeReadBuf->getRowLength()); - DBUG_RETURN(rc); -} - - -uint32 ha_ibmdb2i::adjustLobBuffersForRead() -{ - DBUG_ENTER("ha_ibmdb2i::adjustLobBuffersForRead"); - - char* readBuf = activeReadBuf->getRowN(0); - - for (int i = 0; i < db2Table->getBlobCount(); ++i) - { - DB2Field& db2Field = db2Table->db2Field(db2Table->blobFields[i]); - DB2LobField* lobField = db2Field.asBlobField(readBuf); - if (readAllColumns || - bitmap_is_set(table->read_set, db2Table->blobFields[i])) - { - lobField->dataHandle = (ILEMemHandle)blobReadBuffers->reallocBuffer(db2Table->blobFields[i], lobField->length); - - if (lobField->dataHandle == NULL) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - else - { - lobField->dataHandle = 0; - } - } - - int32 rc = bridge()->objectOverride(activeHandle, - activeReadBuf->ptr()); - DBUG_RETURN(rc); -} - - - -int ha_ibmdb2i::reset() -{ - DBUG_ENTER("ha_ibmdb2i::reset"); - - if (outstanding_start_bulk_insert) - { - finishBulkInsert(); - } - - if (activeHandle != 0) - { - releaseActiveHandle(); - } - - cleanupBuffers(); - - db2i_ileBridge::getBridgeForThread(ha_thd())->freeErrorStorage(); - - last_rnd_init_rc = last_index_init_rc = last_start_bulk_insert_rc = 0; - - returnDupKeysImmediately = false; - onDupUpdate = false; - forceSingleRowRead = false; - -#ifndef DBUG_OFF - cachedBridge=NULL; -#endif - - DBUG_RETURN(0); -} - - -int32 ha_ibmdb2i::buildCreateIndexStatement(SqlStatementStream& sqlStream, - KEY& key, - bool isPrimary, - const char* db2LibName, - const char* db2FileName) -{ - DBUG_ENTER("ha_ibmdb2i::buildCreateIndexStatement"); - - char fileSortSequence[11] = "*HEX"; - char fileSortSequenceLibrary[11] = ""; - char fileSortSequenceType = ' '; - String query(256); - query.length(0); - int rc = 0; - - if (isPrimary) - { - query.append(STRING_WITH_LEN("ALTER TABLE ")); - query.append(db2LibName); - query.append('.'); - query.append(db2FileName); - query.append(STRING_WITH_LEN(" ADD PRIMARY KEY ")); - } - else - { - query.append(STRING_WITH_LEN("CREATE")); - - if (key.flags & HA_NOSAME) - query.append(STRING_WITH_LEN(" UNIQUE WHERE NOT NULL")); - - query.append(STRING_WITH_LEN(" INDEX ")); - - query.append(db2LibName); - query.append('.'); - if (db2i_table::appendQualifiedIndexFileName(key.name, db2FileName, query)) - { - getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*"); - DBUG_RETURN(DB2I_ERR_INVALID_NAME ); - } - - query.append(STRING_WITH_LEN(" ON ")); - - query.append(db2LibName); - query.append('.'); - query.append(db2FileName); - } - - String fieldDefinition(128); - rc = buildIndexFieldList(fieldDefinition, - key, - isPrimary, - &fileSortSequenceType, - fileSortSequence, - fileSortSequenceLibrary); - - if (rc) DBUG_RETURN(rc); - - query.append(fieldDefinition); - - if ((THDVAR(ha_thd(), create_index_option)==1) && - (fileSortSequenceType != 'B') && - (fileSortSequenceType != ' ')) - { - rc = generateShadowIndex(sqlStream, - key, - db2LibName, - db2FileName, - fieldDefinition); - if (rc) DBUG_RETURN(rc); - } - - DBUG_PRINT("ha_ibmdb2i::buildCreateIndexStatement", ("Sent to DB2: %s",query.c_ptr_safe())); - sqlStream.addStatement(query,fileSortSequence,fileSortSequenceLibrary); - - DBUG_RETURN(0); -} - -/** - Generate the SQL syntax for the list of fields to be assigned to the - specified key. The corresponding sort sequence is also calculated. - - @param[out] appendHere The string to receive the generated SQL - @param key The key to evaluate - @param isPrimary True if this is being generated on behalf of the primary key - @param[out] fileSortSequenceType The type of the associated sort sequence - @param[out] fileSortSequence The name of the associated sort sequence - @param[out] fileSortSequenceLibrary The library of the associated sort sequence - - @return 0 if successful; error value otherwise -*/ -int32 ha_ibmdb2i::buildIndexFieldList(String& appendHere, - const KEY& key, - bool isPrimary, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary) -{ - DBUG_ENTER("ha_ibmdb2i::buildIndexFieldList"); - appendHere.append(STRING_WITH_LEN(" ( ")); - for (int j = 0; j < key.key_parts; ++j) - { - char colName[MAX_DB2_COLNAME_LENGTH+1]; - if (j != 0) - { - appendHere.append(STRING_WITH_LEN(" , ")); - } - - KEY_PART_INFO& kpi = key.key_part[j]; - Field* field = kpi.field; - - convertMySQLNameToDB2Name(field->field_name, - colName, - sizeof(colName)); - appendHere.append(colName); - - int32 rc; - rc = updateAssociatedSortSequence(field->charset(), - fileSortSequenceType, - fileSortSequence, - fileSortSequenceLibrary); - if (rc) DBUG_RETURN (rc); - } - - appendHere.append(STRING_WITH_LEN(" ) ")); - - DBUG_RETURN(0); -} - - -/** - Generate an SQL statement that defines a *HEX sorted index to implement - the ibmdb2i_create_index. - - @param[out] stream The stream to append the generated statement to - @param key The key to evaluate - @param[out] libName The library containg the table - @param[out] fileName The DB2-compatible name of the table - @param[out] fieldDefinition The list of the fields in the index, in SQL syntax - - @return 0 if successful; error value otherwise -*/ -int32 ha_ibmdb2i::generateShadowIndex(SqlStatementStream& stream, - const KEY& key, - const char* libName, - const char* fileName, - const String& fieldDefinition) -{ - String shadowQuery(256); - shadowQuery.length(0); - shadowQuery.append(STRING_WITH_LEN("CREATE INDEX ")); - shadowQuery.append(libName); - shadowQuery.append('.'); - if (db2i_table::appendQualifiedIndexFileName(key.name, fileName, shadowQuery, db2i_table::ASCII_SQL, typeHex)) - { - getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*"); - return DB2I_ERR_INVALID_NAME; - } - shadowQuery.append(STRING_WITH_LEN(" ON ")); - shadowQuery.append(libName); - shadowQuery.append('.'); - shadowQuery.append(fileName); - shadowQuery.append(fieldDefinition); - DBUG_PRINT("ha_ibmdb2i::generateShadowIndex", ("Sent to DB2: %s",shadowQuery.c_ptr_safe())); - stream.addStatement(shadowQuery,"*HEX","QSYS"); - return 0; -} - - -void ha_ibmdb2i::doInitialRead(char orientation, - uint32 rowsToBuffer, - ILEMemHandle key, - int keyLength, - int keyParts) -{ - DBUG_ENTER("ha_ibmdb2i::doInitialRead"); - - if (forceSingleRowRead) - rowsToBuffer = 1; - else - rowsToBuffer = min(rowsToBuffer, activeReadBuf->getRowCapacity()); - - activeReadBuf->newReadRequest(activeHandle, - orientation, - rowsToBuffer, - THDVAR(ha_thd(), async_enabled), - key, - keyLength, - keyParts); - DBUG_VOID_RETURN; -} - - -int ha_ibmdb2i::start_stmt(THD *thd, thr_lock_type lock_type) -{ - DBUG_ENTER("ha_ibmdb2i::start_stmt"); - initBridge(thd); - if (!THDVAR(thd, transaction_unsafe)) - { - trans_register_ha(thd, FALSE, ibmdb2i_hton); - - if (!autoCommitIsOn(thd)) - { - bridge()->beginStmtTx(); - } - } - - DBUG_RETURN(0); -} - -int32 ha_ibmdb2i::handleLOBReadOverflow() -{ - DBUG_ENTER("ha_ibmdb2i::handleLOBReadOverflow"); - DBUG_ASSERT(db2Table->hasBlobs() && (activeReadBuf->getRowCapacity() == 1)); - - int32 rc = adjustLobBuffersForRead(); - - if (!rc) - { - activeReadBuf->rewind(); - rc = bridge()->expectErrors(QMY_ERR_END_OF_BLOCK) - ->read(activeHandle, - activeReadBuf->ptr(), - accessIntent, - getCommitLevel(), - QMY_SAME); - releaseRowNeeded = TRUE; - - } - DBUG_RETURN(rc); -} - - -int32 ha_ibmdb2i::finishBulkInsert() -{ - int32 rc = 0; - - if (activeWriteBuf->rowCount() && activeHandle) - rc = flushWrite(activeHandle, table->record[0]); - - if (activeHandle) - releaseActiveHandle(); - - if (autoIncLockAcquired == TRUE) - { - // We could check the return code on the unlock, but beware not - // to overlay the return code from the flushwrite or we will mask - // duplicate key errors.. - bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LEAR, QMY_YES); - autoIncLockAcquired = FALSE; - } - outstanding_start_bulk_insert = false; - multiRowWriteBuf.freeBuf(); - last_start_bulk_insert_rc = 0; - - resetCharacterConversionBuffers(); - - return rc; -} - -int ha_ibmdb2i::getKeyFromName(const char* name, size_t len) -{ - for (int i = 0; i < table_share->keys; ++i) - { - const char* indexName = db2Table->indexFile(i)->getDB2FileName(); - if ((strncmp(name, indexName, len) == 0) && - (strlen(indexName) == len)) - { - return i; - } - } - return MAX_KEY; -} - -/* -Determine the number of I/O's it takes to read through the table. - */ -double ha_ibmdb2i::scan_time() - { - DBUG_ENTER("ha_ibmdb2i::scan_time"); - DBUG_RETURN(ulonglong2double((stats.data_file_length)/IO_SIZE)); - } - - -/** - Estimate the number of I/O's it takes to read a set of ranges through - an index. - - @param index - @param ranges - @param rows - - @return The estimate number of I/Os -*/ - -double ha_ibmdb2i::read_time(uint index, uint ranges, ha_rows rows) -{ - DBUG_ENTER("ha_ibmdb2i::read_time"); - int rc; - uint64 idxPageCnt = 0; - double cost; - - if (unlikely(rows == HA_POS_ERROR)) - DBUG_RETURN(double(rows) + ranges); - - rc = bridge()->retrieveIndexInfo(db2Table->indexFile(index)->getMasterDefnHandle(), - &idxPageCnt); - if (!rc) - { - if ((idxPageCnt == 1) || // Retrieving rows in requested order or - (ranges == rows)) // 'Sweep' full records retrieval - cost = idxPageCnt/4; - else - { - uint64 totalRecords = stats.records + 1; - double dataPageCount = stats.data_file_length/IO_SIZE; - - cost = (rows * dataPageCount / totalRecords) + - min(idxPageCnt, (log_2(idxPageCnt) * ranges + - rows * (log_2(idxPageCnt) + log_2(rows) - log_2(totalRecords)))); - } - } - else - { - cost = rows2double(ranges+rows); // Use default costing - } - DBUG_RETURN(cost); -} - -int ha_ibmdb2i::useIndexFile(int idx) -{ - DBUG_ENTER("ha_ibmdb2i::useIndexFile"); - - if (activeHandle) - releaseActiveHandle(); - - int rc = 0; - - if (!indexHandles[idx]) - rc = db2Table->indexFile(idx)->allocateNewInstance(&indexHandles[idx], curConnection); - - if (rc == 0) - { - activeHandle = indexHandles[idx]; - bumpInUseCounter(1); - } - - DBUG_RETURN(rc); -} - - -ulong ha_ibmdb2i::index_flags(uint inx, uint part, bool all_parts) const -{ - return HA_READ_NEXT | HA_READ_PREV | HA_KEYREAD_ONLY | HA_READ_ORDER | HA_READ_RANGE; -} - - -static struct st_mysql_sys_var* ibmdb2i_system_variables[] = { - MYSQL_SYSVAR(rdb_name), - MYSQL_SYSVAR(transaction_unsafe), - MYSQL_SYSVAR(lob_alloc_size), - MYSQL_SYSVAR(max_read_buffer_size), - MYSQL_SYSVAR(max_write_buffer_size), - MYSQL_SYSVAR(async_enabled), - MYSQL_SYSVAR(assume_exclusive_use), - MYSQL_SYSVAR(compat_opt_blob_cols), - MYSQL_SYSVAR(compat_opt_time_as_duration), - MYSQL_SYSVAR(compat_opt_allow_zero_date_vals), - MYSQL_SYSVAR(compat_opt_year_as_int), - MYSQL_SYSVAR(propagate_default_col_vals), - MYSQL_SYSVAR(create_index_option), -// MYSQL_SYSVAR(discovery_mode), - MYSQL_SYSVAR(system_trace_level), - NULL -}; - - -struct st_mysql_storage_engine ibmdb2i_storage_engine= -{ MYSQL_HANDLERTON_INTERFACE_VERSION }; - -mysql_declare_plugin(ibmdb2i) -{ - MYSQL_STORAGE_ENGINE_PLUGIN, - &ibmdb2i_storage_engine, - "IBMDB2I", - "The IBM development team in Rochester, Minnesota", - "IBM DB2 for i Storage Engine", - PLUGIN_LICENSE_GPL, - ibmdb2i_init_func, /* Plugin Init */ - ibmdb2i_done_func, /* Plugin Deinit */ - 0x0100 /* 1.0 */, - NULL, /* status variables */ - ibmdb2i_system_variables, /* system variables */ - NULL /* config options */ -} -mysql_declare_plugin_end; diff --git a/storage/ibmdb2i/ha_ibmdb2i.h b/storage/ibmdb2i/ha_ibmdb2i.h deleted file mode 100644 index b2a43232f2d..00000000000 --- a/storage/ibmdb2i/ha_ibmdb2i.h +++ /dev/null @@ -1,822 +0,0 @@ -/* -Licensed Materials - Property of IBM -DB2 Storage Engine Enablement -Copyright IBM Corporation 2007,2008 -All rights reserved - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - (a) Redistributions of source code must retain this list of conditions, the - copyright notice in section {d} below, and the disclaimer following this - list of conditions. - (b) Redistributions in binary form must reproduce this list of conditions, the - copyright notice in section (d) below, and the disclaimer following this - list of conditions, in the documentation and/or other materials provided - with the distribution. - (c) The name of IBM may not be used to endorse or promote products derived from - this software without specific prior written permission. - (d) The text of the required copyright notice is: - Licensed Materials - Property of IBM - DB2 Storage Engine Enablement - Copyright IBM Corporation 2007,2008 - All rights reserved - -THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ - -/** @file ha_ibmdb2i.h - - @brief - - @note - - @see -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "as400_types.h" -#include "as400_protos.h" -#include "db2i_global.h" -#include "db2i_ileBridge.h" -#include "builtins.h" -#include "db2i_misc.h" -#include "db2i_file.h" -#include "db2i_blobCollection.h" -#include "db2i_collationSupport.h" -#include "db2i_validatedPointer.h" -#include "db2i_ioBuffers.h" -#include "db2i_errors.h" -#include "db2i_sqlStatementStream.h" - -/** @brief - IBMDB2I_SHARE is a structure that will be shared among all open handlers. - It is used to describe the underlying table definition, and it caches - table statistics. -*/ -struct IBMDB2I_SHARE { - char *table_name; - uint table_name_length,use_count; - pthread_mutex_t mutex; - THR_LOCK lock; - - db2i_table* db2Table; - - class CStats - { - public: - void cacheUpdateTime(time_t time) - {update_time = time; initFlag |= lastModTime;} - time_t getUpdateTime() const - {return update_time;} - void cacheRowCount(ha_rows rows) - {records = rows; initFlag |= rowCount;} - ha_rows getRowCount() const - {return records;} - void cacheDelRowCount(ha_rows rows) - {deleted = rows; initFlag |= deletedRowCount;} - ha_rows getDelRowCount() const - {return deleted;} - void cacheMeanLength(ulong len) - {mean_rec_length = len; initFlag |= meanRowLen;} - ulong getMeanLength() - {return mean_rec_length;} - void cacheAugmentedDataLength(ulong len) - {data_file_length = len; initFlag |= ioCount;} - ulong getAugmentedDataLength() - {return data_file_length;} - bool isInited(uint flags) - {return initFlag & flags;} - void invalidate(uint flags) - {initFlag &= ~flags;} - - private: - uint initFlag; - time_t update_time; - ha_rows records; - ha_rows deleted; - ulong mean_rec_length; - ulong data_file_length; - } cachedStats; - -}; - -class ha_ibmdb2i: public handler -{ - THR_LOCK_DATA lock; ///< MySQL lock - IBMDB2I_SHARE *share; ///< Shared lock info - - // The record we are positioned on, together with the handle used to get - // i. - uint32 currentRRN; - uint32 rrnAssocHandle; - - // Dup key values needed by info() - uint32 lastDupKeyRRN; - uint32 lastDupKeyID; - - bool returnDupKeysImmediately; - - // Dup key value need by update() - bool onDupUpdate; - - - db2i_table* db2Table; - - // The file handle of the PF or LF being accessed by the current operation. - FILE_HANDLE activeHandle; - - // The file handle of the underlying PF - FILE_HANDLE dataHandle; - - // Array of file handles belonging to the underlying LFs - FILE_HANDLE* indexHandles; - - // Flag to indicate whether a call needs to be made to unlock a row when - // a read operation has ended. DB2 will handle row unlocking as we move - // through rows, but if an operation ends before we reach the end of a file, - // DB2 needs to know to unlock the last row read. - bool releaseRowNeeded; - - // Pointer to a definition of the layout of the row buffer for the file - // described by activeHandle - const db2i_file::RowFormat* activeFormat; - - IORowBuffer keyBuf; - uint32 keyLen; - - IOWriteBuffer multiRowWriteBuf; - IOAsyncReadBuffer multiRowReadBuf; - - IOAsyncReadBuffer* activeReadBuf; - IOWriteBuffer* activeWriteBuf; - - BlobCollection* blobReadBuffers; // Dynamically allocated per query and used - // to manage the buffers used for reading LOBs - ValidatedPointer<char>* blobWriteBuffers; - - // Return codes are not used/honored by rnd_init and start_bulk_insert - // so we need a way to signal the failure "downstream" to subsequent - // functions. - int last_rnd_init_rc; - int last_index_init_rc; - int last_start_bulk_insert_rc; - - // end_bulk_insert may get called twice for a single start_bulk_insert - // This is our way to do cleanup only once. - bool outstanding_start_bulk_insert; - - // Auto_increment 'increment by' value needed by write_row() - uint32 incrementByValue; - bool default_identity_value; - - // Flags and values used during write operations for auto_increment processing - bool autoIncLockAcquired; - bool got_auto_inc_values; - uint64 next_identity_value; - - // The access intent indicated by the last external_locks() call. - // May be either QMY_READ or QMY_UPDATABLE - char accessIntent; - char readAccessIntent; - - ha_rows* indexReadSizeEstimates; - - MEM_ROOT conversionBufferMemroot; - - bool forceSingleRowRead; - - bool readAllColumns; - - bool invalidDataFound; - - db2i_ileBridge* cachedBridge; - - ValidatedObject<volatile uint32> curConnection; - uint16 activeReferences; - -public: - - ha_ibmdb2i(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_ibmdb2i(); - - const char *table_type() const { return "IBMDB2I"; } - const char *index_type(uint inx) { return "RADIX"; } - const key_map *keys_to_use_for_scanning() { return &key_map_full; } - const char **bas_ext() const; - - ulonglong table_flags() const - { - return HA_NULL_IN_KEY | HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | - HA_PARTIAL_COLUMN_READ | - HA_DUPLICATE_POS | HA_NO_PREFIX_CHAR_KEYS | - HA_HAS_RECORDS | HA_BINLOG_ROW_CAPABLE | HA_REQUIRES_KEY_COLUMNS_FOR_DELETE | - HA_CAN_INDEX_BLOBS; - } - - ulong index_flags(uint inx, uint part, bool all_parts) const; - -// Note that we do not implement max_supported_record_length. -// We'll let create fail accordingly if the row is -// too long. This allows us to hide the fact that varchars > 32K are being -// implemented as DB2 LOBs. - - uint max_supported_keys() const { return 4000; } - uint max_supported_key_parts() const { return MAX_DB2_KEY_PARTS; } - uint max_supported_key_length() const { return 32767; } - uint max_supported_key_part_length() const { return 32767; } - double read_time(uint index, uint ranges, ha_rows rows); - double scan_time(); - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); - int delete_row(const uchar * buf); - int index_init(uint idx, bool sorted); - int index_read(uchar * buf, const uchar * key, - uint key_len, enum ha_rkey_function find_flag); - int index_next(uchar * buf); - int index_read_last(uchar * buf, const uchar * key, uint key_len); - int index_next_same(uchar *buf, const uchar *key, uint keylen); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - int rnd_init(bool scan); - int rnd_end(); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); - void position(const uchar *record); - int info(uint); - ha_rows records(); - int extra(enum ha_extra_function operation); - int external_lock(THD *thd, int lock_type); - int delete_all_rows(void); - ha_rows records_in_range(uint inx, key_range *min_key, - key_range *max_key); - int delete_table(const char *from); - int rename_table(const char * from, const char * to); - int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); - int updateFrm(TABLE *table_def, File file); - int openTableDef(TABLE *table_def); - int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); - int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys); - int final_drop_index(TABLE *table_arg) {return 0;} - void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values); - int reset_auto_increment(ulonglong value); - void restore_auto_increment(ulonglong prev_insert_id) {return;} - void update_create_info(HA_CREATE_INFO *create_info); - int getNextIdVal(ulonglong *value); - int analyze(THD* thd,HA_CHECK_OPT* check_opt); - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - bool can_switch_engines(); - void free_foreign_key_create_info(char* str); - char* get_foreign_key_create_info(); - int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list); - uint referenced_by_foreign_key(); - bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); - virtual bool get_error_message(int error, String *buf); - - THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - - bool low_byte_first() const { return 0; } - void unlock_row(); - int index_end(); - int reset(); - static int doCommit(handlerton *hton, THD *thd, bool all); - static int doRollback(handlerton *hton, THD *thd, bool all); - void start_bulk_insert(ha_rows rows); - int end_bulk_insert(); - int start_stmt(THD *thd, thr_lock_type lock_type); - - void initBridge(THD* thd = NULL) - { - if (thd == NULL) thd = ha_thd(); - DBUG_PRINT("ha_ibmdb2i::initBridge",("Initing bridge. Conn ID=%d", thd->thread_id)); - cachedBridge = db2i_ileBridge::getBridgeForThread(thd); - } - - db2i_ileBridge* bridge() {DBUG_ASSERT(cachedBridge); return cachedBridge;} - - static uint8 autoCommitIsOn(THD* thd) - { return (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) ? QMY_NO : QMY_YES); } - - uint8 getCommitLevel(); - uint8 getCommitLevel(THD* thd); - - static int doSavepointSet(THD* thd, char* name) - { - return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_SET_SAVEPOINT, - name); - } - - static int doSavepointRollback(THD* thd, char* name) - { - return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_ROLLBACK_SAVEPOINT, - name); - } - - static int doSavepointRelease(THD* thd, char* name) - { - return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_RELEASE_SAVEPOINT, - name); - } - - // We can't guarantee that the rows we know about when this is called - // will be the same number of rows that read returns (since DB2 activity - // may insert additional rows). Therefore, we do as the Federated SE and - // return the max possible. - ha_rows estimate_rows_upper_bound() - { - return HA_POS_ERROR; - } - - -private: - - enum enum_TimeFormat - { - TIME_OF_DAY, - DURATION - }; - - enum enum_BlobMapping - { - AS_BLOB, - AS_VARCHAR - }; - - enum enum_ZeroDate - { - NO_SUBSTITUTE, - SUBSTITUTE_0001_01_01 - }; - - enum enum_YearFormat - { - CHAR4, - SMALLINT - }; - - enum_ZeroDate cachedZeroDateOption; - - IBMDB2I_SHARE *get_share(const char *table_name, TABLE *table); - int free_share(IBMDB2I_SHARE *share); - int32 mungeDB2row(uchar* record, const char* dataPtr, const char* nullMapPtr, bool skipLOBs); - int prepareRowForWrite(char* data, char* nulls, bool honorIdentCols); - int prepareReadBufferForLobs(); - int32 prepareWriteBufferForLobs(); - uint32 adjustLobBuffersForRead(); - bool lobFieldsRequested(); - int convertFieldChars(enum_conversionDirection direction, - uint16 fieldID, - const char* input, - char* output, - size_t ilen, - size_t olen, - size_t* outDataLen, - bool tacitErrors=FALSE, - size_t* substChars=NULL); - - /** - Fast integer log2 function - */ - uint64 log_2(uint64 val) - { - uint64 exp = 0; - while( (val >> exp) != 0) - { - exp++; - } - DBUG_ASSERT(exp-1 == (uint64)log2(val)); - return exp-1; - } - - void bumpInUseCounter(uint16 amount) - { - activeReferences += amount; - DBUG_PRINT("ha_ibmdb2i::bumpInUseCounter", ("activeReferences = %d", activeReferences)); - if (activeReferences) - curConnection = (uint32)(ha_thd()->thread_id); - else - curConnection = 0; - } - - - int useDataFile() - { - DBUG_ENTER("ha_ibmdb2i::useDataFile"); - - int rc = 0; - if (!dataHandle) - rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection); - else if (activeHandle == dataHandle) - DBUG_RETURN(0); - - DBUG_ASSERT(activeHandle == 0); - - if (likely(rc == 0)) - { - activeHandle = dataHandle; - bumpInUseCounter(1); - } - - DBUG_RETURN(rc); - } - - void releaseAnyLockedRows() - { - if (releaseRowNeeded) - { - DBUG_PRINT("ha_ibmdb2i::releaseAnyLockedRows", ("Releasing rows")); - db2i_ileBridge::getBridgeForThread()->rrlslck(activeHandle, accessIntent); - releaseRowNeeded = FALSE; - } - } - - - void releaseDataFile() - { - DBUG_ENTER("ha_ibmdb2i::releaseDataFile"); - releaseAnyLockedRows(); - bumpInUseCounter(-1); - DBUG_ASSERT((volatile int)activeReferences >= 0); - activeHandle = 0; - DBUG_VOID_RETURN; - } - - int useIndexFile(int idx); - - void releaseIndexFile(int idx) - { - DBUG_ENTER("ha_ibmdb2i::releaseIndexFile"); - releaseAnyLockedRows(); - bumpInUseCounter(-1); - DBUG_ASSERT((volatile int)activeReferences >= 0); - activeHandle = 0; - DBUG_VOID_RETURN; - } - - FILE_HANDLE allocateFileHandle(char* database, char* table, int* activityReference, bool hasBlobs); - - int updateBuffers(const db2i_file::RowFormat* format, uint rowsToRead, uint rowsToWrite); - - int flushWrite(FILE_HANDLE fileHandle, uchar* buf = NULL); - - int alterStartWith(); - - int buildDB2ConstraintString(LEX* lex, - String& appendHere, - const char* database, - Field** fields, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary); - - void releaseWriteBuffer(); - - void setIndexReadEstimate(uint index, ha_rows rows) - { - if (!indexReadSizeEstimates) - { - indexReadSizeEstimates = (ha_rows*)my_malloc(sizeof(ha_rows) * table->s->keys, MYF(MY_WME | MY_ZEROFILL)); - } - indexReadSizeEstimates[index] = rows; - } - - ha_rows getIndexReadEstimate(uint index) - { - if (indexReadSizeEstimates) - return max(indexReadSizeEstimates[index], 1); - - return 10000; // Assume index scan if no estimate exists. - } - - - void quiesceAllFileHandles() - { - db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(); - if (dataHandle) - { - bridge->quiesceFileInstance(dataHandle); - } - - for (int idx = 0; idx < table_share->keys; ++idx) - { - if (indexHandles[idx] != 0) - { - bridge->quiesceFileInstance(indexHandles[idx]); - } - } - } - - int32 buildCreateIndexStatement(SqlStatementStream& sqlStream, - KEY& key, - bool isPrimary, - const char* db2LibName, - const char* db2FileName); - - int32 buildIndexFieldList(String& appendHere, - const KEY& key, - bool isPrimary, - char* fileSortSequenceType, - char* fileSortSequence, - char* fileSortSequenceLibrary); - - // Specify NULL for data when using the data pointed to by field - int32 convertMySQLtoDB2(Field* field, const DB2Field& db2Field, char* db2Buf, const uchar* data = NULL); - - int32 convertDB2toMySQL(const DB2Field& db2Field, Field* field, const char* buf); - int getFieldTypeMapping(Field* field, - String& mapping, - enum_TimeFormat timeFormate, - enum_BlobMapping blobMapping, - enum_ZeroDate zeroDateHandling, - bool propagateDefaults, - enum_YearFormat yearFormat); - - int getKeyFromName(const char* name, size_t len); - - void releaseActiveHandle() - { - if (activeHandle == dataHandle) - releaseDataFile(); - else - releaseIndexFile(active_index); - } - - - int32 finishBulkInsert(); - - void doInitialRead(char orientation, - uint32 rowsToBuffer, - ILEMemHandle key = 0, - int keyLength = 0, - int keyParts = 0); - - - int32 readFromBuffer(uchar* destination, char orientation) - { - char* row; - int32 rc = 0; - row = activeReadBuf->readNextRow(orientation, currentRRN); - - if (unlikely(!row)) - { - rc = activeReadBuf->lastrc(); - if (rc == QMY_ERR_LOB_SPACE_TOO_SMALL) - { - rc = handleLOBReadOverflow(); - if (rc == 0) - { - DBUG_ASSERT(activeReadBuf->rowCount() == 1); - row = activeReadBuf->readNextRow(orientation, currentRRN); - - if (unlikely(!row)) - rc = activeReadBuf->lastrc(); - } - } - } - - if (likely(rc == 0)) - { - rrnAssocHandle = activeHandle; - rc = mungeDB2row(destination, row, row+activeReadBuf->getRowNullOffset(), false); - } - return rc; - } - - int32 handleLOBReadOverflow(); - - char* getCharacterConversionBuffer(int fieldId, int length) - { - if (unlikely(!alloc_root_inited(&conversionBufferMemroot))) - init_alloc_root(&conversionBufferMemroot, 8192, 0); - - return (char*)alloc_root(&conversionBufferMemroot, length);; - } - - void resetCharacterConversionBuffers() - { - if (alloc_root_inited(&conversionBufferMemroot)) - { - free_root(&conversionBufferMemroot, MYF(MY_MARK_BLOCKS_FREE)); - } - } - - void tweakReadSet() - { - THD* thd = ha_thd(); - int command = thd_sql_command(thd); - if ((command == SQLCOM_UPDATE || - command == SQLCOM_UPDATE_MULTI) || - ((command == SQLCOM_DELETE || - command == SQLCOM_DELETE_MULTI) && - thd->options & OPTION_BIN_LOG)) - readAllColumns = TRUE; - else - readAllColumns = FALSE; - } - - /** - - */ - int useFileByHandle(char intent, - FILE_HANDLE handle) - { - DBUG_ENTER("ha_ibmdb2i::useFileByHandle"); - - const db2i_file* file; - if (handle == dataHandle) - file = db2Table->dataFile(); - else - { - for (uint i = 0; i < table_share->keys; ++i) - { - if (indexHandles[i] == handle) - { - file = db2Table->indexFile(i); - active_index = i; - } - } - } - - int rc = file->obtainRowFormat(handle, intent, getCommitLevel(), &activeFormat); - if (likely(rc == 0)) - { - activeHandle = handle; - bumpInUseCounter(1); - } - - DBUG_RETURN(rc); - } - - const db2i_file* getFileForActiveHandle() const - { - if (activeHandle == dataHandle) - return db2Table->dataFile(); - else - for (uint i = 0; i < table_share->keys; ++i) - if (indexHandles[i] == activeHandle) - return db2Table->indexFile(i); - DBUG_ASSERT(0); - return NULL; - } - - int prepReadBuffer(ha_rows rowsToRead, const db2i_file* file, char intent); - int prepWriteBuffer(ha_rows rowsToWrite, const db2i_file* file); - - void invalidateCachedStats() - { - share->cachedStats.invalidate(rowCount | deletedRowCount | objLength | - meanRowLen | ioCount); - } - - void warnIfInvalidData() - { - if (unlikely(invalidDataFound)) - { - warning(ha_thd(), DB2I_ERR_INVALID_DATA, table->alias); - } - } - - /** - Calculate the maximum value that a particular field can hold. - - This is used to anticipate overflows in the auto_increment processing. - - @param field The Field to be analyzed - - @return The maximum value - */ - static uint64 maxValueForField(const Field* field) - { - uint64 maxValue=0; - switch (field->type()) - { - case MYSQL_TYPE_TINY: - if (((const Field_num*)field)->unsigned_flag) - maxValue = (1 << 8) - 1; - else - maxValue = (1 << 7) - 1; - break; - case MYSQL_TYPE_SHORT: - if (((const Field_num*)field)->unsigned_flag) - maxValue = (1 << 16) - 1; - else - maxValue = (1 << 15) - 1; - break; - case MYSQL_TYPE_INT24: - if (((const Field_num*)field)->unsigned_flag) - maxValue = (1 << 24) - 1; - else - maxValue = (1 << 23) - 1; - break; - case MYSQL_TYPE_LONG: - if (((const Field_num*)field)->unsigned_flag) - maxValue = (1LL << 32) - 1; - else - maxValue = (1 << 31) - 1; - break; - case MYSQL_TYPE_LONGLONG: - if (((const Field_num*)field)->unsigned_flag) - maxValue = ~(0LL); - else - maxValue = 1 << 63 - 1; - break; - } - - return maxValue; - } - - void cleanupBuffers() - { - if (blobReadBuffers) - { - delete blobReadBuffers; - blobReadBuffers = NULL; - } - if (blobWriteBuffers) - { - delete[] blobWriteBuffers; - blobWriteBuffers = NULL; - } - if (alloc_root_inited(&conversionBufferMemroot)) - { - free_root(&conversionBufferMemroot, MYF(0)); - } - } - - -/** - Generate a valid RCDFMT name based on the name of the table. - - The RCDFMT name is devised by munging the name of the table, - uppercasing all ascii alpha-numeric characters and replacing all other - characters with underscores until up to ten characters have been generated. - - @param tableName The name of the table, as given on the MySQL - CREATE TABLE statement - @param[out] query The string to receive the generated RCDFMT name -*/ - static void generateAndAppendRCDFMT(const char* tableName, String& query) - { - char rcdfmt[11]; - - // The RCDFMT name must begin with an alpha character. - // We enforce this by skipping to the first alpha character in the table - // name. If no alpha character exists, we use 'X' for the RCDFMT name; - - while (*tableName && - (!my_isascii(*tableName) || - !my_isalpha(system_charset_info, *tableName))) - { - tableName += my_mbcharlen(system_charset_info, *tableName); - } - - if (unlikely(!(*tableName))) - { - rcdfmt[0]= 'X'; - rcdfmt[1]= 0; - } - else - { - int r= 0; - while ((r < sizeof(rcdfmt)-1) && *tableName) - { - if (my_isascii(*tableName) && - my_isalnum(system_charset_info, *tableName)) - rcdfmt[r] = my_toupper(system_charset_info, *tableName); - else - rcdfmt[r] = '_'; - - ++r; - tableName += my_mbcharlen(system_charset_info, *tableName); - } - rcdfmt[r]= 0; - } - query.append(STRING_WITH_LEN(" RCDFMT ")); - query.append(rcdfmt); - } - - int32 generateShadowIndex(SqlStatementStream& stream, - const KEY& key, - const char* libName, - const char* fileName, - const String& fieldDefinition); -}; diff --git a/storage/ibmdb2i/plug.in b/storage/ibmdb2i/plug.in deleted file mode 100644 index 0913d72aabf..00000000000 --- a/storage/ibmdb2i/plug.in +++ /dev/null @@ -1,12 +0,0 @@ -MYSQL_STORAGE_ENGINE([ibmdb2i], [], [IBM DB2 for i Storage Engine], - [IBM DB2 for i Storage Engine], [max,max-no-ndb]) -MYSQL_PLUGIN_DYNAMIC([ibmdb2i], [ha_ibmdb2i.la]) - -AC_CHECK_HEADER([qlgusr.h], - # qlgusr.h is just one of the headers from the i5/OS PASE environment; the - # EBCDIC headers are in /QIBM/include, and have to be converted to ASCII - # before cpp gets to them - [:], - # Missing PASE environment, can't build this engine - [mysql_plugin_ibmdb2i=no - with_plugin_ibmdb2i=no]) diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index d34f6fbe722..d55f0fc2dc8 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -118,7 +118,7 @@ table_events_waits_current::m_field_def= PFS_engine_table_share table_events_waits_current::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_CURRENT") }, + { C_STRING_WITH_LEN("events_waits_current") }, &pfs_truncatable_acl, &table_events_waits_current::create, NULL, /* write_row */ @@ -135,7 +135,7 @@ THR_LOCK table_events_waits_history::m_table_lock; PFS_engine_table_share table_events_waits_history::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY") }, + { C_STRING_WITH_LEN("events_waits_history") }, &pfs_truncatable_acl, &table_events_waits_history::create, NULL, /* write_row */ @@ -152,7 +152,7 @@ THR_LOCK table_events_waits_history_long::m_table_lock; PFS_engine_table_share table_events_waits_history_long::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY_LONG") }, + { C_STRING_WITH_LEN("events_waits_history_long") }, &pfs_truncatable_acl, &table_events_waits_history_long::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc index 435a3500f06..05f280f8521 100644 --- a/storage/perfschema/table_events_waits_summary.cc +++ b/storage/perfschema/table_events_waits_summary.cc @@ -74,7 +74,7 @@ table_events_waits_summary_by_thread_by_event_name::m_field_def= PFS_engine_table_share table_events_waits_summary_by_thread_by_event_name::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME") }, + { C_STRING_WITH_LEN("events_waits_summary_by_thread_by_event_name") }, &pfs_truncatable_acl, &table_events_waits_summary_by_thread_by_event_name::create, NULL, /* write_row */ @@ -386,7 +386,7 @@ table_events_waits_summary_by_instance::m_field_def= PFS_engine_table_share table_events_waits_summary_by_instance::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_INSTANCE") }, + { C_STRING_WITH_LEN("events_waits_summary_by_instance") }, &pfs_truncatable_acl, &table_events_waits_summary_by_instance::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc index 35e744ed96b..c983a967c4e 100644 --- a/storage/perfschema/table_ews_global_by_event_name.cc +++ b/storage/perfschema/table_ews_global_by_event_name.cc @@ -69,7 +69,7 @@ table_ews_global_by_event_name::m_field_def= PFS_engine_table_share table_ews_global_by_event_name::m_share= { - { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME") }, + { C_STRING_WITH_LEN("events_waits_summary_global_by_event_name") }, &pfs_truncatable_acl, &table_ews_global_by_event_name::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc index f1676421616..9ae732a0e1c 100644 --- a/storage/perfschema/table_file_instances.cc +++ b/storage/perfschema/table_file_instances.cc @@ -54,7 +54,7 @@ table_file_instances::m_field_def= PFS_engine_table_share table_file_instances::m_share= { - { C_STRING_WITH_LEN("FILE_INSTANCES") }, + { C_STRING_WITH_LEN("file_instances") }, &pfs_readonly_acl, &table_file_instances::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc index f8b9e66118b..a954db7ef4e 100644 --- a/storage/perfschema/table_file_summary.cc +++ b/storage/perfschema/table_file_summary.cc @@ -64,7 +64,7 @@ table_file_summary_by_event_name::m_field_def= PFS_engine_table_share table_file_summary_by_event_name::m_share= { - { C_STRING_WITH_LEN("FILE_SUMMARY_BY_EVENT_NAME") }, + { C_STRING_WITH_LEN("file_summary_by_event_name") }, &pfs_truncatable_acl, &table_file_summary_by_event_name::create, NULL, /* write_row */ @@ -227,7 +227,7 @@ table_file_summary_by_instance::m_field_def= PFS_engine_table_share table_file_summary_by_instance::m_share= { - { C_STRING_WITH_LEN("FILE_SUMMARY_BY_INSTANCE") }, + { C_STRING_WITH_LEN("file_summary_by_instance") }, &pfs_truncatable_acl, &table_file_summary_by_instance::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc index f400e37366c..acd379bc57b 100644 --- a/storage/perfschema/table_performance_timers.cc +++ b/storage/perfschema/table_performance_timers.cc @@ -58,7 +58,7 @@ table_performance_timers::m_field_def= PFS_engine_table_share table_performance_timers::m_share= { - { C_STRING_WITH_LEN("PERFORMANCE_TIMERS") }, + { C_STRING_WITH_LEN("performance_timers") }, &pfs_readonly_acl, &table_performance_timers::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc index 3cc6a1441c1..5b39fd89a03 100644 --- a/storage/perfschema/table_setup_consumers.cc +++ b/storage/perfschema/table_setup_consumers.cc @@ -84,7 +84,7 @@ table_setup_consumers::m_field_def= PFS_engine_table_share table_setup_consumers::m_share= { - { C_STRING_WITH_LEN("SETUP_CONSUMERS") }, + { C_STRING_WITH_LEN("setup_consumers") }, &pfs_updatable_acl, &table_setup_consumers::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc index 259ccee3c84..310f859248b 100644 --- a/storage/perfschema/table_setup_instruments.cc +++ b/storage/perfschema/table_setup_instruments.cc @@ -54,7 +54,7 @@ table_setup_instruments::m_field_def= PFS_engine_table_share table_setup_instruments::m_share= { - { C_STRING_WITH_LEN("SETUP_INSTRUMENTS") }, + { C_STRING_WITH_LEN("setup_instruments") }, &pfs_updatable_acl, &table_setup_instruments::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc index 8ca218913bb..24ec18dafb1 100644 --- a/storage/perfschema/table_setup_timers.cc +++ b/storage/perfschema/table_setup_timers.cc @@ -57,7 +57,7 @@ table_setup_timers::m_field_def= PFS_engine_table_share table_setup_timers::m_share= { - { C_STRING_WITH_LEN("SETUP_TIMERS") }, + { C_STRING_WITH_LEN("setup_timers") }, &pfs_updatable_acl, &table_setup_timers::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc index 82587ce493d..f2bd9fa1a28 100644 --- a/storage/perfschema/table_sync_instances.cc +++ b/storage/perfschema/table_sync_instances.cc @@ -55,7 +55,7 @@ table_mutex_instances::m_field_def= PFS_engine_table_share table_mutex_instances::m_share= { - { C_STRING_WITH_LEN("MUTEX_INSTANCES") }, + { C_STRING_WITH_LEN("mutex_instances") }, &pfs_readonly_acl, &table_mutex_instances::create, NULL, /* write_row */ @@ -223,7 +223,7 @@ table_rwlock_instances::m_field_def= PFS_engine_table_share table_rwlock_instances::m_share= { - { C_STRING_WITH_LEN("RWLOCK_INSTANCES") }, + { C_STRING_WITH_LEN("rwlock_instances") }, &pfs_readonly_acl, &table_rwlock_instances::create, NULL, /* write_row */ @@ -388,7 +388,7 @@ table_cond_instances::m_field_def= PFS_engine_table_share table_cond_instances::m_share= { - { C_STRING_WITH_LEN("COND_INSTANCES") }, + { C_STRING_WITH_LEN("cond_instances") }, &pfs_readonly_acl, &table_cond_instances::create, NULL, /* write_row */ diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc index d9aa600a21e..541ba860386 100644 --- a/storage/perfschema/table_threads.cc +++ b/storage/perfschema/table_threads.cc @@ -52,7 +52,7 @@ table_threads::m_field_def= PFS_engine_table_share table_threads::m_share= { - { C_STRING_WITH_LEN("THREADS") }, + { C_STRING_WITH_LEN("threads") }, &pfs_readonly_acl, &table_threads::create, NULL, /* write_row */ diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index beacf4f02c4..3cf61b213eb 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -9461,7 +9461,7 @@ CHARSET_INFO my_charset_utf8_sinhala_uca_ci= 8, /* strxfrm_multiply */ 1, /* caseup_multiply */ 1, /* casedn_multiply */ - 3, /* mbminlen */ + 1, /* mbminlen */ 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ diff --git a/win/README b/win/README index 9c8ca9a87bc..e5363cf8c8d 100644 --- a/win/README +++ b/win/README @@ -1,114 +1,8 @@ Windows building readme ====================================== -----------------IMPORTANT---------------------------- -This readme outlines the instructions for building -MySQL for Windows staring from version 5.1. -This readme does not apply to MySQL versions 5.0 -or ealier. ------------------------------------------------------ - The Windows build system uses a tool named CMake to generate build files for a variety of project systems. This tool is combined with a set of jscript files to enable building of MySQL for Windows directly out of a bzr clone. -For relevant information, please refer to http://forge.mysql.com/wiki/CMake -The steps required are below. - -Step 1: -------- - -Install a Windows C++ compiler. If you don't have one, you can use -the free compiler "Visual C++ 2005 express edition", which from Cmake -point of view is same as Visual studio 8: -http://msdn.microsoft.com/vstudio/express/ - -Step 2 ------- -Download and install CMake. It can be downloaded from http://www.cmake.org. -Once it is installed, modify your path to make sure you can execute -the cmake binary. - -Step 3 ------- -Download and install bison for Windows. It can be downloaded from -http://gnuwin32.sourceforge.net/packages/bison.htm. Please download using -the link named "Complete package, excluding sources". This includes an -installer that will install bison. After the installer finishes, modify -your path so that you can execute bison. - -(As an alternative you can take the sql_yacc.yy and sql_yacc.h files from a -matching mysql tar distribution and drop them into the sql directory just -before you start the build) - -Step 4 ------- -One of the nice CMake features is "out-of-source" build support, which -means not building in the source directory, but in dedicated build -directory. This keeps the source directory clean and allows for more than -single build tree for the same source tree (e.g debug and release, 32 and -64 bit etc). We'll create subdirectory "bld" in the source directory for -this purpose. Clone your bzr tree to any location you like. - -Step 5 ------- -From the root of your installation directory use cmake . -L to see the -various configuration parameters. - -So the command line could look like: - -cmake .. -G "target" -DWITH_INNOBASE_STORAGE_ENGINE=1 - -The recommended way of configuring would be to use -DBUILD_CONFIG=mysql_release -to build binaries exactly the same as the official MySQL releases. - -Step 6 ------- - -From the root of your installation directory/bzr clone, you can -use cmake to compile the sources. Use cmake --help when necessary. -Before you start building the sources, please remove the old build area -created from an earlier run and start afresh. - -C:\> del bld -C:\> md bld -C:\> cd bld -C:\> cmake .. -G "target name" -DBUILD_CONFIG=mysql_release - - -For Example: -To generate the Win64 project files using Visual Studio 9, you would run -cmake .. -G "Visual Studio 9 2008 Win64" - -Other target names supported using CMake 2.6 patch 4 are: - - Visual Studio 7 "Visual Studio 7 .NET 2003" - Visual Studio 8 "Visual Studio 8 2005" - Visual Studio 8 (64 bit) "Visual Studio 8 2005 Win64" - Visual Studio 9 "Visual Studio 9 2008" - Visual Studio 9 (64 bit) "Visual Studio 9 2008 Win64" - -For generating project files using Visual Studio 10, you need CMake 2.8 -or higher and corresponding target names are - Visual Studio 10 "Visual Studio 10" - Visual Studio 10 (64 bit) "Visual Studio 10 Win64" - -Step 7 ------- -From the root of your bzr clone, start your build. - -For Visual Studio, execute mysql.sln. This will start the IDE -and you can click the build solution menu option. - -Alternatively, you could start the build from command line as follows - -devenv mysql.sln /build relwithdebinfo - -Current issues --------------- -1. After changing configuration (eg. adding or removing a storage engine), it -may be necessary to clean the build tree to remove any stale objects. - -2. To use Visual C++ Express Edition you also need to install the Platform SDK. -Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ -At step 5 you only need to add the libraries advapi32.lib and user32.lib to -the file "corewin_express.vsprops" in order to avoid link errors. +For relevant information and/or for building binaries from source distribution, +please refer to http://forge.mysql.com/wiki/CMake |