From b47bd3f8bf5dba600c5b7dc46fb77c0a8a73508c Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 14 Jun 2024 12:46:56 +0300 Subject: [PATCH 01/85] MDEV-33875: ORDER BY DESC causes ROWID Filter slowdown Rowid Filter cannot be used with reverse-ordered scans, for the same reason as IndexConditionPushdown cannot be. test_if_skip_sort_order() already has logic to disable ICP when setting up a reverse-ordered scan. Added logic to also disable Rowid Filter in this case, factored out the code into prepare_for_reverse_ordered_access(), and added a comment describing the cause of this limitation. --- mysql-test/main/rowid_filter_innodb.result | 65 ++++++++++++ mysql-test/main/rowid_filter_innodb.test | 44 ++++++++ sql/sql_select.cc | 115 ++++++++++++++++----- 3 files changed, 196 insertions(+), 28 deletions(-) diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 42c5f163e2c..c442ad43056 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -3947,3 +3947,68 @@ count(*) SET optimizer_switch=@save_optimizer_switch; DROP TABLE t0, t1; # End of 10.4 tests +# +# MDEV-33875: ORDER BY DESC causes ROWID Filter slowdown +# +create table t1 ( +pk int primary key auto_increment, +a int, +b int, +f1 varchar(200), +f2 varchar(200), +f3 varchar(200), +f4 varchar(200), +f5 varchar(200), +key(a, pk), +key(b) +) engine=innodb; +insert into t1 (a,b,f1, f2, f3, f4) select +seq, seq, +repeat('1-', 100), +repeat('2-', 100), +repeat('3-', 100), +repeat('4-', 100) +from +seq_1_to_5000; +insert into t1 (a,b,f1, f2, f3, f4)select +30100, 30100, +'abcd','abcd','abcd','abcd' +from +seq_1_to_250; +insert into t1 (a,b,f1) values ( 110, 100, 12345); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# The following must NOT use Rowid Filter: +analyze format=json select * from t1 +where +a =30100 and b in (30100,30101,30102) +order by +pk desc; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["a", "b"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["const"], + "r_loops": 1, + "rows": 250, + "r_rows": 250, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 4.799086094, + "r_filtered": 100, + "attached_condition": "t1.a <=> 30100 and t1.b in (30100,30101,30102)" + } + } +} +drop table t1; diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index 65788ba19fc..e27c6366cf4 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -751,3 +751,47 @@ SET optimizer_switch=@save_optimizer_switch; DROP TABLE t0, t1; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33875: ORDER BY DESC causes ROWID Filter slowdown +--echo # +create table t1 ( + pk int primary key auto_increment, + a int, + b int, + f1 varchar(200), + f2 varchar(200), + f3 varchar(200), + f4 varchar(200), + f5 varchar(200), + key(a, pk), + key(b) +) engine=innodb; + +insert into t1 (a,b,f1, f2, f3, f4) select + seq, seq, + repeat('1-', 100), + repeat('2-', 100), + repeat('3-', 100), + repeat('4-', 100) +from + seq_1_to_5000; + +insert into t1 (a,b,f1, f2, f3, f4)select + 30100, 30100, + 'abcd','abcd','abcd','abcd' +from + seq_1_to_250; +insert into t1 (a,b,f1) values ( 110, 100, 12345); +analyze table t1; + +--echo # The following must NOT use Rowid Filter: +--source include/analyze-format.inc +analyze format=json select * from t1 +where + a =30100 and b in (30100,30101,30102) +order by + pk desc; + +drop table t1; + diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b99ea744ae8..06de7afa4f3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -23957,6 +23957,90 @@ void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, } +/* + @brief + This is called when switching table access to produce records + in reverse order. + + @detail + - Disable "Range checked for each record" (Is this strictly necessary + here?) + - Disable Index Condition Pushdown and Rowid Filtering. + + IndexConditionPushdownAndReverseScans, RowidFilteringAndReverseScans: + Suppose we're computing + + select * from t1 + where + key1 between 10 and 20 and extra_condition + order by key1 desc + + here the range access uses a reverse-ordered scan on (1 <= key1 <= 10) and + extra_condition is checked by either ICP or Rowid Filtering. + + Also suppose that extra_condition happens to be false for rows of t1 that + do not satisfy the "10 <= key1 <= 20" condition. + + For forward ordered range scan, the SQL layer will make these calls: + + h->read_range_first(RANGE(10 <= key1 <= 20)); + while (h->read_range_next()) { ... } + + The storage engine sees the end endpoint of "key1<=20" and can stop scanning + as soon as it encounters a row with key1>20. + + For backward-ordered range scan, the SQL layer will make these calls: + + h->index_read_map(key1=20, HA_READ_PREFIX_LAST_OR_PREV); + while (h->index_prev()) { + if (cmp_key(h->record, "key1=10" )<0) + break; // end of range + ... + } + + Note that the check whether we've walked beyond the key=10 endpoint is + made at the SQL layer. The storage engine has no information about the left + endpoint of the interval we're scanning. If all rows before that endpoint + do not satisfy ICP condition or do not pass the Rowid Filter, the storage + engine will enumerate the records until the table start. + + In MySQL, the API is extended with set_end_range() call so that the storage + engine "knows" when to stop scanning. +*/ + +static void prepare_for_reverse_ordered_access(JOIN_TAB *tab) +{ + /* Cancel "Range checked for each record" */ + if (tab->use_quick == 2) + { + tab->use_quick= 1; + tab->read_first_record= join_init_read_record; + } + /* + Cancel Pushed Index Condition, as it doesn't work for reverse scans. + */ + if (tab->select && tab->select->pre_idx_push_select_cond) + { + tab->set_cond(tab->select->pre_idx_push_select_cond); + tab->table->file->cancel_pushed_idx_cond(); + } + /* + The same with Rowid Filter: it doesn't work with reverse scans so cancel + it, too. + */ + { + /* + Rowid Filter is initialized at a later stage. It is not pushed to + the storage engine yet: + */ + DBUG_ASSERT(!tab->table->file->pushed_rowid_filter); + tab->range_rowid_filter_info= NULL; + delete tab->rowid_filter; + tab->rowid_filter= NULL; + } +} + + /** Test if we can skip the ORDER BY by using an index. @@ -24409,23 +24493,11 @@ check_reverse_order: tab->limit= 0; goto use_filesort; // Reverse sort failed -> filesort } - /* - Cancel Pushed Index Condition, as it doesn't work for reverse scans. - */ - if (tab->select && tab->select->pre_idx_push_select_cond) - { - tab->set_cond(tab->select->pre_idx_push_select_cond); - tab->table->file->cancel_pushed_idx_cond(); - } + prepare_for_reverse_ordered_access(tab); + if (select->quick == save_quick) save_quick= 0; // make_reverse() consumed it select->set_quick(tmp); - /* Cancel "Range checked for each record" */ - if (tab->use_quick == 2) - { - tab->use_quick= 1; - tab->read_first_record= join_init_read_record; - } } else if (tab->type != JT_NEXT && tab->type != JT_REF_OR_NULL && tab->ref.key >= 0 && tab->ref.key_parts <= used_key_parts) @@ -24438,20 +24510,7 @@ check_reverse_order: */ tab->read_first_record= join_read_last_key; tab->read_record.read_record_func= join_read_prev_same; - /* Cancel "Range checked for each record" */ - if (tab->use_quick == 2) - { - tab->use_quick= 1; - tab->read_first_record= join_init_read_record; - } - /* - Cancel Pushed Index Condition, as it doesn't work for reverse scans. - */ - if (tab->select && tab->select->pre_idx_push_select_cond) - { - tab->set_cond(tab->select->pre_idx_push_select_cond); - tab->table->file->cancel_pushed_idx_cond(); - } + prepare_for_reverse_ordered_access(tab); } } else if (select && select->quick) From ef9e3e73ed52e55842e6ba40dfa94a78fb06cbee Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 11 Jun 2024 16:20:00 +0300 Subject: [PATCH 02/85] MDEV-30651: Assertion `sel->quick' in make_range_rowid_filters (Variant for 10.6: return error code from SQL_SELECT::test_quick_select) The optimizer deals with Rowid Filters this way: 1. First, range optimizer is invoked. It saves information about all potential range accesses. 2. A query plan is chosen. Suppose, it uses a Rowid Filter on index $IDX. 3. JOIN::make_range_rowid_filters() calls the range optimizer again to create a quick select on index $IDX which will be used to populate the rowid filter. The problem: KILL command catches the query in step #3. Quick Select is not created which causes a crash. Fixed by checking if query was killed. --- .../include/rowid_filter_debug_kill.inc | 28 +++++++++++++++++++ .../main/rowid_filter_innodb_debug.result | 18 ++++++++++++ .../main/rowid_filter_myisam_debug.result | 18 ++++++++++++ sql/opt_range.cc | 9 ++++++ sql/sql_select.cc | 7 +++-- 5 files changed, 77 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/rowid_filter_debug_kill.inc b/mysql-test/include/rowid_filter_debug_kill.inc index 513efed8a4c..45b44b246d2 100644 --- a/mysql-test/include/rowid_filter_debug_kill.inc +++ b/mysql-test/include/rowid_filter_debug_kill.inc @@ -55,5 +55,33 @@ disconnect con1; reap; set debug_sync='RESET'; +--echo # +--echo # MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +--echo # Assertion `sel->quick' failed in make_range_rowid_filters +--echo # + +--echo # Reusing table t2 and t3 from previous test +let $target_id= `select connection_id()`; + +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +send +explain +select * from t2, t3 +where + t3.key1=t2.a and t3.key2 in (2,3); + +connect (con1, localhost, root,,); +set debug_sync='now WAIT_FOR ready1'; +evalp kill query $target_id; +set debug_sync='now SIGNAL go1'; + +connection default; +disconnect con1; + +--error ER_QUERY_INTERRUPTED +reap; +set debug_sync='RESET'; + + drop table t2,t3; --source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result index f82b29aa1e6..4fdf53cb2b0 100644 --- a/mysql-test/main/rowid_filter_innodb_debug.result +++ b/mysql-test/main/rowid_filter_innodb_debug.result @@ -46,5 +46,23 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; +# +# MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +# Assertion `sel->quick' failed in make_range_rowid_filters +# +# Reusing table t2 and t3 from previous test +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +explain +select * from t2, t3 +where +t3.key1=t2.a and t3.key2 in (2,3); +connect con1, localhost, root,,; +set debug_sync='now WAIT_FOR ready1'; +kill query $target_id; +set debug_sync='now SIGNAL go1'; +connection default; +disconnect con1; +ERROR 70100: Query execution was interrupted +set debug_sync='RESET'; drop table t2,t3; set default_storage_engine=default; diff --git a/mysql-test/main/rowid_filter_myisam_debug.result b/mysql-test/main/rowid_filter_myisam_debug.result index 75a8fad6947..175e054af2a 100644 --- a/mysql-test/main/rowid_filter_myisam_debug.result +++ b/mysql-test/main/rowid_filter_myisam_debug.result @@ -45,4 +45,22 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; +# +# MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +# Assertion `sel->quick' failed in make_range_rowid_filters +# +# Reusing table t2 and t3 from previous test +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +explain +select * from t2, t3 +where +t3.key1=t2.a and t3.key2 in (2,3); +connect con1, localhost, root,,; +set debug_sync='now WAIT_FOR ready1'; +kill query $target_id; +set debug_sync='now SIGNAL go1'; +connection default; +disconnect con1; +ERROR 70100: Query execution was interrupted +set debug_sync='RESET'; drop table t2,t3; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 9c47639596d..ea0a0d70807 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2720,7 +2720,10 @@ SQL_SELECT::test_quick_select(THD *thd, only_single_index_range_scan= 1; if (head->force_index || force_quick_range) + { + DEBUG_SYNC(thd, "in_forced_range_optimize"); scan_time= read_time= DBL_MAX; + } else { scan_time= rows2double(records) / TIME_FOR_COMPARE; @@ -3117,6 +3120,12 @@ SQL_SELECT::test_quick_select(THD *thd, free_root(&alloc,MYF(0)); // Return memory & allocator thd->mem_root= param.old_root; thd->no_errors=0; + if (thd->killed || thd->is_error()) + { + delete quick; + quick= NULL; + returnval= ERROR; + } } DBUG_EXECUTE("info", print_quick(quick, &needed_reg);); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9b103a7f2ea..e195ab31564 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1987,6 +1987,7 @@ bool JOIN::make_range_rowid_filters() tab->table->force_index= force_index_save; if (rc == SQL_SELECT::ERROR || thd->is_error()) { + delete sel; DBUG_RETURN(true); /* Fatal error */ } /* @@ -2012,8 +2013,6 @@ bool JOIN::make_range_rowid_filters() continue; } no_filter: - if (sel->quick) - delete sel->quick; delete sel; } @@ -2031,7 +2030,9 @@ bool JOIN::make_range_rowid_filters() rowid container employed by the filter. On success it lets the table engine know that what rowid filter will be used when accessing the table rows. - @retval false always + @retval + false OK + true Error, query should abort */ bool From a2066b2400f8f1bc87ea235cfb8e740b82a0af28 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 11 Jun 2024 16:16:11 +0300 Subject: [PATCH 03/85] MDEV-30651: Assertion `sel->quick' in make_range_rowid_filters The optimizer deals with Rowid Filters this way: 1. First, range optimizer is invoked. It saves information about all potential range accesses. 2. A query plan is chosen. Suppose, it uses a Rowid Filter on index $IDX. 3. JOIN::make_range_rowid_filters() calls the range optimizer again to create a quick select on index $IDX which will be used to populate the rowid filter. The problem: KILL command catches the query in step #3. Quick Select is not created which causes a crash. Fixed by checking if query was killed. Note: the problem also affects 10.6, even if error handling for SQL_SELECT::test_quick_select is different there. --- .../include/rowid_filter_debug_kill.inc | 28 +++++++++++++++++++ .../main/rowid_filter_innodb_debug.result | 18 ++++++++++++ .../main/rowid_filter_myisam_debug.result | 18 ++++++++++++ sql/opt_range.cc | 3 ++ sql/sql_select.cc | 13 +++++---- 5 files changed, 75 insertions(+), 5 deletions(-) diff --git a/mysql-test/include/rowid_filter_debug_kill.inc b/mysql-test/include/rowid_filter_debug_kill.inc index 513efed8a4c..45b44b246d2 100644 --- a/mysql-test/include/rowid_filter_debug_kill.inc +++ b/mysql-test/include/rowid_filter_debug_kill.inc @@ -55,5 +55,33 @@ disconnect con1; reap; set debug_sync='RESET'; +--echo # +--echo # MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +--echo # Assertion `sel->quick' failed in make_range_rowid_filters +--echo # + +--echo # Reusing table t2 and t3 from previous test +let $target_id= `select connection_id()`; + +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +send +explain +select * from t2, t3 +where + t3.key1=t2.a and t3.key2 in (2,3); + +connect (con1, localhost, root,,); +set debug_sync='now WAIT_FOR ready1'; +evalp kill query $target_id; +set debug_sync='now SIGNAL go1'; + +connection default; +disconnect con1; + +--error ER_QUERY_INTERRUPTED +reap; +set debug_sync='RESET'; + + drop table t2,t3; --source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result index f82b29aa1e6..4fdf53cb2b0 100644 --- a/mysql-test/main/rowid_filter_innodb_debug.result +++ b/mysql-test/main/rowid_filter_innodb_debug.result @@ -46,5 +46,23 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; +# +# MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +# Assertion `sel->quick' failed in make_range_rowid_filters +# +# Reusing table t2 and t3 from previous test +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +explain +select * from t2, t3 +where +t3.key1=t2.a and t3.key2 in (2,3); +connect con1, localhost, root,,; +set debug_sync='now WAIT_FOR ready1'; +kill query $target_id; +set debug_sync='now SIGNAL go1'; +connection default; +disconnect con1; +ERROR 70100: Query execution was interrupted +set debug_sync='RESET'; drop table t2,t3; set default_storage_engine=default; diff --git a/mysql-test/main/rowid_filter_myisam_debug.result b/mysql-test/main/rowid_filter_myisam_debug.result index 75a8fad6947..175e054af2a 100644 --- a/mysql-test/main/rowid_filter_myisam_debug.result +++ b/mysql-test/main/rowid_filter_myisam_debug.result @@ -45,4 +45,22 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; +# +# MDEV-30651: SIGSEGV in st_join_table::save_explain_data and +# Assertion `sel->quick' failed in make_range_rowid_filters +# +# Reusing table t2 and t3 from previous test +set debug_sync='in_forced_range_optimize SIGNAL ready1 WAIT_FOR go1'; +explain +select * from t2, t3 +where +t3.key1=t2.a and t3.key2 in (2,3); +connect con1, localhost, root,,; +set debug_sync='now WAIT_FOR ready1'; +kill query $target_id; +set debug_sync='now SIGNAL go1'; +connection default; +disconnect con1; +ERROR 70100: Query execution was interrupted +set debug_sync='RESET'; drop table t2,t3; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3f13c76df3a..36d67bd0d7c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2708,7 +2708,10 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, only_single_index_range_scan= 1; if (head->force_index || force_quick_range) + { + DEBUG_SYNC(thd, "in_forced_range_optimize"); scan_time= read_time= DBL_MAX; + } else { scan_time= rows2double(records) / TIME_FOR_COMPARE; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 06de7afa4f3..2ab1736891c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1783,7 +1783,9 @@ int JOIN::optimize() object a pointer to which is set in the field JOIN_TAB::rowid_filter of the joined table. - @retval false always + @retval + false OK + true Error, query should abort */ bool JOIN::make_range_rowid_filters() @@ -1830,8 +1832,11 @@ bool JOIN::make_range_rowid_filters() (ha_rows) HA_POS_ERROR, true, false, true, true); tab->table->force_index= force_index_save; - if (thd->is_error()) - goto no_filter; + if (thd->is_error() || thd->check_killed()) + { + delete sel; + DBUG_RETURN(true); + } /* If SUBS_IN_TO_EXISTS strtrategy is chosen for the subquery then additional conditions are injected into WHERE/ON/HAVING and it may @@ -1855,8 +1860,6 @@ bool JOIN::make_range_rowid_filters() continue; } no_filter: - if (sel->quick) - delete sel->quick; delete sel; } From 0903276eaea3058dc0f11216977fd7b216d51420 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 14 Jun 2024 13:41:03 +0300 Subject: [PATCH 04/85] MDEV-30651: Assertion `sel->quick' in make_range_rowid_filters, followup Review followup: RANGE_OPT_PARAM statement_should_be_aborted() checks for thd->is_fatal_error and thd->is_error(). The first is redundant when the second is present. --- sql/opt_range.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/opt_range.h b/sql/opt_range.h index 20be6031a2d..ea0ab9a52e9 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -736,7 +736,6 @@ public: { return thd->killed || - thd->is_fatal_error || thd->is_error() || alloced_sel_args > SEL_ARG::MAX_SEL_ARGS; } From 2eda310b155a643046866b28749af06d03a199a6 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 14 Jun 2024 16:56:10 +0300 Subject: [PATCH 05/85] Restore test coverage for MDEV-18956 (It was accidentally removed by fix for MDEV-28846) --- mysql-test/main/rowid_filter.result | 19 +++++++++++-------- mysql-test/main/rowid_filter.test | 17 ++++++++++------- mysql-test/main/rowid_filter_innodb.result | 19 +++++++++++-------- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index e32b738c4e5..6bc5c0f9750 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -2036,21 +2036,24 @@ DROP TABLE t1; CREATE TABLE t1 (pk int) engine=myisam ; INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 ( -pk int auto_increment PRIMARY KEY, -i1 int, i2 int, c2 varchar(1), -KEY (i1), KEY (i2) +pk int PRIMARY KEY, +i1 int, i2 int, +c2 varchar(100), +KEY (i1), +KEY (i2) ) engine=myisam; -INSERT INTO t2 VALUES -(1,8,6,'t'),(2,5,7,'i'),(3,4,4,'h'),(4,207,38,'d'),(5,183,206,'b'), -(6,7,null,'o'),(7,1,2,'j'),(8,17,36,'s'),(9,4,5,'q'),(10,0,6,'l'), -(11,1,9,'j'),(12,5,6,'y'),(13,null,0,'i'),(14,7,7,'x'),(15,5,2,'u'); +insert into t2 +select +seq, floor(seq/100), floor(seq/100), 'abcd' +from +seq_1_to_10000; SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); pk EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t2 ref i1,i2 i1 5 const 1 100.00 Using index condition; Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; diff --git a/mysql-test/main/rowid_filter.test b/mysql-test/main/rowid_filter.test index a2543e197ca..61ddf32407e 100644 --- a/mysql-test/main/rowid_filter.test +++ b/mysql-test/main/rowid_filter.test @@ -298,15 +298,18 @@ CREATE TABLE t1 (pk int) engine=myisam ; INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 ( - pk int auto_increment PRIMARY KEY, - i1 int, i2 int, c2 varchar(1), - KEY (i1), KEY (i2) + pk int PRIMARY KEY, + i1 int, i2 int, + c2 varchar(100), + KEY (i1), + KEY (i2) ) engine=myisam; -INSERT INTO t2 VALUES - (1,8,6,'t'),(2,5,7,'i'),(3,4,4,'h'),(4,207,38,'d'),(5,183,206,'b'), - (6,7,null,'o'),(7,1,2,'j'),(8,17,36,'s'),(9,4,5,'q'),(10,0,6,'l'), - (11,1,9,'j'),(12,5,6,'y'),(13,null,0,'i'),(14,7,7,'x'),(15,5,2,'u'); +insert into t2 +select + seq, floor(seq/100), floor(seq/100), 'abcd' +from + seq_1_to_10000; SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); EXPLAIN EXTENDED diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index c442ad43056..20a087ec61e 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -1982,21 +1982,24 @@ DROP TABLE t1; CREATE TABLE t1 (pk int) engine=myisam ; INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 ( -pk int auto_increment PRIMARY KEY, -i1 int, i2 int, c2 varchar(1), -KEY (i1), KEY (i2) +pk int PRIMARY KEY, +i1 int, i2 int, +c2 varchar(100), +KEY (i1), +KEY (i2) ) engine=myisam; -INSERT INTO t2 VALUES -(1,8,6,'t'),(2,5,7,'i'),(3,4,4,'h'),(4,207,38,'d'),(5,183,206,'b'), -(6,7,null,'o'),(7,1,2,'j'),(8,17,36,'s'),(9,4,5,'q'),(10,0,6,'l'), -(11,1,9,'j'),(12,5,6,'y'),(13,null,0,'i'),(14,7,7,'x'),(15,5,2,'u'); +insert into t2 +select +seq, floor(seq/100), floor(seq/100), 'abcd' +from +seq_1_to_10000; SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); pk EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t2 ref i1,i2 i1 5 const 1 100.00 Using index condition; Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; From 83d3ed4908836ff1613208037ff29c8ae3b2e04d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 17 Jun 2024 15:41:46 +0400 Subject: [PATCH 06/85] MDEV-34014 mysql_upgrade failed Adding a new statement into scripts/sys_schema/before_setup.sql: ALTER DATABASE sys CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci; to fix db.opt in case: - the database `sys` was altered to unexpected CHARACTER SET or COLLATE values - or db.opt was erroneously removed to make sure that sys objects are always recreated using utf8mb3_general_ci. --- mysql-test/main/mysql_upgrade-34014.opt | 2 + mysql-test/main/mysql_upgrade-34014.result | 186 +++++++++++++++++++++ mysql-test/main/mysql_upgrade-34014.test | 26 +++ scripts/sys_schema/before_setup.sql | 7 +- 4 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 mysql-test/main/mysql_upgrade-34014.opt create mode 100644 mysql-test/main/mysql_upgrade-34014.result create mode 100644 mysql-test/main/mysql_upgrade-34014.test diff --git a/mysql-test/main/mysql_upgrade-34014.opt b/mysql-test/main/mysql_upgrade-34014.opt new file mode 100644 index 00000000000..48849b3eb21 --- /dev/null +++ b/mysql-test/main/mysql_upgrade-34014.opt @@ -0,0 +1,2 @@ +--character-set-server=utf8mb3 +--collation-server=utf8mb3_unicode_ci diff --git a/mysql-test/main/mysql_upgrade-34014.result b/mysql-test/main/mysql_upgrade-34014.result new file mode 100644 index 00000000000..d53da1c85df --- /dev/null +++ b/mysql-test/main/mysql_upgrade-34014.result @@ -0,0 +1,186 @@ +# +# Stat of 10.6 tests +# +# +# MDEV-34014 mysql_upgrade failed +# +SHOW CREATE DATABASE sys; +Database Create Database +sys CREATE DATABASE `sys` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ +# Emulate db.opt file was removed in a mistake +FLUSH TABLES; +SHOW CREATE DATABASE sys; +Database Create Database +sys CREATE DATABASE `sys` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */ +Phase 1/8: Checking and upgrading mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.global_priv OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.index_stats OK +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt + +Repairing tables +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt +Phase 2/8: Installing used storage engines... Skipped +Phase 3/8: Running 'mysql_fix_privilege_tables' +Phase 4/8: Fixing views +mysql.user OK +sys.host_summary OK +sys.host_summary_by_file_io OK +sys.host_summary_by_file_io_type OK +sys.host_summary_by_stages OK +sys.host_summary_by_statement_latency OK +sys.host_summary_by_statement_type OK +sys.innodb_buffer_stats_by_schema OK +sys.innodb_buffer_stats_by_table OK +sys.innodb_lock_waits OK +sys.io_by_thread_by_latency OK +sys.io_global_by_file_by_bytes OK +sys.io_global_by_file_by_latency OK +sys.io_global_by_wait_by_bytes OK +sys.io_global_by_wait_by_latency OK +sys.latest_file_io OK +sys.memory_by_host_by_current_bytes OK +sys.memory_by_thread_by_current_bytes OK +sys.memory_by_user_by_current_bytes OK +sys.memory_global_by_current_bytes OK +sys.memory_global_total OK +sys.metrics OK +sys.processlist OK +sys.ps_check_lost_instrumentation OK +sys.schema_auto_increment_columns OK +sys.schema_index_statistics OK +sys.schema_object_overview OK +sys.schema_redundant_indexes OK +sys.schema_table_lock_waits OK +sys.schema_table_statistics OK +sys.schema_table_statistics_with_buffer OK +sys.schema_tables_with_full_table_scans OK +sys.schema_unused_indexes OK +sys.session OK +sys.session_ssl_status OK +sys.statement_analysis OK +sys.statements_with_errors_or_warnings OK +sys.statements_with_full_table_scans OK +sys.statements_with_runtimes_in_95th_percentile OK +sys.statements_with_sorting OK +sys.statements_with_temp_tables OK +sys.user_summary OK +sys.user_summary_by_file_io OK +sys.user_summary_by_file_io_type OK +sys.user_summary_by_stages OK +sys.user_summary_by_statement_latency OK +sys.user_summary_by_statement_type OK +sys.version OK +sys.wait_classes_global_by_avg_latency OK +sys.wait_classes_global_by_latency OK +sys.waits_by_host_by_latency OK +sys.waits_by_user_by_latency OK +sys.waits_global_by_latency OK +sys.x$host_summary OK +sys.x$host_summary_by_file_io OK +sys.x$host_summary_by_file_io_type OK +sys.x$host_summary_by_stages OK +sys.x$host_summary_by_statement_latency OK +sys.x$host_summary_by_statement_type OK +sys.x$innodb_buffer_stats_by_schema OK +sys.x$innodb_buffer_stats_by_table OK +sys.x$innodb_lock_waits OK +sys.x$io_by_thread_by_latency OK +sys.x$io_global_by_file_by_bytes OK +sys.x$io_global_by_file_by_latency OK +sys.x$io_global_by_wait_by_bytes OK +sys.x$io_global_by_wait_by_latency OK +sys.x$latest_file_io OK +sys.x$memory_by_host_by_current_bytes OK +sys.x$memory_by_thread_by_current_bytes OK +sys.x$memory_by_user_by_current_bytes OK +sys.x$memory_global_by_current_bytes OK +sys.x$memory_global_total OK +sys.x$processlist OK +sys.x$ps_digest_95th_percentile_by_avg_us OK +sys.x$ps_digest_avg_latency_distribution OK +sys.x$ps_schema_table_statistics_io OK +sys.x$schema_flattened_keys OK +sys.x$schema_index_statistics OK +sys.x$schema_table_lock_waits OK +sys.x$schema_table_statistics OK +sys.x$schema_table_statistics_with_buffer OK +sys.x$schema_tables_with_full_table_scans OK +sys.x$session OK +sys.x$statement_analysis OK +sys.x$statements_with_errors_or_warnings OK +sys.x$statements_with_full_table_scans OK +sys.x$statements_with_runtimes_in_95th_percentile OK +sys.x$statements_with_sorting OK +sys.x$statements_with_temp_tables OK +sys.x$user_summary OK +sys.x$user_summary_by_file_io OK +sys.x$user_summary_by_file_io_type OK +sys.x$user_summary_by_stages OK +sys.x$user_summary_by_statement_latency OK +sys.x$user_summary_by_statement_type OK +sys.x$wait_classes_global_by_avg_latency OK +sys.x$wait_classes_global_by_latency OK +sys.x$waits_by_host_by_latency OK +sys.x$waits_by_user_by_latency OK +sys.x$waits_global_by_latency OK +Phase 5/8: Fixing table and database names +Phase 6/8: Checking and upgrading tables +Processing databases +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +sys +sys.sys_config OK +test +Phase 7/8: uninstalling plugins +Phase 8/8: Running 'FLUSH PRIVILEGES' +OK +SHOW CREATE DATABASE sys; +Database Create Database +sys CREATE DATABASE `sys` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ +# +# End of 10.6 tests +# diff --git a/mysql-test/main/mysql_upgrade-34014.test b/mysql-test/main/mysql_upgrade-34014.test new file mode 100644 index 00000000000..ae547c3e098 --- /dev/null +++ b/mysql-test/main/mysql_upgrade-34014.test @@ -0,0 +1,26 @@ +--source include/mysql_upgrade_preparation.inc + +let $MYSQLD_DATADIR= `select @@datadir`; + +--echo # +--echo # Stat of 10.6 tests +--echo # + +--echo # +--echo # MDEV-34014 mysql_upgrade failed +--echo # + +SHOW CREATE DATABASE sys; + +--echo # Emulate db.opt file was removed in a mistake +--remove_file $MYSQLD_DATADIR/sys/db.opt +FLUSH TABLES; +SHOW CREATE DATABASE sys; + +--exec $MYSQL_UPGRADE --force 2>&1 +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info +SHOW CREATE DATABASE sys; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/scripts/sys_schema/before_setup.sql b/scripts/sys_schema/before_setup.sql index c0634d69e5c..e3e2f6ab32c 100644 --- a/scripts/sys_schema/before_setup.sql +++ b/scripts/sys_schema/before_setup.sql @@ -17,6 +17,11 @@ SET NAMES utf8; SET @sql_log_bin = @@sql_log_bin; SET sql_log_bin = 0; -CREATE DATABASE IF NOT EXISTS sys DEFAULT CHARACTER SET utf8; +CREATE DATABASE IF NOT EXISTS sys DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci; + +-- If the database had existed, let's recreate its db.opt: +-- * to fix it if it contained unexpected charset/collation values +-- * to create it if it was removed in a mistake +ALTER DATABASE sys CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci; USE sys; From c37b2a9f045f5170189e1ed18a7d177b61beab93 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 17 Jun 2024 19:06:34 +0300 Subject: [PATCH 07/85] MDEV-30460 rpl.rpl_start_alter_restart_slave sometimes fails in BB with result length mismatch The test was used to fail because of lacking a synchronization point designating an expected for processing "CA_1" event has been indeed taken into this phase. The event apparently may not have even arrived at slave. Fixed with deploying the missed synchronization. --- mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result | 1 + mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result index 76f9cbcd2ce..5a6f36d3f31 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result @@ -52,6 +52,7 @@ master-bin.000001 # Query 1 # use `test`; create table t3( a int primary key, b # let's stop at first CA processing (in process_commit_alter) connection slave; include/sync_with_master_gtid.inc +# wait for CA_1 waiting itself connect extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT; stop slave;; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test index 5dcb0bf85e6..5b13fd8dc93 100644 --- a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test +++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test @@ -73,6 +73,10 @@ create table t3( a int primary key, b int) engine=innodb; --connection slave --source include/sync_with_master_gtid.inc +--echo # wait for CA_1 waiting itself +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'; +--source include/wait_condition.inc + # set debug_sync="now wait_for CA_1_processing"; connect(extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT); --send stop slave; From 10fbd1ce5137f612b951c0cae6a2f5246053449d Mon Sep 17 00:00:00 2001 From: Souradeep Saha Date: Tue, 4 Jun 2024 22:58:25 +0000 Subject: [PATCH 08/85] MDEV-34168: Extend perror utility to print link to KB page As all MariaDB Server errors now have a dedicated web page, the perror utility is extended to include a link to the KB page of the corresponding error code. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- extra/perror.c | 3 ++- mysql-test/main/perror-win.result | 1 + mysql-test/main/perror.result | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/extra/perror.c b/extra/perror.c index ee6e362e06b..d678d46d1be 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -359,7 +359,8 @@ int main(int argc,char *argv[]) { found= 1; if (verbose) - printf("MariaDB error code %3d (%s): %s\n", code, name, msg); + printf("MariaDB error code %3d (%s): %s\n" + "Learn more: https://mariadb.com/kb/en/e%3d/\n", code, name, msg, code); else puts(msg); } diff --git a/mysql-test/main/perror-win.result b/mysql-test/main/perror-win.result index a0ea54f9187..696dd47b72d 100644 --- a/mysql-test/main/perror-win.result +++ b/mysql-test/main/perror-win.result @@ -3,5 +3,6 @@ Win32 error code 150: System trace information was not specified in your CONFIG. OS error code 23: Too many open files in system Win32 error code 23: Data error (cyclic redundancy check). MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d +Learn more: https://mariadb.com/kb/en/e1062/ Win32 error code 1062: The service has not been started. Illegal error code: 30000 diff --git a/mysql-test/main/perror.result b/mysql-test/main/perror.result index b95b8b8dd99..a6293bda6d8 100644 --- a/mysql-test/main/perror.result +++ b/mysql-test/main/perror.result @@ -1,6 +1,10 @@ Illegal error code: 10000 MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d +Learn more: https://mariadb.com/kb/en/e1062/ MariaDB error code 1408 (ER_STARTUP): %s: ready for connections. Version: '%s' socket: '%s' port: %d %s +Learn more: https://mariadb.com/kb/en/e1408/ MariaDB error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it! +Learn more: https://mariadb.com/kb/en/e1459/ MariaDB error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u) +Learn more: https://mariadb.com/kb/en/e1461/ From 0e25cc51a91d734d3dd8a0b96eece429ee46b9fe Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Tue, 18 Jun 2024 06:12:57 -0600 Subject: [PATCH 09/85] MDEV-34397: "delete si" rather than "my_free(si)" in THD::register_slave() In the error case of THD::register_slave(), there is undefined behavior of Slave_info si because it is allocated via malloc() (my_malloc), and cleaned up via delete(). This patch makes these consistent by switching si's cleanup to use my_free. --- sql/repl_failsafe.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 1df85759a9c..f3d76df31ed 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -159,7 +159,7 @@ int THD::register_slave(uchar *packet, size_t packet_length) return 0; err: - delete si; + my_free(si); my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0)); /* purecov: inspected */ return 1; } From 6cab2f75fe25df4673cab5ac6ff2c114fb976ed8 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Tue, 18 Jun 2024 06:52:16 -0600 Subject: [PATCH 10/85] MDEV-23857: replication master password length After MDEV-4013, the maximum length of replication passwords was extended to 96 ASCII characters. After a restart, however, slaves only read the first 41 characters of MASTER_PASSWORD from the master.info file. This lead to slaves unable to reconnect to the master after a restart. After a slave restart, if a master.info file is detected, use the full allowable length of the password rather than 41 characters. Reviewed By: ============ Sergei Golubchik --- .../r/rpl_slave_restart_long_password.result | 28 +++++++ .../t/rpl_slave_restart_long_password.test | 80 +++++++++++++++++++ sql/rpl_mi.cc | 2 +- 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/rpl/r/rpl_slave_restart_long_password.result create mode 100644 mysql-test/suite/rpl/t/rpl_slave_restart_long_password.test diff --git a/mysql-test/suite/rpl/r/rpl_slave_restart_long_password.result b/mysql-test/suite/rpl/r/rpl_slave_restart_long_password.result new file mode 100644 index 00000000000..52686c1b6ee --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_slave_restart_long_password.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +include/assert.inc [Password length is 96] +connection master; +SET SQL_LOG_BIN=0; +GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY '123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496'; +SET SQL_LOG_BIN=1; +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_HOST='127.0.0.1', master_user='rpl', master_password='123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496'; +include/start_slave.inc +include/check_slave_param.inc [Slave_IO_Running] +connection master; +include/rpl_restart_server.inc [server_number=2] +connection slave; +include/start_slave.inc +include/check_slave_param.inc [Slave_IO_Running] +connection master; +SET SQL_LOG_BIN=0; +DROP USER rpl@127.0.0.1; +FLUSH PRIVILEGES; +SET SQL_LOG_BIN=1; +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = ''; +include/start_slave.inc +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_restart_long_password.test b/mysql-test/suite/rpl/t/rpl_slave_restart_long_password.test new file mode 100644 index 00000000000..e004777aa76 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_restart_long_password.test @@ -0,0 +1,80 @@ +# +# This test validates a fix for a bug where slaves only read the +# first 41 characters of MASTER_PASSWORD from the master.info file +# after restarts. +# +# The test ensures that passwords up to the maximum allowable +# length (96 ASCII characters) will be read from the master.info +# file after slave restarts +# +# References: +# MDEV-23857: replication master password length +# + +# Test is format independent, so only run with one format +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + + +##### +# Setup +# +--let $passwd=123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496 +--let $expected_pwlen=96 +--let assert_cond=CHAR_LENGTH("$passwd")=$expected_pwlen +--let assert_text=Password length is $expected_pwlen +--source include/assert.inc + +connection master; +SET SQL_LOG_BIN=0; +--eval GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY '$passwd' +SET SQL_LOG_BIN=1; +##### + + +##### +# Change master to new user/password combination +# +connection slave; +--source include/stop_slave.inc +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', master_user='rpl', master_password='$passwd' + +--source include/start_slave.inc +--let $slave_param= Slave_IO_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc +##### + + +##### +# Ensure slave can re-connect to master after restart +# +connection master; +--let $rpl_server_number= 2 +--source include/rpl_restart_server.inc + +connection slave; +--source include/start_slave.inc +--let $slave_param= Slave_IO_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc +##### + + +##### +# Cleanup +# +connection master; +SET SQL_LOG_BIN=0; +DROP USER rpl@127.0.0.1; +FLUSH PRIVILEGES; +SET SQL_LOG_BIN=1; + +connection slave; +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = ''; +--source include/start_slave.inc + +connection master; +-- source include/rpl_end.inc +##### diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 17c9029e1a5..3c6db4f0aad 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -482,7 +482,7 @@ file '%s')", fname); if (init_intvar_from_file(&master_log_pos, &mi->file, 4) || init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file, 0) || init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file, "test") || - init_strvar_from_file(mi->password, SCRAMBLED_PASSWORD_CHAR_LENGTH+1, + init_strvar_from_file(mi->password, sizeof(mi->password), &mi->file, 0) || init_intvar_from_file(&port, &mi->file, MYSQL_PORT) || init_intvar_from_file(&connect_retry, &mi->file, From 2bd661ca1038e78296289d9285d54b57954d48e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Jun 2024 18:22:28 +0300 Subject: [PATCH 11/85] MDEV-34178: Simplify the U lock The U lock mode of the sux_lock that was introduced in commit 03ca6495df31313c96e38834b9a235245e2ae2a8 (MDEV-24142) is unnecessarily complex. Internally, sux_lock comprises two parts, each with their own wait queue inside the operating system kernel: a mutex and a rw-lock. We can map the operations as follows: x_lock(): (X,X) u_lock(): (X,_) s_lock(): (_,S) The Update lock mode, which is mutually exclusive with itself and with X (exclusive) locks but not with shared (S) locks, was unnecessarily acquiring a shared lock on the second component. The mutual exclusion is guaranteed by the first component. We might simplify the #ifdef SUX_LOCK_GENERIC case further by omitting srw_mutex_impl::lock, because it is kind-of duplicating the mutex that we will use for having a wait queue. However, the predicate buf_page_t::can_relocate() would depend on the predicate is_locked_or_waiting(), which is not available for pthread_mutex_t. Reviewed by: Debarun Banerjee Tested by: Matthias Leich --- storage/innobase/include/srw_lock.h | 22 +++++----------------- storage/innobase/sync/srw_lock.cc | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index db3fef2a2e0..67faaed0cec 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -223,12 +223,7 @@ public: bool u_lock_try() { - if (!writer.wr_lock_try()) - return false; - IF_DBUG_ASSERT(uint32_t lk=,) - readers.fetch_add(1, std::memory_order_acquire); - DBUG_ASSERT(lk < WRITER - 1); - return true; + return writer.wr_lock_try(); } bool wr_lock_try() @@ -248,9 +243,6 @@ public: void u_lock() { writer.wr_lock(); - IF_DBUG_ASSERT(uint32_t lk=,) - readers.fetch_add(1, std::memory_order_acquire); - DBUG_ASSERT(lk < WRITER - 1); } void wr_lock() { @@ -272,15 +264,15 @@ public: void u_wr_upgrade() { DBUG_ASSERT(writer.is_locked()); - uint32_t lk= readers.fetch_add(WRITER - 1, std::memory_order_acquire); - if (lk != 1) - wr_wait(lk - 1); + uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire); + if (lk) + wr_wait(lk); } void wr_u_downgrade() { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(is_write_locked()); - readers.store(1, std::memory_order_release); + readers.store(0, std::memory_order_release); /* Note: Any pending rd_lock() will not be woken up until u_unlock() */ } @@ -293,10 +285,6 @@ public: } void u_unlock() { - IF_DBUG_ASSERT(uint32_t lk=,) - readers.fetch_sub(1, std::memory_order_release); - DBUG_ASSERT(lk); - DBUG_ASSERT(lk < WRITER); writer.wr_unlock(); } void wr_unlock() diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 651ac4dcb7e..cf543a9b7e9 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -525,7 +525,7 @@ void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) { PSI_rwlock_locker_state state; DBUG_ASSERT(lock.writer.is_locked()); - uint32_t lk= 1; + uint32_t lk= 0; const bool nowait= lock.readers.compare_exchange_strong(lk, ssux_lock_impl::WRITER, std::memory_order_acquire, From cfa614345358c7ad54abd4a23331d65ef0aba6f4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 19 Jun 2024 10:01:30 +0400 Subject: [PATCH 12/85] MDEV-27966 Assertion `fixed()' failed and Assertion `fixed == 1' failed, both in Item_func_concat::val_str on SELECT after INSERT with collation utf32_bin on utf8_bin table This problem was earlier fixed by this commit: > commit 08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917 > Author: Aleksey Midenkov > Date: Mon Apr 18 12:44:27 2022 +0300 > > MDEV-24176 Server crashes after insert in the table with virtual > column generated using date_format() and if() Adding an mtr test only. --- mysql-test/suite/vcol/r/vcol_utf32.result | 37 +++++++++++++++++++++++ mysql-test/suite/vcol/t/vcol_utf32.test | 18 +++++++++++ 2 files changed, 55 insertions(+) create mode 100644 mysql-test/suite/vcol/r/vcol_utf32.result create mode 100644 mysql-test/suite/vcol/t/vcol_utf32.test diff --git a/mysql-test/suite/vcol/r/vcol_utf32.result b/mysql-test/suite/vcol/r/vcol_utf32.result new file mode 100644 index 00000000000..202c9da40f0 --- /dev/null +++ b/mysql-test/suite/vcol/r/vcol_utf32.result @@ -0,0 +1,37 @@ +# +# MDEV-27966 Assertion `fixed()' failed and Assertion `fixed == 1' failed, both in Item_func_concat::val_str on SELECT after INSERT with collation utf32_bin on utf8_bin table +# +SET NAMES utf8mb3; +SET sql_mode=''; +CREATE TABLE t (c1 INT,c2 CHAR AS (CONCAT ('',DAYNAME ('')))) COLLATE utf8_bin ENGINE=InnoDB; +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1266 Using storage engine MyISAM for table 't' +INSERT INTO t VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +Warnings: +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +Warning 1906 The value specified for generated column 'c2' in table 't' has been ignored +Warning 1292 Incorrect datetime value: '' +SET collation_connection='utf32_bin'; +INSERT INTO t VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +ERROR HY000: Illegal mix of collations (utf8_bin,COERCIBLE) and (utf32_bin,COERCIBLE) for operation 'concat' +SELECT * FROM t; +ERROR HY000: Illegal mix of collations (utf8_bin,COERCIBLE) and (utf32_bin,COERCIBLE) for operation 'concat' +DROP TABLE t; +SET sql_mode=DEFAULT; +SET NAMES utf8mb3; diff --git a/mysql-test/suite/vcol/t/vcol_utf32.test b/mysql-test/suite/vcol/t/vcol_utf32.test new file mode 100644 index 00000000000..a8a116201de --- /dev/null +++ b/mysql-test/suite/vcol/t/vcol_utf32.test @@ -0,0 +1,18 @@ +--source include/have_utf32.inc + +--echo # +--echo # MDEV-27966 Assertion `fixed()' failed and Assertion `fixed == 1' failed, both in Item_func_concat::val_str on SELECT after INSERT with collation utf32_bin on utf8_bin table +--echo # + +SET NAMES utf8mb3; +SET sql_mode=''; +CREATE TABLE t (c1 INT,c2 CHAR AS (CONCAT ('',DAYNAME ('')))) COLLATE utf8_bin ENGINE=InnoDB; +INSERT INTO t VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +SET collation_connection='utf32_bin'; +--error ER_CANT_AGGREGATE_2COLLATIONS +INSERT INTO t VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +--error ER_CANT_AGGREGATE_2COLLATIONS +SELECT * FROM t; +DROP TABLE t; +SET sql_mode=DEFAULT; +SET NAMES utf8mb3; From 6cde03aedc5297f9e239d3a0089a6d4947a43e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Jun 2024 13:30:23 +0300 Subject: [PATCH 13/85] MDEV-34178: Improve PERFORMANCE_SCHEMA instrumentation When MariaDB is built with PERFORMANCE_SCHEMA support enabled and with futex-based rw-locks (not srw_lock_), we were unnecessarily releasing and reacquiring lock.writer in srw_lock_impl::psi_wr_lock() and ssux_lock::psi_wr_lock(). If there is a conflict with rd_lock(), let us hold the lock.writer and execute u_wr_upgrade() to wait for rd_unlock(). Reviewed by: Debarun Banerjee Tested by: Matthias Leich --- storage/innobase/sync/srw_lock.cc | 62 +++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index cf543a9b7e9..684363a0c38 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -462,17 +462,40 @@ template void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) { PSI_rwlock_locker_state state; - const bool nowait= lock.wr_lock_try(); +# if defined _WIN32 || defined SUX_LOCK_GENERIC + const bool nowait2= lock.wr_lock_try(); +# else + const bool nowait1= lock.writer.wr_lock_try(); + uint32_t lk= 0; + const bool nowait2= nowait1 && + lock.readers.compare_exchange_strong(lk, lock.WRITER, + std::memory_order_acquire, + std::memory_order_relaxed); +# endif if (PSI_rwlock_locker *locker= PSI_RWLOCK_CALL(start_rwlock_wrwait) (&state, pfs_psi, - nowait ? PSI_RWLOCK_TRYWRITELOCK : PSI_RWLOCK_WRITELOCK, file, line)) + nowait2 ? PSI_RWLOCK_TRYWRITELOCK : PSI_RWLOCK_WRITELOCK, file, line)) { - if (!nowait) +# if defined _WIN32 || defined SUX_LOCK_GENERIC + if (!nowait2) lock.wr_lock(); +# else + if (!nowait1) + lock.wr_lock(); + else if (!nowait2) + lock.u_wr_upgrade(); +# endif PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, 0); } - else if (!nowait) +# if defined _WIN32 || defined SUX_LOCK_GENERIC + else if (!nowait2) lock.wr_lock(); +# else + else if (!nowait1) + lock.wr_lock(); + else if (!nowait2) + lock.u_wr_upgrade(); +# endif } void ssux_lock::psi_rd_lock(const char *file, unsigned line) @@ -507,18 +530,41 @@ void ssux_lock::psi_u_lock(const char *file, unsigned line) void ssux_lock::psi_wr_lock(const char *file, unsigned line) { PSI_rwlock_locker_state state; - const bool nowait= lock.wr_lock_try(); +# if defined _WIN32 || defined SUX_LOCK_GENERIC + const bool nowait2= lock.wr_lock_try(); +# else + const bool nowait1= lock.writer.wr_lock_try(); + uint32_t lk= 0; + const bool nowait2= nowait1 && + lock.readers.compare_exchange_strong(lk, lock.WRITER, + std::memory_order_acquire, + std::memory_order_relaxed); +# endif if (PSI_rwlock_locker *locker= PSI_RWLOCK_CALL(start_rwlock_wrwait) (&state, pfs_psi, - nowait ? PSI_RWLOCK_TRYEXCLUSIVELOCK : PSI_RWLOCK_EXCLUSIVELOCK, + nowait2 ? PSI_RWLOCK_TRYEXCLUSIVELOCK : PSI_RWLOCK_EXCLUSIVELOCK, file, line)) { - if (!nowait) +# if defined _WIN32 || defined SUX_LOCK_GENERIC + if (!nowait2) lock.wr_lock(); +# else + if (!nowait1) + lock.wr_lock(); + else if (!nowait2) + lock.u_wr_upgrade(); +# endif PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, 0); } - else if (!nowait) +# if defined _WIN32 || defined SUX_LOCK_GENERIC + else if (!nowait2) lock.wr_lock(); +# else + else if (!nowait1) + lock.wr_lock(); + else if (!nowait2) + lock.u_wr_upgrade(); +# endif } void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) From f8d213bd0e1900303b1d2fa257c77d84f629dc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Jun 2024 13:40:57 +0300 Subject: [PATCH 14/85] MDEV-34178: Improve the spin loops srw_mutex_impl::wait_and_lock(): Invoke srw_pause() and reload the lock word on each loop. Thanks to Mark Callaghan for suggesting this. ssux_lock_impl::rd_wait(): Actually implement a spin loop on the rw-lock component without blocking on the mutex component. If there is a conflict with wr_lock(), wait for writer.lock to be released without actually acquiring it. Reviewed by: Debarun Banerjee Tested by: Matthias Leich --- storage/innobase/include/srw_lock.h | 24 +++++++---- storage/innobase/sync/srw_lock.cc | 64 +++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 67faaed0cec..696c4786d62 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -72,10 +72,13 @@ inline void pthread_mutex_wrapper::wr_lock() # endif #endif +template class ssux_lock_impl; + /** Futex-based mutex */ template class srw_mutex_impl final { + friend ssux_lock_impl; /** The lock word, containing HOLDER + 1 if the lock is being held, plus the number of waiters */ std::atomic lock; @@ -97,6 +100,8 @@ private: inline void wait(uint32_t lk); /** Wake up one wait() thread */ void wake(); + /** Wake up all wait() threads */ + inline void wake_all(); public: /** @return whether the mutex is being held or waited for */ bool is_locked_or_waiting() const @@ -209,22 +214,25 @@ public: /** @return whether the lock is being held or waited for */ bool is_vacant() const { return !is_locked_or_waiting(); } #endif /* !DBUG_OFF */ - - bool rd_lock_try() +private: + /** Try to acquire a shared latch. + @return the lock word value if the latch was not acquired + @retval 0 if the latch was acquired */ + uint32_t rd_lock_try_low() { uint32_t lk= 0; while (!readers.compare_exchange_weak(lk, lk + 1, std::memory_order_acquire, std::memory_order_relaxed)) if (lk & WRITER) - return false; - return true; + return lk; + return 0; } +public: - bool u_lock_try() - { - return writer.wr_lock_try(); - } + bool rd_lock_try() { return rd_lock_try_low() == 0; } + + bool u_lock_try() { return writer.wr_lock_try(); } bool wr_lock_try() { diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 684363a0c38..c1e32f26d51 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -191,6 +191,13 @@ void srw_mutex_impl::wake() pthread_mutex_unlock(&mutex); } template +inline void srw_mutex_impl::wake_all() +{ + pthread_mutex_lock(&mutex); + pthread_cond_broadcast(&cond); + pthread_mutex_unlock(&mutex); +} +template void ssux_lock_impl::wake() { pthread_mutex_lock(&writer.mutex); @@ -207,6 +214,8 @@ inline void srw_mutex_impl::wait(uint32_t lk) { WaitOnAddress(&lock, &lk, 4, INFINITE); } template void srw_mutex_impl::wake() { WakeByAddressSingle(&lock); } +template +inline void srw_mutex_impl::wake_all() { WakeByAddressAll(&lock); } template inline void ssux_lock_impl::wait(uint32_t lk) @@ -244,6 +253,8 @@ inline void srw_mutex_impl::wait(uint32_t lk) { SRW_FUTEX(&lock, WAIT, lk); } template void srw_mutex_impl::wake() { SRW_FUTEX(&lock, WAKE, 1); } +template +void srw_mutex_impl::wake_all() { SRW_FUTEX(&lock, WAKE, INT_MAX); } template inline void ssux_lock_impl::wait(uint32_t lk) @@ -304,9 +315,8 @@ void srw_mutex_impl::wait_and_lock() for (auto spin= srv_n_spin_wait_rounds;;) { DBUG_ASSERT(~HOLDER & lk); - if (lk & HOLDER) - lk= lock.load(std::memory_order_relaxed); - else + lk= lock.load(std::memory_order_relaxed); + if (!(lk & HOLDER)) { #ifdef IF_NOT_FETCH_OR_GOTO static_assert(HOLDER == (1U << 31), "compatibility"); @@ -316,10 +326,10 @@ void srw_mutex_impl::wait_and_lock() if (!((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER)) goto acquired; #endif - srw_pause(delay); } if (!--spin) break; + srw_pause(delay); } } @@ -392,14 +402,52 @@ template void ssux_lock_impl::wr_wait(uint32_t); template void ssux_lock_impl::rd_wait() { + const unsigned delay= srw_pause_delay(); + + if (spinloop) + { + for (auto spin= srv_n_spin_wait_rounds; spin; spin--) + { + srw_pause(delay); + if (rd_lock_try()) + return; + } + } + + /* Subscribe to writer.wake() or write.wake_all() calls by + concurrently executing rd_wait() or writer.wr_unlock(). */ + uint32_t wl= 1 + writer.lock.fetch_add(1, std::memory_order_acquire); + for (;;) { - writer.wr_lock(); - bool acquired= rd_lock_try(); - writer.wr_unlock(); - if (acquired) + if (UNIV_LIKELY(writer.HOLDER & wl)) + writer.wait(wl); + uint32_t lk= rd_lock_try_low(); + if (!lk) break; + if (UNIV_UNLIKELY(lk == WRITER)) /* A wr_lock() just succeeded. */ + /* Immediately wake up (also) wr_lock(). We may also unnecessarily + wake up other concurrent threads that are executing rd_wait(). + If we invoked writer.wake() here to wake up just one thread, + we could wake up a rd_wait(), which then would invoke writer.wake(), + waking up possibly another rd_wait(), and we could end up doing + lots of non-productive context switching until the wr_lock() + is finally woken up. */ + writer.wake_all(); + srw_pause(delay); + wl= writer.lock.load(std::memory_order_acquire); + ut_ad(wl); } + + /* Unsubscribe writer.wake() and writer.wake_all(). */ + wl= writer.lock.fetch_sub(1, std::memory_order_release); + ut_ad(wl); + + /* Wake any other threads that may be blocked in writer.wait(). + All other waiters than this rd_wait() would end up acquiring writer.lock + and waking up other threads on unlock(). */ + if (wl > 1) + writer.wake_all(); } template void ssux_lock_impl::rd_wait(); From 5b26a07698b92f58e5d1f55c7929b0e25d1a586b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Jun 2024 13:41:11 +0300 Subject: [PATCH 15/85] MDEV-34178: Enable spinloop for index_lock In an I/O bound concurrent INSERT test conducted by Mark Callaghan, spin loops on dict_index_t::lock turn out to be beneficial. This is a mixed bag; enabling the spin loops will improve throughput and latency on some workloads and degrade in others. Reviewed by: Debarun Banerjee Tested by: Matthias Leich Performance tested by: Axel Schwenke --- storage/innobase/include/srw_lock.h | 2 +- storage/innobase/include/sux_lock.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 696c4786d62..40bf9f8b0c2 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -402,7 +402,7 @@ typedef srw_spin_lock_low srw_spin_lock; class ssux_lock { PSI_rwlock *pfs_psi; - ssux_lock_impl lock; + ssux_lock_impl lock; ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); diff --git a/storage/innobase/include/sux_lock.h b/storage/innobase/include/sux_lock.h index 2c0167ac651..a8f51fdcdba 100644 --- a/storage/innobase/include/sux_lock.h +++ b/storage/innobase/include/sux_lock.h @@ -285,7 +285,7 @@ public: typedef sux_lock> block_lock; #ifndef UNIV_PFS_RWLOCK -typedef sux_lock> index_lock; +typedef sux_lock> index_lock; #else typedef sux_lock index_lock; From 387bdb2a2ece0d86b189c54fe1bbd48c7fc3d025 Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 19 Jun 2024 14:03:31 +0300 Subject: [PATCH 16/85] MDEV-29934 rpl.rpl_start_alter_chain_basic, rpl.rpl_start_alter_restart_slave sometimes fail in BB with result content mismatch rpl.rpl_start_alter_chain_basic was used to fail sporadically due to a missed GTID master-slave synchronization which was necessary because of the following SELECT from GTID-state table. Fixed with arranging two synchronization pieces for two chain slaves requiring that. Note rpl.rpl_start_alter_restart_slave must have been fixed by MDEV-30460 and 87e13722a95a (manual) merge commit. --- mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result | 4 ++++ mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result b/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result index b6c28458561..a62b02b2f44 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result @@ -64,7 +64,10 @@ connection server_2; select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; domain_id seq_no 0 12 +connection server_1; +include/save_master_gtid.inc connection server_3; +include/sync_with_master_gtid.inc select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; domain_id seq_no 0 12 @@ -77,6 +80,7 @@ select @@slave_parallel_threads; @@slave_parallel_threads 0 connection server_4; +include/sync_with_master_gtid.inc select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; domain_id seq_no 0 12 diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test index 2c6f9c0fd72..efb667ad6fa 100644 --- a/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test +++ b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test @@ -39,7 +39,11 @@ connect(slave_node,127.0.0.1,root,,test, $SERVER_MYPORT_2); --connection server_2 select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +--connection server_1 +--source include/save_master_gtid.inc --connection server_3 +--source include/sync_with_master_gtid.inc + select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; --source include/stop_slave.inc --eval set global slave_parallel_threads = $slave_parallel_threads; @@ -49,6 +53,7 @@ select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; select @@slave_parallel_threads; --connection server_4 +--source include/sync_with_master_gtid.inc select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; --source include/rpl_end.inc From 1001dae186d17e89e78a5596f1076cdda6467785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 29 May 2024 08:59:44 +0300 Subject: [PATCH 17/85] MDEV-12008 : Change error code for Galera unkillable threads Changed error code for Galera unkillable threads to be ER_KILL_DENIED_HIGH_PRIORITY giving message This is a high priority thread/query and cannot be killed without the compromising consistency of the cluster also a warning is produced Thread %lld is [wsrep applier|high priority] and cannot be killed Signed-off-by: Julius Goryavsky --- .../suite/galera/r/galera_kill_applier.result | 8 ++-- .../suite/galera/r/galera_kill_bf.result | 25 +++++++++++ .../suite/galera/t/galera_kill_applier.test | 8 ++-- mysql-test/suite/galera/t/galera_kill_bf.test | 41 +++++++++++++++++++ sql/share/errmsg-utf8.txt | 2 + sql/sql_parse.cc | 22 ++++++---- 6 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_kill_bf.result create mode 100644 mysql-test/suite/galera/t/galera_kill_bf.test diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result index a47f486b5fb..65b6096db2e 100644 --- a/mysql-test/suite/galera/r/galera_kill_applier.result +++ b/mysql-test/suite/galera/r/galera_kill_applier.result @@ -6,13 +6,13 @@ SELECT @@wsrep_slave_threads; 1 SET GLOBAL wsrep_slave_threads=2; KILL ID; -Got one of the listed errors +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster KILL QUERY ID; -Got one of the listed errors +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster KILL ID; -Got one of the listed errors +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster KILL QUERY ID; -Got one of the listed errors +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster SET GLOBAL wsrep_slave_threads=DEFAULT; connection node_1; create table t1(a int not null primary key) engine=innodb; diff --git a/mysql-test/suite/galera/r/galera_kill_bf.result b/mysql-test/suite/galera/r/galera_kill_bf.result new file mode 100644 index 00000000000..c5b76560933 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_kill_bf.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1; +call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); +CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB; +INSERT into t1 values (1,1); +SET DEBUG_SYNC = 'alter_table_after_open_tables SIGNAL bf_started WAIT_FOR bf_continue'; +ALTER TABLE t1 DROP COLUMN c2;; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'now WAIT_FOR bf_started'; +KILL ID; +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +KILL QUERY ID; +ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL bf_continue'; +connection con1; +SET DEBUG_SYNC = 'RESET'; +SELECT * FROM t1; +c1 +1 +connection node_1; +DROP TABLE t1; +disconnect con1; diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test index 88ec55ed0c1..eb05551b334 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.test +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -17,21 +17,21 @@ SET GLOBAL wsrep_slave_threads=2; --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1` --replace_result $applier_thread ID ---error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--error ER_KILL_DENIED_HIGH_PRIORITY --eval KILL $applier_thread --replace_result $applier_thread ID ---error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--error ER_KILL_DENIED_HIGH_PRIORITY --eval KILL QUERY $applier_thread --let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` --replace_result $aborter_thread ID ---error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--error ER_KILL_DENIED_HIGH_PRIORITY --eval KILL $aborter_thread --replace_result $aborter_thread ID ---error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--error ER_KILL_DENIED_HIGH_PRIORITY --eval KILL QUERY $aborter_thread SET GLOBAL wsrep_slave_threads=DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_kill_bf.test b/mysql-test/suite/galera/t/galera_kill_bf.test new file mode 100644 index 00000000000..7a5d2ef512a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_kill_bf.test @@ -0,0 +1,41 @@ +--source include/galera_cluster.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1 + +call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); + +CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB; +INSERT into t1 values (1,1); + +SET DEBUG_SYNC = 'alter_table_after_open_tables SIGNAL bf_started WAIT_FOR bf_continue'; +--send ALTER TABLE t1 DROP COLUMN c2; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'now WAIT_FOR bf_started'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_after_open_tables' +--source include/wait_condition.inc + +--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%' LIMIT 1` + +--replace_result $applier_thread ID +--error ER_KILL_DENIED_HIGH_PRIORITY +--eval KILL $applier_thread + +--replace_result $applier_thread ID +--error ER_KILL_DENIED_HIGH_PRIORITY +--eval KILL QUERY $applier_thread + +--connection node_1 +SET DEBUG_SYNC = 'now SIGNAL bf_continue'; + +--connection con1 +--reap +SET DEBUG_SYNC = 'RESET'; +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +--disconnect con1 diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 13642a62c73..9c9b9ea734f 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -9111,3 +9111,5 @@ ER_NOT_ALLOWED_IN_THIS_CONTEXT eng "'%-.128s' is not allowed in this context" ER_DATA_WAS_COMMITED_UNDER_ROLLBACK eng "Engine %s does not support rollback. Changes were committed during rollback call" +ER_KILL_DENIED_HIGH_PRIORITY + eng "This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 559af2fc813..96aad2e01bf 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9415,17 +9415,21 @@ kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from concurrent usage -#ifdef WITH_WSREP - if (((thd->security_ctx->master_access & PRIV_KILL_OTHER_USER_PROCESS) || - thd->security_ctx->user_matches(tmp->security_ctx)) && - !wsrep_thd_is_BF(tmp, false) && !tmp->wsrep_applier) -#else if ((thd->security_ctx->master_access & PRIV_KILL_OTHER_USER_PROCESS) || thd->security_ctx->user_matches(tmp->security_ctx)) -#endif /* WITH_WSREP */ { - { #ifdef WITH_WSREP + if (wsrep_thd_is_BF(tmp, false) || tmp->wsrep_applier) + { + error= ER_KILL_DENIED_HIGH_PRIORITY; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_KILL_DENIED_HIGH_PRIORITY, + "Thread %lld is %s and cannot be killed", + tmp->thread_id, + (tmp->wsrep_applier ? "wsrep applier" : "high priority")); + } + else + { if (WSREP(tmp)) { /* Object tmp is not guaranteed to exist after wsrep_kill_thd() @@ -9435,7 +9439,9 @@ kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type #endif /* WITH_WSREP */ tmp->awake_no_mutex(kill_signal); error= 0; +#ifdef WITH_WSREP } +#endif /* WITH_WSREP */ } else error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR : @@ -9565,7 +9571,9 @@ void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) thd->send_kill_message(); } else + { my_error(error, MYF(0), id); + } } From 2f0e7f665c6ed45a935fdf8935b80e9ef3d90746 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 14 Jun 2024 15:31:39 +0200 Subject: [PATCH 18/85] galera: syncing SST scripts code with the following versions --- scripts/wsrep_sst_common.sh | 31 +++++++++++++------------------ scripts/wsrep_sst_mariabackup.sh | 4 +--- scripts/wsrep_sst_mysqldump.sh | 6 ++---- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 14e058cecee..b6b8c0501c8 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -152,7 +152,6 @@ WSREP_SST_OPT_DATA="" WSREP_SST_OPT_AUTH="${WSREP_SST_OPT_AUTH:-}" WSREP_SST_OPT_USER="${WSREP_SST_OPT_USER:-}" WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_PSWD:-}" -WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}" WSREP_SST_OPT_DEFAULT="" WSREP_SST_OPT_DEFAULTS="" WSREP_SST_OPT_EXTRA_DEFAULT="" @@ -1008,11 +1007,6 @@ in_config() echo $found } -wsrep_auth_not_set() -{ - [ -z "$WSREP_SST_OPT_AUTH" ] -} - # Get rid of incorrect values resulting from substitution # in programs external to the script: if [ "$WSREP_SST_OPT_USER" = '(null)' ]; then @@ -1028,12 +1022,12 @@ fi # Let's read the value of the authentication string from the # configuration file so that it does not go to the command line # and does not appear in the ps output: -if wsrep_auth_not_set; then +if [ -z "$WSREP_SST_OPT_AUTH" ]; then WSREP_SST_OPT_AUTH=$(parse_cnf 'sst' 'wsrep-sst-auth') fi # Splitting WSREP_SST_OPT_AUTH as "user:password" pair: -if ! wsrep_auth_not_set; then +if [ -n "$WSREP_SST_OPT_AUTH" ]; then # Extract username as shortest prefix up to first ':' character: WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}" if [ -z "$WSREP_SST_OPT_USER" ]; then @@ -1057,19 +1051,20 @@ if ! wsrep_auth_not_set; then fi fi +WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}" +WSREP_SST_OPT_REMOTE_USER= +WSREP_SST_OPT_REMOTE_PSWD= +if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then + # Split auth string at the last ':' + WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}" + WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}" +fi + readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_PSWD readonly WSREP_SST_OPT_AUTH - -if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then - # Split auth string at the last ':' - readonly WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}" - readonly WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}" -else - readonly WSREP_SST_OPT_REMOTE_USER= - readonly WSREP_SST_OPT_REMOTE_PSWD= -fi - +readonly WSREP_SST_OPT_REMOTE_USER +readonly WSREP_SST_OPT_REMOTE_PSWD readonly WSREP_SST_OPT_REMOTE_AUTH if [ -n "$WSREP_SST_OPT_DATA" ]; then diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 2cae93ed694..6eea14df5d2 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -1100,15 +1100,13 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then wsrep_log_info "Using '$itmpdir' as mariadb-backup working directory" - usrst=0 if [ -n "$WSREP_SST_OPT_USER" ]; then INNOEXTRA="$INNOEXTRA --user='$WSREP_SST_OPT_USER'" - usrst=1 fi if [ -n "$WSREP_SST_OPT_PSWD" ]; then export MYSQL_PWD="$WSREP_SST_OPT_PSWD" - elif [ $usrst -eq 1 ]; then + elif [ -n "$WSREP_SST_OPT_USER" ]; then # Empty password, used for testing, debugging etc. unset MYSQL_PWD fi diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 5bd2e9ff656..a06231424b5 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -40,17 +40,15 @@ then fi # Check client version -if ! $MYSQL_CLIENT --version | grep -q -E 'Distrib 10\.[1-9]'; then +if ! $MYSQL_CLIENT --version | grep -q -E '(Distrib 10\.[1-9])|( from 1[1-9]\.)'; then $MYSQL_CLIENT --version >&2 wsrep_log_error "this operation requires MySQL client version 10.1 or newer" exit $EINVAL fi AUTH="" -usrst=0 if [ -n "$WSREP_SST_OPT_USER" ]; then AUTH="-u$WSREP_SST_OPT_USER" - usrst=1 fi # Refs https://github.com/codership/mysql-wsrep/issues/141 @@ -64,7 +62,7 @@ fi # word, it is arguably more secure than passing password on the command line. if [ -n "$WSREP_SST_OPT_PSWD" ]; then export MYSQL_PWD="$WSREP_SST_OPT_PSWD" -elif [ $usrst -eq 1 ]; then +elif [ -n "$WSREP_SST_OPT_USER" ]; then # Empty password, used for testing, debugging etc. unset MYSQL_PWD fi From f9e717cb4807941d49c87645f37da2ee870d850d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Jun 2024 15:08:19 +0300 Subject: [PATCH 19/85] MDEV-34426: Assertion failure on bootstrap Let us relax an assertion that would fail in ./mtr main.1st --mysqld=--innodb-undo-tablespaces=127 --- storage/innobase/buf/buf0buf.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 436ac5ece32..21a8818afb6 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2598,9 +2598,12 @@ buf_page_get_gen( recovery may be in progress. The only case when it may be invoked outside recovery is when dict_create() has initialized a new database and is invoking dict_boot(). In this case, the - LSN will be small. */ + LSN will be small. At the end of a bootstrap, the shutdown LSN + would typically be around 60000 with the default + innodb_undo_tablespaces=3, and less than 110000 with the maximum + innodb_undo_tablespaces=127. */ ut_ad(mode == BUF_GET_RECOVER - ? recv_recovery_is_on() || log_sys.get_lsn() < 50000 + ? recv_recovery_is_on() || log_sys.get_lsn() < 120000 : !recv_recovery_is_on() || recv_sys.after_apply); ut_ad(!mtr || mtr->is_active()); ut_ad(mtr || mode == BUF_PEEK_IF_IN_POOL); From ee974ca5e0f00e928873179c5dfc2f040ab5aefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 13 May 2024 08:55:36 +0300 Subject: [PATCH 20/85] MDEV-31658 : Deadlock found when trying to get lock during applying Problem was that there was two non-conflicting local idle transactions in node_1 that both inserted a key to primary key. Then two transactions from other nodes inserted also a key to primary key so that insert from node_2 conflicted one of the local transactions in node_1 so that there would be duplicate key if both are committed. For this insert from other node tries to acquire S-lock for this record and because this insert is high priority brute force (BF) transaction it will kill idle local transaction. Concurrently, second insert from node_3 conflicts the second idle insert transaction in node_1. Again, it tries to acquire S-lock for this record and kills idle local transaction. At this point we have two non-conflicting high priority transactions holding S-lock on different records in node_1. For example like this: rec s-lock-node2-rec s-lock-node3-rec rec. Because these high priority BF-transactions do not wait each other insert from node3 that has later seqno compared to insert from node2 can continue. It will try to acquire insert intention for record it tries to insert (to avoid duplicate key to be inserted by local transaction). Hower, it will note that there is conflicting S-lock in same gap between records. This will lead deadlock error as we have defined that BF-transactions may not wait for record lock but we can't kill conflicting BF-transaction because it has lower seqno and it should commit first. BF-transactions are executed concurrently because their values to primary key are different i.e. they do not conflict. Galera certification will make sure that inserts from other nodes i.e these high priority BF-transactions can't insert duplicate keys. Local transactions naturally can but they will be killed when BF-transaction acquires required record locks. Therefore, we can allow situation where there is conflicting S-lock and insert intention lock regardless of their seqno order and let both continue with no wait. This will lead to situation where we need to allow BF-transaction to wait when lock_rec_has_to_wait_in_queue is called because this function is also called from lock_rec_queue_validate and because lock is waiting there would be assertion in ut_a(lock->is_gap() || lock_rec_has_to_wait_in_queue(cell, lock)); lock_wait_wsrep_kill Add debug sync points for BF-transactions killing local transaction. wsrep_assert_no_bf_bf_wait Print also requested lock information lock_rec_has_to_wait Add function to handle wsrep transaction lock wait cases. lock_rec_has_to_wait_wsrep New function to handle wsrep transaction lock wait exceptions. lock_rec_has_to_wait_in_queue Remove wsrep exception, in this function all conflicting locks need to wait in queue. Conflicts between BF and local transactions are handled in lock_wait. Signed-off-by: Julius Goryavsky --- .../r/galera_duplicate_primary_value.result | 68 ++++++++++ .../t/galera_duplicate_primary_value.cnf | 19 +++ .../t/galera_duplicate_primary_value.test | 81 ++++++++++++ sql/service_wsrep.cc | 29 +++-- storage/innobase/handler/ha_innodb.cc | 19 +++ storage/innobase/lock/lock0lock.cc | 122 +++++++++++++----- 6 files changed, 292 insertions(+), 46 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/r/galera_duplicate_primary_value.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test diff --git a/mysql-test/suite/galera_3nodes/r/galera_duplicate_primary_value.result b/mysql-test/suite/galera_3nodes/r/galera_duplicate_primary_value.result new file mode 100644 index 00000000000..c1d69efaf6f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_duplicate_primary_value.result @@ -0,0 +1,68 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1d, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1e, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1(a int not null primary key auto_increment, b int) engine=innodb; +INSERT INTO t1(b) VALUES (1); +connection node_1c; +begin; +insert into t1 values (2,2); +connection node_1d; +begin; +insert into t1 values (3,3); +connection node_1a; +SET GLOBAL DEBUG_DBUG='+d,wsrep_after_kill'; +connection node_2; +insert into t1 values (2,6); +connection node_1a; +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC='now WAIT_FOR wsrep_after_kill_reached'; +SET GLOBAL DEBUG_DBUG=''; +SET GLOBAL DEBUG_DBUG='+d,wsrep_after_kill_2'; +connection node_3; +insert into t1 values (3,9); +connection node_1a; +SET DEBUG_SYNC='now WAIT_FOR wsrep_after_kill_reached_2'; +SET GLOBAL DEBUG_DBUG=''; +SET DEBUG_SYNC='now SIGNAL wsrep_after_kill_continue'; +connection node_1c; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1a; +SET GLOBAL DEBUG_DBUG=''; +SET DEBUG_SYNC='now SIGNAL wsrep_after_kill_continue_2'; +connection node_1d; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2; +SELECT * from t1; +a b +1 1 +2 6 +3 9 +connection node_3; +SELECT * from t1; +a b +1 1 +2 6 +3 9 +connection node_1a; +SET DEBUG_SYNC = reset; +connection node_1e; +set debug_sync = reset; +connection node_1; +SELECT * from t1; +a b +1 1 +2 6 +3 9 +disconnect node_1a; +disconnect node_1b; +disconnect node_1c; +disconnect node_1d; +disconnect node_1e; +drop table t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.cnf b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.cnf new file mode 100644 index 00000000000..862997d2afd --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.cnf @@ -0,0 +1,19 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep-debug=SERVER +loose-wsrep-duplicate-primary-value=1 +wsrep-auto-increment-control=OFF +auto-increment-offset=1 + +[mysqld.2] +wsrep-debug=SERVER +loose-wsrep-duplicate-primary-value=1 +wsrep-auto-increment-control=OFF +auto-increment-offset=1 + +[mysqld.3] +wsrep-debug=SERVER +loose-wsrep-duplicate-primary-value=1 +wsrep-auto-increment-control=OFF +auto-increment-offset=1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test new file mode 100644 index 00000000000..49ddb31d2d7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test @@ -0,0 +1,81 @@ +--source include/galera_cluster.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/big_test.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1d, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1e, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +CREATE TABLE t1(a int not null primary key auto_increment, b int) engine=innodb; +INSERT INTO t1(b) VALUES (1); + +--connection node_1c +begin; +insert into t1 values (2,2); + +--connection node_1d +begin; +insert into t1 values (3,3); + +--connection node_1a +SET GLOBAL DEBUG_DBUG='+d,wsrep_after_kill'; + +--connection node_2 +insert into t1 values (2,6); + +--connection node_1a +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC='now WAIT_FOR wsrep_after_kill_reached'; +SET GLOBAL DEBUG_DBUG=''; +SET GLOBAL DEBUG_DBUG='+d,wsrep_after_kill_2'; + +--connection node_3 +insert into t1 values (3,9); + +--connection node_1a +SET DEBUG_SYNC='now WAIT_FOR wsrep_after_kill_reached_2'; +SET GLOBAL DEBUG_DBUG=''; +SET DEBUG_SYNC='now SIGNAL wsrep_after_kill_continue'; + +--connection node_1c +--error 1213 +COMMIT; + +--connection node_1a +SET GLOBAL DEBUG_DBUG=''; +SET DEBUG_SYNC='now SIGNAL wsrep_after_kill_continue_2'; + +--connection node_1d +--error 1213 +COMMIT; + +--connection node_2 +SELECT * from t1; + +--connection node_3 +SELECT * from t1; + +--connection node_1a +SET DEBUG_SYNC = reset; + +--connection node_1e +set debug_sync = reset; + +--connection node_1 +SELECT * from t1; + +--disconnect node_1a +--disconnect node_1b +--disconnect node_1c +--disconnect node_1d +--disconnect node_1e + +drop table t1; diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index f8c6ddaa28b..22ae84aa353 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -249,18 +249,23 @@ extern "C" my_bool wsrep_thd_skip_locking(const THD *thd) extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right) { - if (wsrep_thd_is_BF(left, false) && - wsrep_thd_is_BF(right, false) && - wsrep_thd_trx_seqno(left) < wsrep_thd_trx_seqno(right)) { - WSREP_DEBUG("BF conflict, order: %lld %lld\n", - (long long)wsrep_thd_trx_seqno(left), - (long long)wsrep_thd_trx_seqno(right)); - return TRUE; - } - WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n", - (long long)wsrep_thd_trx_seqno(left), - (long long)wsrep_thd_trx_seqno(right)); - return FALSE; + my_bool before= (wsrep_thd_is_BF(left, false) && + wsrep_thd_is_BF(right, false) && + wsrep_thd_trx_seqno(left) < wsrep_thd_trx_seqno(right)); + + WSREP_DEBUG("wsrep_thd_order_before: %s thread=%llu seqno=%llu query=%s " + "%s %s thread=%llu, seqno=%llu query=%s", + (wsrep_thd_is_BF(left, false) ? "BF" : "def"), + thd_get_thread_id(left), + wsrep_thd_trx_seqno(left), + wsrep_thd_query(left), + (before ? " TRUE " : " FALSE "), + (wsrep_thd_is_BF(right, false) ? "BF" : "def"), + thd_get_thread_id(right), + wsrep_thd_trx_seqno(right), + wsrep_thd_query(right)); + + return before; } /** Check if wsrep transaction is aborting state. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d878d699510..d29681bbcbd 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18738,6 +18738,25 @@ void lock_wait_wsrep_kill(trx_t *bf_trx, ulong thd_id, trx_id_t trx_id) wsrep_thd_UNLOCK(vthd); wsrep_thd_kill_UNLOCK(vthd); } + +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF( + "wsrep_after_kill", + {const char act[]= + "now " + "SIGNAL wsrep_after_kill_reached " + "WAIT_FOR wsrep_after_kill_continue"; + DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act))); + };); + DBUG_EXECUTE_IF( + "wsrep_after_kill_2", + {const char act2[]= + "now " + "SIGNAL wsrep_after_kill_reached_2 " + "WAIT_FOR wsrep_after_kill_continue_2"; + DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act2))); + };); +#endif /* ENABLED_DEBUG_SYNC*/ } /** This function forces the victim transaction to abort. Aborting the diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 9d268d80f73..4d0ac5ccc04 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -503,8 +503,10 @@ this BF-BF wait correct and if not report BF wait and assert. @param[in] lock_rec other waiting record lock @param[in] trx trx requesting conflicting record lock +@param[in] type_mode lock type mode of requesting trx */ -static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx) +static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, + const unsigned type_mode = LOCK_NONE) { ut_ad(!lock->is_table()); lock_sys.assert_locked(*lock); @@ -546,6 +548,15 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx) return; } + if (type_mode != LOCK_NONE) + ib::error() << " Requested lock " + << ((type_mode & LOCK_TABLE) ? "on table " : " on record ") + << ((type_mode & LOCK_WAIT) ? " WAIT " : " ") + << ((type_mode & LOCK_GAP) ? " GAP " : " ") + << ((type_mode & LOCK_REC_NOT_GAP) ? " RECORD " : " ") + << ((type_mode & LOCK_INSERT_INTENTION) ? " INSERT INTENTION " : " ") + << ((type_mode & LOCK_X) ? " LOCK_X " : " LOCK_S "); + mtr_t mtr; ib::error() << "Conflicting lock on table: " @@ -582,6 +593,80 @@ ATTRIBUTE_NOINLINE static bool wsrep_is_BF_lock_timeout(const trx_t &trx) << " query: " << wsrep_thd_query(trx.mysql_thd); return true; } + +/** Checks if a lock request for a new lock has to wait for request + lock2 in Galera. +@param trx trx of new lock +@param type_mode precise mode of the new lock + to set: LOCK_S or LOCK_X, possibly + ORed to LOCK_GAP or LOCK_REC_NOT_GAP, + LOCK_INSERT_INTENTION. +@param lock2 another record lock; NOTE that + it is assumed that this has a lock bit + set on the same record as in the new + lock we are setting. +@return TRUE if new lock has to wait for lock2 to be removed */ + +ATTRIBUTE_NOINLINE ATTRIBUTE_COLD +bool lock_rec_has_to_wait_wsrep(const trx_t *trx, + const unsigned type_mode, + const lock_t *lock2) +{ + const trx_t* trx2= lock2->trx; + + if (trx->is_wsrep_UK_scan() && + wsrep_thd_is_BF(trx2->mysql_thd, false)) + { + /* New lock request from a transaction is using unique key + scan and this transaction is a wsrep high priority transaction + (brute force). If conflicting transaction is also wsrep high + priority transaction we should avoid lock conflict because + ordering of these transactions is already decided and + conflicting transaction will be later replayed. */ + + return false; + } + + if (wsrep_thd_is_BF(trx->mysql_thd, false) && + wsrep_thd_is_BF(trx2->mysql_thd, false)) + { + /* Both transactions are high priority transactions. */ + + if (((type_mode & LOCK_S) && lock2->is_insert_intention()) || + ((type_mode & LOCK_INSERT_INTENTION) && lock2->mode() == LOCK_S)) + { + ut_ad(!wsrep_thd_is_local(trx->mysql_thd)); + ut_ad(!wsrep_thd_is_local(trx2->mysql_thd)); + + /* High priority applier transaction might take S-locks to + conflicting primary/unique key records and those local + transactions are BF-killed. However, these S-locks + are released at commit time. Therefore, high priority + applier transaction when requesting insert intention (II-lock) + lock for primary/unique index might notice conflicting + S-lock. Certification makes sure that applier transactions + do not insert duplicate keys and so we can allow + S-lock and II-lock. */ + return false; + } + + if (wsrep_thd_order_before(trx->mysql_thd, trx2->mysql_thd)) + { + /* If two high priority threads have lock conflict, we look at the + order of these transactions and honor the earlier transaction. */ + + return false; + } + + /* We very well can let bf to wait normally as other + BF will be replayed in case of conflict. For debug + builds we will do additional sanity checks to catch + unsupported bf wait if any. */ + ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx, type_mode)); + } + + return true; +} #endif /* WITH_WSREP */ /*********************************************************************//** @@ -691,31 +776,8 @@ lock_rec_has_to_wait( #endif /* HAVE_REPLICATION */ #ifdef WITH_WSREP - /* New lock request from a transaction is using unique key - scan and this transaction is a wsrep high priority transaction - (brute force). If conflicting transaction is also wsrep high - priority transaction we should avoid lock conflict because - ordering of these transactions is already decided and - conflicting transaction will be later replayed. */ - if (trx->is_wsrep_UK_scan() - && wsrep_thd_is_BF(lock2->trx->mysql_thd, false)) { - return false; - } - - /* if BF-BF conflict, we have to look at write set order */ - if (trx->is_wsrep() && - (type_mode & LOCK_MODE_MASK) == LOCK_X && - (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X && - wsrep_thd_order_before(trx->mysql_thd, - lock2->trx->mysql_thd)) { - return false; - } - - /* We very well can let bf to wait normally as other - BF will be replayed in case of conflict. For debug - builds we will do additional sanity checks to catch - unsupported bf wait if any. */ - ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx)); + if (trx->is_wsrep()) + return lock_rec_has_to_wait_wsrep(trx, type_mode, lock2); #endif /* WITH_WSREP */ return true; @@ -1766,14 +1828,6 @@ lock_rec_has_to_wait_in_queue(const hash_cell_t &cell, const lock_t *wait_lock) if (heap_no < lock_rec_get_n_bits(lock) && (p[bit_offset] & bit_mask) && lock_has_to_wait(wait_lock, lock)) { -#ifdef WITH_WSREP - if (lock->trx->is_wsrep() && - wsrep_thd_order_before(wait_lock->trx->mysql_thd, - lock->trx->mysql_thd)) { - /* don't wait for another BF lock */ - continue; - } -#endif return(lock); } } From 8c8b3ab784b884754efae8182539e1c8752831d2 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Wed, 19 Jun 2024 09:47:37 -0600 Subject: [PATCH 21/85] MDEV-34274: Test rpl.rpl_change_master_demote frequently fails on buildbot with "IO thread should not be running..." The test rpl.rpl_change_master_demote used a `sleep 1` command to give time for a START SLAVE UNTIL to start the slave threads and wait for them to automatically die by UNTIL. On machines with heavy load (especially MSAN bb builders), one second was not enough, and the test would fail due to the IO thread still being up. This patch fixes the test by replacing the sleep with specific conditions to wait for. The test cannot wait for the IO or SQL threads to start, as it would be possible that they would be started and stopped by the time the MTR executor would check the slave status. So instead, we test for proof that they existed via the Connections status variable being incremented by at least 2 (Connections just shows the global thread id). At this point, we still can't use the wait_for_slave_to_stop helper, as the SQL/IO_Running fields of SHOW SLAVE STATUS may not be updated yet. So instead, we use information_schema.processlist, which would show the presence of the Slave_SQL/IO threads. So to "wait for the slave to stop", we wait for the Slave_SQL/IO threads to be gone from the processlist. --- .../rpl/r/rpl_change_master_demote.result | 3 +++ .../suite/rpl/t/rpl_change_master_demote.test | 21 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_change_master_demote.result b/mysql-test/suite/rpl/r/rpl_change_master_demote.result index 2114ac4a208..dc6e5c2ffee 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master_demote.result +++ b/mysql-test/suite/rpl/r/rpl_change_master_demote.result @@ -500,6 +500,9 @@ START SLAVE UNTIL master_gtid_pos="ssu_middle_binlog_pos"; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mariadbd restart # Slave needs time to start and stop automatically +# Waiting for both SQL and IO threads to have started.. +# Waiting for SQL thread to be killed.. +# Waiting for IO thread to be killed.. # Validating neither SQL nor IO threads are running.. # ..success # Clean slave state of master diff --git a/mysql-test/suite/rpl/t/rpl_change_master_demote.test b/mysql-test/suite/rpl/t/rpl_change_master_demote.test index 6304d3526d1..9754b03f1cc 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master_demote.test +++ b/mysql-test/suite/rpl/t/rpl_change_master_demote.test @@ -276,14 +276,27 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER --echo # binlog position and should still succeed despite the SSU stop --echo # position pointing to a previous event (because --echo # master_demote_to_slave=1 merges gtid_binlog_pos into gtid_slave_pos). + +--let $pre_start_slave_thread_count= query_get_value(SHOW STATUS LIKE 'Connections', Value, 1) + --replace_result $ssu_middle_binlog_pos ssu_middle_binlog_pos eval START SLAVE UNTIL master_gtid_pos="$ssu_middle_binlog_pos"; --echo # Slave needs time to start and stop automatically -# Note sync_with_master_gtid.inc, wait_for_slave_to_start.inc, and -# wait_for_slave_to_stop.inc won't work due to replication state and race -# conditions ---sleep 1 +--echo # Waiting for both SQL and IO threads to have started.. +--let $expected_cons_after_start_slave= `SELECT ($pre_start_slave_thread_count + 2)` +--let $status_var= Connections +--let $status_var_value= $expected_cons_after_start_slave +--let $status_var_comparsion= >= +--source include/wait_for_status_var.inc +--let $status_var_comparsion= + +--echo # Waiting for SQL thread to be killed.. +--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_SQL" +--source include/wait_condition.inc +--echo # Waiting for IO thread to be killed.. +--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_IO" +--source include/wait_condition.inc --echo # Validating neither SQL nor IO threads are running.. --let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1) From 5d49a2add70123fa3a54db4c1e48b9246d2f208d Mon Sep 17 00:00:00 2001 From: Iaroslav Babanin Date: Wed, 15 May 2024 17:42:08 +0300 Subject: [PATCH 22/85] MDEV-33935 fix deadlock counter - The deadlock counter was moved from Deadlock::find_cycle into Deadlock::report, because the find_cycle method is called multiple times during deadlock detection flow, which means it shouldn't have such side effects. But report() can, which called only once for a victim transaction. - Also the deadlock_detect.test and *.result test case has been extended to handle the fix. --- .../suite/innodb/r/deadlock_detect.result | 8 +++++++ .../suite/innodb/t/deadlock_detect.test | 21 +++++++++++++++++-- storage/innobase/include/srv0srv.h | 1 - storage/innobase/lock/lock0lock.cc | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/deadlock_detect.result b/mysql-test/suite/innodb/r/deadlock_detect.result index 8131585aea2..284556e56c9 100644 --- a/mysql-test/suite/innodb/r/deadlock_detect.result +++ b/mysql-test/suite/innodb/r/deadlock_detect.result @@ -3,7 +3,12 @@ CREATE TABLE t1( id INT, PRIMARY KEY(id) ) ENGINE=InnoDB; +CREATE TABLE dl( +id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, +cnt INT UNSIGNED +) ENGINE=InnoDB; INSERT INTO t1 VALUES(1), (2), (3); +INSERT INTO dl(cnt) SELECT variable_value FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_deadlocks'; BEGIN; SELECT * FROM t1 WHERE id = 1 LOCK IN SHARE MODE; connect con1,localhost,root,,; @@ -20,5 +25,8 @@ disconnect con1; ROLLBACK; disconnect con2; connection default; +'Deadlock counter is valid'; +1 ROLLBACK; DROP TABLE t1; +DROP TABLE dl; diff --git a/mysql-test/suite/innodb/t/deadlock_detect.test b/mysql-test/suite/innodb/t/deadlock_detect.test index e853790755a..a84e6fc328f 100644 --- a/mysql-test/suite/innodb/t/deadlock_detect.test +++ b/mysql-test/suite/innodb/t/deadlock_detect.test @@ -14,7 +14,14 @@ CREATE TABLE t1( PRIMARY KEY(id) ) ENGINE=InnoDB; +CREATE TABLE dl( + id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, + cnt INT UNSIGNED +) ENGINE=InnoDB; + INSERT INTO t1 VALUES(1), (2), (3); +# Preserve the initial value of the deadlock counter +INSERT INTO dl(cnt) SELECT variable_value FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_deadlocks'; # We are not interested query results, only errors --disable_result_log @@ -61,6 +68,7 @@ disconnect con2; # and does the update. # connection default; +--let $valid_deadlock_cnt= 1 if (!$have_deadlock) { --error 0,ER_LOCK_WAIT_TIMEOUT reap; @@ -68,12 +76,21 @@ reap; if ($have_deadlock) { --error 0,ER_LOCK_DEADLOCK reap; +--disable_query_log +INSERT INTO dl(cnt) SELECT variable_value FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_deadlocks'; +set @init_deadlock_cnt = (SELECT min(k.cnt) FROM dl k); +--let $valid_deadlock_cnt= `SELECT (max(t.cnt-@init_deadlock_cnt) = 1) FROM dl t` +--enable_query_log } +# Indicates that the deadlock counter works well. +# Use the default =1 where is no deadlock detection, +# to enable unconditional check. +--echo 'Deadlock counter is valid'; +--echo $valid_deadlock_cnt ROLLBACK; --enable_result_log - DROP TABLE t1; - +DROP TABLE dl; --source include/wait_until_count_sessions.inc diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index dc0546ac0f3..4c3c17a1a16 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -668,7 +668,6 @@ struct export_var_t{ ulint innodb_data_reads; /*!< I/O read requests */ ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */ - ulint innodb_deadlocks; ulint innodb_history_list_length; ulint innodb_log_waits; /*!< srv_log_waits */ ulint innodb_log_write_requests; /*!< srv_log_write_requests */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 4d0ac5ccc04..3e3d573ba5b 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -296,7 +296,6 @@ namespace Deadlock if (tortoise == hare) { ut_ad(l > 1); - lock_sys.deadlocks++; /* Note: Normally, trx should be part of any deadlock cycle that is found. However, if innodb_deadlock_detect=OFF had been in effect in the past, it is possible that trx will be waiting @@ -6825,6 +6824,7 @@ and less modified rows. Bit 0 is used to prefer orig_trx in case of a tie. if (!cycle) goto func_exit; /* One of the transactions was already aborted. */ + lock_sys.deadlocks++; victim= cycle; undo_no_t victim_weight= calc_victim_weight(victim, trx); unsigned victim_pos= l; From 2d8d813941d3ad34c7ab8264f92e864d7ac9ce30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 16 Jun 2024 14:00:39 +0300 Subject: [PATCH 23/85] cleanup, refactor Fix coding style and extract common password reset counter code into separate ACL_USER method. --- sql/sql_acl.cc | 54 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f91151c7fb5..e58fb5f4870 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -256,6 +256,28 @@ public: return compare_hostname(&host, host2, ip2 ? ip2 : host2); } + + enum PASSWD_ERROR_ACTION + { + PASSWD_ERROR_CLEAR, + PASSWD_ERROR_INCREMENT + }; + + inline void update_password_errors(PASSWD_ERROR_ACTION action) + { + switch (action) + { + case PASSWD_ERROR_INCREMENT: + password_errors++; + break; + case PASSWD_ERROR_CLEAR: + password_errors= 0; + break; + default: + DBUG_ASSERT(0); + break; + } + } }; class ACL_ROLE :public ACL_USER_BASE @@ -14267,34 +14289,17 @@ static int do_auth_once(THD *thd, const LEX_CSTRING *auth_plugin_name, return res; } -enum PASSWD_ERROR_ACTION -{ - PASSWD_ERROR_CLEAR, - PASSWD_ERROR_INCREMENT -}; /* Increment, or clear password errors for a user. */ -static void handle_password_errors(const char *user, const char *hostname, PASSWD_ERROR_ACTION action) +static void handle_password_errors(const char *user, const char *hostname, + ACL_USER::PASSWD_ERROR_ACTION action) { #ifndef NO_EMBEDDED_ACCESS_CHECKS mysql_mutex_assert_not_owner(&acl_cache->lock); mysql_mutex_lock(&acl_cache->lock); ACL_USER *u = find_user_exact(hostname, user); if (u) - { - switch(action) - { - case PASSWD_ERROR_INCREMENT: - u->password_errors++; - break; - case PASSWD_ERROR_CLEAR: - u->password_errors= 0; - break; - default: - DBUG_ASSERT(0); - break; - } - } + u->update_password_errors(action); mysql_mutex_unlock(&acl_cache->lock); #endif } @@ -14442,7 +14447,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) case CR_AUTH_USER_CREDENTIALS: errors.m_authentication= 1; if (thd->password && !mpvio.make_it_fail) - handle_password_errors(acl_user->user.str, acl_user->host.hostname, PASSWD_ERROR_INCREMENT); + handle_password_errors(acl_user->user.str, acl_user->host.hostname, + ACL_USER::PASSWD_ERROR_INCREMENT); break; case CR_ERROR: default: @@ -14460,7 +14466,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) if (thd->password && acl_user->password_errors) { /* Login succeeded, clear password errors.*/ - handle_password_errors(acl_user->user.str, acl_user->host.hostname, PASSWD_ERROR_CLEAR); + handle_password_errors(acl_user->user.str, acl_user->host.hostname, + ACL_USER::PASSWD_ERROR_CLEAR); } if (initialized) // if not --skip-grant-tables @@ -14479,7 +14486,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) DBUG_RETURN(1); } - if (acl_user->account_locked) { + if (acl_user->account_locked) + { status_var_increment(denied_connections); my_error(ER_ACCOUNT_HAS_BEEN_LOCKED, MYF(0)); DBUG_RETURN(1); From 6382339144256a3668b7c0102e10353b46203659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 16 Jun 2024 14:01:36 +0300 Subject: [PATCH 24/85] MDEV-34311: Alter USER should reset all account limit counters This commit introduces a reset of password errors counter on any alter user command for the altered user. This is done so as to not require a complete privilege system reload. --- mysql-test/main/max_password_errors.result | 23 +++++++++++++++---- mysql-test/main/max_password_errors.test | 26 ++++++++++++++++++++-- sql/share/errmsg-utf8.txt | 6 ++--- sql/sql_acl.cc | 5 ++++- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/mysql-test/main/max_password_errors.result b/mysql-test/main/max_password_errors.result index 020761b4f2e..9ee7d0d448d 100644 --- a/mysql-test/main/max_password_errors.result +++ b/mysql-test/main/max_password_errors.result @@ -9,10 +9,10 @@ connect con1, localhost, u, bad_pass; ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) connect(localhost,u,good_pass,test,MASTER_PORT,MASTER_SOCKET); connect con1, localhost, u, good_pass; -ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +ERROR HY000: User is blocked because of too many credential errors; unblock with 'ALTER USER / FLUSH PRIVILEGES' connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET); connect con1, localhost, u, bad_pass; -ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +ERROR HY000: User is blocked because of too many credential errors; unblock with 'ALTER USER / FLUSH PRIVILEGES' FLUSH PRIVILEGES; connect con1, localhost, u, good_pass; disconnect con1; @@ -27,7 +27,7 @@ ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) connect con1, localhost, u, good_pass; ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) -ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +ERROR HY000: User is blocked because of too many credential errors; unblock with 'ALTER USER / FLUSH PRIVILEGES' disconnect con1; connection default; FLUSH PRIVILEGES; @@ -40,6 +40,21 @@ ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) connect con1, localhost, u, good_pass; disconnect con1; connection default; +connect(localhost,u,bad_password,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_password; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect(localhost,u,bad_password,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_password; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect(localhost,u,good_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, good_pass; +ERROR HY000: User is blocked because of too many credential errors; unblock with 'ALTER USER / FLUSH PRIVILEGES' +ALTER USER u ACCOUNT UNLOCK; +connect(localhost,u,bad_password,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_password; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect con1, localhost, u, good_pass; +disconnect con1; +connection default; DROP USER u; -FLUSH PRIVILEGES; set global max_password_errors=@old_max_password_errors; diff --git a/mysql-test/main/max_password_errors.test b/mysql-test/main/max_password_errors.test index 1debca0258d..3642746e83f 100644 --- a/mysql-test/main/max_password_errors.test +++ b/mysql-test/main/max_password_errors.test @@ -59,6 +59,28 @@ connect (con1, localhost, root, bad_pass); connect (con1, localhost, u, good_pass); disconnect con1; connection default; + +# Block u again +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect(con1, localhost, u, bad_password); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect(con1, localhost, u, bad_password); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_USER_IS_BLOCKED; +connect(con1, localhost, u, good_pass); + +# Unblock foo +ALTER USER u ACCOUNT UNLOCK; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect(con1, localhost, u, bad_password); + +connect(con1, localhost, u, good_pass); +disconnect con1; +connection default; + DROP USER u; -FLUSH PRIVILEGES; -set global max_password_errors=@old_max_password_errors; \ No newline at end of file +set global max_password_errors=@old_max_password_errors; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 9e2211eb4f0..76a26c6b700 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -9922,9 +9922,9 @@ ER_BACKUP_UNKNOWN_STAGE eng "Unknown backup stage: '%s'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END" spa "Fase de respaldo desconocida: '%s'. La fase debería de ser una de START, FLUSH, BLOCK_DDL, BLOCK_COMMIT o END" ER_USER_IS_BLOCKED - chi "由于凭è¯é”™è¯¯å¤ªå¤šï¼Œç”¨æˆ·è¢«é˜»æ­¢;用'FLUSH PRIVILEGES'è§£é”" - eng "User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'" - spa "El usuario está bloqueado a causa de demasiados errores de credenciales; desbloquee mediante 'FLUSH PRIVILEGES'" + chi "由于凭è¯é”™è¯¯å¤ªå¤šï¼Œç”¨æˆ·è¢«é˜»æ­¢;用'ALTER USER / FLUSH PRIVILEGES'è§£é”" + eng "User is blocked because of too many credential errors; unblock with 'ALTER USER / FLUSH PRIVILEGES'" + spa "El usuario está bloqueado a causa de demasiados errores de credenciales; desbloquee mediante 'ALTER USER / FLUSH PRIVILEGES'" ER_ACCOUNT_HAS_BEEN_LOCKED chi "访问拒ç»ï¼Œæ­¤å¸æˆ·å·²é”定" eng "Access denied, this account is locked" diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e58fb5f4870..c5c83046c6a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -263,7 +263,7 @@ public: PASSWD_ERROR_INCREMENT }; - inline void update_password_errors(PASSWD_ERROR_ACTION action) + void update_password_errors(PASSWD_ERROR_ACTION action) { switch (action) { @@ -3560,6 +3560,9 @@ static int acl_user_update(THD *thd, ACL_USER *acl_user, uint nauth, break; } + // Any alter user resets password_errors; + acl_user->update_password_errors(ACL_USER::PASSWD_ERROR_CLEAR); + return 0; } From 6c2cd4cf56f72de1288db9b103cc25abf2c50440 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 19 Jun 2024 17:06:00 +0200 Subject: [PATCH 25/85] MDEV-34428 bootstrap can't delete tempfile, it is already gone The problem is seen on CI, where TEMP pointed to directory outside of the usual vardir, when testing mysql_install_db.exe A likely cause for this error is that TEMP was periodically cleaned up by some automation running on the host, perhaps by buildbot itself. To fix, mysql_install_db.exe will now use datadir as --tmpdir for the bootstrap run. This will minimize chances to run into any environment problems. --- sql/mysql_install_db.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index ac57c35855a..c1d71aa855b 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -333,6 +333,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) " %s" " --bootstrap" " --datadir=." + " --tmpdir=." " --loose-innodb-buffer-pool-size=20M" "\"" , mysqld_path, opt_verbose_bootstrap ? "--console" : ""); From 3541bd63f0d0bbe3357097d2e2dcbe0937bcb8ea Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 15 May 2024 12:20:27 +0300 Subject: [PATCH 26/85] MDEV-33582 Add more warnings to be able to better diagnose network issues Changed the logged messages from errors to warnings Also changed 'remain' to 'read_length' in the warning to make it more readable. --- .../r/rpl_semi_sync_cond_var_per_thd.result | 3 ++ .../rpl/t/rpl_semi_sync_cond_var_per_thd.test | 3 ++ sql/net_serv.cc | 32 +++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_cond_var_per_thd.result b/mysql-test/suite/rpl/r/rpl_semi_sync_cond_var_per_thd.result index 08f601447d5..d03d99c2efb 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_cond_var_per_thd.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_cond_var_per_thd.result @@ -2,6 +2,9 @@ include/master-slave.inc [connection master] connection master; call mtr.add_suppression("Got an error reading communication packets"); +call mtr.add_suppression("Got an error writing communication packets"); +call mtr.add_suppression("Could not read packet"); +call mtr.add_suppression("Could not write packet"); set @save_bgc_count= @@global.binlog_commit_wait_count; set @save_bgc_usec= @@global.binlog_commit_wait_usec; set @save_debug_dbug= @@global.debug_dbug; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_cond_var_per_thd.test b/mysql-test/suite/rpl/t/rpl_semi_sync_cond_var_per_thd.test index 65b6e8b4f7b..5908a660c0f 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_cond_var_per_thd.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_cond_var_per_thd.test @@ -26,6 +26,9 @@ --connection master call mtr.add_suppression("Got an error reading communication packets"); +call mtr.add_suppression("Got an error writing communication packets"); +call mtr.add_suppression("Could not read packet"); +call mtr.add_suppression("Could not write packet"); set @save_bgc_count= @@global.binlog_commit_wait_count; set @save_bgc_usec= @@global.binlog_commit_wait_usec; set @save_debug_dbug= @@global.debug_dbug; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index af65d92c2b9..48d523d53ea 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -778,13 +778,12 @@ net_real_write(NET *net,const uchar *packet, size_t len) #ifdef MYSQL_SERVER if (global_system_variables.log_warnings > 3) { - my_printf_error(net->last_errno, - "Could not write packet: fd: %lld state: %d " - "errno: %d vio_errno: %d length: %ld", - MYF(ME_ERROR_LOG), - (longlong) vio_fd(net->vio), (int) net->vio->state, - vio_errno(net->vio), net->last_errno, (ulong) (end-pos)); - break; + sql_print_warning("Could not write packet: fd: %lld state: %d " + "errno: %d vio_errno: %d length: %ld", + MYF(ME_ERROR_LOG | ME_WARNING), + (longlong) vio_fd(net->vio), (int) net->vio->state, + vio_errno(net->vio), net->last_errno, + (ulong) (end-pos)); } #endif MYSQL_SERVER_my_error(net->last_errno, MYF(0)); @@ -1101,17 +1100,16 @@ retry: #ifdef MYSQL_SERVER if (global_system_variables.log_warnings > 3) { - my_printf_error(net->last_errno, - "Could not read packet: fd: %lld state: %d " - "remain: %u errno: %d vio_errno: %d " - "length: %lld", - MYF(ME_ERROR_LOG), - (longlong) vio_fd(net->vio), (int) net->vio->state, - remain, vio_errno(net->vio), net->last_errno, - (longlong) length); + /* Log things as a warning */ + sql_print_warning("Could not read packet: fd: %lld state: %d " + "read_length: %u errno: %d vio_errno: %d " + "length: %lld", + (longlong) vio_fd(net->vio), + (int) net->vio->state, + remain, vio_errno(net->vio), net->last_errno, + (longlong) length); } - else - my_error(net->last_errno, MYF(0)); + my_error(net->last_errno, MYF(0)); #endif /* MYSQL_SERVER */ goto end; } From 279aa1e6b4e382c5eac0afde4c2f73de2b5d37c1 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 12 Jun 2024 12:27:55 +0300 Subject: [PATCH 27/85] Disable new connections in case of fatal signal A user reported that MariaDB server got a signal 6 but still accepted new connections and did not crash. I have not been able to find a way to repeat this or find the cause of issue. However to make it easier to notice that the server is unstable, I added code to disable new connections when the handle_fatal_signal() handler has been called. --- sql/signal_handler.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 534a9a1cfbf..656b72b933b 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -149,6 +149,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) goto end; } segfaulted = 1; + abort_loop= 1; // Disable now connections DBUG_PRINT("error", ("handling fatal signal")); curr_time= my_time(0); From 6cecf61a590c15680287ac9ea4967f07dd47c577 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 18 Jun 2024 13:03:56 +0400 Subject: [PATCH 28/85] MDEV-34417 Wrong result set with utf8mb4_danish_ci and BNLH join There were erroneous calls for charpos() in key_hashnr() and key_buf_cmp(). These functions are never called with prefix segments. The charpos() calls were wrong. Before the change BNHL joins - could return wrong result sets, as reported in MDEV-34417 - were extremely slow for multi-byte character sets, because the hash was calculated on string prefixes, which increased the amount of collisions drastically. This patch fixes the wrong result set as reported in MDEV-34417, as well as (partially) the performance problem reported in MDEV-34352. --- mysql-test/main/ctype_uca.result | 36 ++++++++++++++++++++++++++++++++ mysql-test/main/ctype_uca.test | 29 +++++++++++++++++++++++++ sql/key.cc | 36 ++++++++++---------------------- 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 0ab995993ac..f329db1826b 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -15370,3 +15370,39 @@ DROP TABLE t1; # # End of MariaDB-10.2 tests # +# +# Start of 10.5 tests +# +# +# MDEV-34417 Wrong result set with utf8mb4_danish_ci and BNLH join +# +CREATE TABLE t1 (a VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci); +INSERT INTO t1 VALUES ('aaaa'),('åå'); +SELECT * FROM t1 WHERE a='aaaa'; +a +aaaa +åå +SET join_cache_level=1; +SELECT * FROM t1 NATURAL JOIN t1 t2; +a +aaaa +åå +aaaa +åå +# Expect a BNHL join +SET join_cache_level=3; +EXPLAIN SELECT * FROM t1 NATURAL JOIN t1 t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 hash_ALL NULL #hash#$hj 2003 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) +SELECT * FROM t1 NATURAL JOIN t1 t2; +a +aaaa +åå +aaaa +åå +DROP TABLE t1; +SET join_cache_level=DEFAULT; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/ctype_uca.test b/mysql-test/main/ctype_uca.test index 8ccda3e680c..a88db7ea512 100644 --- a/mysql-test/main/ctype_uca.test +++ b/mysql-test/main/ctype_uca.test @@ -696,3 +696,32 @@ DROP TABLE t1; --echo # --echo # End of MariaDB-10.2 tests --echo # + + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-34417 Wrong result set with utf8mb4_danish_ci and BNLH join +--echo # + +CREATE TABLE t1 (a VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci); +INSERT INTO t1 VALUES ('aaaa'),('åå'); +SELECT * FROM t1 WHERE a='aaaa'; + +SET join_cache_level=1; +SELECT * FROM t1 NATURAL JOIN t1 t2; + +--echo # Expect a BNHL join +SET join_cache_level=3; +EXPLAIN SELECT * FROM t1 NATURAL JOIN t1 t2; +SELECT * FROM t1 NATURAL JOIN t1 t2; + +DROP TABLE t1; +SET join_cache_level=DEFAULT; + + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/sql/key.cc b/sql/key.cc index 2fa7d7066a4..58b2cfbb47a 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -754,13 +754,11 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key) if (is_string) { - if (cs->mbmaxlen > 1) - { - size_t char_length= cs->charpos(pos + pack_length, - pos + pack_length + length, - length / cs->mbmaxlen); - set_if_smaller(length, char_length); - } + /* + Prefix keys are not possible in BNLH joins. + Use the whole string to calculate the hash. + */ + DBUG_ASSERT((key_part->key_part_flag & HA_PART_KEY_SEG) == 0); cs->hash_sort(pos+pack_length, length, &nr, &nr2); key+= pack_length; } @@ -864,25 +862,13 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts, if (is_string) { /* - Compare the strings taking into account length in characters - and collation + Prefix keys are not possible in BNLH joins. + Compare whole strings. */ - size_t byte_len1= length1, byte_len2= length2; - if (cs->mbmaxlen > 1) - { - size_t char_length1= cs->charpos(pos1 + pack_length, - pos1 + pack_length + length1, - length1 / cs->mbmaxlen); - size_t char_length2= cs->charpos(pos2 + pack_length, - pos2 + pack_length + length2, - length2 / cs->mbmaxlen); - set_if_smaller(length1, char_length1); - set_if_smaller(length2, char_length2); - } - if (length1 != length2 || - cs->strnncollsp(pos1 + pack_length, byte_len1, - pos2 + pack_length, byte_len2)) - return TRUE; + DBUG_ASSERT((key_part->key_part_flag & HA_PART_KEY_SEG) == 0); + if (cs->strnncollsp(pos1 + pack_length, length1, + pos2 + pack_length, length2)) + return true; key1+= pack_length; key2+= pack_length; } else From ab448d4b342a3b33abe73c14ad92c8dafbb2a6a7 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 20 Jun 2024 17:54:57 +0530 Subject: [PATCH 29/85] MDEV-34389 Avoid log overwrite in early recovery - InnoDB tries to write FILE_CHECKPOINT marker during early recovery when log file size is insufficient. While updating the log checkpoint at the end of the recovery, InnoDB must already have written out all pending changes to the persistent files. To complete the checkpoint, InnoDB has to write some log records for the checkpoint and to update the checkpoint header. If the server gets killed before updating the checkpoint header then it would lead the logfile to be unrecoverable. - This patch avoids FILE_CHECKPOINT marker during early recovery and narrows down the window of opportunity to make the log file unrecoverable. --- .../suite/innodb/r/log_file_overwrite.result | 8 ++++++++ .../suite/innodb/t/log_file_overwrite.test | 17 +++++++++++++++++ storage/innobase/log/log0recv.cc | 7 ++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/innodb/r/log_file_overwrite.result create mode 100644 mysql-test/suite/innodb/t/log_file_overwrite.test diff --git a/mysql-test/suite/innodb/r/log_file_overwrite.result b/mysql-test/suite/innodb/r/log_file_overwrite.result new file mode 100644 index 00000000000..5f1f38784f6 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_overwrite.result @@ -0,0 +1,8 @@ +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t1(f1 INT NOT NULL, f2 TEXT)ENGINE=InnoDB; +# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 +INSERT INTO t1 SELECT seq, repeat('a', 4000) FROM seq_1_to_1800; +# restart: --debug_dbug=+d,before_final_redo_apply --innodb_log_file_size=8M +# restart: --innodb_log_file_size=10M +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_file_overwrite.test b/mysql-test/suite/innodb/t/log_file_overwrite.test new file mode 100644 index 00000000000..209f21c67cd --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_overwrite.test @@ -0,0 +1,17 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_debug.inc + +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t1(f1 INT NOT NULL, f2 TEXT)ENGINE=InnoDB; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; +--source include/restart_mysqld.inc +INSERT INTO t1 SELECT seq, repeat('a', 4000) FROM seq_1_to_1800; +let $restart_parameters=--debug_dbug=+d,before_final_redo_apply --innodb_log_file_size=8M; +let $shutdown_timeout=0; +--source include/restart_mysqld.inc +let $restart_parameters=--innodb_log_file_size=10M; +let $shutdown_timeout=; +--source include/restart_mysqld.inc +DROP TABLE t1; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index f83f5f45af6..366cf524f41 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3738,7 +3738,9 @@ completed: if (!srv_read_only_mode && srv_operation <= SRV_OPERATION_EXPORT_RESTORED && (~log_t::FORMAT_ENCRYPTED & log_sys.log.format) - == log_t::FORMAT_10_5) { + == log_t::FORMAT_10_5 + && recv_sys.recovered_lsn - log_sys.last_checkpoint_lsn + < log_sys.log_capacity) { /* Write a FILE_CHECKPOINT marker as the first thing, before generating any other redo log. This ensures that subsequent crash recovery will be possible even @@ -3748,6 +3750,9 @@ completed: log_sys.next_checkpoint_no = ++checkpoint_no; + DBUG_EXECUTE_IF("before_final_redo_apply", + mysql_mutex_unlock(&log_sys.mutex); + return DB_ERROR;); mutex_enter(&recv_sys.mutex); recv_sys.apply_log_recs = true; From 0a199cb81009590a1b337fe3ddec09e559dbb22d Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Thu, 20 Jun 2024 11:59:06 +0300 Subject: [PATCH 30/85] MDEV-34108 Inappropriate semi-consistent read in RC if innodb_snapshot_isolation=ON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fixes in b8a671988954870b7db22e20d1a1409fd40f8e3d have not disabled semi-consistent read for innodb_snapshot_isolation=ON mode, they just allowed read uncommitted version of a record, that's why the test for MDEV-26643 worked well. The semi-consistent read should be disabled on upper level in row_search_mvcc() for READ COMMITTED isolation level. Reviewed by Marko Mäkelä. --- .../suite/innodb/r/lock_isolation.result | 21 ++++++++++++ mysql-test/suite/innodb/t/lock_isolation.test | 34 +++++++++++++++++++ storage/innobase/row/row0sel.cc | 17 +++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/lock_isolation.result b/mysql-test/suite/innodb/r/lock_isolation.result index 31843266617..1ddb9deb24c 100644 --- a/mysql-test/suite/innodb/r/lock_isolation.result +++ b/mysql-test/suite/innodb/r/lock_isolation.result @@ -103,6 +103,27 @@ SELECT * FROM t; a b 10 1 10 20 +TRUNCATE TABLE t; +# +# MDEV-34108 Inappropriate semi-consistent read in snapshot isolation +# +INSERT INTO t VALUES(NULL, 1), (1, 1); +BEGIN; +UPDATE t SET b = 3; +connection consistent; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +UPDATE t SET b = 2 WHERE a; +connection default; +UPDATE t SET a = 1; +COMMIT; +connection consistent; +COMMIT; +connection default; +SELECT * FROM t; +a b +1 2 +1 2 DROP TABLE t; # # MDEV-33802 Weird read view after ROLLBACK of other transactions diff --git a/mysql-test/suite/innodb/t/lock_isolation.test b/mysql-test/suite/innodb/t/lock_isolation.test index 5c60f6e707c..4e44cea8c2e 100644 --- a/mysql-test/suite/innodb/t/lock_isolation.test +++ b/mysql-test/suite/innodb/t/lock_isolation.test @@ -103,6 +103,40 @@ COMMIT; --reap COMMIT; +--connection default +SELECT * FROM t; +TRUNCATE TABLE t; + +--echo # +--echo # MDEV-34108 Inappropriate semi-consistent read in snapshot isolation +--echo # +INSERT INTO t VALUES(NULL, 1), (1, 1); +BEGIN; +UPDATE t SET b = 3; + +--connection consistent +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +# As semi-consistent read is disabled for innodb_snapshot_isolation=ON, the +# following UPDATE must be blocked on the first record. +--send UPDATE t SET b = 2 WHERE a + +--connection default +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'Updating' and info = 'UPDATE t SET b = 2 WHERE a'; +--source include/wait_condition.inc + +UPDATE t SET a = 1; +COMMIT; +--connection consistent +# If the bug wouldn't be fixed, the result would be (1,3),(1,2), because +# "UPDATE t SET b = 2 WHERE a" would be blocked on the second (1,3) record, +# as semi-consistent read would filter out the first (null,3) record without +# blocking. +--reap +COMMIT; + --connection default SELECT * FROM t; DROP TABLE t; diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 5ebcab88b01..dd3a50a22b3 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -866,6 +866,8 @@ row_sel_build_committed_vers_for_mysql( mtr_t* mtr) /*!< in: mtr */ { if (prebuilt->trx->snapshot_isolation) { + ut_ad(prebuilt->trx->isolation_level + == TRX_ISO_READ_UNCOMMITTED); *old_vers = rec; return; } @@ -5261,7 +5263,20 @@ no_gap_lock: if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) || unique_search - || index != clust_index) { + || index != clust_index + /* If read view was opened, sel_set_rec_lock() + would return DB_RECORD_CHANGED, and we would not be + here. As read view wasn't opened, do locking read + instead of semi-consistent one for READ COMMITTED. + For READ UNCOMMITTED + row_sel_build_committed_vers_for_mysql() must read + uncommitted version of the record. For REPEATABLE + READ and SERIALIZABLE prebuilt->row_read_type + must be not equal to ROW_READ_TRY_SEMI_CONSISTENT, + so there will be locking read for those isolation + levels. */ + || (trx->snapshot_isolation && trx->isolation_level + == TRX_ISO_READ_COMMITTED )) { if (!prebuilt->skip_locked) { goto lock_wait_or_error; } From db0c28eff88afac7e923bdb8ef2c8467a1065bea Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Wed, 12 Jun 2024 09:46:26 -0400 Subject: [PATCH 31/85] MDEV-33746 Supply missing override markings Find and fix missing virtual override markings. Updates cmake maintainer flags to include -Wsuggest-override and -Winconsistent-missing-override. --- cmake/maintainer.cmake | 4 +- mysys_ssl/my_crypt.cc | 16 +- .../aws_key_management_plugin.cc | 6 +- plugin/feedback/url_http.cc | 8 +- plugin/func_test/plugin.cc | 10 +- .../handler_socket/handlersocket/database.cpp | 38 +- .../handler_socket/handlersocket/hstcpsvr.cpp | 4 +- .../handlersocket/hstcpsvr_worker.cpp | 20 +- .../handler_socket/libhsclient/hstcpcli.cpp | 28 +- plugin/type_inet/item_inetfunc.h | 60 +- plugin/type_inet/plugin.cc | 16 +- plugin/type_inet/sql_type_inet.cc | 20 +- plugin/type_mysql_json/type.cc | 10 +- plugin/versioning/versioning.cc | 12 +- sql/event_data_objects.cc | 4 +- sql/event_data_objects.h | 6 +- sql/field.h | 14 +- sql/gcalc_tools.h | 20 +- sql/ha_partition.cc | 2 +- sql/ha_partition.h | 2 +- sql/ha_sequence.h | 64 +- sql/handler.cc | 2 +- sql/handler.h | 4 +- sql/item.cc | 2 +- sql/item.h | 170 +- sql/item_cmpfunc.cc | 8 +- sql/item_cmpfunc.h | 1064 ++++++------ sql/item_create.cc | 790 ++++----- sql/item_func.cc | 22 +- sql/item_func.h | 1440 ++++++++--------- sql/item_geofunc.cc | 108 +- sql/item_geofunc.h | 404 ++--- sql/item_jsonfunc.h | 194 +-- sql/item_row.h | 78 +- sql/item_strfunc.h | 838 +++++----- sql/item_subselect.cc | 2 +- sql/item_subselect.h | 80 +- sql/item_sum.h | 482 +++--- sql/item_timefunc.cc | 8 +- sql/item_timefunc.h | 706 ++++---- sql/item_vers.h | 36 +- sql/item_windowfunc.h | 284 ++-- sql/item_xmlfunc.cc | 132 +- sql/item_xmlfunc.h | 18 +- sql/keycaches.cc | 2 +- sql/log.cc | 6 +- sql/log.h | 72 +- sql/log_event.h | 539 +++--- sql/log_event_old.h | 84 +- sql/log_event_server.cc | 6 +- sql/mdl.cc | 36 +- sql/mdl.h | 4 +- sql/multi_range_read.h | 30 +- sql/opt_range.cc | 36 +- sql/opt_range.h | 172 +- sql/opt_subselect.cc | 2 +- sql/opt_table_elimination.cc | 24 +- sql/parse_file.h | 4 +- sql/procedure.h | 60 +- sql/rowid_filter.h | 14 +- sql/session_tracker.h | 20 +- sql/set_var.h | 32 +- sql/sp.cc | 16 +- sql/sp.h | 96 +- sql/sp_head.h | 194 +-- sql/spatial.h | 210 +-- sql/sql_acl.cc | 158 +- sql/sql_acl.h | 8 +- sql/sql_admin.h | 16 +- sql/sql_alter.h | 12 +- sql/sql_analyse.h | 82 +- sql/sql_base.cc | 14 +- sql/sql_base.h | 34 +- sql/sql_class.h | 224 +-- sql/sql_cmd.h | 16 +- sql/sql_cursor.cc | 18 +- sql/sql_error.h | 10 +- sql/sql_explain.h | 62 +- sql/sql_expression_cache.h | 12 +- sql/sql_get_diagnostics.h | 8 +- sql/sql_insert.cc | 18 +- sql/sql_join_cache.h | 92 +- sql/sql_lifo_buffer.h | 44 +- sql/sql_parse.cc | 6 +- sql/sql_partition_admin.h | 22 +- sql/sql_plugin.cc | 20 +- sql/sql_prepare.cc | 42 +- sql/sql_schema.cc | 12 +- sql/sql_select.h | 52 +- sql/sql_show.cc | 10 +- sql/sql_show.h | 2 +- sql/sql_signal.h | 8 +- sql/sql_statistics.cc | 20 +- sql/sql_trigger.cc | 16 +- sql/sql_truncate.h | 4 +- sql/sql_type.h | 8 +- sql/sql_update.cc | 4 +- sql/sql_window.cc | 138 +- sql/sql_window.h | 2 +- sql/sys_vars.inl | 410 ++--- sql/sys_vars_shared.h | 12 +- sql/table.cc | 2 +- sql/table.h | 58 +- sql/threadpool.h | 24 +- sql/threadpool_generic.h | 10 +- sql/tztime.cc | 28 +- sql/wsrep_client_service.h | 44 +- sql/wsrep_condition_variable.h | 6 +- sql/wsrep_high_priority_service.h | 52 +- sql/wsrep_mutex.h | 6 +- sql/wsrep_server_service.h | 44 +- sql/wsrep_storage_service.h | 18 +- storage/archive/ha_archive.h | 84 +- storage/blackhole/ha_blackhole.h | 56 +- storage/connect/array.h | 24 +- storage/connect/blkfil.h | 36 +- storage/connect/cmgfam.h | 6 +- storage/connect/colblk.h | 59 +- storage/connect/domdoc.h | 2 +- storage/connect/filamap.h | 76 +- storage/connect/filamdbf.h | 42 +- storage/connect/filamfix.h | 50 +- storage/connect/filamgz.h | 100 +- storage/connect/filamtxt.h | 88 +- storage/connect/filamvct.h | 124 +- storage/connect/filamzip.h | 64 +- storage/connect/filter.h | 40 +- storage/connect/ha_connect.h | 104 +- storage/connect/jdbconn.h | 8 +- storage/connect/jmgfam.h | 48 +- storage/connect/jmgoconn.h | 6 +- storage/connect/json.h | 62 +- storage/connect/libdoc.cpp | 74 +- storage/connect/mongo.h | 6 +- storage/connect/mycat.h | 6 +- storage/connect/reldef.h | 24 +- storage/connect/tabbson.h | 84 +- storage/connect/tabcmg.h | 46 +- storage/connect/tabcol.h | 26 +- storage/connect/tabdos.h | 92 +- storage/connect/tabext.h | 22 +- storage/connect/tabfix.h | 42 +- storage/connect/tabfmt.h | 60 +- storage/connect/tabjdbc.h | 68 +- storage/connect/tabjmg.h | 46 +- storage/connect/tabjson.h | 84 +- storage/connect/tabmac.h | 28 +- storage/connect/tabmul.h | 84 +- storage/connect/tabmysql.h | 76 +- storage/connect/taboccur.h | 32 +- storage/connect/tabodbc.h | 88 +- storage/connect/tabpivot.h | 42 +- storage/connect/tabrest.h | 6 +- storage/connect/tabsys.h | 80 +- storage/connect/tabtbl.h | 40 +- storage/connect/tabutil.h | 50 +- storage/connect/tabvct.h | 32 +- storage/connect/tabvir.h | 40 +- storage/connect/tabwmi.h | 26 +- storage/connect/tabxcl.h | 26 +- storage/connect/tabxml.h | 68 +- storage/connect/tabzip.h | 34 +- storage/connect/valblk.h | 198 +-- storage/connect/value.h | 274 ++-- storage/connect/xindex.h | 106 +- storage/connect/xobject.h | 36 +- storage/connect/xtable.h | 46 +- storage/csv/ha_tina.h | 56 +- storage/example/ha_example.h | 66 +- storage/federated/ha_federated.cc | 2 +- storage/federated/ha_federated.h | 90 +- storage/federatedx/federatedx_io_mysql.cc | 70 +- storage/federatedx/federatedx_io_null.cc | 68 +- storage/federatedx/federatedx_pushdown.h | 16 +- storage/federatedx/ha_federatedx.cc | 2 +- storage/federatedx/ha_federatedx.h | 90 +- storage/heap/ha_heap.h | 104 +- storage/innobase/handler/handler0alter.cc | 4 +- storage/innobase/include/log0log.h | 12 +- storage/innobase/include/sync0policy.h | 2 +- storage/maria/ha_maria.h | 2 +- storage/mroonga/ha_mroonga.hpp | 15 +- .../mroonga/vendor/groonga/lib/dat/dat.hpp | 4 +- .../vendor/groonga/lib/dat/id-cursor.hpp | 10 +- .../vendor/groonga/lib/dat/key-cursor.hpp | 10 +- .../groonga/lib/dat/predictive-cursor.hpp | 10 +- .../vendor/groonga/lib/dat/prefix-cursor.hpp | 10 +- storage/myisam/ha_myisam.h | 150 +- storage/myisammrg/ha_myisammrg.h | 90 +- storage/perfschema/cursor_by_account.h | 6 +- storage/perfschema/cursor_by_host.h | 6 +- storage/perfschema/cursor_by_thread.h | 6 +- .../cursor_by_thread_connect_attr.h | 6 +- storage/perfschema/cursor_by_user.h | 6 +- storage/perfschema/ha_perfschema.h | 62 +- storage/perfschema/pfs_account.cc | 4 +- storage/perfschema/pfs_engine_table.cc | 10 +- storage/perfschema/pfs_engine_table.h | 22 +- storage/perfschema/pfs_host.cc | 2 +- storage/perfschema/pfs_instr_class.cc | 4 +- storage/perfschema/pfs_setup_actor.cc | 2 +- storage/perfschema/pfs_setup_object.cc | 2 +- storage/perfschema/pfs_user.cc | 2 +- storage/perfschema/pfs_variable.h | 26 +- storage/perfschema/pfs_visitor.cc | 16 +- storage/perfschema/pfs_visitor.h | 160 +- storage/perfschema/table_accounts.h | 10 +- storage/perfschema/table_all_instr.h | 6 +- .../table_esgs_by_account_by_event_name.h | 16 +- .../table_esgs_by_host_by_event_name.h | 16 +- .../table_esgs_by_thread_by_event_name.h | 16 +- .../table_esgs_by_user_by_event_name.h | 16 +- .../table_esgs_global_by_event_name.h | 16 +- .../table_esms_by_account_by_event_name.h | 16 +- storage/perfschema/table_esms_by_digest.h | 14 +- .../table_esms_by_host_by_event_name.h | 16 +- storage/perfschema/table_esms_by_program.h | 14 +- .../table_esms_by_thread_by_event_name.h | 16 +- .../table_esms_by_user_by_event_name.h | 16 +- .../table_esms_global_by_event_name.h | 16 +- .../table_ets_by_account_by_event_name.h | 16 +- .../table_ets_by_host_by_event_name.h | 16 +- .../table_ets_by_thread_by_event_name.h | 16 +- .../table_ets_by_user_by_event_name.h | 16 +- .../table_ets_global_by_event_name.h | 16 +- storage/perfschema/table_events_stages.h | 32 +- storage/perfschema/table_events_statements.h | 32 +- .../perfschema/table_events_transactions.h | 32 +- storage/perfschema/table_events_waits.h | 26 +- .../perfschema/table_events_waits_summary.h | 18 +- .../table_ews_by_account_by_event_name.h | 14 +- .../table_ews_by_host_by_event_name.h | 14 +- .../table_ews_by_thread_by_event_name.h | 14 +- .../table_ews_by_user_by_event_name.h | 14 +- .../table_ews_global_by_event_name.h | 14 +- storage/perfschema/table_file_instances.h | 14 +- .../table_file_summary_by_event_name.h | 14 +- .../table_file_summary_by_instance.h | 14 +- storage/perfschema/table_global_status.h | 16 +- storage/perfschema/table_global_variables.h | 16 +- storage/perfschema/table_host_cache.h | 14 +- storage/perfschema/table_hosts.h | 12 +- storage/perfschema/table_md_locks.h | 14 +- .../table_mems_by_account_by_event_name.h | 14 +- .../table_mems_by_host_by_event_name.h | 14 +- .../table_mems_by_thread_by_event_name.h | 14 +- .../table_mems_by_user_by_event_name.h | 14 +- .../table_mems_global_by_event_name.h | 14 +- storage/perfschema/table_os_global_by_type.h | 14 +- storage/perfschema/table_performance_timers.h | 14 +- .../table_prepared_stmt_instances.h | 14 +- .../table_replication_applier_configuration.h | 14 +- .../table_replication_applier_status.h | 14 +- ...eplication_applier_status_by_coordinator.h | 14 +- ...ble_replication_applier_status_by_worker.h | 14 +- ...ble_replication_connection_configuration.h | 14 +- .../table_replication_connection_status.h | 14 +- .../table_replication_group_member_stats.h | 14 +- .../table_replication_group_members.h | 14 +- .../table_session_account_connect_attrs.h | 2 +- storage/perfschema/table_session_connect.h | 6 +- storage/perfschema/table_session_status.h | 16 +- storage/perfschema/table_session_variables.h | 16 +- storage/perfschema/table_setup_actors.h | 28 +- storage/perfschema/table_setup_consumers.h | 22 +- storage/perfschema/table_setup_instruments.h | 26 +- storage/perfschema/table_setup_objects.h | 30 +- storage/perfschema/table_setup_timers.h | 22 +- storage/perfschema/table_socket_instances.h | 14 +- .../table_socket_summary_by_event_name.h | 14 +- .../table_socket_summary_by_instance.h | 14 +- storage/perfschema/table_status_by_account.h | 16 +- storage/perfschema/table_status_by_host.h | 16 +- storage/perfschema/table_status_by_thread.h | 16 +- storage/perfschema/table_status_by_user.h | 16 +- storage/perfschema/table_sync_instances.h | 42 +- storage/perfschema/table_table_handles.h | 16 +- storage/perfschema/table_threads.h | 20 +- .../perfschema/table_tiws_by_index_usage.h | 16 +- storage/perfschema/table_tiws_by_table.h | 16 +- storage/perfschema/table_tlws_by_table.h | 16 +- storage/perfschema/table_users.h | 10 +- storage/perfschema/table_uvar_by_thread.cc | 2 +- storage/perfschema/table_uvar_by_thread.h | 14 +- .../perfschema/table_variables_by_thread.h | 16 +- storage/rocksdb/ha_rocksdb.cc | 6 +- storage/rocksdb/ha_rocksdb.h | 20 +- storage/rocksdb/properties_collector.h | 4 +- storage/rocksdb/rdb_compact_filter.h | 4 +- storage/rocksdb/rdb_datadic.h | 2 +- storage/rocksdb/rdb_mutex_wrapper.h | 14 +- storage/rocksdb/rdb_threads.h | 6 +- storage/sequence/sequence.cc | 54 +- storage/sphinx/ha_sphinx.h | 80 +- storage/spider/ha_spider.h | 204 +-- storage/spider/spd_db_mysql.h | 482 +++--- storage/spider/spd_group_by_handler.h | 6 +- .../test_sql_discovery/test_sql_discovery.cc | 26 +- storage/tokudb/PerconaFT/ftcxx/exceptions.hpp | 4 +- storage/tokudb/ha_tokudb.h | 142 +- storage/tokudb/ha_tokudb_admin.cc | 32 +- tpool/aio_simulated.cc | 6 +- tpool/aio_win.cc | 6 +- tpool/tpool_generic.cc | 8 +- tpool/tpool_win.cc | 8 +- unittest/sql/my_apc-t.cc | 2 +- 306 files changed, 8808 insertions(+), 8781 deletions(-) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index d5ad2867f5b..11d4b896f45 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -27,14 +27,16 @@ SET(MY_WARNING_FLAGS -Wenum-conversion -Wextra -Wformat-security + -Winconsistent-missing-override -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-null-conversion -Wno-unused-parameter -Wno-unused-private-field - -Woverloaded-virtual -Wnon-virtual-dtor + -Woverloaded-virtual + -Wsuggest-override -Wvla -Wwrite-strings ) diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc index 00447e73d79..0356b64ccfb 100644 --- a/mysys_ssl/my_crypt.cc +++ b/mysys_ssl/my_crypt.cc @@ -101,10 +101,10 @@ public: uchar source_tail[MY_AES_BLOCK_SIZE]; MyCTX_nopad() : MyCTX() { } - ~MyCTX_nopad() = default; + ~MyCTX_nopad() override = default; int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen, - const uchar *iv, uint ivlen) + const uchar *iv, uint ivlen) override { compile_time_assert(MY_AES_CTX_SIZE >= sizeof(MyCTX_nopad)); this->key= key; @@ -141,13 +141,13 @@ public: source_tail_len= new_tail_len; } - int update(const uchar *src, uint slen, uchar *dst, uint *dlen) + int update(const uchar *src, uint slen, uchar *dst, uint *dlen) override { update_source_tail(src, slen); return MyCTX::update(src, slen, dst, dlen); } - int finish(uchar *dst, uint *dlen) + int finish(uchar *dst, uint *dlen) override { if (source_tail_len) { @@ -206,10 +206,10 @@ public: const uchar *aad; int aadlen; MyCTX_gcm() : MyCTX() { } - ~MyCTX_gcm() { } + ~MyCTX_gcm() override { } int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen, - const uchar *iv, uint ivlen) + const uchar *iv, uint ivlen) override { compile_time_assert(MY_AES_CTX_SIZE >= sizeof(MyCTX_gcm)); int res= MyCTX::init(cipher, encrypt, key, klen, iv, ivlen); @@ -219,7 +219,7 @@ public: return res; } - int update(const uchar *src, uint slen, uchar *dst, uint *dlen) + int update(const uchar *src, uint slen, uchar *dst, uint *dlen) override { /* note that this GCM class cannot do streaming decryption, because @@ -244,7 +244,7 @@ public: return MyCTX::update(src, slen, dst, dlen); } - int finish(uchar *dst, uint *dlen) + int finish(uchar *dst, uint *dlen) override { int fin; if (!EVP_CipherFinal_ex(ctx, dst, &fin)) diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc index 7740c2eae60..18ec8f0c087 100644 --- a/plugin/aws_key_management/aws_key_management_plugin.cc +++ b/plugin/aws_key_management/aws_key_management_plugin.cc @@ -154,7 +154,7 @@ public: Base(logLevel) { } - virtual LogLevel GetLogLevel(void) const override + LogLevel GetLogLevel(void) const override { return (LogLevel)log_level; } @@ -162,12 +162,12 @@ public: { } - virtual void Flush(void) override + void Flush(void) override { } protected: - virtual void ProcessFormattedStatement(Aws::String&& statement) override + void ProcessFormattedStatement(Aws::String&& statement) override { #ifdef _WIN32 /* diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc index 590bb06cc5f..712d175c37d 100644 --- a/plugin/feedback/url_http.cc +++ b/plugin/feedback/url_http.cc @@ -53,7 +53,7 @@ class Url_http: public Url { { proxy_host.length= 0; } - ~Url_http() + ~Url_http() override { my_free(host.str); my_free(port.str); @@ -62,9 +62,9 @@ class Url_http: public Url { } public: - void abort(); - int send(const char* data, size_t data_length); - int set_proxy(const char *proxy, size_t proxy_len) + void abort() override; + int send(const char* data, size_t data_length) override; + int set_proxy(const char *proxy, size_t proxy_len) override { if (use_proxy()) { diff --git a/plugin/func_test/plugin.cc b/plugin/func_test/plugin.cc index 811189773f1..00fc0039de8 100644 --- a/plugin/func_test/plugin.cc +++ b/plugin/func_test/plugin.cc @@ -24,20 +24,20 @@ class Item_func_sysconst_test :public Item_func_sysconst { public: Item_func_sysconst_test(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *str) + String *val_str(String *str) override { null_value= str->copy(STRING_WITH_LEN("sysconst_test"), system_charset_info); return null_value ? NULL : str; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; maybe_null= true; return false; } - const char *func_name() const { return "sysconst_test"; } - const char *fully_qualified_func_name() const { return "sysconst_test()"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "sysconst_test"; } + const char *fully_qualified_func_name() const override { return "sysconst_test()"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index db24e33a141..0a006a42f00 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -84,10 +84,10 @@ prep_stmt::operator =(const prep_stmt& x) struct database : public database_i, private noncopyable { database(const config& c); - virtual ~database(); - virtual dbcontext_ptr create_context(bool for_write) volatile; - virtual void stop() volatile; - virtual const config& get_conf() const volatile; + ~database() override; + dbcontext_ptr create_context(bool for_write) volatile override; + void stop() volatile override; + const config& get_conf() const volatile override; public: int child_running; private: @@ -128,21 +128,21 @@ struct expr_user_lock : private noncopyable { struct dbcontext : public dbcontext_i, private noncopyable { dbcontext(volatile database *d, bool for_write); - virtual ~dbcontext(); - virtual void init_thread(const void *stack_botton, - volatile int& shutdown_flag); - virtual void term_thread(); - virtual bool check_alive(); - virtual void lock_tables_if(); - virtual void unlock_tables_if(); - virtual bool get_commit_error(); - virtual void clear_error(); - virtual void close_tables_if(); - virtual void table_addref(size_t tbl_id); - virtual void table_release(size_t tbl_id); - virtual void cmd_open(dbcallback_i& cb, const cmd_open_args& args); - virtual void cmd_exec(dbcallback_i& cb, const cmd_exec_args& args); - virtual void set_statistics(size_t num_conns, size_t num_active); + ~dbcontext() override; + void init_thread(const void *stack_botton, + volatile int& shutdown_flag) override; + void term_thread() override; + bool check_alive() override; + void lock_tables_if() override; + void unlock_tables_if() override; + bool get_commit_error() override; + void clear_error() override; + void close_tables_if() override; + void table_addref(size_t tbl_id) override; + void table_release(size_t tbl_id) override; + void cmd_open(dbcallback_i& cb, const cmd_open_args& args) override; + void cmd_exec(dbcallback_i& cb, const cmd_exec_args& args) override; + void set_statistics(size_t num_conns, size_t num_active) override; private: int set_thread_message(const char *fmt, ...) __attribute__((format (printf, 2, 3))); diff --git a/plugin/handler_socket/handlersocket/hstcpsvr.cpp b/plugin/handler_socket/handlersocket/hstcpsvr.cpp index 250ef2c7be5..336d36422b0 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr.cpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr.cpp @@ -34,8 +34,8 @@ struct worker_throbj { struct hstcpsvr : public hstcpsvr_i, private noncopyable { hstcpsvr(const config& c); - ~hstcpsvr(); - virtual std::string start_listen(); + ~hstcpsvr() override; + std::string start_listen() override; private: hstcpsvr_shared_c cshared; volatile hstcpsvr_shared_v vshared; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp index f6bbe9004c2..0796546cb5e 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp @@ -77,15 +77,15 @@ struct hstcpsvr_conn : public dbcallback_i { bool write_more(bool *more_r = 0); bool read_more(bool *more_r = 0); public: - virtual void dbcb_set_prep_stmt(size_t pst_id, const prep_stmt& v); - virtual const prep_stmt *dbcb_get_prep_stmt(size_t pst_id) const; - virtual void dbcb_resp_short(uint32_t code, const char *msg); - virtual void dbcb_resp_short_num(uint32_t code, uint32_t value); - virtual void dbcb_resp_short_num64(uint32_t code, uint64_t value); - virtual void dbcb_resp_begin(size_t num_flds); - virtual void dbcb_resp_entry(const char *fld, size_t fldlen); - virtual void dbcb_resp_end(); - virtual void dbcb_resp_cancel(); + void dbcb_set_prep_stmt(size_t pst_id, const prep_stmt& v) override; + const prep_stmt *dbcb_get_prep_stmt(size_t pst_id) const override; + void dbcb_resp_short(uint32_t code, const char *msg) override; + void dbcb_resp_short_num(uint32_t code, uint32_t value) override; + void dbcb_resp_short_num64(uint32_t code, uint64_t value) override; + void dbcb_resp_begin(size_t num_flds) override; + void dbcb_resp_entry(const char *fld, size_t fldlen) override; + void dbcb_resp_end() override; + void dbcb_resp_cancel() override; public: hstcpsvr_conn() : addr_len(sizeof(addr)), readsize(4096), nonblocking(false), read_finished(false), write_finished(false), @@ -254,7 +254,7 @@ hstcpsvr_conn::dbcb_resp_cancel() struct hstcpsvr_worker : public hstcpsvr_worker_i, private noncopyable { hstcpsvr_worker(const hstcpsvr_worker_arg& arg); - virtual void run(); + void run() override; private: const hstcpsvr_shared_c& cshared; volatile hstcpsvr_shared_v& vshared; diff --git a/plugin/handler_socket/libhsclient/hstcpcli.cpp b/plugin/handler_socket/libhsclient/hstcpcli.cpp index 461bed3f5d0..c2823d139fd 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.cpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.cpp @@ -27,23 +27,23 @@ namespace dena { struct hstcpcli : public hstcpcli_i, private noncopyable { hstcpcli(const socket_args& args); - virtual void close(); - virtual int reconnect(); - virtual bool stable_point(); - virtual void request_buf_open_index(size_t pst_id, const char *dbn, - const char *tbl, const char *idx, const char *retflds, const char *filflds); - virtual void request_buf_auth(const char *secret, const char *typ); - virtual void request_buf_exec_generic(size_t pst_id, const string_ref& op, + void close() override; + int reconnect() override; + bool stable_point() override; + void request_buf_open_index(size_t pst_id, const char *dbn, + const char *tbl, const char *idx, const char *retflds, const char *filflds) override; + void request_buf_auth(const char *secret, const char *typ) override; + void request_buf_exec_generic(size_t pst_id, const string_ref& op, const string_ref *kvs, size_t kvslen, uint32_t limit, uint32_t skip, const string_ref& mod_op, const string_ref *mvs, size_t mvslen, const hstcpcli_filter *fils, size_t filslen, int invalues_keypart, - const string_ref *invalues, size_t invalueslen); - virtual int request_send(); - virtual int response_recv(size_t& num_flds_r); - virtual const string_ref *get_next_row(); - virtual void response_buf_remove(); - virtual int get_error_code(); - virtual std::string get_error(); + const string_ref *invalues, size_t invalueslen) override; + int request_send() override; + int response_recv(size_t& num_flds_r) override; + const string_ref *get_next_row() override; + void response_buf_remove() override; + int get_error_code() override; + std::string get_error() override; private: int read_more(); void clear_error(); diff --git a/plugin/type_inet/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h index 94255426f68..813181b065a 100644 --- a/plugin/type_inet/item_inetfunc.h +++ b/plugin/type_inet/item_inetfunc.h @@ -27,13 +27,13 @@ class Item_func_inet_aton : public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_text(0, arg_count); } public: Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "inet_aton"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "inet_aton"; } + bool fix_length_and_dec() override { decimals= 0; max_length= 21; @@ -41,7 +41,7 @@ public: unsigned_flag= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -55,16 +55,16 @@ class Item_func_inet_ntoa : public Item_str_func public: Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a) { } - String* val_str(String* str); - const char *func_name() const { return "inet_ntoa"; } - bool fix_length_and_dec() + String* val_str(String* str) override; + const char *func_name() const override { return "inet_ntoa"; } + bool fix_length_and_dec() override { decimals= 0; fix_length_and_charset(3 * 8 + 7, default_charset()); maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -82,7 +82,7 @@ public: { null_value= false; } - bool need_parentheses_in_default() { return false; } + bool need_parentheses_in_default() override { return false; } }; @@ -98,20 +98,20 @@ public: { } public: - virtual const char *func_name() const + const char *func_name() const override { return "inet6_aton"; } - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_length_and_charset(16, &my_charset_bin); maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - String *val_str(String *to); + String *val_str(String *to) override; }; @@ -127,10 +127,10 @@ public: { } public: - virtual const char *func_name() const + const char *func_name() const override { return "inet6_ntoa"; } - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; @@ -142,8 +142,8 @@ public: maybe_null= 1; return FALSE; } - String *val_str_ascii(String *to); - Item *get_copy(THD *thd) + String *val_str_ascii(String *to) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -160,12 +160,12 @@ public: { } public: - virtual const char *func_name() const + const char *func_name() const override { return "is_ipv4"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -180,12 +180,12 @@ public: Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const + const char *func_name() const override { return "is_ipv6"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -199,11 +199,11 @@ public: inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr): Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const + const char *func_name() const override { return "is_ipv4_compat"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -217,11 +217,11 @@ public: inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr): Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const + const char *func_name() const override { return "is_ipv4_mapped"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; #endif // ITEM_INETFUNC_INCLUDED diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc index 77804c82af6..a66927f611c 100644 --- a/plugin/type_inet/plugin.cc +++ b/plugin/type_inet/plugin.cc @@ -44,7 +44,7 @@ public: static Create_func_inet_ntoa s_singleton; protected: Create_func_inet_ntoa() {} - virtual ~Create_func_inet_ntoa() {} + ~Create_func_inet_ntoa() override {} }; @@ -58,7 +58,7 @@ public: static Create_func_inet_aton s_singleton; protected: Create_func_inet_aton() {} - virtual ~Create_func_inet_aton() {} + ~Create_func_inet_aton() override {} }; @@ -72,7 +72,7 @@ public: static Create_func_inet6_aton s_singleton; protected: Create_func_inet6_aton() {} - virtual ~Create_func_inet6_aton() {} + ~Create_func_inet6_aton() override {} }; @@ -86,7 +86,7 @@ public: static Create_func_inet6_ntoa s_singleton; protected: Create_func_inet6_ntoa() {} - virtual ~Create_func_inet6_ntoa() {} + ~Create_func_inet6_ntoa() override {} }; @@ -100,7 +100,7 @@ public: static Create_func_is_ipv4 s_singleton; protected: Create_func_is_ipv4() {} - virtual ~Create_func_is_ipv4() {} + ~Create_func_is_ipv4() override {} }; @@ -114,7 +114,7 @@ public: static Create_func_is_ipv6 s_singleton; protected: Create_func_is_ipv6() {} - virtual ~Create_func_is_ipv6() {} + ~Create_func_is_ipv6() override {} }; @@ -128,7 +128,7 @@ public: static Create_func_is_ipv4_compat s_singleton; protected: Create_func_is_ipv4_compat() {} - virtual ~Create_func_is_ipv4_compat() {} + ~Create_func_is_ipv4_compat() override {} }; @@ -142,7 +142,7 @@ public: static Create_func_is_ipv4_mapped s_singleton; protected: Create_func_is_ipv4_mapped() {} - virtual ~Create_func_is_ipv4_mapped() {} + ~Create_func_is_ipv4_mapped() override {} }; diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index 3f457fd52db..880cf50c98a 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -1102,9 +1102,9 @@ public: Item_cache_inet6(THD *thd) :Item_cache(thd, &type_handler_inet6) { } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool cache_value() + bool cache_value() override { if (!example) return false; @@ -1119,54 +1119,54 @@ public: type_handler()); return true; } - String* val_str(String *to) + String* val_str(String *to) override { if (!has_value()) return NULL; Inet6_null tmp(m_value.ptr(), m_value.length()); return tmp.is_null() || tmp.to_string(to) ? NULL : to; } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { if (!has_value()) return NULL; my_decimal_set_zero(to); return to; } - longlong val_int() + longlong val_int() override { if (!has_value()) return 0; return 0; } - double val_real() + double val_real() override { if (!has_value()) return 0; return 0; } - longlong val_datetime_packed(THD *thd) + longlong val_datetime_packed(THD *thd) override { DBUG_ASSERT(0); if (!has_value()) return 0; return 0; } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { DBUG_ASSERT(0); if (!has_value()) return 0; return 0; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { if (!has_value()) return true; set_zero_time(ltime, MYSQL_TIMESTAMP_TIME); return false; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (!has_value()) return true; diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc index f84f76381a0..ea8a99c4c37 100644 --- a/plugin/type_mysql_json/type.cc +++ b/plugin/type_mysql_json/type.cc @@ -62,14 +62,14 @@ public: &my_charset_utf8mb4_bin) {} - String *val_str(String *val_buffer, String *val_str); - const Type_handler *type_handler() const { return &type_handler_mysql_json; } + String *val_str(String *val_buffer, String *val_str) override; + const Type_handler *type_handler() const override { return &type_handler_mysql_json; } bool parse_mysql(String *dest, const char *data, size_t length) const; - bool send(Protocol *protocol) { return Field::send(protocol); } - void sql_type(String &s) const + bool send(Protocol *protocol) override { return Field::send(protocol); } + void sql_type(String &s) const override { s.set_ascii(STRING_WITH_LEN("mysql_json /* JSON from MySQL 5.7 */")); } /* this will make ALTER TABLE to consider it different from built-in field */ - Compression_method *compression_method() const { return (Compression_method*)1; } + Compression_method *compression_method() const override { return (Compression_method*)1; } }; Field *Type_handler_mysql_json::make_conversion_table_field(MEM_ROOT *root, diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index a4916e2f9c1..387dfa80ae9 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -30,14 +30,14 @@ template class Create_func_trt : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_trt s_singleton; protected: Create_func_trt() = default; - virtual ~Create_func_trt() = default; + ~Create_func_trt() override = default; }; template @@ -104,8 +104,8 @@ template class Create_func_trt_trx_sees : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override { Item *func= NULL; int arg_count= 0; @@ -133,7 +133,7 @@ public: protected: Create_func_trt_trx_sees() = default; - virtual ~Create_func_trt_trx_sees() = default; + ~Create_func_trt_trx_sees() override = default; }; template diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index b06a5509176..6d377ce5100 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -71,14 +71,14 @@ public: Stored_program_creation_ctx **ctx); public: - virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) override { return new (mem_root) Event_creation_ctx(m_client_cs, m_connection_cl, m_db_cl); } protected: - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + Object_creation_ctx *create_backup_ctx(THD *thd) const override { /* We can avoid usual backup/restore employed in stored programs since we diff --git a/sql/event_data_objects.h b/sql/event_data_objects.h index c51d5433e15..d66707c0eaa 100644 --- a/sql/event_data_objects.h +++ b/sql/event_data_objects.h @@ -117,7 +117,7 @@ public: virtual ~Event_queue_element(); virtual bool - load_from_row(THD *thd, TABLE *table); + load_from_row(THD *thd, TABLE *table) override; bool compute_next_execution_time(); @@ -155,7 +155,7 @@ public: init(); virtual bool - load_from_row(THD *thd, TABLE *table); + load_from_row(THD *thd, TABLE *table) override; int get_create_event(THD *thd, String *buf); @@ -176,7 +176,7 @@ public: Event_job_data(); virtual bool - load_from_row(THD *thd, TABLE *table); + load_from_row(THD *thd, TABLE *table) override; bool execute(THD *thd, bool drop); diff --git a/sql/field.h b/sql/field.h index 2eafb471d4b..5aa50294b0a 100644 --- a/sql/field.h +++ b/sql/field.h @@ -3156,7 +3156,7 @@ public: :Field_temporal(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg) {} - bool validate_value_in_record(THD *thd, const uchar *record) const; + bool validate_value_in_record(THD *thd, const uchar *record) const override; }; @@ -4161,7 +4161,7 @@ public: { return (uint32) field_length + sort_suffix_length(); } - virtual uint32 sort_suffix_length() const override + uint32 sort_suffix_length() const override { return (field_charset() == &my_charset_bin ? length_bytes : 0); } @@ -4507,7 +4507,7 @@ public: uint32 sort_length() const override; uint32 sort_suffix_length() const override; uint32 value_length() override { return get_length(); } - virtual uint32 max_data_length() const override + uint32 max_data_length() const override { return (uint32) (((ulonglong) 1 << (packlength*8)) -1); } @@ -5119,20 +5119,20 @@ public: m_table(NULL) {} ~Field_row(); - en_fieldtype tmp_engine_column_type(bool use_packed_rows) const + en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override { DBUG_ASSERT(0); return Field::tmp_engine_column_type(use_packed_rows); } enum_conv_type rpl_conv_type_from(const Conv_source &source, const Relay_log_info *rli, - const Conv_param ¶m) const + const Conv_param ¶m) const override { DBUG_ASSERT(0); return CONV_TYPE_IMPOSSIBLE; } - Virtual_tmp_table **virtual_tmp_table_addr() { return &m_table; } - bool sp_prepare_and_store_item(THD *thd, Item **value); + Virtual_tmp_table **virtual_tmp_table_addr() override { return &m_table; } + bool sp_prepare_and_store_item(THD *thd, Item **value) override; }; diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h index bb1f473e180..f7a05633ace 100644 --- a/sql/gcalc_tools.h +++ b/sql/gcalc_tools.h @@ -146,16 +146,16 @@ public: Gcalc_operation_transporter(Gcalc_function *fn, Gcalc_heap *heap) : Gcalc_shape_transporter(heap), m_fn(fn) {} - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); - int start_collection(int n_objects); - int empty_shape(); + int single_point(double x, double y) override; + int start_line() override; + int complete_line() override; + int start_poly() override; + int complete_poly() override; + int start_ring() override; + int complete_ring() override; + int add_point(double x, double y) override; + int start_collection(int n_objects) override; + int empty_shape() override; }; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0d2abc7d860..587e30339bc 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -10344,7 +10344,7 @@ public: m_tot_parts(tot_parts) {} - ~ha_partition_inplace_ctx() + ~ha_partition_inplace_ctx() override { if (handler_ctx_array) { diff --git a/sql/ha_partition.h b/sql/ha_partition.h index e86928ce2d9..f47cc3f8957 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -478,7 +478,7 @@ public: } Partition_share *get_part_share() { return part_share; } handler *clone(const char *name, MEM_ROOT *mem_root) override; - virtual void set_part_info(partition_info *part_info) override + void set_part_info(partition_info *part_info) override { m_part_info= part_info; m_is_sub_partitioned= part_info->is_sub_partitioned(); diff --git a/sql/ha_sequence.h b/sql/ha_sequence.h index 72e59a40479..320f8e301ee 100644 --- a/sql/ha_sequence.h +++ b/sql/ha_sequence.h @@ -67,44 +67,44 @@ public: ~ha_sequence(); /* virtual function that are re-implemented for sequence */ - int open(const char *name, int mode, uint test_if_locked); + int open(const char *name, int mode, uint test_if_locked) override; int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); - handler *clone(const char *name, MEM_ROOT *mem_root); - int write_row(const uchar *buf); - Table_flags table_flags() const; + HA_CREATE_INFO *create_info) override; + handler *clone(const char *name, MEM_ROOT *mem_root) override; + int write_row(const uchar *buf) override; + Table_flags table_flags() const override; /* One can't update or delete from sequence engine */ - int update_row(const uchar *old_data, const uchar *new_data) + int update_row(const uchar *old_data, const uchar *new_data) override { return HA_ERR_WRONG_COMMAND; } - int delete_row(const uchar *buf) + int delete_row(const uchar *buf) override { return HA_ERR_WRONG_COMMAND; } /* One can't delete from sequence engine */ - int truncate() + int truncate() override { return HA_ERR_WRONG_COMMAND; } /* Can't use query cache */ - uint8 table_cache_type() + uint8 table_cache_type() override { return HA_CACHE_TBL_NOCACHE; } - void print_error(int error, myf errflag); - int info(uint); - LEX_CSTRING *engine_name() { return hton_name(file->ht); } - int external_lock(THD *thd, int lock_type); - int extra(enum ha_extra_function operation); + void print_error(int error, myf errflag) override; + int info(uint) override; + LEX_CSTRING *engine_name() override { return hton_name(file->ht); } + int external_lock(THD *thd, int lock_type) override; + int extra(enum ha_extra_function operation) override; /* For ALTER ONLINE TABLE */ bool check_if_incompatible_data(HA_CREATE_INFO *create_info, - uint table_changes); + uint table_changes) override; void write_lock() { write_locked= 1;} void unlock() { write_locked= 0; } bool is_locked() { return write_locked; } /* Functions that are directly mapped to the underlying handler */ - int rnd_init(bool scan) + int rnd_init(bool scan) override { return file->rnd_init(scan); } /* We need to have a lock here to protect engines like MyISAM from simultaneous read and write. For sequence's this is not critical as this function is used extremely seldom. */ - int rnd_next(uchar *buf) + int rnd_next(uchar *buf) override { int error; table->s->sequence->read_lock(table); @@ -112,9 +112,9 @@ public: table->s->sequence->read_unlock(table); return error; } - int rnd_end() + int rnd_end() override { return file->rnd_end(); } - int rnd_pos(uchar *buf, uchar *pos) + int rnd_pos(uchar *buf, uchar *pos) override { int error; table->s->sequence->read_lock(table); @@ -122,37 +122,37 @@ public: table->s->sequence->read_unlock(table); return error; } - void position(const uchar *record) + void position(const uchar *record) override { return file->position(record); } const char *table_type() const { return file->table_type(); } - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return file->index_flags(inx, part, all_parts); } THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type) + enum thr_lock_type lock_type) override { return file->store_lock(thd, to, lock_type); } - int close(void) + int close(void) override { return file->close(); } const char **bas_ext() const { return file->bas_ext(); } - int delete_table(const char*name) + int delete_table(const char*name) override { return file->delete_table(name); } - int rename_table(const char *from, const char *to) + int rename_table(const char *from, const char *to) override { return file->rename_table(from, to); } - void unbind_psi() + void unbind_psi() override { file->unbind_psi(); } - void rebind_psi() + void rebind_psi() override { file->rebind_psi(); } - bool auto_repair(int error) const + bool auto_repair(int error) const override { return file->auto_repair(error); } - int repair(THD* thd, HA_CHECK_OPT* check_opt) + int repair(THD* thd, HA_CHECK_OPT* check_opt) override { return file->repair(thd, check_opt); } - bool check_and_repair(THD *thd) + bool check_and_repair(THD *thd) override { return file->check_and_repair(thd); } - bool is_crashed() const + bool is_crashed() const override { return file->is_crashed(); } - void column_bitmaps_signal() + void column_bitmaps_signal() override { return file->column_bitmaps_signal(); } /* New methods */ diff --git a/sql/handler.cc b/sql/handler.cc index 3acc0246aab..6fc74fc1fbc 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -162,7 +162,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { *cond_hdl= NULL; if (non_existing_table_error(sql_errno)) diff --git a/sql/handler.h b/sql/handler.h index 2be0b3372f3..91879010ff9 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -5141,8 +5141,8 @@ public: : thd(thd_arg), wild(NULL), with_temps(true), tables(tables_arg) {} ~Discovered_table_list() = default; - bool add_table(const char *tname, size_t tlen); - bool add_file(const char *fname); + bool add_table(const char *tname, size_t tlen) override; + bool add_file(const char *fname) override; void sort(); void remove_duplicates(); // assumes that the list is sorted diff --git a/sql/item.cc b/sql/item.cc index 063c9d3122e..be923fe7bae 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7992,7 +7992,7 @@ class Dependency_marker: public Field_enumerator public: THD *thd; st_select_lex *current_select; - virtual void visit_field(Item_field *item) + void visit_field(Item_field *item) override { // Find which select the field is in. This is achieved by walking up // the select tree and looking for the table of interest. diff --git a/sql/item.h b/sql/item.h index 1b696db66e9..389c2da4cf4 100644 --- a/sql/item.h +++ b/sql/item.h @@ -417,16 +417,16 @@ public: class Sp_rcontext_handler_local: public Sp_rcontext_handler { public: - const LEX_CSTRING *get_name_prefix() const; - sp_rcontext *get_rcontext(sp_rcontext *ctx) const; + const LEX_CSTRING *get_name_prefix() const override; + sp_rcontext *get_rcontext(sp_rcontext *ctx) const override; }; class Sp_rcontext_handler_package_body: public Sp_rcontext_handler { public: - const LEX_CSTRING *get_name_prefix() const; - sp_rcontext *get_rcontext(sp_rcontext *ctx) const; + const LEX_CSTRING *get_name_prefix() const override; + sp_rcontext *get_rcontext(sp_rcontext *ctx) const override; }; @@ -1156,9 +1156,9 @@ public: { return type_handler()->max_display_length(this); } - const TYPELIB *get_typelib() const { return NULL; } - void set_maybe_null(bool maybe_null_arg) { maybe_null= maybe_null_arg; } - void set_typelib(const TYPELIB *typelib) + const TYPELIB *get_typelib() const override { return NULL; } + void set_maybe_null(bool maybe_null_arg) override { maybe_null= maybe_null_arg; } + void set_typelib(const TYPELIB *typelib) override { // Non-field Items (e.g. hybrid functions) never have ENUM/SET types yet. DBUG_ASSERT(0); @@ -1666,7 +1666,7 @@ public: inline uint float_length(uint decimals_par) const { return decimals < FLOATING_POINT_DECIMALS ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} /* Returns total number of decimal digits */ - virtual uint decimal_precision() const + uint decimal_precision() const override { return type_handler()->Item_decimal_precision(this); } @@ -2798,20 +2798,20 @@ public: Item_fixed_hybrid(THD *thd, Item_fixed_hybrid *item) :Item(thd, item), fixed(item->fixed) { } - bool fix_fields(THD *thd, Item **ref) + bool fix_fields(THD *thd, Item **ref) override { DBUG_ASSERT(!fixed); fixed= true; return false; } - void cleanup() + void cleanup() override { Item::cleanup(); fixed= false; } - void quick_fix_field() { fixed= true; } - void unfix_fields() { fixed= false; } - bool is_fixed() const { return fixed; } + void quick_fix_field() override { fixed= true; } + void unfix_fields() override { fixed= false; } + bool is_fixed() const override { return fixed; } }; @@ -2889,8 +2889,8 @@ class Item_basic_constant :public Item_basic_value { public: Item_basic_constant(THD *thd): Item_basic_value(thd) {}; - bool check_vcol_func_processor(void *arg) { return false; } - const Item_const *get_item_const() const { return this; } + bool check_vcol_func_processor(void *arg) override { return false; } + const Item_const *get_item_const() const override { return this; } virtual Item_basic_constant *make_string_literal_concat(THD *thd, const LEX_CSTRING *) { @@ -4330,11 +4330,11 @@ public: Item_uint(THD *thd, const char *str_arg, size_t length); Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {} Item_uint(THD *thd, const char *str_arg, longlong i, uint length); - double val_real() { return ulonglong2double((ulonglong)value); } - Item *clone_item(THD *thd); - Item *neg(THD *thd); - uint decimal_precision() const { return max_length; } - Item *get_copy(THD *thd) + double val_real() override { return ulonglong2double((ulonglong)value); } + Item *clone_item(THD *thd) override; + Item *neg(THD *thd) override; + uint decimal_precision() const override { return max_length; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4617,7 +4617,7 @@ public: const LEX_CSTRING &str, CHARSET_INFO *tocs): Item_string(thd, name_arg, str, tocs) { } - virtual bool is_cs_specified() const + bool is_cs_specified() const override { return true; } @@ -4696,7 +4696,7 @@ public: { max_length= length; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE); } @@ -4721,7 +4721,7 @@ public: :Item_partition_func_safe_string(thd, LEX_CSTRING({header, strlen(header)}), length * cs->mbmaxlen, cs) { } - void make_send_field(THD *thd, Send_field *field); + void make_send_field(THD *thd, Send_field *field) override; }; @@ -4735,7 +4735,7 @@ public: { unsigned_flag=1; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { const Type_handler *h= Type_handler::get_handler_by_field_type(int_field_type); @@ -4761,14 +4761,14 @@ public: { hex_string_init(thd, str, str_length); } - const Type_handler *type_handler() const { return &type_handler_varchar; } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + const Type_handler *type_handler() const override { return &type_handler_varchar; } + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { return const_charset_converter(thd, tocs, true); } - const String *const_ptr_string() const { return &str_value; } - String *val_str(String*) { return &str_value; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + const String *const_ptr_string() const override { return &str_value; } + String *val_str(String*) override { return &str_value; } + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } @@ -5132,7 +5132,7 @@ public: { maybe_null= false; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { cached_time.copy_to_mysql_time(ltime); return (null_value= false); @@ -5153,7 +5153,7 @@ public: { maybe_null= false; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { cached_time.copy_to_mysql_time(ltime); return (null_value= false); @@ -7074,7 +7074,7 @@ class Item_cache_year: public Item_cache_int public: Item_cache_year(THD *thd, const Type_handler *handler) :Item_cache_int(thd, handler) { } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { return type_handler_year.Item_get_date_with_warn(thd, this, to, mode); } @@ -7281,8 +7281,8 @@ public: Item_cache_double(THD *thd) :Item_cache_real(thd, &type_handler_double) { } - String* val_str(String *str); - Item *get_copy(THD *thd) + String* val_str(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7293,8 +7293,8 @@ public: Item_cache_float(THD *thd) :Item_cache_real(thd, &type_handler_float) { } - String* val_str(String *str); - Item *get_copy(THD *thd) + String* val_str(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7358,7 +7358,7 @@ public: Item_cache_str_for_nullif(THD *thd, const Item *item) :Item_cache_str(thd, item) { } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { /** Item_cache_str::safe_charset_converter() returns a new Item_cache @@ -7372,7 +7372,7 @@ public: */ return Item::safe_charset_converter(thd, tocs); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7594,9 +7594,9 @@ class Item_iterator_ref_list: public Item_iterator public: Item_iterator_ref_list(List_iterator &arg_list): list(arg_list) {} - void open() { list.rewind(); } - Item *next() { return *(list++); } - void close() {} + void open() override { list.rewind(); } + Item *next() override { return *(list++); } + void close() override {} }; @@ -7610,9 +7610,9 @@ class Item_iterator_list: public Item_iterator public: Item_iterator_list(List_iterator &arg_list): list(arg_list) {} - void open() { list.rewind(); } - Item *next() { return (list++); } - void close() {} + void open() override { list.rewind(); } + Item *next() override { return (list++); } + void close() override {} }; @@ -7626,14 +7626,14 @@ class Item_iterator_row: public Item_iterator uint current; public: Item_iterator_row(Item *base) : base_item(base), current(0) {} - void open() { current= 0; } - Item *next() + void open() override { current= 0; } + Item *next() override { if (current >= base_item->cols()) return NULL; return base_item->element_index(current++); } - void close() {} + void close() override {} }; @@ -7679,84 +7679,84 @@ public: void change_item(THD *thd, Item *); - bool fix_fields(THD *thd, Item **it); + bool fix_fields(THD *thd, Item **it) override; - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - Item *get_tmp_table_item(THD *thd) + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override; + Item *get_tmp_table_item(THD *thd) override { return m_item->get_tmp_table_item(thd); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref) + COND_EQUAL **cond_equal_ref) override { return m_item->build_equal_items(thd, inherited, link_item_fields, cond_equal_ref); } - const char *full_name() const { return m_item->full_name(); } - void make_send_field(THD *thd, Send_field *field) + const char *full_name() const override { return m_item->full_name(); } + void make_send_field(THD *thd, Send_field *field) override { m_item->make_send_field(thd, field); } - bool eq(const Item *item, bool binary_cmp) const + bool eq(const Item *item, bool binary_cmp) const override { const Item *it= item->real_item(); return m_item->eq(it, binary_cmp); } - void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) + void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) override { m_item->fix_after_pullout(new_parent, &m_item, merge); } - void save_val(Field *to) + void save_val(Field *to) override { return m_item->save_val(to); } - void save_result(Field *to) + void save_result(Field *to) override { return m_item->save_result(to); } - int save_in_field(Field *to, bool no_conversions) + int save_in_field(Field *to, bool no_conversions) override { return m_item->save_in_field(to, no_conversions); } - const Type_handler *type_handler() const { return m_item->type_handler(); } - table_map used_tables() const { return m_item->used_tables(); } - void update_used_tables() + const Type_handler *type_handler() const override { return m_item->type_handler(); } + table_map used_tables() const override { return m_item->used_tables(); } + void update_used_tables() override { m_item->update_used_tables(); } - bool const_item() const { return m_item->const_item(); } - table_map not_null_tables() const { return m_item->not_null_tables(); } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool const_item() const override { return m_item->const_item(); } + table_map not_null_tables() const override { return m_item->not_null_tables(); } + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { return m_item->walk(processor, walk_subquery, arg) || (this->*processor)(arg); } - bool enumerate_field_refs_processor(void *arg) + bool enumerate_field_refs_processor(void *arg) override { return m_item->enumerate_field_refs_processor(arg); } - Item_field *field_for_view_update() + Item_field *field_for_view_update() override { return m_item->field_for_view_update(); } /* Row emulation: forwarding of ROW-related calls to orig_item */ - uint cols() const + uint cols() const override { return m_item->cols(); } - Item* element_index(uint i) + Item* element_index(uint i) override { return this; } - Item** addr(uint i) + Item** addr(uint i) override { return &m_item; } - bool check_cols(uint c) + bool check_cols(uint c) override { return Item::check_cols(c); } - bool null_inside() + bool null_inside() override { return m_item->null_inside(); } - void bring_value() + void bring_value() override {} - Item_equal *get_item_equal() { return m_item->get_item_equal(); } - void set_item_equal(Item_equal *item_eq) { m_item->set_item_equal(item_eq); } - Item_equal *find_item_equal(COND_EQUAL *cond_equal) + Item_equal *get_item_equal() override { return m_item->get_item_equal(); } + void set_item_equal(Item_equal *item_eq) override { m_item->set_item_equal(item_eq); } + Item_equal *find_item_equal(COND_EQUAL *cond_equal) override { return m_item->find_item_equal(cond_equal); } - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { return m_item->propagate_equal_fields(thd, ctx, cond); } - Item *replace_equal_field(THD *thd, uchar *arg) + Item *replace_equal_field(THD *thd, uchar *arg) override { return m_item->replace_equal_field(thd, arg); } - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { return m_item->excl_dep_on_table(tab_map); } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return m_item->excl_dep_on_grouping_fields(sel); } - bool is_expensive() { return m_item->is_expensive(); } + bool is_expensive() override { return m_item->is_expensive(); } void set_item(Item *item) { m_item= item; } - Item *build_clone(THD *thd) + Item *build_clone(THD *thd) override { Item *clone_item= m_item->build_clone(thd); if (clone_item) @@ -7771,7 +7771,7 @@ public: } void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags) + List &fields, uint flags) override { m_item->split_sum_func(thd, ref_pointer_array, fields, flags); } @@ -7779,7 +7779,7 @@ public: This processor states that this is safe for virtual columns (because this Item transparency) */ - bool check_vcol_func_processor(void *arg) { return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} }; inline bool TABLE::mark_column_with_deps(Field *field) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index a755cac49ad..c17a7d57545 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4823,7 +4823,7 @@ class Func_handler_bit_or_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); Longlong_null a= item->arguments()[0]->to_longlong_null(); @@ -4836,7 +4836,7 @@ class Func_handler_bit_or_dec_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); VDec a(item->arguments()[0]); @@ -4858,7 +4858,7 @@ class Func_handler_bit_and_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); Longlong_null a= item->arguments()[0]->to_longlong_null(); @@ -4871,7 +4871,7 @@ class Func_handler_bit_and_dec_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); VDec a(item->arguments()[0]); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 4674f935aed..e2e743fa075 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -236,12 +236,12 @@ public: Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} Item_bool_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const { return &type_handler_bool; } - const Type_handler *fixed_type_handler() const { return &type_handler_bool; } - CHARSET_INFO *compare_collation() const { return NULL; } - bool fix_length_and_dec() { decimals=0; max_length=1; return FALSE; } - uint decimal_precision() const { return 1; } - bool need_parentheses_in_default() { return true; } + const Type_handler *type_handler() const override { return &type_handler_bool; } + const Type_handler *fixed_type_handler() const override { return &type_handler_bool; } + CHARSET_INFO *compare_collation() const override { return NULL; } + bool fix_length_and_dec() override { decimals=0; max_length=1; return FALSE; } + uint decimal_precision() const override { return 1; } + bool need_parentheses_in_default() override { return true; } }; @@ -253,11 +253,11 @@ public: class Item_func_truth : public Item_bool_func { public: - virtual bool val_bool(); - virtual longlong val_int(); - virtual bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } + bool val_bool() override; + longlong val_int() override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return CMP_PRECEDENCE; } protected: Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): @@ -287,8 +287,8 @@ class Item_func_istrue : public Item_func_truth public: Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {} ~Item_func_istrue() = default; - virtual const char* func_name() const { return "istrue"; } - Item *get_copy(THD *thd) + const char* func_name() const override { return "istrue"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -303,11 +303,11 @@ public: Item_func_isnottrue(THD *thd, Item *a): Item_func_truth(thd, a, true, false) {} ~Item_func_isnottrue() = default; - virtual const char* func_name() const { return "isnottrue"; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) + const char* func_name() const override { return "isnottrue"; } + bool find_not_null_fields(table_map allowed) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return false; } }; @@ -320,8 +320,8 @@ class Item_func_isfalse : public Item_func_truth public: Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {} ~Item_func_isfalse() = default; - virtual const char* func_name() const { return "isfalse"; } - Item *get_copy(THD *thd) + const char* func_name() const override { return "isfalse"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -336,11 +336,11 @@ public: Item_func_isnotfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, false) {} ~Item_func_isnotfalse() = default; - virtual const char* func_name() const { return "isnotfalse"; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) + const char* func_name() const override { return "isnotfalse"; } + bool find_not_null_fields(table_map allowed) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return false; } }; @@ -427,10 +427,10 @@ public: Item_bool_func2(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b) { } - bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } + bool is_null() override { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - bool count_sargable_conds(void *arg); + bool top_level) override; + bool count_sargable_conds(void *arg) override; /* Specifies which result type the function uses to compare its arguments. This method is used in equal field propagation. @@ -445,7 +445,7 @@ public: */ return &type_handler_varchar; } - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_bool_func2::get_mm_tree"); DBUG_ASSERT(arg_count == 2); @@ -478,7 +478,7 @@ class Item_bool_func2_with_rev :public Item_bool_func2 { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_bool_func2_with_rev::get_func_mm_tree"); Item_func::Functype func_type= @@ -489,7 +489,7 @@ public: Item_bool_func2_with_rev(THD *thd, Item *a, Item *b): Item_bool_func2(thd, a, b) { } virtual enum Functype rev_functype() const= 0; - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_bool_func2_with_rev::get_mm_tree"); DBUG_ASSERT(arg_count == 2); @@ -523,7 +523,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2_with_rev { protected: Arg_comparator cmp; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } @@ -531,15 +531,15 @@ public: Item_bool_rowready_func2(THD *thd, Item *a, Item *b): Item_bool_func2_with_rev(thd, a, b), cmp(tmp_arg, tmp_arg + 1) { } - Sql_mode_dependency value_depends_on_sql_mode() const; - void print(String *str, enum_query_type query_type) + Sql_mode_dependency value_depends_on_sql_mode() const override; + void print(String *str, enum_query_type query_type) override { Item_func::print_op(str, query_type); } - enum precedence precedence() const { return CMP_PRECEDENCE; } - Item *neg_transformer(THD *thd); + enum precedence precedence() const override { return CMP_PRECEDENCE; } + Item *neg_transformer(THD *thd) override; virtual Item *negated_item(THD *thd); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Item_args::propagate_equal_fields(thd, Context(ANY_SUBST, @@ -548,7 +548,7 @@ public: cond); return this; } - bool fix_length_and_dec(); + bool fix_length_and_dec() override; bool fix_length_and_dec_generic(THD *thd, const Type_handler *compare_handler) { @@ -561,25 +561,25 @@ public: DBUG_ASSERT(args == tmp_arg); return cmp.set_cmp_func(thd, this, tmp_arg, tmp_arg + 1, true/*set_null*/); } - CHARSET_INFO *compare_collation() const { return cmp.compare_collation(); } - const Type_handler *compare_type_handler() const + CHARSET_INFO *compare_collation() const override { return cmp.compare_collation(); } + const Type_handler *compare_type_handler() const override { return cmp.compare_type_handler(); } Arg_comparator *get_comparator() { return &cmp; } - void cleanup() + void cleanup() override { Item_bool_func2::cleanup(); cmp.cleanup(); } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) + SARGABLE_PARAM **sargables) override { return add_key_fields_optimize_op(join, key_fields, and_level, usable_tables, sargables, false); } - Item *build_clone(THD *thd) + Item *build_clone(THD *thd) override { Item_bool_rowready_func2 *clone= (Item_bool_rowready_func2 *) Item_func::build_clone(thd); @@ -600,20 +600,20 @@ class Item_func_xor :public Item_bool_func { public: Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {} - enum Functype functype() const { return XOR_FUNC; } - const char *func_name() const { return "xor"; } - enum precedence precedence() const { return XOR_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + enum Functype functype() const override { return XOR_FUNC; } + const char *func_name() const override { return "xor"; } + enum precedence precedence() const override { return XOR_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { Item_func::print_op(str, query_type); } - longlong val_int(); - bool find_not_null_fields(table_map allowed) { return false; } - Item *neg_transformer(THD *thd); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + longlong val_int() override; + bool find_not_null_fields(table_map allowed) override { return false; } + Item *neg_transformer(THD *thd) override; + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Item_args::propagate_equal_fields(thd, Context_boolean(), cond); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -674,15 +674,15 @@ class Item_func_trig_cond: public Item_bool_func public: Item_func_trig_cond(THD *thd, Item *a, bool *f): Item_bool_func(thd, a) { trig_var= f; } - longlong val_int() { return *trig_var ? args[0]->val_int() : 1; } - enum Functype functype() const { return TRIG_COND_FUNC; }; - const char *func_name() const { return "trigcond"; }; - bool const_item() const { return FALSE; } + longlong val_int() override { return *trig_var ? args[0]->val_int() : 1; } + enum Functype functype() const override { return TRIG_COND_FUNC; }; + const char *func_name() const override { return "trigcond"; }; + bool const_item() const override { return FALSE; } bool *get_trig_var() { return trig_var; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) + SARGABLE_PARAM **sargables) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -698,19 +698,19 @@ public: Item_func_not_all(THD *thd, Item *a): Item_func_not(thd, a), test_sum_item(0), test_sub_item(0), show(0) {} - table_map not_null_tables() const { return 0; } - longlong val_int(); - enum Functype functype() const { return NOT_ALL_FUNC; } - const char *func_name() const { return ""; } - enum precedence precedence() const + table_map not_null_tables() const override { return 0; } + longlong val_int() override; + enum Functype functype() const override { return NOT_ALL_FUNC; } + const char *func_name() const override { return ""; } + enum precedence precedence() const override { return show ? Item_func::precedence() : args[0]->precedence(); } - bool fix_fields(THD *thd, Item **ref) + bool fix_fields(THD *thd, Item **ref) override {return Item_func::fix_fields(thd, ref);} - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; void set_sum_test(Item_sum_min_max *item) { test_sum_item= item; test_sub_item= 0; }; void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; test_sum_item= 0;}; bool empty_underlying_subquery(); - Item *neg_transformer(THD *thd); + Item *neg_transformer(THD *thd) override; }; @@ -719,10 +719,10 @@ class Item_func_nop_all :public Item_func_not_all public: Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {} - longlong val_int(); - const char *func_name() const { return ""; } - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return ""; } + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -735,24 +735,24 @@ public: Item_bool_rowready_func2(thd, a, b), abort_on_null(false), in_equality_no(UINT_MAX) {} - longlong val_int(); - enum Functype functype() const { return EQ_FUNC; } - enum Functype rev_functype() const { return EQ_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "="; } - void top_level_item() { abort_on_null= true; } - Item *negated_item(THD *thd); + longlong val_int() override; + enum Functype functype() const override { return EQ_FUNC; } + enum Functype rev_functype() const override { return EQ_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } + const char *func_name() const override { return "="; } + void top_level_item() override { abort_on_null= true; } + Item *negated_item(THD *thd) override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) + SARGABLE_PARAM **sargables) override { return add_key_fields_optimize_op(join, key_fields, and_level, usable_tables, sargables, true); } - bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list); + bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list) override; /* - If this equality is created from the subquery's IN-equality: number of the item it was created from, e.g. for @@ -761,9 +761,9 @@ public: - Otherwise, UINT_MAX */ uint in_equality_no; - virtual uint exists2in_reserved_items() { return 1; }; + uint exists2in_reserved_items() override { return 1; }; friend class Arg_comparator; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -772,23 +772,23 @@ class Item_func_equal final :public Item_bool_rowready_func2 public: Item_func_equal(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - bool fix_length_and_dec(); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed) { return false; } - enum Functype functype() const { return EQUAL_FUNC; } - enum Functype rev_functype() const { return EQUAL_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "<=>"; } - Item *neg_transformer(THD *thd) { return 0; } + longlong val_int() override; + bool fix_length_and_dec() override; + table_map not_null_tables() const override { return 0; } + bool find_not_null_fields(table_map allowed) override { return false; } + enum Functype functype() const override { return EQUAL_FUNC; } + enum Functype rev_functype() const override { return EQUAL_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } + const char *func_name() const override { return "<=>"; } + Item *neg_transformer(THD *thd) override { return 0; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) + SARGABLE_PARAM **sargables) override { return add_key_fields_optimize_op(join, key_fields, and_level, usable_tables, sargables, true); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -798,13 +798,13 @@ class Item_func_ge :public Item_bool_rowready_func2 public: Item_func_ge(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GE_FUNC; } - enum Functype rev_functype() const { return LE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return ">="; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + longlong val_int() override; + enum Functype functype() const override { return GE_FUNC; } + enum Functype rev_functype() const override { return LE_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } + const char *func_name() const override { return ">="; } + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -814,13 +814,13 @@ class Item_func_gt :public Item_bool_rowready_func2 public: Item_func_gt(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GT_FUNC; } - enum Functype rev_functype() const { return LT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return ">"; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + longlong val_int() override; + enum Functype functype() const override { return GT_FUNC; } + enum Functype rev_functype() const override { return LT_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } + const char *func_name() const override { return ">"; } + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -830,13 +830,13 @@ class Item_func_le :public Item_bool_rowready_func2 public: Item_func_le(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return LE_FUNC; } - enum Functype rev_functype() const { return GE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "<="; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + longlong val_int() override; + enum Functype functype() const override { return LE_FUNC; } + enum Functype rev_functype() const override { return GE_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } + const char *func_name() const override { return "<="; } + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -846,13 +846,13 @@ class Item_func_lt :public Item_bool_rowready_func2 public: Item_func_lt(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return LT_FUNC; } - enum Functype rev_functype() const { return GT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return "<"; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + longlong val_int() override; + enum Functype functype() const override { return LT_FUNC; } + enum Functype rev_functype() const override { return GT_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } + const char *func_name() const override { return "<"; } + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -861,19 +861,19 @@ class Item_func_ne :public Item_bool_rowready_func2 { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); + Field *field, Item *value) override; public: Item_func_ne(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return NE_FUNC; } - enum Functype rev_functype() const { return NE_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return "<>"; } - Item *negated_item(THD *thd); + longlong val_int() override; + enum Functype functype() const override { return NE_FUNC; } + enum Functype rev_functype() const override { return NE_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } + const char *func_name() const override { return "<>"; } + Item *negated_item(THD *thd) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) + table_map usable_tables, SARGABLE_PARAM **sargables) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -929,37 +929,37 @@ class Item_func_between :public Item_func_opt_neg { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); + Field *field, Item *value) override; bool val_int_cmp_int_finalize(longlong value, longlong a, longlong b); public: String value0,value1,value2; Item_func_between(THD *thd, Item *a, Item *b, Item *c): Item_func_opt_neg(thd, a, b, c) { } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed); return m_comparator.type_handler()->Item_func_between_val_int(this); } - enum Functype functype() const { return BETWEEN; } - const char *func_name() const { return "between"; } - enum precedence precedence() const { return BETWEEN_PRECEDENCE; } - bool fix_length_and_dec(); + enum Functype functype() const override { return BETWEEN; } + const char *func_name() const override { return "between"; } + enum precedence precedence() const override { return BETWEEN_PRECEDENCE; } + bool fix_length_and_dec() override; bool fix_length_and_dec_string(THD *) { return agg_arg_charsets_for_comparison(cmp_collation, args, 3); } bool fix_length_and_dec_temporal(THD *); bool fix_length_and_dec_numeric(THD *); - virtual void print(String *str, enum_query_type query_type); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); + void print(String *str, enum_query_type query_type) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; + bool count_sargable_conds(void *arg) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Item_args::propagate_equal_fields(thd, Context(ANY_SUBST, @@ -968,7 +968,7 @@ public: cond); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } longlong val_int_cmp_string(); @@ -983,24 +983,24 @@ public: class Item_func_strcmp :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2); } String value1, value2; DTCollation cmp_collation; public: Item_func_strcmp(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - uint decimal_precision() const { return 1; } - const char *func_name() const { return "strcmp"; } - bool fix_length_and_dec() + longlong val_int() override; + uint decimal_precision() const override { return 1; } + const char *func_name() const override { return "strcmp"; } + bool fix_length_and_dec() override { if (agg_arg_charsets_for_comparison(cmp_collation, args, 2)) return TRUE; fix_char_length(2); // returns "1" or "0" or "-1" return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1017,7 +1017,7 @@ class Item_func_interval :public Item_long_func Item_row *row; bool use_decimal_comparison; interval_range *intervals; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } @@ -1025,17 +1025,17 @@ public: Item_func_interval(THD *thd, Item_row *a): Item_long_func(thd, a), row(a), intervals(0) { } - bool fix_fields(THD *, Item **); - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "interval"; } - uint decimal_precision() const { return 2; } - void print(String *str, enum_query_type query_type) + bool fix_fields(THD *, Item **) override; + longlong val_int() override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "interval"; } + uint decimal_precision() const override { return 2; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); print_args(str, 0, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1047,23 +1047,23 @@ public: Item_func_case_expression(thd, a, b) {} Item_func_coalesce(THD *thd, List &list): Item_func_case_expression(thd, list) {} - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() + double real_op() override; + longlong int_op() override; + String *str_op(String *) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override { if (aggregate_for_result(func_name(), args, arg_count, true)) return TRUE; fix_attributes(args, arg_count); return FALSE; } - const char *func_name() const { return "coalesce"; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "coalesce"; } + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1127,14 +1127,14 @@ class Item_func_ifnull :public Item_func_case_abbreviation2 public: Item_func_ifnull(THD *thd, Item *a, Item *b): Item_func_case_abbreviation2(thd, a, b) {} - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() + double real_op() override; + longlong int_op() override; + String *str_op(String *str) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override { /* Set nullability from args[1] by default. @@ -1151,10 +1151,10 @@ public: return TRUE; return FALSE; } - const char *func_name() const { return "ifnull"; } + const char *func_name() const override { return "ifnull"; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1177,32 +1177,32 @@ public: :Item_func_case_abbreviation2(thd, a, b, c) { } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { Datetime_truncation_not_needed dt(thd, find_item(), fuzzydate); return (null_value= dt.copy_to_mysql_time(ltime, mysql_timestamp_type())); } - bool time_op(THD *thd, MYSQL_TIME *ltime) + bool time_op(THD *thd, MYSQL_TIME *ltime) override { return (null_value= Time(find_item()).copy_to_mysql_time(ltime)); } - longlong int_op() + longlong int_op() override { return val_int_from_item(find_item()); } - double real_op() + double real_op() override { return val_real_from_item(find_item()); } - my_decimal *decimal_op(my_decimal *decimal_value) + my_decimal *decimal_op(my_decimal *decimal_value) override { return val_decimal_from_item(find_item(), decimal_value); } - String *str_op(String *str) + String *str_op(String *str) override { return val_str_from_item(find_item(), str); } - bool native_op(THD *thd, Native *to) + bool native_op(THD *thd, Native *to) override { return val_native_with_conversion_from_item(thd, find_item(), to, type_handler()); @@ -1213,21 +1213,21 @@ public: class Item_func_if :public Item_func_case_abbreviation2_switch { protected: - Item *find_item() const { return args[0]->val_bool() ? args[1] : args[2]; } + Item *find_item() const override { return args[0]->val_bool() ? args[1] : args[2]; } public: Item_func_if(THD *thd, Item *a, Item *b, Item *c): Item_func_case_abbreviation2_switch(thd, a, b, c) {} - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override { return fix_length_and_dec2_eliminate_null(args + 1); } - const char *func_name() const { return "if"; } - bool eval_not_null_tables(void *opt_arg); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - Item *get_copy(THD *thd) + const char *func_name() const override { return "if"; } + bool eval_not_null_tables(void *opt_arg) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: void cache_type_info(Item *source); @@ -1237,18 +1237,18 @@ private: class Item_func_nvl2 :public Item_func_case_abbreviation2_switch { protected: - Item *find_item() const { return args[0]->is_null() ? args[2] : args[1]; } + Item *find_item() const override { return args[0]->is_null() ? args[2] : args[1]; } public: Item_func_nvl2(THD *thd, Item *a, Item *b, Item *c): Item_func_case_abbreviation2_switch(thd, a, b, c) {} - const char *func_name() const { return "nvl2"; } - bool fix_length_and_dec() + const char *func_name() const override { return "nvl2"; } + bool fix_length_and_dec() override { return fix_length_and_dec2_eliminate_null(args + 1); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1295,28 +1295,28 @@ public: m_cache(NULL), m_arg0(NULL) { arg_count--; } - void cleanup() + void cleanup() override { Item_func_hybrid_field_type::cleanup(); arg_count= 2; // See the comment to the constructor } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec(); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - const char *func_name() const { return "nullif"; } - void print(String *str, enum_query_type query_type); + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + double real_op() override; + longlong int_op() override; + String *str_op(String *str) override; + my_decimal *decimal_op(my_decimal *) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override; + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; + const char *func_name() const override { return "nullif"; } + void print(String *str, enum_query_type query_type) override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - void update_used_tables(); - table_map not_null_tables() const { return 0; } - bool is_null(); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + List &fields, uint flags) override; + void update_used_tables() override; + table_map not_null_tables() const override { return 0; } + bool is_null() override; + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Context cmpctx(ANY_SUBST, cmp.compare_type_handler(), cmp.compare_collation()); @@ -1337,17 +1337,17 @@ public: cond, &args[2]); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *derived_field_transformer_for_having(THD *thd, uchar *arg) + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *derived_field_transformer_for_where(THD *thd, uchar *arg) + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) + Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } }; @@ -1435,16 +1435,16 @@ class in_string :public in_vector public: in_string(THD *thd, uint elements, qsort2_cmp cmp_func, CHARSET_INFO *cs); ~in_string(); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { String *str=((String*) base)+pos; Item_string_for_in_vector *to= (Item_string_for_in_vector*) item; to->set_value(str); } - const Type_handler *type_handler() const { return &type_handler_varchar; } + const Type_handler *type_handler() const override { return &type_handler_varchar; } }; class in_longlong :public in_vector @@ -1462,16 +1462,16 @@ protected: } tmp; public: in_longlong(THD *thd, uint elements); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { ((Item_int*) item)->value= ((packed_longlong*) base)[pos].val; ((Item_int*) item)->unsigned_flag= (bool) ((packed_longlong*) base)[pos].unsigned_flag; } - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override { return &type_handler_slonglong; } friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); }; @@ -1482,11 +1482,11 @@ class in_timestamp :public in_vector Timestamp_or_zero_datetime tmp; public: in_timestamp(THD *thd, uint elements); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item); - const Type_handler *type_handler() const { return &type_handler_timestamp2; } + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override; + const Type_handler *type_handler() const override { return &type_handler_timestamp2; } }; @@ -1500,8 +1500,8 @@ public: in_temporal(THD *thd, uint elements) :in_longlong(thd, elements) {}; - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) + Item *create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { packed_longlong *val= reinterpret_cast(base)+pos; Item_datetime *dt= static_cast(item); @@ -1517,9 +1517,9 @@ public: in_datetime(THD *thd, uint elements) :in_temporal(thd, elements) {} - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_datetime2; } + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + const Type_handler *type_handler() const override { return &type_handler_datetime2; } }; @@ -1529,9 +1529,9 @@ public: in_time(THD *thd, uint elements) :in_temporal(thd, elements) {} - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_time2; } + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + const Type_handler *type_handler() const override { return &type_handler_time2; } }; @@ -1540,14 +1540,14 @@ class in_double :public in_vector double tmp; public: in_double(THD *thd, uint elements); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item *create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { ((Item_float*)item)->value= ((double*) base)[pos]; } - const Type_handler *type_handler() const { return &type_handler_double; } + const Type_handler *type_handler() const override { return &type_handler_double; } }; @@ -1556,16 +1556,16 @@ class in_decimal :public in_vector my_decimal val; public: in_decimal(THD *thd, uint elements); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item *create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { my_decimal *dec= ((my_decimal *)base) + pos; Item_decimal *item_dec= (Item_decimal*)item; item_dec->set_decimal_value(dec); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } + const Type_handler *type_handler() const override { return &type_handler_newdecimal; } }; @@ -1634,7 +1634,7 @@ public: cmp_item_sort_string(CHARSET_INFO *cs): cmp_item_string(cs), value(value_buff, sizeof(value_buff), cs) {} - void store_value(Item *item) + void store_value(Item *item) override { value_res= item->val_str(&value); m_null_value= item->null_value; @@ -1646,13 +1646,13 @@ public: value_res= &value; } } - int cmp_not_null(const Value *val) + int cmp_not_null(const Value *val) override { DBUG_ASSERT(!val->is_null()); DBUG_ASSERT(val->is_string()); return sortcmp(value_res, &val->m_string, cmp_charset) != 0; } - int cmp(Item *arg) + int cmp(Item *arg) override { char buff[STRING_BUFFER_USUAL_SIZE]; String tmp(buff, sizeof(buff), cmp_charset), *res= arg->val_str(&tmp); @@ -1665,12 +1665,12 @@ public: else return TRUE; } - int compare(cmp_item *ci) + int compare(cmp_item *ci) override { cmp_item_string *l_cmp= (cmp_item_string *) ci; return sortcmp(value_res, l_cmp->value_res, cmp_charset); } - cmp_item *make_same(); + cmp_item *make_same() override; void set_charset(CHARSET_INFO *cs) { cmp_charset= cs; @@ -1683,28 +1683,28 @@ class cmp_item_int : public cmp_item_scalar longlong value; public: cmp_item_int() = default; /* Remove gcc warning */ - void store_value(Item *item) + void store_value(Item *item) override { value= item->val_int(); m_null_value= item->null_value; } - int cmp_not_null(const Value *val) + int cmp_not_null(const Value *val) override { DBUG_ASSERT(!val->is_null()); DBUG_ASSERT(val->is_longlong()); return value != val->value.m_longlong; } - int cmp(Item *arg) + int cmp(Item *arg) override { const bool rc= value != arg->val_int(); return (m_null_value || arg->null_value) ? UNKNOWN : rc; } - int compare(cmp_item *ci) + int compare(cmp_item *ci) override { cmp_item_int *l_cmp= (cmp_item_int *)ci; return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1); } - cmp_item *make_same(); + cmp_item *make_same() override; }; /* @@ -1716,7 +1716,7 @@ protected: longlong value; public: cmp_item_temporal() = default; - int compare(cmp_item *ci); + int compare(cmp_item *ci) override; }; @@ -1726,14 +1726,14 @@ public: cmp_item_datetime() :cmp_item_temporal() { } - void store_value(Item *item) + void store_value(Item *item) override { value= item->val_datetime_packed(current_thd); m_null_value= item->null_value; } - int cmp_not_null(const Value *val); - int cmp(Item *arg); - cmp_item *make_same(); + int cmp_not_null(const Value *val) override; + int cmp(Item *arg) override; + cmp_item *make_same() override; }; @@ -1743,14 +1743,14 @@ public: cmp_item_time() :cmp_item_temporal() { } - void store_value(Item *item) + void store_value(Item *item) override { value= item->val_time_packed(current_thd); m_null_value= item->null_value; } - int cmp_not_null(const Value *val); - int cmp(Item *arg); - cmp_item *make_same(); + int cmp_not_null(const Value *val) override; + int cmp(Item *arg) override; + cmp_item *make_same() override; }; @@ -1759,11 +1759,11 @@ class cmp_item_timestamp: public cmp_item_scalar Timestamp_or_zero_datetime_native m_native; public: cmp_item_timestamp() :cmp_item_scalar() { } - void store_value(Item *item); - int cmp_not_null(const Value *val); - int cmp(Item *arg); - int compare(cmp_item *ci); - cmp_item *make_same(); + void store_value(Item *item) override; + int cmp_not_null(const Value *val) override; + int cmp(Item *arg) override; + int compare(cmp_item *ci) override; + cmp_item *make_same() override; }; @@ -1772,28 +1772,28 @@ class cmp_item_real : public cmp_item_scalar double value; public: cmp_item_real() = default; /* Remove gcc warning */ - void store_value(Item *item) + void store_value(Item *item) override { value= item->val_real(); m_null_value= item->null_value; } - int cmp_not_null(const Value *val) + int cmp_not_null(const Value *val) override { DBUG_ASSERT(!val->is_null()); DBUG_ASSERT(val->is_double()); return value != val->value.m_double; } - int cmp(Item *arg) + int cmp(Item *arg) override { const bool rc= value != arg->val_real(); return (m_null_value || arg->null_value) ? UNKNOWN : rc; } - int compare(cmp_item *ci) + int compare(cmp_item *ci) override { cmp_item_real *l_cmp= (cmp_item_real *) ci; return (value < l_cmp->value)? -1 : ((value == l_cmp->value) ? 0 : 1); } - cmp_item *make_same(); + cmp_item *make_same() override; }; @@ -1802,11 +1802,11 @@ class cmp_item_decimal : public cmp_item_scalar my_decimal value; public: cmp_item_decimal() = default; /* Remove gcc warning */ - void store_value(Item *item); - int cmp(Item *arg); - int cmp_not_null(const Value *val); - int compare(cmp_item *c); - cmp_item *make_same(); + void store_value(Item *item) override; + int cmp(Item *arg) override; + int cmp_not_null(const Value *val) override; + int compare(cmp_item *c) override; + cmp_item *make_same() override; }; @@ -1822,28 +1822,28 @@ class cmp_item_sort_string_in_static :public cmp_item_string public: cmp_item_sort_string_in_static(CHARSET_INFO *cs): cmp_item_string(cs) {} - void store_value(Item *item) + void store_value(Item *item) override { value_res= item->val_str(&value); m_null_value= item->null_value; } - int cmp_not_null(const Value *val) + int cmp_not_null(const Value *val) override { DBUG_ASSERT(false); return TRUE; } - int cmp(Item *item) + int cmp(Item *item) override { // Should never be called DBUG_ASSERT(false); return TRUE; } - int compare(cmp_item *ci) + int compare(cmp_item *ci) override { cmp_item_string *l_cmp= (cmp_item_string *) ci; return sortcmp(value_res, l_cmp->value_res, cmp_charset); } - cmp_item *make_same() + cmp_item *make_same() override { return new cmp_item_sort_string_in_static(cmp_charset); } @@ -2229,18 +2229,18 @@ public: Item_func_case(THD *thd, List &list) :Item_func_case_expression(thd, list) { } - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_fields(THD *thd, Item **ref); - table_map not_null_tables() const { return 0; } - const char *func_name() const { return "case"; } + double real_op() override; + longlong int_op() override; + String *str_op(String *) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_fields(THD *thd, Item **ref) override; + table_map not_null_tables() const override { return 0; } + const char *func_name() const override { return "case"; } CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; @@ -2255,7 +2255,7 @@ class Item_func_case_searched: public Item_func_case { uint when_count() const { return arg_count / 2; } bool with_else() const { return arg_count % 2; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } + Item **else_expr_addr() const override { return with_else() ? &args[arg_count - 1] : 0; } public: Item_func_case_searched(THD *thd, List &list) :Item_func_case(thd, list) @@ -2263,17 +2263,17 @@ public: DBUG_ASSERT(arg_count >= 2); reorder_args(0); } - enum Functype functype() const { return CASE_SEARCHED_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + enum Functype functype() const override { return CASE_SEARCHED_FUNC; } + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; + Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { // None of the arguments are in a comparison context Item_args::propagate_equal_fields(thd, Context_identity(), cond); return this; } - Item *find_item(); - Item *get_copy(THD *thd) + Item *find_item() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2296,7 +2296,7 @@ protected: uint m_found_types; uint when_count() const { return (arg_count - 1) / 2; } bool with_else() const { return arg_count % 2 == 0; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } + Item **else_expr_addr() const override { return with_else() ? &args[arg_count - 1] : 0; } bool aggregate_switch_and_when_arguments(THD *thd, bool nulls_equal); bool prepare_predicant_and_values(THD *thd, uint *found_types, bool nulls_equal); @@ -2309,19 +2309,19 @@ public: DBUG_ASSERT(arg_count >= 3); reorder_args(1); } - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_case_simple::cleanup"); Item_func::cleanup(); Predicant_to_list_comparator::cleanup(); DBUG_VOID_RETURN; } - enum Functype functype() const { return CASE_SIMPLE_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond); - Item *find_item(); - Item *build_clone(THD *thd) + enum Functype functype() const override { return CASE_SIMPLE_FUNC; } + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; + Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override; + Item *find_item() override; + Item *build_clone(THD *thd) override { Item_func_case_simple *clone= (Item_func_case_simple *) Item_func_case::build_clone(thd); @@ -2330,7 +2330,7 @@ public: return NULL; return clone; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2341,12 +2341,12 @@ public: Item_func_decode_oracle(THD *thd, List &list) :Item_func_case_simple(thd, list) { } - const Schema *schema() const { return &oracle_schema_ref; } - const char *func_name() const { return "decode"; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *find_item(); - Item *get_copy(THD *thd) + const Schema *schema() const override { return &oracle_schema_ref; } + const char *func_name() const override { return "decode"; } + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; + Item *find_item() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2397,13 +2397,13 @@ class Item_func_in :public Item_func_opt_neg, return true; } bool prepare_predicant_and_values(THD *thd, uint *found_types); - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); + Field *field, Item *value) override; bool transform_into_subq; bool transform_into_subq_checked; public: @@ -2432,9 +2432,9 @@ public: array(0), have_null(0), arg_types_compatible(FALSE), emb_on_expr_nest(0) { } - longlong val_int(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + longlong val_int() override; + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; bool compatible_types_scalar_bisection_possible() { DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT); @@ -2466,7 +2466,7 @@ public: bool fix_for_row_comparison_using_cmp_items(THD *thd); bool fix_for_row_comparison_using_bisection(THD *thd); - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_in::cleanup"); Item_int_func::cleanup(); @@ -2476,10 +2476,10 @@ public: DBUG_VOID_RETURN; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); + table_map usable_tables, SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; SEL_TREE *get_func_row_mm_tree(RANGE_OPT_PARAM *param, Item_row *key_row); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { /* Note, we pass ANY_SUBST, this makes sure that non of the args @@ -2503,17 +2503,17 @@ public: } return this; } - virtual void print(String *str, enum_query_type query_type); - enum Functype functype() const { return IN_FUNC; } - const char *func_name() const { return "in"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + enum Functype functype() const override { return IN_FUNC; } + const char *func_name() const override { return "in"; } + enum precedence precedence() const override { return IN_PRECEDENCE; } + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; + bool count_sargable_conds(void *arg) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) + Item *build_clone(THD *thd) override { Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd); if (clone) @@ -2524,10 +2524,10 @@ public: } return clone; } - void mark_as_condition_AND_part(TABLE_LIST *embedding); + void mark_as_condition_AND_part(TABLE_LIST *embedding) override; bool to_be_transformed_into_in_subq(THD *thd); bool create_value_list_for_tvc(THD *thd, List< List > *values); - Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg); + Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg) override; uint32 max_length_of_left_expr(); }; @@ -2568,10 +2568,10 @@ class in_row :public in_vector public: in_row(THD *thd, uint elements, Item *); ~in_row(); - bool set(uint pos, Item *item); - uchar *get_value(Item *item); + bool set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; friend class Item_func_in; - const Type_handler *type_handler() const { return &type_handler_row; } + const Type_handler *type_handler() const override { return &type_handler_row; } cmp_item *get_cmp_item() { return &tmp; } }; @@ -2580,19 +2580,19 @@ class Item_func_null_predicate :public Item_bool_func { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_func_null_predicate::get_func_mm_tree"); DBUG_RETURN(get_mm_parts(param, field, functype(), value)); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); + Item_func::Functype type, Item *value) override; public: Item_func_null_predicate(THD *thd, Item *a): Item_bool_func(thd, a) { } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + table_map usable_tables, SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_func_null_predicate::get_mm_tree"); SEL_TREE *ftree= get_full_func_mm_tree_for_args(param, args[0], NULL); @@ -2600,14 +2600,14 @@ public: ftree= Item_func::get_mm_tree(param, cond_ptr); DBUG_RETURN(ftree); } - CHARSET_INFO *compare_collation() const + CHARSET_INFO *compare_collation() const override { return args[0]->collation.collation; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=1; maybe_null=0; return FALSE; } - bool count_sargable_conds(void *arg); + bool count_sargable_conds(void *arg) override; }; @@ -2615,11 +2615,11 @@ class Item_func_isnull :public Item_func_null_predicate { public: Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {} - longlong val_int(); - enum Functype functype() const { return ISNULL_FUNC; } - const char *func_name() const { return "isnull"; } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } + longlong val_int() override; + enum Functype functype() const override { return ISNULL_FUNC; } + const char *func_name() const override { return "isnull"; } + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return CMP_PRECEDENCE; } bool arg_is_datetime_notnull_field() { @@ -2636,7 +2636,7 @@ public: } /* Optimize case of not_null_column IS NULL */ - virtual void update_used_tables() + void update_used_tables() override { if (!args[0]->maybe_null && !arg_is_datetime_notnull_field()) { @@ -2651,11 +2651,11 @@ public: } } COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + bool top_level) override; + table_map not_null_tables() const override { return 0; } + bool find_not_null_fields(table_map allowed) override; + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2674,16 +2674,16 @@ public: Item_is_not_null_test(THD *thd, Item_in_subselect* ow, Item *a): Item_func_isnull(thd, a), owner(ow) {} - enum Functype functype() const { return ISNOTNULLTEST_FUNC; } - longlong val_int(); - const char *func_name() const { return ""; } - void update_used_tables(); + enum Functype functype() const override { return ISNOTNULLTEST_FUNC; } + longlong val_int() override; + const char *func_name() const override { return ""; } + void update_used_tables() override; /* we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE */ - table_map used_tables() const + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool const_item() const { return FALSE; } + bool const_item() const override { return FALSE; } }; @@ -2694,16 +2694,16 @@ public: Item_func_isnotnull(THD *thd, Item *a): Item_func_null_predicate(thd, a), abort_on_null(0) { } - longlong val_int(); - enum Functype functype() const { return ISNOTNULL_FUNC; } - const char *func_name() const { return "isnotnull"; } - enum precedence precedence() const { return CMP_PRECEDENCE; } - table_map not_null_tables() const + longlong val_int() override; + enum Functype functype() const override { return ISNOTNULL_FUNC; } + const char *func_name() const override { return "isnotnull"; } + enum precedence precedence() const override { return CMP_PRECEDENCE; } + table_map not_null_tables() const override { return abort_on_null ? not_null_tables_cache : 0; } - Item *neg_transformer(THD *thd); - void print(String *str, enum_query_type query_type); - void top_level_item() { abort_on_null=1; } - Item *get_copy(THD *thd) + Item *neg_transformer(THD *thd) override; + void print(String *str, enum_query_type query_type) override; + void top_level_item() override { abort_on_null=1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2735,14 +2735,14 @@ class Item_func_like :public Item_bool_func2 bool with_sargable_pattern() const; protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_func_like::get_func_mm_tree"); DBUG_RETURN(get_mm_parts(param, field, LIKE_FUNC, value)); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); + Item_func::Functype type, Item *value) override; public: int escape; bool negated; @@ -2754,13 +2754,13 @@ public: bool get_negated() const { return negated; } // Used by ColumnStore - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong val_int(); - enum Functype functype() const { return LIKE_FUNC; } - void print(String *str, enum_query_type query_type); - CHARSET_INFO *compare_collation() const + Sql_mode_dependency value_depends_on_sql_mode() const override; + longlong val_int() override; + enum Functype functype() const override { return LIKE_FUNC; } + void print(String *str, enum_query_type query_type) override; + CHARSET_INFO *compare_collation() const override { return cmp_collation.collation; } - cond_result eq_cmp_result() const + cond_result eq_cmp_result() const override { /** We cannot always rewrite conditions as follows: @@ -2796,9 +2796,9 @@ public: return compare_collation() == &my_charset_bin ? COND_TRUE : COND_OK; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + table_map usable_tables, SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { /* LIKE differs from the regular comparison operator ('=') in the following: @@ -2831,32 +2831,32 @@ public: cond); return this; } - const char *func_name() const { return "like"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + const char *func_name() const override { return "like"; } + enum precedence precedence() const override { return IN_PRECEDENCE; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= 1; return agg_arg_charsets_for_comparison(cmp_collation, args, 2); } - void cleanup(); + void cleanup() override; - Item *neg_transformer(THD *thd) + Item *neg_transformer(THD *thd) override { negated= !negated; return this; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { return walk_args(processor, walk_subquery, arg) || escape_item->walk(processor, walk_subquery, arg) || (this->*processor)(arg); } - bool find_selective_predicates_list_processor(void *arg); + bool find_selective_predicates_list_processor(void *arg) override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2938,24 +2938,24 @@ class Item_func_regex :public Item_bool_func public: Item_func_regex(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regex::cleanup"); Item_bool_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - Item *get_copy(THD *) { return 0; } - void print(String *str, enum_query_type query_type) + longlong val_int() override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "regexp"; } + enum precedence precedence() const override { return IN_PRECEDENCE; } + Item *get_copy(THD *) override { return 0; } + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } + CHARSET_INFO *compare_collation() const override { return cmp_collation.collation; } }; @@ -2967,7 +2967,7 @@ public: */ class Item_func_regexp_instr :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name()) || args[1]->check_type_can_return_text(func_name()); @@ -2978,17 +2978,17 @@ public: Item_func_regexp_instr(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_instr::cleanup"); Item_int_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_instr"; } - Item *get_copy(THD *thd) { return 0; } + longlong val_int() override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "regexp_instr"; } + Item *get_copy(THD *thd) override { return 0; } }; @@ -3029,64 +3029,64 @@ public: DBUG_ASSERT(nlist->elements); list.append(nlist); } - bool fix_fields(THD *, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); + bool fix_fields(THD *, Item **ref) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; - enum Type type() const { return COND_ITEM; } + enum Type type() const override { return COND_ITEM; } List* argument_list() { return &list; } - table_map used_tables() const; - void update_used_tables() + table_map used_tables() const override; + void update_used_tables() override { used_tables_and_const_cache_init(); used_tables_and_const_cache_update_and_join(list); } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); + bool top_level) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - virtual void print(String *str, enum_query_type query_type); + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + void print(String *str, enum_query_type query_type) override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); + List &fields, uint flags) override; friend int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds); - void top_level_item() { abort_on_null=1; } + void top_level_item() override { abort_on_null=1; } bool top_level() { return abort_on_null; } void copy_andor_arguments(THD *thd, Item_cond *item); - bool walk(Item_processor processor, bool walk_subquery, void *arg); + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; Item *do_transform(THD *thd, Item_transformer transformer, uchar *arg, bool toplevel); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg) + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override { return do_transform(thd, transformer, arg, 0); } - Item *top_level_transform(THD *thd, Item_transformer transformer, uchar *arg) + Item *top_level_transform(THD *thd, Item_transformer transformer, uchar *arg) override { return do_transform(thd, transformer, arg, 1); } - void traverse_cond(Cond_traverser, void *arg, traverse_order order); + void traverse_cond(Cond_traverser, void *arg, traverse_order order) override; void neg_arguments(THD *thd); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); + Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) override; Item *do_compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t, bool toplevel); Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t) + Item_transformer transformer, uchar *arg_t) override { return do_compile(thd, analyzer, arg_p, transformer, arg_t, 0); } Item* top_level_compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t) + Item_transformer transformer, uchar *arg_t) override { return do_compile(thd, analyzer, arg_p, transformer, arg_t, 1); } - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - Item *build_clone(THD *thd); - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + Item *build_clone(THD *thd) override; + bool excl_dep_on_table(table_map tab_map) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; private: void merge_sub_condition(List_iterator& li); @@ -3240,53 +3240,53 @@ public: void merge_into_list(THD *thd, List *list, bool save_merged, bool only_intersected); void update_const(THD *thd); - enum Functype functype() const { return MULT_EQUAL_FUNC; } - longlong val_int(); - const char *func_name() const { return "multiple equal"; } + enum Functype functype() const override { return MULT_EQUAL_FUNC; } + longlong val_int() override; + const char *func_name() const override { return "multiple equal"; } void sort(Item_field_cmpfunc compare, void *arg); - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; + void cleanup() override { delete eval_item; eval_item= NULL; } - void update_used_tables(); - bool find_not_null_fields(table_map allowed); + void update_used_tables() override; + bool find_not_null_fields(table_map allowed) override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - virtual void print(String *str, enum_query_type query_type); + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; + void print(String *str, enum_query_type query_type) override; const Type_handler *compare_type_handler() const { return m_compare_handler; } - CHARSET_INFO *compare_collation() const { return m_compare_collation; } + CHARSET_INFO *compare_collation() const override { return m_compare_collation; } void set_context_field(Item_field *ctx_field) { context_field= ctx_field; } void set_link_equal_fields(bool flag) { link_equal_fields= flag; } - Item* get_copy(THD *thd) { return 0; } + Item* get_copy(THD *thd) override { return 0; } /* This does not comply with the specification of the virtual method, but Item_equal items are processed distinguishly anyway */ - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { return used_tables() & tab_map; } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - bool excl_dep_on_grouping_fields(st_select_lex *sel); + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; bool create_pushable_equalities(THD *thd, List *equalities, Pushdown_checker checker, uchar *arg, bool clone_const); /* Return the number of elements in this multiple equality */ uint elements_count() { return equal_items.elements; } friend class Item_equal_fields_iterator; - bool count_sargable_conds(void *arg); - Item *multiple_equality_transformer(THD *thd, uchar *arg); + bool count_sargable_conds(void *arg) override; + Item *multiple_equality_transformer(THD *thd, uchar *arg) override; friend class Item_equal_iterator; friend class Item_equal_iterator; friend Item *eliminate_item_equal(THD *thd, COND *cond, @@ -3416,24 +3416,24 @@ public: Item_cond_and(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} Item_cond_and(THD *thd, Item_cond_and *item): Item_cond(thd, item) {} Item_cond_and(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_AND_FUNC; } - longlong val_int(); - const char *func_name() const { return "and"; } - enum precedence precedence() const { return AND_PRECEDENCE; } - table_map not_null_tables() const + enum Functype functype() const override { return COND_AND_FUNC; } + longlong val_int() override; + const char *func_name() const override { return "and"; } + enum precedence precedence() const override { return AND_PRECEDENCE; } + table_map not_null_tables() const override { return abort_on_null ? not_null_tables_cache: and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - void mark_as_condition_AND_part(TABLE_LIST *embedding); - virtual uint exists2in_reserved_items() { return list.elements; }; + Item *copy_andor_structure(THD *thd) override; + Item *neg_transformer(THD *thd) override; + void mark_as_condition_AND_part(TABLE_LIST *embedding) override; + uint exists2in_reserved_items() override { return list.elements; }; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); - bool set_format_by_check_constraint(Send_field_extended_metadata *to) const; + COND_EQUAL **cond_equal_ref) override; + bool set_format_by_check_constraint(Send_field_extended_metadata *to) const override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item *get_copy(THD *thd) + table_map usable_tables, SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3450,14 +3450,14 @@ public: Item_cond_or(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} Item_cond_or(THD *thd, Item_cond_or *item): Item_cond(thd, item) {} Item_cond_or(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_OR_FUNC; } - longlong val_int(); - const char *func_name() const { return "or"; } - enum precedence precedence() const { return OR_PRECEDENCE; } - table_map not_null_tables() const { return and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + enum Functype functype() const override { return COND_OR_FUNC; } + longlong val_int() override; + const char *func_name() const override { return "or"; } + enum precedence precedence() const override { return OR_PRECEDENCE; } + table_map not_null_tables() const override { return and_tables_cache; } + Item *copy_andor_structure(THD *thd) override; + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3465,10 +3465,10 @@ class Item_func_dyncol_check :public Item_bool_func { public: Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {} - longlong val_int(); - const char *func_name() const { return "column_check"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "column_check"; } + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3477,10 +3477,10 @@ class Item_func_dyncol_exists :public Item_bool_func public: Item_func_dyncol_exists(THD *thd, Item *str, Item *num): Item_bool_func(thd, str, num) {} - longlong val_int(); - const char *func_name() const { return "column_exists"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "column_exists"; } + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3491,11 +3491,11 @@ public: Item_func_cursor_bool_attr(THD *thd, const LEX_CSTRING *name, uint offset) :Item_bool_func(thd), Cursor_ref(name, offset) { } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC); } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { Cursor_ref::print_func(str, func_name()); } @@ -3507,9 +3507,9 @@ class Item_func_cursor_isopen: public Item_func_cursor_bool_attr public: Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset) :Item_func_cursor_bool_attr(thd, name, offset) { } - const char *func_name() const { return "%ISOPEN"; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "%ISOPEN"; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3519,9 +3519,9 @@ class Item_func_cursor_found: public Item_func_cursor_bool_attr public: Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset) :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; } - const char *func_name() const { return "%FOUND"; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "%FOUND"; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3531,9 +3531,9 @@ class Item_func_cursor_notfound: public Item_func_cursor_bool_attr public: Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset) :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; } - const char *func_name() const { return "%NOTFOUND"; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "%NOTFOUND"; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3572,11 +3572,11 @@ class Eq_creator :public Comp_creator public: Eq_creator() = default; /* Remove gcc warning */ virtual ~Eq_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<>" : "="; } - bool eqne_op() const { return 1; } - bool l_op() const { return 0; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? "<>" : "="; } + bool eqne_op() const override { return 1; } + bool l_op() const override { return 0; } }; class Ne_creator :public Comp_creator @@ -3584,11 +3584,11 @@ class Ne_creator :public Comp_creator public: Ne_creator() = default; /* Remove gcc warning */ virtual ~Ne_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "=" : "<>"; } - bool eqne_op() const { return 1; } - bool l_op() const { return 0; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? "=" : "<>"; } + bool eqne_op() const override { return 1; } + bool l_op() const override { return 0; } }; class Gt_creator :public Comp_creator @@ -3596,11 +3596,11 @@ class Gt_creator :public Comp_creator public: Gt_creator() = default; /* Remove gcc warning */ virtual ~Gt_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<=" : ">"; } - bool eqne_op() const { return 0; } - bool l_op() const { return 0; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? "<=" : ">"; } + bool eqne_op() const override { return 0; } + bool l_op() const override { return 0; } }; class Lt_creator :public Comp_creator @@ -3608,11 +3608,11 @@ class Lt_creator :public Comp_creator public: Lt_creator() = default; /* Remove gcc warning */ virtual ~Lt_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? ">=" : "<"; } - bool eqne_op() const { return 0; } - bool l_op() const { return 1; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? ">=" : "<"; } + bool eqne_op() const override { return 0; } + bool l_op() const override { return 1; } }; class Ge_creator :public Comp_creator @@ -3620,11 +3620,11 @@ class Ge_creator :public Comp_creator public: Ge_creator() = default; /* Remove gcc warning */ virtual ~Ge_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<" : ">="; } - bool eqne_op() const { return 0; } - bool l_op() const { return 0; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? "<" : ">="; } + bool eqne_op() const override { return 0; } + bool l_op() const override { return 0; } }; class Le_creator :public Comp_creator @@ -3632,11 +3632,11 @@ class Le_creator :public Comp_creator public: Le_creator() = default; /* Remove gcc warning */ virtual ~Le_creator() = default; /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? ">" : "<="; } - bool eqne_op() const { return 0; } - bool l_op() const { return 1; } + Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const override; + Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const override; + const char* symbol(bool invert) const override { return invert? ">" : "<="; } + bool eqne_op() const override { return 0; } + bool l_op() const override { return 1; } }; /* diff --git a/sql/item_create.cc b/sql/item_create.cc index 1e72a66f8e4..f9588eaa953 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -66,10 +66,10 @@ extern Native_func_registry_array native_func_registry_array_geom; class Create_sp_func : public Create_qfunc { public: - virtual Item *create_with_db(THD *thd, + Item *create_with_db(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *name, - bool use_explicit_name, List *item_list); + bool use_explicit_name, List *item_list) override; static Create_sp_func s_singleton; @@ -77,7 +77,7 @@ protected: /** Constructor. */ Create_sp_func() = default; /** Destructor. */ - virtual ~Create_sp_func() = default; + ~Create_sp_func() override = default; }; @@ -90,319 +90,319 @@ protected: class Create_func_abs : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_abs s_singleton; protected: Create_func_abs() = default; - virtual ~Create_func_abs() = default; + ~Create_func_abs() override = default; }; class Create_func_acos : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_acos s_singleton; protected: Create_func_acos() = default; - virtual ~Create_func_acos() = default; + ~Create_func_acos() override = default; }; class Create_func_addtime : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_addtime s_singleton; protected: Create_func_addtime() = default; - virtual ~Create_func_addtime() = default; + ~Create_func_addtime() override = default; }; class Create_func_aes_encrypt : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_aes_encrypt s_singleton; protected: Create_func_aes_encrypt() = default; - virtual ~Create_func_aes_encrypt() = default; + ~Create_func_aes_encrypt() override = default; }; class Create_func_aes_decrypt : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_aes_decrypt s_singleton; protected: Create_func_aes_decrypt() = default; - virtual ~Create_func_aes_decrypt() = default; + ~Create_func_aes_decrypt() override = default; }; class Create_func_asin : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_asin s_singleton; protected: Create_func_asin() = default; - virtual ~Create_func_asin() = default; + ~Create_func_asin() override = default; }; class Create_func_atan : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_atan s_singleton; protected: Create_func_atan() = default; - virtual ~Create_func_atan() = default; + ~Create_func_atan() override = default; }; class Create_func_benchmark : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_benchmark s_singleton; protected: Create_func_benchmark() = default; - virtual ~Create_func_benchmark() = default; + ~Create_func_benchmark() override = default; }; class Create_func_bin : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_bin s_singleton; protected: Create_func_bin() = default; - virtual ~Create_func_bin() = default; + ~Create_func_bin() override = default; }; class Create_func_binlog_gtid_pos : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_binlog_gtid_pos s_singleton; protected: Create_func_binlog_gtid_pos() = default; - virtual ~Create_func_binlog_gtid_pos() = default; + ~Create_func_binlog_gtid_pos() override = default; }; class Create_func_bit_count : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_bit_count s_singleton; protected: Create_func_bit_count() = default; - virtual ~Create_func_bit_count() = default; + ~Create_func_bit_count() override = default; }; class Create_func_bit_length : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_bit_length s_singleton; protected: Create_func_bit_length() = default; - virtual ~Create_func_bit_length() = default; + ~Create_func_bit_length() override = default; }; class Create_func_ceiling : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ceiling s_singleton; protected: Create_func_ceiling() = default; - virtual ~Create_func_ceiling() = default; + ~Create_func_ceiling() override = default; }; class Create_func_chr : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_chr s_singleton; protected: Create_func_chr() = default; - virtual ~Create_func_chr() = default; + ~Create_func_chr() override = default; }; class Create_func_char_length : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_char_length s_singleton; protected: Create_func_char_length() = default; - virtual ~Create_func_char_length() = default; + ~Create_func_char_length() override = default; }; class Create_func_coercibility : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_coercibility s_singleton; protected: Create_func_coercibility() = default; - virtual ~Create_func_coercibility() = default; + ~Create_func_coercibility() override = default; }; class Create_func_dyncol_check : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dyncol_check s_singleton; protected: Create_func_dyncol_check() = default; - virtual ~Create_func_dyncol_check() = default; + ~Create_func_dyncol_check() override = default; }; class Create_func_dyncol_exists : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_dyncol_exists s_singleton; protected: Create_func_dyncol_exists() = default; - virtual ~Create_func_dyncol_exists() = default; + ~Create_func_dyncol_exists() override = default; }; class Create_func_dyncol_list : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dyncol_list s_singleton; protected: Create_func_dyncol_list() = default; - virtual ~Create_func_dyncol_list() = default; + ~Create_func_dyncol_list() override = default; }; class Create_func_dyncol_json : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dyncol_json s_singleton; protected: Create_func_dyncol_json() = default; - virtual ~Create_func_dyncol_json() = default; + ~Create_func_dyncol_json() override = default; }; class Create_func_compress : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_compress s_singleton; protected: Create_func_compress() = default; - virtual ~Create_func_compress() = default; + ~Create_func_compress() override = default; }; class Create_func_concat : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_concat s_singleton; protected: Create_func_concat() = default; - virtual ~Create_func_concat() = default; + ~Create_func_concat() override = default; }; class Create_func_concat_operator_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_concat_operator_oracle s_singleton; protected: Create_func_concat_operator_oracle() = default; - virtual ~Create_func_concat_operator_oracle() = default; + ~Create_func_concat_operator_oracle() override = default; }; class Create_func_decode_histogram : public Create_func_arg2 { public: - Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_decode_histogram s_singleton; protected: Create_func_decode_histogram() = default; - virtual ~Create_func_decode_histogram() = default; + ~Create_func_decode_histogram() override = default; }; class Create_func_decode_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override { if (unlikely(!item_list || item_list->elements < 3)) { @@ -416,15 +416,15 @@ public: protected: Create_func_decode_oracle() = default; - virtual ~Create_func_decode_oracle() = default; + ~Create_func_decode_oracle() override = default; }; class Create_func_decode : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override { if (unlikely(!item_list || item_list->elements != 2)) { @@ -440,945 +440,945 @@ public: protected: Create_func_decode() {} - virtual ~Create_func_decode() {} + ~Create_func_decode() override {} }; class Create_func_concat_ws : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_concat_ws s_singleton; protected: Create_func_concat_ws() = default; - virtual ~Create_func_concat_ws() = default; + ~Create_func_concat_ws() override = default; }; class Create_func_connection_id : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_connection_id s_singleton; protected: Create_func_connection_id() = default; - virtual ~Create_func_connection_id() = default; + ~Create_func_connection_id() override = default; }; class Create_func_nvl2 : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_nvl2 s_singleton; protected: Create_func_nvl2() = default; - virtual ~Create_func_nvl2() = default; + ~Create_func_nvl2() override = default; }; class Create_func_conv : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_conv s_singleton; protected: Create_func_conv() = default; - virtual ~Create_func_conv() = default; + ~Create_func_conv() override = default; }; class Create_func_convert_tz : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_convert_tz s_singleton; protected: Create_func_convert_tz() = default; - virtual ~Create_func_convert_tz() = default; + ~Create_func_convert_tz() override = default; }; class Create_func_cos : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_cos s_singleton; protected: Create_func_cos() = default; - virtual ~Create_func_cos() = default; + ~Create_func_cos() override = default; }; class Create_func_cot : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_cot s_singleton; protected: Create_func_cot() = default; - virtual ~Create_func_cot() = default; + ~Create_func_cot() override = default; }; class Create_func_crc32 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_crc32 s_singleton; protected: Create_func_crc32() = default; - virtual ~Create_func_crc32() = default; + ~Create_func_crc32() override = default; }; class Create_func_datediff : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_datediff s_singleton; protected: Create_func_datediff() = default; - virtual ~Create_func_datediff() = default; + ~Create_func_datediff() override = default; }; class Create_func_dayname : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dayname s_singleton; protected: Create_func_dayname() = default; - virtual ~Create_func_dayname() = default; + ~Create_func_dayname() override = default; }; class Create_func_dayofmonth : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dayofmonth s_singleton; protected: Create_func_dayofmonth() = default; - virtual ~Create_func_dayofmonth() = default; + ~Create_func_dayofmonth() override = default; }; class Create_func_dayofweek : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dayofweek s_singleton; protected: Create_func_dayofweek() = default; - virtual ~Create_func_dayofweek() = default; + ~Create_func_dayofweek() override = default; }; class Create_func_dayofyear : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_dayofyear s_singleton; protected: Create_func_dayofyear() = default; - virtual ~Create_func_dayofyear() = default; + ~Create_func_dayofyear() override = default; }; class Create_func_degrees : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_degrees s_singleton; protected: Create_func_degrees() = default; - virtual ~Create_func_degrees() = default; + ~Create_func_degrees() override = default; }; class Create_func_des_decrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_des_decrypt s_singleton; protected: Create_func_des_decrypt() = default; - virtual ~Create_func_des_decrypt() = default; + ~Create_func_des_decrypt() override = default; }; class Create_func_des_encrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_des_encrypt s_singleton; protected: Create_func_des_encrypt() = default; - virtual ~Create_func_des_encrypt() = default; + ~Create_func_des_encrypt() override = default; }; class Create_func_elt : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_elt s_singleton; protected: Create_func_elt() = default; - virtual ~Create_func_elt() = default; + ~Create_func_elt() override = default; }; class Create_func_encode : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_encode s_singleton; protected: Create_func_encode() = default; - virtual ~Create_func_encode() = default; + ~Create_func_encode() override = default; }; class Create_func_encrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_encrypt s_singleton; protected: Create_func_encrypt() = default; - virtual ~Create_func_encrypt() = default; + ~Create_func_encrypt() override = default; }; class Create_func_exp : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_exp s_singleton; protected: Create_func_exp() = default; - virtual ~Create_func_exp() = default; + ~Create_func_exp() override = default; }; class Create_func_export_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_export_set s_singleton; protected: Create_func_export_set() = default; - virtual ~Create_func_export_set() = default; + ~Create_func_export_set() override = default; }; class Create_func_field : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_field s_singleton; protected: Create_func_field() = default; - virtual ~Create_func_field() = default; + ~Create_func_field() override = default; }; class Create_func_find_in_set : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_find_in_set s_singleton; protected: Create_func_find_in_set() = default; - virtual ~Create_func_find_in_set() = default; + ~Create_func_find_in_set() override = default; }; class Create_func_floor : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_floor s_singleton; protected: Create_func_floor() = default; - virtual ~Create_func_floor() = default; + ~Create_func_floor() override = default; }; class Create_func_format : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_format s_singleton; protected: Create_func_format() = default; - virtual ~Create_func_format() = default; + ~Create_func_format() override = default; }; class Create_func_found_rows : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_found_rows s_singleton; protected: Create_func_found_rows() = default; - virtual ~Create_func_found_rows() = default; + ~Create_func_found_rows() override = default; }; class Create_func_from_base64 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_from_base64 s_singleton; protected: Create_func_from_base64() = default; - virtual ~Create_func_from_base64() = default; + ~Create_func_from_base64() override = default; }; class Create_func_from_days : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_from_days s_singleton; protected: Create_func_from_days() = default; - virtual ~Create_func_from_days() = default; + ~Create_func_from_days() override = default; }; class Create_func_from_unixtime : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_from_unixtime s_singleton; protected: Create_func_from_unixtime() = default; - virtual ~Create_func_from_unixtime() = default; + ~Create_func_from_unixtime() override = default; }; class Create_func_get_lock : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_get_lock s_singleton; protected: Create_func_get_lock() = default; - virtual ~Create_func_get_lock() = default; + ~Create_func_get_lock() override = default; }; class Create_func_greatest : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_greatest s_singleton; protected: Create_func_greatest() = default; - virtual ~Create_func_greatest() = default; + ~Create_func_greatest() override = default; }; class Create_func_hex : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_hex s_singleton; protected: Create_func_hex() = default; - virtual ~Create_func_hex() = default; + ~Create_func_hex() override = default; }; class Create_func_ifnull : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_ifnull s_singleton; protected: Create_func_ifnull() = default; - virtual ~Create_func_ifnull() = default; + ~Create_func_ifnull() override = default; }; class Create_func_instr : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_instr s_singleton; protected: Create_func_instr() = default; - virtual ~Create_func_instr() = default; + ~Create_func_instr() override = default; }; class Create_func_is_free_lock : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_is_free_lock s_singleton; protected: Create_func_is_free_lock() = default; - virtual ~Create_func_is_free_lock() = default; + ~Create_func_is_free_lock() override = default; }; class Create_func_is_used_lock : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_is_used_lock s_singleton; protected: Create_func_is_used_lock() = default; - virtual ~Create_func_is_used_lock() = default; + ~Create_func_is_used_lock() override = default; }; class Create_func_isnull : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_isnull s_singleton; protected: Create_func_isnull() = default; - virtual ~Create_func_isnull() = default; + ~Create_func_isnull() override = default; }; class Create_func_json_exists : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_json_exists s_singleton; protected: Create_func_json_exists() = default; - virtual ~Create_func_json_exists() = default; + ~Create_func_json_exists() override = default; }; class Create_func_json_valid : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_valid s_singleton; protected: Create_func_json_valid() = default; - virtual ~Create_func_json_valid() = default; + ~Create_func_json_valid() override = default; }; class Create_func_json_compact : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_compact s_singleton; protected: Create_func_json_compact() = default; - virtual ~Create_func_json_compact() = default; + ~Create_func_json_compact() override = default; }; class Create_func_json_loose : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_loose s_singleton; protected: Create_func_json_loose() = default; - virtual ~Create_func_json_loose() = default; + ~Create_func_json_loose() override = default; }; class Create_func_json_detailed: public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_detailed s_singleton; protected: Create_func_json_detailed() = default; - virtual ~Create_func_json_detailed() = default; + ~Create_func_json_detailed() override = default; }; class Create_func_json_type : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_type s_singleton; protected: Create_func_json_type() = default; - virtual ~Create_func_json_type() = default; + ~Create_func_json_type() override = default; }; class Create_func_json_depth : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_depth s_singleton; protected: Create_func_json_depth() = default; - virtual ~Create_func_json_depth() = default; + ~Create_func_json_depth() override = default; }; class Create_func_json_value : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_json_value s_singleton; protected: Create_func_json_value() = default; - virtual ~Create_func_json_value() = default; + ~Create_func_json_value() override = default; }; class Create_func_json_query : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_json_query s_singleton; protected: Create_func_json_query() = default; - virtual ~Create_func_json_query() = default; + ~Create_func_json_query() override = default; }; class Create_func_json_keys: public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_keys s_singleton; protected: Create_func_json_keys() = default; - virtual ~Create_func_json_keys() = default; + ~Create_func_json_keys() override = default; }; class Create_func_json_contains: public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_contains s_singleton; protected: Create_func_json_contains() = default; - virtual ~Create_func_json_contains() = default; + ~Create_func_json_contains() override = default; }; class Create_func_json_contains_path : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_contains_path s_singleton; protected: Create_func_json_contains_path() = default; - virtual ~Create_func_json_contains_path() = default; + ~Create_func_json_contains_path() override = default; }; class Create_func_json_extract : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_extract s_singleton; protected: Create_func_json_extract() = default; - virtual ~Create_func_json_extract() = default; + ~Create_func_json_extract() override = default; }; class Create_func_json_search : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_search s_singleton; protected: Create_func_json_search() = default; - virtual ~Create_func_json_search() = default; + ~Create_func_json_search() override = default; }; class Create_func_json_array : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_array s_singleton; protected: Create_func_json_array() = default; - virtual ~Create_func_json_array() = default; + ~Create_func_json_array() override = default; }; class Create_func_json_array_append : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_array_append s_singleton; protected: Create_func_json_array_append() = default; - virtual ~Create_func_json_array_append() = default; + ~Create_func_json_array_append() override = default; }; class Create_func_json_array_insert : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_array_insert s_singleton; protected: Create_func_json_array_insert() = default; - virtual ~Create_func_json_array_insert() = default; + ~Create_func_json_array_insert() override = default; }; class Create_func_json_insert : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_insert s_singleton; protected: Create_func_json_insert() = default; - virtual ~Create_func_json_insert() = default; + ~Create_func_json_insert() override = default; }; class Create_func_json_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_set s_singleton; protected: Create_func_json_set() = default; - virtual ~Create_func_json_set() = default; + ~Create_func_json_set() override = default; }; class Create_func_json_replace : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_replace s_singleton; protected: Create_func_json_replace() = default; - virtual ~Create_func_json_replace() = default; + ~Create_func_json_replace() override = default; }; class Create_func_json_remove : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_remove s_singleton; protected: Create_func_json_remove() = default; - virtual ~Create_func_json_remove() = default; + ~Create_func_json_remove() override = default; }; class Create_func_json_object : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_object s_singleton; protected: Create_func_json_object() = default; - virtual ~Create_func_json_object() = default; + ~Create_func_json_object() override = default; }; class Create_func_json_length : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_length s_singleton; protected: Create_func_json_length() = default; - virtual ~Create_func_json_length() = default; + ~Create_func_json_length() override = default; }; class Create_func_json_merge : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_merge s_singleton; protected: Create_func_json_merge() = default; - virtual ~Create_func_json_merge() = default; + ~Create_func_json_merge() override = default; }; class Create_func_json_merge_patch : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_json_merge_patch s_singleton; protected: Create_func_json_merge_patch() = default; - virtual ~Create_func_json_merge_patch() = default; + ~Create_func_json_merge_patch() override = default; }; class Create_func_json_quote : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_quote s_singleton; protected: Create_func_json_quote() = default; - virtual ~Create_func_json_quote() = default; + ~Create_func_json_quote() override = default; }; class Create_func_json_unquote : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_json_unquote s_singleton; protected: Create_func_json_unquote() = default; - virtual ~Create_func_json_unquote() = default; + ~Create_func_json_unquote() override = default; }; class Create_func_last_day : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_last_day s_singleton; protected: Create_func_last_day() = default; - virtual ~Create_func_last_day() = default; + ~Create_func_last_day() override = default; }; class Create_func_last_insert_id : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_last_insert_id s_singleton; protected: Create_func_last_insert_id() = default; - virtual ~Create_func_last_insert_id() = default; + ~Create_func_last_insert_id() override = default; }; class Create_func_lcase : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_lcase s_singleton; protected: Create_func_lcase() = default; - virtual ~Create_func_lcase() = default; + ~Create_func_lcase() override = default; }; class Create_func_least : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_least s_singleton; protected: Create_func_least() = default; - virtual ~Create_func_least() = default; + ~Create_func_least() override = default; }; class Create_func_length : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_length s_singleton; protected: Create_func_length() = default; - virtual ~Create_func_length() = default; + ~Create_func_length() override = default; }; class Create_func_octet_length : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_octet_length s_singleton; protected: Create_func_octet_length() = default; - virtual ~Create_func_octet_length() = default; + ~Create_func_octet_length() override = default; }; @@ -1386,26 +1386,26 @@ protected: class Create_func_like_range_min : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_like_range_min s_singleton; protected: Create_func_like_range_min() = default; - virtual ~Create_func_like_range_min() = default; + ~Create_func_like_range_min() override = default; }; class Create_func_like_range_max : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_like_range_max s_singleton; protected: Create_func_like_range_max() = default; - virtual ~Create_func_like_range_max() = default; + ~Create_func_like_range_max() override = default; }; #endif @@ -1413,88 +1413,88 @@ protected: class Create_func_ln : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ln s_singleton; protected: Create_func_ln() = default; - virtual ~Create_func_ln() = default; + ~Create_func_ln() override = default; }; class Create_func_load_file : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_load_file s_singleton; protected: Create_func_load_file() = default; - virtual ~Create_func_load_file() = default; + ~Create_func_load_file() override = default; }; class Create_func_locate : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_locate s_singleton; protected: Create_func_locate() = default; - virtual ~Create_func_locate() = default; + ~Create_func_locate() override = default; }; class Create_func_log : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_log s_singleton; protected: Create_func_log() = default; - virtual ~Create_func_log() = default; + ~Create_func_log() override = default; }; class Create_func_log10 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_log10 s_singleton; protected: Create_func_log10() = default; - virtual ~Create_func_log10() = default; + ~Create_func_log10() override = default; }; class Create_func_log2 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_log2 s_singleton; protected: Create_func_log2() = default; - virtual ~Create_func_log2() = default; + ~Create_func_log2() override = default; }; class Create_func_lpad : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override { return create_native_std(thd, name, item_list); } @@ -1502,7 +1502,7 @@ public: protected: Create_func_lpad() = default; - virtual ~Create_func_lpad() = default; + ~Create_func_lpad() override = default; Item *create_native_std(THD *thd, const LEX_CSTRING *name, List *items); Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, @@ -1514,7 +1514,7 @@ class Create_func_lpad_oracle : public Create_func_lpad { public: Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + List *item_list) override { return create_native_oracle(thd, name, item_list); } @@ -1525,250 +1525,250 @@ public: class Create_func_ltrim : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ltrim s_singleton; protected: Create_func_ltrim() = default; - virtual ~Create_func_ltrim() = default; + ~Create_func_ltrim() override = default; }; class Create_func_ltrim_oracle : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ltrim_oracle s_singleton; protected: Create_func_ltrim_oracle() = default; - virtual ~Create_func_ltrim_oracle() = default; + ~Create_func_ltrim_oracle() override = default; }; class Create_func_makedate : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_makedate s_singleton; protected: Create_func_makedate() = default; - virtual ~Create_func_makedate() = default; + ~Create_func_makedate() override = default; }; class Create_func_maketime : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_maketime s_singleton; protected: Create_func_maketime() = default; - virtual ~Create_func_maketime() = default; + ~Create_func_maketime() override = default; }; class Create_func_make_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_make_set s_singleton; protected: Create_func_make_set() = default; - virtual ~Create_func_make_set() = default; + ~Create_func_make_set() override = default; }; class Create_func_master_pos_wait : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_master_pos_wait s_singleton; protected: Create_func_master_pos_wait() = default; - virtual ~Create_func_master_pos_wait() = default; + ~Create_func_master_pos_wait() override = default; }; class Create_func_master_gtid_wait : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_master_gtid_wait s_singleton; protected: Create_func_master_gtid_wait() = default; - virtual ~Create_func_master_gtid_wait() = default; + ~Create_func_master_gtid_wait() override = default; }; class Create_func_md5 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_md5 s_singleton; protected: Create_func_md5() = default; - virtual ~Create_func_md5() = default; + ~Create_func_md5() override = default; }; class Create_func_monthname : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_monthname s_singleton; protected: Create_func_monthname() = default; - virtual ~Create_func_monthname() = default; + ~Create_func_monthname() override = default; }; class Create_func_name_const : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_name_const s_singleton; protected: Create_func_name_const() = default; - virtual ~Create_func_name_const() = default; + ~Create_func_name_const() override = default; }; class Create_func_nullif : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_nullif s_singleton; protected: Create_func_nullif() = default; - virtual ~Create_func_nullif() = default; + ~Create_func_nullif() override = default; }; class Create_func_oct : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_oct s_singleton; protected: Create_func_oct() = default; - virtual ~Create_func_oct() = default; + ~Create_func_oct() override = default; }; class Create_func_ord : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ord s_singleton; protected: Create_func_ord() = default; - virtual ~Create_func_ord() = default; + ~Create_func_ord() override = default; }; class Create_func_period_add : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_period_add s_singleton; protected: Create_func_period_add() = default; - virtual ~Create_func_period_add() = default; + ~Create_func_period_add() override = default; }; class Create_func_period_diff : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_period_diff s_singleton; protected: Create_func_period_diff() = default; - virtual ~Create_func_period_diff() = default; + ~Create_func_period_diff() override = default; }; class Create_func_pi : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_pi s_singleton; protected: Create_func_pi() = default; - virtual ~Create_func_pi() = default; + ~Create_func_pi() override = default; }; class Create_func_pow : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_pow s_singleton; protected: Create_func_pow() = default; - virtual ~Create_func_pow() = default; + ~Create_func_pow() override = default; }; class Create_func_quote : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_quote s_singleton; protected: Create_func_quote() = default; - virtual ~Create_func_quote() = default; + ~Create_func_quote() override = default; }; class Create_func_regexp_instr : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_regexp_instr s_singleton; protected: Create_func_regexp_instr() = default; - virtual ~Create_func_regexp_instr() = default; + ~Create_func_regexp_instr() override = default; }; @@ -1784,7 +1784,7 @@ public: protected: Create_func_regexp_replace() = default; - virtual ~Create_func_regexp_replace() = default; + ~Create_func_regexp_replace() override = default; }; Create_func_regexp_replace Create_func_regexp_replace::s_singleton; @@ -1803,7 +1803,7 @@ public: protected: Create_func_regexp_replace_oracle() = default; - virtual ~Create_func_regexp_replace_oracle() = default; + ~Create_func_regexp_replace_oracle() override = default; }; Create_func_regexp_replace_oracle @@ -1813,47 +1813,47 @@ Create_func_regexp_replace_oracle class Create_func_regexp_substr : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_regexp_substr s_singleton; protected: Create_func_regexp_substr() = default; - virtual ~Create_func_regexp_substr() = default; + ~Create_func_regexp_substr() override = default; }; class Create_func_radians : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_radians s_singleton; protected: Create_func_radians() = default; - virtual ~Create_func_radians() = default; + ~Create_func_radians() override = default; }; class Create_func_rand : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_rand s_singleton; protected: Create_func_rand() = default; - virtual ~Create_func_rand() = default; + ~Create_func_rand() override = default; }; class Create_func_release_all_locks : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_release_all_locks s_singleton; }; @@ -1862,61 +1862,61 @@ public: class Create_func_release_lock : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_release_lock s_singleton; protected: Create_func_release_lock() = default; - virtual ~Create_func_release_lock() = default; + ~Create_func_release_lock() override = default; }; class Create_func_replace_oracle : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_replace_oracle s_singleton; protected: Create_func_replace_oracle() = default; - virtual ~Create_func_replace_oracle() = default; + ~Create_func_replace_oracle() override = default; }; class Create_func_reverse : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_reverse s_singleton; protected: Create_func_reverse() = default; - virtual ~Create_func_reverse() = default; + ~Create_func_reverse() override = default; }; class Create_func_round : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_round s_singleton; protected: Create_func_round() = default; - virtual ~Create_func_round() = default; + ~Create_func_round() override = default; }; class Create_func_rpad : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override { return create_native_std(thd, name, item_list); } @@ -1924,7 +1924,7 @@ public: protected: Create_func_rpad() = default; - virtual ~Create_func_rpad() = default; + ~Create_func_rpad() override = default; Item *create_native_std(THD *thd, const LEX_CSTRING *name, List *items); Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, @@ -1936,7 +1936,7 @@ class Create_func_rpad_oracle : public Create_func_rpad { public: Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list) + List *item_list) override { return create_native_oracle(thd, name, item_list); } @@ -1947,430 +1947,430 @@ public: class Create_func_rtrim : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_rtrim s_singleton; protected: Create_func_rtrim() = default; - virtual ~Create_func_rtrim() = default; + ~Create_func_rtrim() override = default; }; class Create_func_rtrim_oracle : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_rtrim_oracle s_singleton; protected: Create_func_rtrim_oracle() = default; - virtual ~Create_func_rtrim_oracle() = default; + ~Create_func_rtrim_oracle() override = default; }; class Create_func_sec_to_time : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sec_to_time s_singleton; protected: Create_func_sec_to_time() = default; - virtual ~Create_func_sec_to_time() = default; + ~Create_func_sec_to_time() override = default; }; class Create_func_sha : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sha s_singleton; protected: Create_func_sha() = default; - virtual ~Create_func_sha() = default; + ~Create_func_sha() override = default; }; class Create_func_sha2 : public Create_func_arg2 { public: - virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_sha2 s_singleton; protected: Create_func_sha2() = default; - virtual ~Create_func_sha2() = default; + ~Create_func_sha2() override = default; }; class Create_func_sign : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sign s_singleton; protected: Create_func_sign() = default; - virtual ~Create_func_sign() = default; + ~Create_func_sign() override = default; }; class Create_func_sin : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sin s_singleton; protected: Create_func_sin() = default; - virtual ~Create_func_sin() = default; + ~Create_func_sin() override = default; }; class Create_func_sleep : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sleep s_singleton; protected: Create_func_sleep() = default; - virtual ~Create_func_sleep() = default; + ~Create_func_sleep() override = default; }; class Create_func_soundex : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_soundex s_singleton; protected: Create_func_soundex() = default; - virtual ~Create_func_soundex() = default; + ~Create_func_soundex() override = default; }; class Create_func_space : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_space s_singleton; protected: Create_func_space() = default; - virtual ~Create_func_space() = default; + ~Create_func_space() override = default; }; class Create_func_sqrt : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_sqrt s_singleton; protected: Create_func_sqrt() = default; - virtual ~Create_func_sqrt() = default; + ~Create_func_sqrt() override = default; }; class Create_func_str_to_date : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_str_to_date s_singleton; protected: Create_func_str_to_date() = default; - virtual ~Create_func_str_to_date() = default; + ~Create_func_str_to_date() override = default; }; class Create_func_strcmp : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_strcmp s_singleton; protected: Create_func_strcmp() = default; - virtual ~Create_func_strcmp() = default; + ~Create_func_strcmp() override = default; }; class Create_func_substr_index : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_substr_index s_singleton; protected: Create_func_substr_index() = default; - virtual ~Create_func_substr_index() = default; + ~Create_func_substr_index() override = default; }; class Create_func_substr_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_substr_oracle s_singleton; protected: Create_func_substr_oracle() = default; - virtual ~Create_func_substr_oracle() = default; + ~Create_func_substr_oracle() override = default; }; class Create_func_subtime : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_subtime s_singleton; protected: Create_func_subtime() = default; - virtual ~Create_func_subtime() = default; + ~Create_func_subtime() override = default; }; class Create_func_tan : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_tan s_singleton; protected: Create_func_tan() = default; - virtual ~Create_func_tan() = default; + ~Create_func_tan() override = default; }; class Create_func_time_format : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_time_format s_singleton; protected: Create_func_time_format() = default; - virtual ~Create_func_time_format() = default; + ~Create_func_time_format() override = default; }; class Create_func_time_to_sec : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_time_to_sec s_singleton; protected: Create_func_time_to_sec() = default; - virtual ~Create_func_time_to_sec() = default; + ~Create_func_time_to_sec() override = default; }; class Create_func_timediff : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_timediff s_singleton; protected: Create_func_timediff() = default; - virtual ~Create_func_timediff() = default; + ~Create_func_timediff() override = default; }; class Create_func_to_base64 : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_to_base64 s_singleton; protected: Create_func_to_base64() = default; - virtual ~Create_func_to_base64() = default; + ~Create_func_to_base64() override = default; }; class Create_func_to_days : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_to_days s_singleton; protected: Create_func_to_days() = default; - virtual ~Create_func_to_days() = default; + ~Create_func_to_days() override = default; }; class Create_func_to_seconds : public Create_func_arg1 { public: - virtual Item* create_1_arg(THD *thd, Item *arg1); + Item* create_1_arg(THD *thd, Item *arg1) override; static Create_func_to_seconds s_singleton; protected: Create_func_to_seconds() = default; - virtual ~Create_func_to_seconds() = default; + ~Create_func_to_seconds() override = default; }; class Create_func_ucase : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_ucase s_singleton; protected: Create_func_ucase() = default; - virtual ~Create_func_ucase() = default; + ~Create_func_ucase() override = default; }; class Create_func_uncompress : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_uncompress s_singleton; protected: Create_func_uncompress() = default; - virtual ~Create_func_uncompress() = default; + ~Create_func_uncompress() override = default; }; class Create_func_uncompressed_length : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_uncompressed_length s_singleton; protected: Create_func_uncompressed_length() = default; - virtual ~Create_func_uncompressed_length() = default; + ~Create_func_uncompressed_length() override = default; }; class Create_func_unhex : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_unhex s_singleton; protected: Create_func_unhex() = default; - virtual ~Create_func_unhex() = default; + ~Create_func_unhex() override = default; }; class Create_func_unix_timestamp : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_unix_timestamp s_singleton; protected: Create_func_unix_timestamp() = default; - virtual ~Create_func_unix_timestamp() = default; + ~Create_func_unix_timestamp() override = default; }; class Create_func_uuid : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_uuid s_singleton; protected: Create_func_uuid() = default; - virtual ~Create_func_uuid() = default; + ~Create_func_uuid() override = default; }; class Create_func_uuid_short : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_uuid_short s_singleton; protected: Create_func_uuid_short() = default; - virtual ~Create_func_uuid_short() = default; + ~Create_func_uuid_short() override = default; }; class Create_func_version : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_version s_singleton; protected: Create_func_version() = default; - virtual ~Create_func_version() = default; + ~Create_func_version() override = default; }; class Create_func_weekday : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_weekday s_singleton; protected: Create_func_weekday() = default; - virtual ~Create_func_weekday() = default; + ~Create_func_weekday() override = default; }; class Create_func_weekofyear : public Create_func_arg1 { public: - virtual Item *create_1_arg(THD *thd, Item *arg1); + Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_weekofyear s_singleton; protected: Create_func_weekofyear() = default; - virtual ~Create_func_weekofyear() = default; + ~Create_func_weekofyear() override = default; }; @@ -2378,26 +2378,26 @@ protected: class Create_func_wsrep_last_written_gtid : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_wsrep_last_written_gtid s_singleton; protected: Create_func_wsrep_last_written_gtid() = default; - virtual ~Create_func_wsrep_last_written_gtid() = default; + ~Create_func_wsrep_last_written_gtid() override = default; }; class Create_func_wsrep_last_seen_gtid : public Create_func_arg0 { public: - virtual Item *create_builder(THD *thd); + Item *create_builder(THD *thd) override; static Create_func_wsrep_last_seen_gtid s_singleton; protected: Create_func_wsrep_last_seen_gtid() = default; - virtual ~Create_func_wsrep_last_seen_gtid() = default; + ~Create_func_wsrep_last_seen_gtid() override = default; }; @@ -2411,7 +2411,7 @@ public: protected: Create_func_wsrep_sync_wait_upto() = default; - virtual ~Create_func_wsrep_sync_wait_upto() = default; + ~Create_func_wsrep_sync_wait_upto() override = default; }; #endif /* WITH_WSREP */ @@ -2419,40 +2419,40 @@ protected: class Create_func_xml_extractvalue : public Create_func_arg2 { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override; static Create_func_xml_extractvalue s_singleton; protected: Create_func_xml_extractvalue() = default; - virtual ~Create_func_xml_extractvalue() = default; + ~Create_func_xml_extractvalue() override = default; }; class Create_func_xml_update : public Create_func_arg3 { public: - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override; static Create_func_xml_update s_singleton; protected: Create_func_xml_update() = default; - virtual ~Create_func_xml_update() = default; + ~Create_func_xml_update() override = default; }; class Create_func_year_week : public Create_native_func { public: - virtual Item *create_native(THD *thd, const LEX_CSTRING *name, - List *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) override; static Create_func_year_week s_singleton; protected: Create_func_year_week() = default; - virtual ~Create_func_year_week() = default; + ~Create_func_year_week() override = default; }; diff --git a/sql/item_func.cc b/sql/item_func.cc index 1e6fa039059..4e835243f02 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2150,7 +2150,7 @@ class Func_handler_shift_left_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return item->arguments()[0]->to_longlong_null() << @@ -2163,7 +2163,7 @@ class Func_handler_shift_left_decimal_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return VDec(item->arguments()[0]).to_xlonglong_null() << @@ -2184,7 +2184,7 @@ class Func_handler_shift_right_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->fixed == 1); return item->arguments()[0]->to_longlong_null() >> @@ -2197,7 +2197,7 @@ class Func_handler_shift_right_decimal_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return VDec(item->arguments()[0]).to_xlonglong_null() >> @@ -2218,7 +2218,7 @@ class Func_handler_bit_neg_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return ~ item->arguments()[0]->to_longlong_null(); @@ -2230,7 +2230,7 @@ class Func_handler_bit_neg_decimal_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return ~ VDec(item->arguments()[0]).to_xlonglong_null(); @@ -3428,7 +3428,7 @@ class Func_handler_bit_count_int_to_slong: public Item_handled_func::Handler_slong2 { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return item->arguments()[0]->to_longlong_null().bit_count(); @@ -3440,7 +3440,7 @@ class Func_handler_bit_count_decimal_to_slong: public Item_handled_func::Handler_slong2 { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return VDec(item->arguments()[0]).to_xlonglong_null().bit_count(); @@ -4182,7 +4182,7 @@ public: const char * /* sqlstate */, Sql_condition::enum_warning_level* /* level */, const char *message, - Sql_condition ** /* cond_hdl */); + Sql_condition ** /* cond_hdl */) override; }; bool @@ -6500,7 +6500,7 @@ class Func_handler_bit_xor_int_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return item->arguments()[0]->to_longlong_null() ^ @@ -6513,7 +6513,7 @@ class Func_handler_bit_xor_dec_to_ulonglong: public Item_handled_func::Handler_ulonglong { public: - Longlong_null to_longlong_null(Item_handled_func *item) const + Longlong_null to_longlong_null(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); return VDec(item->arguments()[0]).to_xlonglong_null() ^ diff --git a/sql/item_func.h b/sql/item_func.h index 13b522dc25c..015f6ca8106 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -126,7 +126,7 @@ public: DBUG_ASSERT(0); return SCALAR_CMP_EQ; } - enum Type type() const { return FUNC_ITEM; } + enum Type type() const override { return FUNC_ITEM; } virtual enum Functype functype() const { return UNKNOWN_FUNC; } Item_func(THD *thd): Item_func_or_sum(thd) { @@ -177,29 +177,29 @@ public: :Item_func_or_sum(thd, item), With_sum_func_cache(item), not_null_tables_cache(item->not_null_tables_cache) { } - bool fix_fields(THD *, Item **ref); - void cleanup() + bool fix_fields(THD *, Item **ref) override; + void cleanup() override { Item_func_or_sum::cleanup(); used_tables_and_const_cache_init(); } - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void quick_fix_field(); - table_map not_null_tables() const; - void update_used_tables() + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; + void quick_fix_field() override; + table_map not_null_tables() const override; + void update_used_tables() override { used_tables_and_const_cache_init(); used_tables_and_const_cache_update_and_join(arg_count, args); } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + COND_EQUAL **cond_equal_ref) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_func::get_mm_tree"); DBUG_RETURN(const_item() ? get_mm_tree_for_const(param) : NULL); } - bool eq(const Item *item, bool binary_cmp) const; + bool eq(const Item *item, bool binary_cmp) const override; virtual Item *key_item() const { return args[0]; } void set_arguments(THD *thd, List &list) { @@ -208,8 +208,8 @@ public: list.empty(); // Fields are used } void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - virtual void print(String *str, enum_query_type query_type); + List &fields, uint flags) override; + void print(String *str, enum_query_type query_type) override; void print_op(String *str, enum_query_type query_type); void print_args(String *str, uint from, enum_query_type query_type) const; void print_args_parenthesized(String *str, enum_query_type query_type) const @@ -218,7 +218,7 @@ public: print_args(str, 0, query_type); str->append(')'); } - bool is_null() { + bool is_null() override { update_null_value(); return null_value; } @@ -226,9 +226,9 @@ public: void signal_divide_by_null(); friend class udf_handler; - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return tmp_table_field_from_field_type(root, table); } - Item *get_tmp_table_item(THD *thd); + Item *get_tmp_table_item(THD *thd) override; void fix_char_length_ulonglong(ulonglong max_char_length_arg) { @@ -242,13 +242,13 @@ public: else max_length= (uint32) max_result_length; } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); + Item_transformer transformer, uchar *arg_t) override; void traverse_cond(Cond_traverser traverser, - void * arg, traverse_order order); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); + void * arg, traverse_order order) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; // bool is_expensive_processor(void *arg); // virtual bool is_expensive() { return 0; } inline void raise_numeric_overflow(const char *type_name) @@ -364,7 +364,7 @@ public: return FALSE; } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { /* By default only substitution for a field whose two different values @@ -380,7 +380,7 @@ public: return used_tables() & RAND_TABLE_BIT; } - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { if (used_tables() & OUTER_REF_TABLE_BIT) return false; @@ -388,14 +388,14 @@ public: Item_args::excl_dep_on_table(tab_map); } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { if (has_rand_bit() || with_subquery()) return false; return Item_args::excl_dep_on_grouping_fields(sel); } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override { return Item_args::excl_dep_on_in_subq_left_part(subq_pred); } @@ -408,24 +408,24 @@ public: representation of a TIMESTAMP argument verbatim, and thus does not depend on the timezone. */ - virtual bool check_valid_arguments_processor(void *bool_arg) + bool check_valid_arguments_processor(void *bool_arg) override { return has_timestamp_args(); } - virtual bool find_function_processor (void *arg) + bool find_function_processor (void *arg) override { return functype() == *(Functype *) arg; } - void no_rows_in_result() + void no_rows_in_result() override { for (uint i= 0; i < arg_count; i++) { args[i]->no_rows_in_result(); } } - void restore_to_before_no_rows_in_result() + void restore_to_before_no_rows_in_result() override { for (uint i= 0; i < arg_count; i++) { @@ -433,10 +433,10 @@ public: } } void convert_const_compared_to_int_field(THD *thd); - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - Item_func *get_item_func() { return this; } - bool is_simplified_cond_processor(void *arg) + bool with_sum_func() const override { return m_with_sum_func; } + With_sum_func_cache* get_with_sum_func_cache() override { return this; } + Item_func *get_item_func() override { return this; } + bool is_simplified_cond_processor(void *arg) override { return const_item() && !val_int(); } }; @@ -451,17 +451,17 @@ public: { collation= DTCollation_numeric(); } Item_real_func(THD *thd, List &list): Item_func(thd, list) { collation= DTCollation_numeric(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value); - longlong val_int() + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *decimal_value) override; + longlong val_int() override { DBUG_ASSERT(fixed == 1); return Converter_double_to_longlong(val_real(), unsigned_flag).result(); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_real(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() + const Type_handler *type_handler() const override { return &type_handler_double; } + bool fix_length_and_dec() override { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); @@ -487,7 +487,7 @@ public: Item_hybrid_func(THD *thd, List &list): Item_func(thd, list) { } Item_hybrid_func(THD *thd, Item_hybrid_func *item) :Item_func(thd, item), Type_handler_hybrid_field_type(item) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } void fix_length_and_dec_long_or_longlong(uint char_length, bool unsigned_arg) { @@ -543,30 +543,30 @@ public: class Handler_str: public Handler { public: - String *val_str_ascii(Item_handled_func *item, String *str) const + String *val_str_ascii(Item_handled_func *item, String *str) const override { return item->Item::val_str_ascii(str); } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); StringBuffer<64> tmp; String *res= item->val_str(&tmp); return res ? item->double_from_string_with_check(res) : 0.0; } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { DBUG_ASSERT(item->is_fixed()); StringBuffer<22> tmp; String *res= item->val_str(&tmp); return res ? item->longlong_from_string_with_check(res) : 0; } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return item->val_decimal_from_string(to); } bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to, - date_mode_t fuzzydate) const + date_mode_t fuzzydate) const override { return item->get_date_from_string(thd, to, fuzzydate); } @@ -579,7 +579,7 @@ public: class Handler_temporal: public Handler { public: - String *val_str(Item_handled_func *item, String *to) const + String *val_str(Item_handled_func *item, String *to) const override { StringBuffer ascii_buf; return item->val_str_from_val_str_ascii(to, &ascii_buf); @@ -594,28 +594,28 @@ public: class Handler_temporal_string: public Handler_temporal { public: - const Type_handler *return_type_handler(const Item_handled_func *) const + const Type_handler *return_type_handler(const Item_handled_func *) const override { return &type_handler_string; } const Type_handler * - type_handler_for_create_select(const Item_handled_func *item) const + type_handler_for_create_select(const Item_handled_func *item) const override { return return_type_handler(item)->type_handler_for_tmp_table(item); } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { return Temporal_hybrid(item).to_double(); } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { return Temporal_hybrid(item).to_longlong(); } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return Temporal_hybrid(item).to_decimal(to); } - String *val_str_ascii(Item_handled_func *item, String *to) const + String *val_str_ascii(Item_handled_func *item, String *to) const override { return Temporal_hybrid(item).to_string(to, item->decimals); } @@ -625,28 +625,28 @@ public: class Handler_date: public Handler_temporal { public: - const Type_handler *return_type_handler(const Item_handled_func *) const + const Type_handler *return_type_handler(const Item_handled_func *) const override { return &type_handler_newdate; } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->fix_attributes_date(); return false; } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { return Date(item).to_double(); } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { return Date(item).to_longlong(); } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return Date(item).to_decimal(to); } - String *val_str_ascii(Item_handled_func *item, String *to) const + String *val_str_ascii(Item_handled_func *item, String *to) const override { return Date(item).to_string(to); } @@ -656,27 +656,27 @@ public: class Handler_time: public Handler_temporal { public: - const Type_handler *return_type_handler(const Item_handled_func *) const + const Type_handler *return_type_handler(const Item_handled_func *) const override { return &type_handler_time2; } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { return Time(item).to_double(); } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { return Time(item).to_longlong(); } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return Time(item).to_decimal(to); } - String *val_str_ascii(Item_handled_func *item, String *to) const + String *val_str_ascii(Item_handled_func *item, String *to) const override { return Time(item).to_string(to, item->decimals); } - bool val_native(THD *thd, Item_handled_func *item, Native *to) const + bool val_native(THD *thd, Item_handled_func *item, Native *to) const override { return Time(thd, item).to_native(to, item->decimals); } @@ -686,23 +686,23 @@ public: class Handler_datetime: public Handler_temporal { public: - const Type_handler *return_type_handler(const Item_handled_func *) const + const Type_handler *return_type_handler(const Item_handled_func *) const override { return &type_handler_datetime2; } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { return Datetime(item).to_double(); } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { return Datetime(item).to_longlong(); } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return Datetime(item).to_decimal(to); } - String *val_str_ascii(Item_handled_func *item, String *to) const + String *val_str_ascii(Item_handled_func *item, String *to) const override { return Datetime(item).to_string(to, item->decimals); } @@ -712,7 +712,7 @@ public: class Handler_int: public Handler { public: - String *val_str(Item_handled_func *item, String *to) const + String *val_str(Item_handled_func *item, String *to) const override { longlong nr= val_int(item); if (item->null_value) @@ -720,25 +720,25 @@ public: to->set_int(nr, item->unsigned_flag, item->collation.collation); return to; } - String *val_str_ascii(Item_handled_func *item, String *to) const + String *val_str_ascii(Item_handled_func *item, String *to) const override { return item->Item::val_str_ascii(to); } - double val_real(Item_handled_func *item) const + double val_real(Item_handled_func *item) const override { return item->unsigned_flag ? (double) ((ulonglong) val_int(item)) : (double) val_int(item); } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const + my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const override { return item->val_decimal_from_int(to); } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzydate) const + MYSQL_TIME *to, date_mode_t fuzzydate) const override { return item->get_date_from_int(thd, to, fuzzydate); } - longlong val_int(Item_handled_func *item) const + longlong val_int(Item_handled_func *item) const override { Longlong_null tmp= to_longlong_null(item); item->null_value= tmp.is_null(); @@ -750,11 +750,11 @@ public: class Handler_slong: public Handler_int { public: - const Type_handler *return_type_handler(const Item_handled_func *item) const + const Type_handler *return_type_handler(const Item_handled_func *item) const override { return &type_handler_slong; } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->unsigned_flag= false; item->collation= DTCollation_numeric(); @@ -766,7 +766,7 @@ public: class Handler_slong2: public Handler_slong { public: - bool fix_length_and_dec(Item_handled_func *func) const + bool fix_length_and_dec(Item_handled_func *func) const override { bool rc= Handler_slong::fix_length_and_dec(func); func->max_length= 2; @@ -777,11 +777,11 @@ public: class Handler_ulonglong: public Handler_int { public: - const Type_handler *return_type_handler(const Item_handled_func *item) const + const Type_handler *return_type_handler(const Item_handled_func *item) const override { return &type_handler_ulonglong; } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->unsigned_flag= true; item->collation= DTCollation_numeric(); @@ -801,11 +801,11 @@ public: { m_func_handler= handler; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return m_func_handler->return_type_handler(this); } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { DBUG_ASSERT(fixed); const Type_handler *h= m_func_handler->type_handler_for_create_select(this); @@ -813,31 +813,31 @@ public: Record_addr(maybe_null), *this, table); } - String *val_str(String *to) + String *val_str(String *to) override { return m_func_handler->val_str(this, to); } - String *val_str_ascii(String *to) + String *val_str_ascii(String *to) override { return m_func_handler->val_str_ascii(this, to); } - double val_real() + double val_real() override { return m_func_handler->val_real(this); } - longlong val_int() + longlong val_int() override { return m_func_handler->val_int(this); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return m_func_handler->val_decimal(this, to); } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) override { return m_func_handler->get_date(thd, this, to, fuzzydate); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { return m_func_handler->val_native(thd, this, to); } @@ -940,25 +940,25 @@ public: Item_hybrid_func(thd, list) { collation= DTCollation_numeric(); } - double val_real() + double val_real() override { DBUG_ASSERT(fixed); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_real(this); } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_int(this); } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { DBUG_ASSERT(fixed); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_decimal(this, dec); } - String *val_str(String*str) + String *val_str(String*str) override { DBUG_ASSERT(fixed); String *res= Item_func_hybrid_field_type::type_handler()-> @@ -966,14 +966,14 @@ public: DBUG_ASSERT(null_value == (res == NULL)); return res; } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { DBUG_ASSERT(fixed); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_get_date_with_warn(thd, this, to, mode); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { DBUG_ASSERT(fixed); return native_op(thd, to); @@ -1078,7 +1078,7 @@ public: Item_func_case_expression(THD *thd, List &list): Item_func_hybrid_field_type(thd, list) { } - bool find_not_null_fields(table_map allowed) { return false; } + bool find_not_null_fields(table_map allowed) override { return false; } }; @@ -1107,18 +1107,18 @@ public: Item_func_numhybrid(THD *thd, List &list): Item_func_hybrid_field_type(thd, list) { } - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + String *str_op(String *str) override { DBUG_ASSERT(0); return 0; } + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { DBUG_ASSERT(0); return true; } - bool time_op(THD *thd, MYSQL_TIME *ltime) + bool time_op(THD *thd, MYSQL_TIME *ltime) override { DBUG_ASSERT(0); return true; } - bool native_op(THD *thd, Native *to) + bool native_op(THD *thd, Native *to) override { DBUG_ASSERT(0); return true; @@ -1132,8 +1132,8 @@ class Item_func_num1: public Item_func_numhybrid public: Item_func_num1(THD *thd, Item *a): Item_func_numhybrid(thd, a) {} Item_func_num1(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {} - bool check_partition_func_processor(void *int_arg) { return FALSE; } - bool check_vcol_func_processor(void *arg) { return FALSE; } + bool check_partition_func_processor(void *int_arg) override { return FALSE; } + bool check_vcol_func_processor(void *arg) override { return FALSE; } }; @@ -1141,7 +1141,7 @@ public: class Item_num_op :public Item_func_numhybrid { protected: - bool check_arguments() const + bool check_arguments() const override { return false; // Checked by aggregate_for_num_op() } @@ -1149,7 +1149,7 @@ public: Item_num_op(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {} virtual void result_precision()= 0; - virtual inline void print(String *str, enum_query_type query_type) + inline void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } @@ -1179,7 +1179,7 @@ public: if (decimals == 0 && downcast_decimal_to_int) set_handler(type_handler_long_or_longlong()); } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; @@ -1207,16 +1207,16 @@ public: { collation= DTCollation_numeric(); fix_char_length(21); } Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) { collation= DTCollation_numeric(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value) + double val_real() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *decimal_value) override { return val_decimal_from_int(decimal_value); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_int(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const= 0; - bool fix_length_and_dec() { return FALSE; } + const Type_handler *type_handler() const override= 0; + bool fix_length_and_dec() override { return FALSE; } }; @@ -1229,13 +1229,13 @@ public: Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} Item_long_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulong; return &type_handler_slong; } - bool fix_length_and_dec() { max_length= 11; return FALSE; } + bool fix_length_and_dec() override { max_length= 11; return FALSE; } }; @@ -1248,12 +1248,12 @@ public: Item_long_ge0_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} Item_long_ge0_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_long_ge0_func(THD *thd, Item_long_ge0_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { DBUG_ASSERT(!unsigned_flag); return &type_handler_slong_ge0; } - bool fix_length_and_dec() { max_length= 10; return FALSE; } + bool fix_length_and_dec() override { max_length= 10; return FALSE; } }; @@ -1262,12 +1262,12 @@ class Item_func_hash: public Item_int_func public: Item_func_hash(THD *thd, List &item): Item_int_func(thd, item) {} - longlong val_int(); - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_slong; } - Item *get_copy(THD *thd) + longlong val_int() override; + bool fix_length_and_dec() override; + const Type_handler *type_handler() const override { return &type_handler_slong; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - const char *func_name() const { return ""; } + const char *func_name() const override { return ""; } }; class Item_func_hash_mariadb_100403: public Item_func_hash @@ -1276,10 +1276,10 @@ public: Item_func_hash_mariadb_100403(THD *thd, List &item) :Item_func_hash(thd, item) {} - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - const char *func_name() const { return ""; } + const char *func_name() const override { return ""; } }; class Item_longlong_func: public Item_int_func @@ -1293,7 +1293,7 @@ public: Item_int_func(thd, a, b, c, d) {} Item_longlong_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; @@ -1322,17 +1322,17 @@ class Item_func_cursor_rowcount: public Item_longlong_func, public: Item_func_cursor_rowcount(THD *thd, const LEX_CSTRING *name, uint offset) :Item_longlong_func(thd), Cursor_ref(name, offset) { maybe_null= true; } - const char *func_name() const { return "%ROWCOUNT"; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "%ROWCOUNT"; } + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC); } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { return Cursor_ref::print_func(str, func_name()); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1344,15 +1344,15 @@ class Item_func_connection_id :public Item_long_func public: Item_func_connection_id(THD *thd): Item_long_func(thd) { unsigned_flag=1; } - const char *func_name() const { return "connection_id"; } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "connection_id"; } + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; + longlong val_int() override { DBUG_ASSERT(fixed == 1); return value; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1364,13 +1364,13 @@ public: { unsigned_flag= 0; } - const char *func_name() const { return "cast_as_signed"; } - const Type_handler *type_handler() const + const char *func_name() const override { return "cast_as_signed"; } + const Type_handler *type_handler() const override { return Type_handler::type_handler_long_or_longlong(max_char_length(), false); } - longlong val_int() + longlong val_int() override { longlong value= args[0]->val_int_signed_typecast(); null_value= args[0]->null_value; @@ -1412,14 +1412,14 @@ public: set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); fix_char_length(char_length); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this); } - virtual void print(String *str, enum_query_type query_type); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + uint decimal_precision() const override { return args[0]->decimal_precision(); } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1431,26 +1431,26 @@ public: { unsigned_flag= 1; } - const char *func_name() const { return "cast_as_unsigned"; } - const Type_handler *type_handler() const + const char *func_name() const override { return "cast_as_unsigned"; } + const Type_handler *type_handler() const override { if (max_char_length() <= MY_INT32_NUM_DECIMAL_DIGITS - 1) return &type_handler_ulong; return &type_handler_ulonglong; } - longlong val_int() + longlong val_int() override { longlong value= args[0]->val_int_unsigned_typecast(); null_value= args[0]->null_value; return value; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this); } - uint decimal_precision() const { return max_length; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + uint decimal_precision() const override { return max_length; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1467,26 +1467,26 @@ public: fix_char_length(my_decimal_precision_to_length_no_truncation(len, dec, unsigned_flag)); } - String *val_str(String *str) { return VDec(this).to_string(str); } - double val_real() { return VDec(this).to_double(); } - longlong val_int() { return VDec(this).to_longlong(unsigned_flag); } - my_decimal *val_decimal(my_decimal*); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + String *val_str(String *str) override { return VDec(this).to_string(str); } + double val_real() override { return VDec(this).to_double(); } + longlong val_int() override { return VDec(this).to_longlong(unsigned_flag); } + my_decimal *val_decimal(my_decimal*) override; + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL, NULL); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } + const Type_handler *type_handler() const override { return &type_handler_newdecimal; } void fix_length_and_dec_generic() {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this); } - const char *func_name() const { return "decimal_typecast"; } - virtual void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "decimal_typecast"; } + void print(String *str, enum_query_type query_type) override; + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1502,8 +1502,8 @@ public: decimals= (uint8) dec; max_length= (uint32) len; } - bool need_parentheses_in_default() { return true; } - void print(String *str, enum_query_type query_type); + bool need_parentheses_in_default() override { return true; } + void print(String *str, enum_query_type query_type) override; void fix_length_and_dec_generic() { maybe_null= 1; } }; @@ -1514,18 +1514,18 @@ public: Item_float_typecast(THD *thd, Item *a) :Item_real_typecast(thd, a, MAX_FLOAT_STR_LENGTH, NOT_FIXED_DEC) { } - const Type_handler *type_handler() const { return &type_handler_float; } - bool fix_length_and_dec() + const Type_handler *type_handler() const override { return &type_handler_float; } + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this); } - const char *func_name() const { return "float_typecast"; } - double val_real() + const char *func_name() const override { return "float_typecast"; } + double val_real() override { return (double) (float) val_real_with_truncate(FLT_MAX); } - String *val_str(String*str) + String *val_str(String*str) override { Float nr(Item_float_typecast::val_real()); if (null_value) @@ -1533,7 +1533,7 @@ public: nr.to_string(str, decimals); return str; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1544,14 +1544,14 @@ public: Item_double_typecast(THD *thd, Item *a, uint len, uint dec): Item_real_typecast(thd, a, len, dec) { } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this); } - const char *func_name() const { return "double_typecast"; } - double val_real() { return val_real_with_truncate(DBL_MAX); } - Item *get_copy(THD *thd) + const char *func_name() const override { return "double_typecast"; } + double val_real() override { return val_real_with_truncate(DBL_MAX); } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1560,9 +1560,9 @@ class Item_func_additive_op :public Item_num_op { public: Item_func_additive_op(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - void result_precision(); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} + void result_precision() override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} }; @@ -1571,13 +1571,13 @@ class Item_func_plus :public Item_func_additive_op public: Item_func_plus(THD *thd, Item *a, Item *b): Item_func_additive_op(thd, a, b) {} - const char *func_name() const { return "+"; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - bool fix_length_and_dec(); - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "+"; } + enum precedence precedence() const override { return ADD_PRECEDENCE; } + bool fix_length_and_dec() override; + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1589,13 +1589,13 @@ public: Item_func_additive_op(thd, a, b), m_depends_on_sql_mode_no_unsigned_subtraction(false) { } - const char *func_name() const { return "-"; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool fix_length_and_dec(); + const char *func_name() const override { return "-"; } + enum precedence precedence() const override { return ADD_PRECEDENCE; } + Sql_mode_dependency value_depends_on_sql_mode() const override; + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool fix_length_and_dec() override; void fix_unsigned_flag(); void fix_length_and_dec_double() { @@ -1612,7 +1612,7 @@ public: Item_func_additive_op::fix_length_and_dec_int(); fix_unsigned_flag(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1622,16 +1622,16 @@ class Item_func_mul :public Item_num_op public: Item_func_mul(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - const char *func_name() const { return "*"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - void result_precision(); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) + const char *func_name() const override { return "*"; } + enum precedence precedence() const override { return MUL_PRECEDENCE; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + void result_precision() override; + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1641,16 +1641,16 @@ class Item_func_div :public Item_num_op public: uint prec_increment; Item_func_div(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op() { DBUG_ASSERT(0); return 0; } - double real_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "/"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - bool fix_length_and_dec(); + longlong int_op() override { DBUG_ASSERT(0); return 0; } + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + const char *func_name() const override { return "/"; } + enum precedence precedence() const override { return MUL_PRECEDENCE; } + bool fix_length_and_dec() override; void fix_length_and_dec_double(); void fix_length_and_dec_int(); - void result_precision(); - Item *get_copy(THD *thd) + void result_precision() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1660,21 +1660,21 @@ class Item_func_int_div :public Item_int_func public: Item_func_int_div(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "DIV"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - const Type_handler *type_handler() const + longlong val_int() override; + const char *func_name() const override { return "DIV"; } + enum precedence precedence() const override { return MUL_PRECEDENCE; } + const Type_handler *type_handler() const override { return type_handler_long_or_longlong(); } - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type) + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1683,13 +1683,13 @@ class Item_func_mod :public Item_num_op { public: Item_func_mod(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "MOD"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - void result_precision(); - bool fix_length_and_dec(); + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + const char *func_name() const override { return "MOD"; } + enum precedence precedence() const override { return MUL_PRECEDENCE; } + void result_precision() override; + bool fix_length_and_dec() override; void fix_length_and_dec_double() { Item_num_op::fix_length_and_dec_double(); @@ -1706,9 +1706,9 @@ public: DBUG_ASSERT(decimals == 0); set_handler(type_handler_long_or_longlong()); } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1717,13 +1717,13 @@ class Item_func_neg :public Item_func_num1 { public: Item_func_neg(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "-"; } - enum Functype functype() const { return NEG_FUNC; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; + const char *func_name() const override { return "-"; } + enum Functype functype() const override { return NEG_FUNC; } + enum precedence precedence() const override { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); args[0]->print_parenthesised(str, query_type, precedence()); @@ -1731,10 +1731,10 @@ public: void fix_length_and_dec_int(); void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + uint decimal_precision() const override { return args[0]->decimal_precision(); } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1743,16 +1743,16 @@ class Item_func_abs :public Item_func_num1 { public: Item_func_abs(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "abs"; } + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; + const char *func_name() const override { return "abs"; } void fix_length_and_dec_int(); void fix_length_and_dec_sint_ge0(); void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1760,12 +1760,12 @@ public: class Item_dec_func :public Item_real_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_real(0, arg_count); } public: Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {} Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); maybe_null=1; @@ -1777,9 +1777,9 @@ class Item_func_exp :public Item_dec_func { public: Item_func_exp(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "exp"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "exp"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1788,9 +1788,9 @@ class Item_func_ln :public Item_dec_func { public: Item_func_ln(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "ln"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "ln"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1800,9 +1800,9 @@ class Item_func_log :public Item_dec_func public: Item_func_log(THD *thd, Item *a): Item_dec_func(thd, a) {} Item_func_log(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "log"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "log"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1811,9 +1811,9 @@ class Item_func_log2 :public Item_dec_func { public: Item_func_log2(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "log2"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "log2"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1822,9 +1822,9 @@ class Item_func_log10 :public Item_dec_func { public: Item_func_log10(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "log10"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "log10"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1833,9 +1833,9 @@ class Item_func_sqrt :public Item_dec_func { public: Item_func_sqrt(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "sqrt"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "sqrt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1844,9 +1844,9 @@ class Item_func_pow :public Item_dec_func { public: Item_func_pow(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "pow"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "pow"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1855,9 +1855,9 @@ class Item_func_acos :public Item_dec_func { public: Item_func_acos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "acos"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "acos"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1865,9 +1865,9 @@ class Item_func_asin :public Item_dec_func { public: Item_func_asin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "asin"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "asin"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1876,9 +1876,9 @@ class Item_func_atan :public Item_dec_func public: Item_func_atan(THD *thd, Item *a): Item_dec_func(thd, a) {} Item_func_atan(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "atan"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "atan"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1886,9 +1886,9 @@ class Item_func_cos :public Item_dec_func { public: Item_func_cos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "cos"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "cos"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1896,9 +1896,9 @@ class Item_func_sin :public Item_dec_func { public: Item_func_sin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "sin"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "sin"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1906,9 +1906,9 @@ class Item_func_tan :public Item_dec_func { public: Item_func_tan(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "tan"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "tan"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1916,9 +1916,9 @@ class Item_func_cot :public Item_dec_func { public: Item_func_cot(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "cot"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "cot"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1927,8 +1927,8 @@ class Item_func_int_val :public Item_func_hybrid_field_type { public: Item_func_int_val(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) {} - bool check_partition_func_processor(void *int_arg) { return FALSE; } - bool check_vcol_func_processor(void *arg) { return FALSE; } + bool check_partition_func_processor(void *int_arg) override { return FALSE; } + bool check_vcol_func_processor(void *arg) override { return FALSE; } virtual decimal_round_mode round_mode() const= 0; void fix_length_and_dec_double(); void fix_length_and_dec_int_or_decimal(); @@ -1943,9 +1943,9 @@ public: set_handler(&type_handler_datetime2); maybe_null= true; // E.g. CEILING(TIMESTAMP'0000-01-01 23:59:59.9') } - bool fix_length_and_dec(); - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool native_op(THD *thd, Native *to); + bool fix_length_and_dec() override; + String *str_op(String *str) override { DBUG_ASSERT(0); return 0; } + bool native_op(THD *thd, Native *to) override; }; @@ -1953,14 +1953,14 @@ class Item_func_ceiling :public Item_func_int_val { public: Item_func_ceiling(THD *thd, Item *a): Item_func_int_val(thd, a) {} - const char *func_name() const { return "ceiling"; } - decimal_round_mode round_mode() const { return CEILING; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) + const char *func_name() const override { return "ceiling"; } + decimal_round_mode round_mode() const override { return CEILING; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1969,14 +1969,14 @@ class Item_func_floor :public Item_func_int_val { public: Item_func_floor(THD *thd, Item *a): Item_func_int_val(thd, a) {} - const char *func_name() const { return "floor"; } - decimal_round_mode round_mode() const { return FLOOR; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) + const char *func_name() const override { return "floor"; } + decimal_round_mode round_mode() const override { return FLOOR; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1991,14 +1991,14 @@ class Item_func_round :public Item_func_hybrid_field_type public: Item_func_round(THD *thd, Item *a, Item *b, bool trunc_arg) :Item_func_hybrid_field_type(thd, a, b), truncate(trunc_arg) {} - const char *func_name() const { return truncate ? "truncate" : "round"; } - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - String *str_op(String *str) + const char *func_name() const override { return truncate ? "truncate" : "round"; } + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + String *str_op(String *str) override { DBUG_ASSERT(0); return NULL; @@ -2013,7 +2013,7 @@ public: void fix_arg_time(); void fix_arg_datetime(); void fix_arg_temporal(const Type_handler *h, uint int_part_length); - bool fix_length_and_dec() + bool fix_length_and_dec() override { /* We don't want to translate ENUM/SET to CHAR here. @@ -2021,7 +2021,7 @@ public: */ return args[0]->real_type_handler()->Item_func_round_fix_length_and_dec(this); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2030,39 +2030,39 @@ class Item_func_rand :public Item_real_func { struct my_rnd_struct *rand; bool first_eval; // TRUE if val_real() is called 1st time - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } void seed_random (Item * val); public: Item_func_rand(THD *thd, Item *a): Item_real_func(thd, a), rand(0), first_eval(TRUE) {} Item_func_rand(THD *thd): Item_real_func(thd) {} - double val_real(); - const char *func_name() const { return "rand"; } - bool const_item() const { return 0; } - void update_used_tables(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() { first_eval= TRUE; Item_real_func::cleanup(); } - bool check_vcol_func_processor(void *arg) + double val_real() override; + const char *func_name() const override { return "rand"; } + bool const_item() const override { return 0; } + void update_used_tables() override; + bool fix_fields(THD *thd, Item **ref) override; + void cleanup() override { first_eval= TRUE; Item_real_func::cleanup(); } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_sign :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_real(func_name()); } public: Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {} - const char *func_name() const { return "sign"; } - uint decimal_precision() const { return 1; } - bool fix_length_and_dec() { fix_char_length(2); return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "sign"; } + uint decimal_precision() const override { return 1; } + bool fix_length_and_dec() override { fix_char_length(2); return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2071,21 +2071,21 @@ class Item_func_units :public Item_real_func { char *name; double mul,add; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_real(0, arg_count); } public: Item_func_units(THD *thd, char *name_arg, Item *a, double mul_arg, double add_arg): Item_real_func(thd, a), name(name_arg), mul(mul_arg), add(add_arg) {} - double val_real(); - const char *func_name() const { return name; } - bool fix_length_and_dec() + double val_real() override; + const char *func_name() const override { return name; } + bool fix_length_and_dec() override { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2106,7 +2106,7 @@ class Item_func_min_max :public Item_hybrid_func String tmp_value; int cmp_sign; protected: - bool check_arguments() const + bool check_arguments() const override { return false; // Checked by aggregate_for_min_max() } @@ -2122,37 +2122,37 @@ public: bool get_date_native(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); bool get_time_native(THD *thd, MYSQL_TIME *res); - double val_real() + double val_real() override { DBUG_ASSERT(fixed); return Item_func_min_max::type_handler()-> Item_func_min_max_val_real(this); } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed); return Item_func_min_max::type_handler()-> Item_func_min_max_val_int(this); } - String *val_str(String *str) + String *val_str(String *str) override { DBUG_ASSERT(fixed); return Item_func_min_max::type_handler()-> Item_func_min_max_val_str(this, str); } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { DBUG_ASSERT(fixed); return Item_func_min_max::type_handler()-> Item_func_min_max_val_decimal(this, dec); } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override { DBUG_ASSERT(fixed); return Item_func_min_max::type_handler()-> Item_func_min_max_get_date(thd, this, res, fuzzydate); } - bool val_native(THD *thd, Native *to); + bool val_native(THD *thd, Native *to) override; void aggregate_attributes_real(Item **items, uint nitems) { /* @@ -2173,7 +2173,7 @@ public: Item_func::aggregate_attributes_real(items, nitems); max_length= float_length(decimals); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (aggregate_for_min_max(func_name(), args, arg_count)) return true; @@ -2186,8 +2186,8 @@ class Item_func_min :public Item_func_min_max { public: Item_func_min(THD *thd, List &list): Item_func_min_max(thd, list, 1) {} - const char *func_name() const { return "least"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "least"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2195,8 +2195,8 @@ class Item_func_max :public Item_func_min_max { public: Item_func_max(THD *thd, List &list): Item_func_min_max(thd, list, -1) {} - const char *func_name() const { return "greatest"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "greatest"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2213,35 +2213,35 @@ public: { name= a->name; } - double val_real() { return val_real_from_item(args[0]); } - longlong val_int() { return val_int_from_item(args[0]); } - String *val_str(String *str) { return val_str_from_item(args[0], str); } - bool val_native(THD *thd, Native *to) + double val_real() override { return val_real_from_item(args[0]); } + longlong val_int() override { return val_int_from_item(args[0]); } + String *val_str(String *str) override { return val_str_from_item(args[0], str); } + bool val_native(THD *thd, Native *to) override { return val_native_from_item(thd, args[0], to); } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { return val_decimal_from_item(args[0], dec); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_item(thd, args[0], ltime, fuzzydate); } - const char *func_name() const { return "rollup_const"; } - bool const_item() const { return 0; } - const Type_handler *type_handler() const { return args[0]->type_handler(); } - bool fix_length_and_dec() + const char *func_name() const override { return "rollup_const"; } + bool const_item() const override { return 0; } + const Type_handler *type_handler() const override { return args[0]->type_handler(); } + bool fix_length_and_dec() override { Type_std_attributes::set(*args[0]); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_long_func_length: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name()); } public: Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { max_length=10; return FALSE; } + bool fix_length_and_dec() override { max_length=10; return FALSE; } }; @@ -2250,9 +2250,9 @@ class Item_func_octet_length :public Item_long_func_length String value; public: Item_func_octet_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); - const char *func_name() const { return "octet_length"; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "octet_length"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2261,14 +2261,14 @@ class Item_func_bit_length :public Item_longlong_func String value; public: Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 11; // 0x100000000*8 = 34,359,738,368 return FALSE; } - longlong val_int(); - const char *func_name() const { return "bit_length"; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "bit_length"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2277,34 +2277,34 @@ class Item_func_char_length :public Item_long_func_length String value; public: Item_func_char_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); - const char *func_name() const { return "char_length"; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "char_length"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_coercibility :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name()); } public: Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "coercibility"; } - bool fix_length_and_dec() { max_length=10; maybe_null= 0; return FALSE; } - bool eval_not_null_tables(void *) + longlong val_int() override; + const char *func_name() const override { return "coercibility"; } + bool fix_length_and_dec() override { max_length=10; maybe_null= 0; return FALSE; } + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return false; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { return this; } - bool const_item() const { return true; } - Item *get_copy(THD *thd) + bool const_item() const override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2317,7 +2317,7 @@ public: */ class Item_func_locate :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2) || (arg_count > 2 && args[2]->check_type_can_return_int(func_name())); @@ -2329,15 +2329,15 @@ public: :Item_long_func(thd, a, b) {} Item_func_locate(THD *thd, Item *a, Item *b, Item *c) :Item_long_func(thd, a, b, c) {} - const char *func_name() const { return "locate"; } - longlong val_int(); - bool fix_length_and_dec() + const char *func_name() const override { return "locate"; } + longlong val_int() override; + bool fix_length_and_dec() override { max_length= MY_INT32_NUM_DECIMAL_DIGITS; return agg_arg_charsets_for_comparison(cmp_collation, args, 2); } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2349,45 +2349,45 @@ class Item_func_field :public Item_long_func DTCollation cmp_collation; public: Item_func_field(THD *thd, List &list): Item_long_func(thd, list) {} - longlong val_int(); - const char *func_name() const { return "field"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "field"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_ascii :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, arg_count); } String value; public: Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "ascii"; } - bool fix_length_and_dec() { max_length=3; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "ascii"; } + bool fix_length_and_dec() override { max_length=3; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_ord :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name()); } String value; public: Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(7); return FALSE; } - longlong val_int(); - const char *func_name() const { return "ord"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { fix_char_length(7); return FALSE; } + longlong val_int() override; + const char *func_name() const override { return "ord"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_find_in_set :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2); } String value,value2; uint enum_value; @@ -2396,10 +2396,10 @@ class Item_func_find_in_set :public Item_long_func public: Item_func_find_in_set(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b), enum_value(0) {} - longlong val_int(); - const char *func_name() const { return "find_in_set"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "find_in_set"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2407,7 +2407,7 @@ public: class Item_func_bit_operator: public Item_handled_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } protected: bool fix_length_and_dec_op1_std(const Handler *ha_int, const Handler *ha_dec) @@ -2426,11 +2426,11 @@ public: :Item_handled_func(thd, a) {} Item_func_bit_operator(THD *thd, Item *a, Item *b) :Item_handled_func(thd, a, b) {} - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; class Item_func_bit_or :public Item_func_bit_operator @@ -2438,10 +2438,10 @@ class Item_func_bit_or :public Item_func_bit_operator public: Item_func_bit_or(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "|"; } - enum precedence precedence() const { return BITOR_PRECEDENCE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "|"; } + enum precedence precedence() const override { return BITOR_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2450,22 +2450,22 @@ class Item_func_bit_and :public Item_func_bit_operator public: Item_func_bit_and(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "&"; } - enum precedence precedence() const { return BITAND_PRECEDENCE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "&"; } + enum precedence precedence() const override { return BITAND_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_bit_count :public Item_handled_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name()); } public: Item_func_bit_count(THD *thd, Item *a): Item_handled_func(thd, a) {} - const char *func_name() const { return "bit_count"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "bit_count"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2474,10 +2474,10 @@ class Item_func_shift_left :public Item_func_bit_operator public: Item_func_shift_left(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "<<"; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "<<"; } + enum precedence precedence() const override { return SHIFT_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2486,10 +2486,10 @@ class Item_func_shift_right :public Item_func_bit_operator public: Item_func_shift_right(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return ">>"; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return ">>"; } + enum precedence precedence() const override { return SHIFT_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2497,48 +2497,48 @@ class Item_func_bit_neg :public Item_func_bit_operator { public: Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {} - bool fix_length_and_dec(); - const char *func_name() const { return "~"; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + bool fix_length_and_dec() override; + const char *func_name() const override { return "~"; } + enum precedence precedence() const override { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); args[0]->print_parenthesised(str, query_type, precedence()); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_last_insert_id :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } public: Item_func_last_insert_id(THD *thd): Item_longlong_func(thd) {} Item_func_last_insert_id(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "last_insert_id"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "last_insert_id"; } + bool fix_length_and_dec() override { unsigned_flag= true; if (arg_count) max_length= args[0]->max_length; return FALSE; } - bool fix_fields(THD *thd, Item **ref); - bool check_vcol_func_processor(void *arg) + bool fix_fields(THD *thd, Item **ref) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_benchmark :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name()) || args[1]->check_type_scalar(func_name()); @@ -2547,15 +2547,15 @@ public: Item_func_benchmark(THD *thd, Item *count_expr, Item *expr): Item_long_func(thd, count_expr, expr) {} - longlong val_int(); - const char *func_name() const { return "benchmark"; } - bool fix_length_and_dec() { max_length=1; maybe_null=0; return FALSE; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + const char *func_name() const override { return "benchmark"; } + bool fix_length_and_dec() override { max_length=1; maybe_null=0; return FALSE; } + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2565,24 +2565,24 @@ void item_func_sleep_free(void); class Item_func_sleep :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_real(func_name()); } public: Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(1); return FALSE; } - bool const_item() const { return 0; } - const char *func_name() const { return "sleep"; } - table_map used_tables() const + bool fix_length_and_dec() override { fix_char_length(1); return FALSE; } + bool const_item() const override { return 0; } + const char *func_name() const override { return "sleep"; } + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool is_expensive() { return 1; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + bool is_expensive() override { return 1; } + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2603,7 +2603,7 @@ class Item_udf_func :public Item_func } protected: udf_handler udf; - bool is_expensive_processor(void *arg) { return TRUE; } + bool is_expensive_processor(void *arg) override { return TRUE; } class VDec_udf: public Dec_ptr_and_buffer { @@ -2622,9 +2622,9 @@ public: Item_func(thd), udf(udf_arg) {} Item_udf_func(THD *thd, udf_func *udf_arg, List &list): Item_func(thd, list), udf(udf_arg) {} - const char *func_name() const { return udf.name(); } - enum Functype functype() const { return UDF_FUNC; } - bool fix_fields(THD *thd, Item **ref) + const char *func_name() const override { return udf.name(); } + enum Functype functype() const override { return UDF_FUNC; } + bool fix_fields(THD *thd, Item **ref) override { DBUG_ASSERT(fixed == 0); bool res= udf.fix_fields(thd, this, arg_count, args); @@ -2633,7 +2633,7 @@ public: return res; } void fix_num_length_and_dec(); - void update_used_tables() + void update_used_tables() override { /* TODO: Make a member in UDF_INIT and return if a UDF is deterministic or @@ -2682,27 +2682,27 @@ public: set_non_deterministic_if_needed(); } } - void cleanup(); - bool eval_not_null_tables(void *opt_arg) + void cleanup() override; + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool is_expensive() { return 1; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + bool is_expensive() override { return 1; } + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return false; } }; @@ -2715,13 +2715,13 @@ class Item_func_udf_float :public Item_udf_func Item_func_udf_float(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed == 1); return Converter_double_to_longlong(Item_func_udf_float::val_real(), unsigned_flag).result(); } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { double res=val_real(); if (null_value) @@ -2729,11 +2729,11 @@ class Item_func_udf_float :public Item_udf_func double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); return dec_buf; } - double val_real(); - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) + double val_real() override; + String *val_str(String *str) override; + const Type_handler *type_handler() const override { return &type_handler_double; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2746,21 +2746,21 @@ public: Item_func_udf_int(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int(); - double val_real() { return (double) Item_func_udf_int::val_int(); } - my_decimal *val_decimal(my_decimal *decimal_value) + longlong val_int() override; + double val_real() override { return (double) Item_func_udf_int::val_int(); } + my_decimal *val_decimal(my_decimal *decimal_value) override { return val_decimal_from_int(decimal_value); } - String *val_str(String *str); - const Type_handler *type_handler() const + String *val_str(String *str) override; + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals= 0; max_length= 21; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2772,22 +2772,22 @@ public: Item_udf_func(thd, udf_arg) {} Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int() + longlong val_int() override { return VDec_udf(this, &udf).to_longlong(unsigned_flag); } - double val_real() + double val_real() override { return VDec_udf(this, &udf).to_double(); } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str) + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String *str) override { return VDec_udf(this, &udf).to_string_round(str, decimals); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_newdecimal; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2799,8 +2799,8 @@ public: Item_udf_func(thd, udf_arg) {} Item_func_udf_str(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - String *val_str(String *); - double val_real() + String *val_str(String *) override; + double val_real() override { int err_not_used; char *end_not_used; @@ -2809,14 +2809,14 @@ public: return res ? res->charset()->strntod((char*) res->ptr(), res->length(), &end_not_used, &err_not_used) : 0.0; } - longlong val_int() + longlong val_int() override { int err_not_used; String *res; res=val_str(&str_value); return res ? res->charset()->strntoll(res->ptr(),res->length(),10, (char**) 0, &err_not_used) : (longlong) 0; } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { String *res=val_str(&str_value); if (!res) @@ -2824,9 +2824,9 @@ public: string2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); return dec_buf; } - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return string_type_handler(); } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2893,13 +2893,13 @@ class Item_func_lock :public Item_long_func Item_func_lock(THD *thd): Item_long_func(thd) { } Item_func_lock(THD *thd, Item *a): Item_long_func(thd, a) {} Item_func_lock(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - table_map used_tables() const + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool const_item() const { return 0; } - bool is_expensive() { return 1; } - bool check_vcol_func_processor(void *arg) + bool const_item() const override { return 0; } + bool is_expensive() override { return 1; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } @@ -2908,7 +2908,7 @@ class Item_func_lock :public Item_long_func class Item_func_get_lock final :public Item_func_lock { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()) || args[1]->check_type_can_return_real(func_name()); @@ -2916,10 +2916,10 @@ class Item_func_get_lock final :public Item_func_lock String value; public: Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_func_lock(thd, a, b) {} - longlong val_int() final; - const char *func_name() const final { return "get_lock"; } - bool fix_length_and_dec() { max_length= 1; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) final + longlong val_int() override final; + const char *func_name() const override final { return "get_lock"; } + bool fix_length_and_dec() override { max_length= 1; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override final { return get_item_copy(thd, this); } }; @@ -2929,24 +2929,24 @@ class Item_func_release_all_locks final :public Item_func_lock public: Item_func_release_all_locks(THD *thd): Item_func_lock(thd) { unsigned_flag= 1; } - longlong val_int() final; - const char *func_name() const final { return "release_all_locks"; } - Item *get_copy(THD *thd) final + longlong val_int() override final; + const char *func_name() const override final { return "release_all_locks"; } + Item *get_copy(THD *thd) override final { return get_item_copy(thd, this); } }; class Item_func_release_lock final :public Item_func_lock { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()); } String value; public: Item_func_release_lock(THD *thd, Item *a): Item_func_lock(thd, a) {} - longlong val_int() final; - const char *func_name() const { return "release_lock"; } - bool fix_length_and_dec() { max_length= 1; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) final + longlong val_int() override final; + const char *func_name() const override { return "release_lock"; } + bool fix_length_and_dec() override { max_length= 1; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override final { return get_item_copy(thd, this); } }; @@ -2955,7 +2955,7 @@ public: class Item_master_pos_wait :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()) || @@ -2971,21 +2971,21 @@ public: Item_longlong_func(thd, a, b, c) {} Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d): Item_longlong_func(thd, a, b, c, d) {} - longlong val_int(); - const char *func_name() const { return "master_pos_wait"; } - bool fix_length_and_dec() { max_length=21; maybe_null=1; return FALSE; } - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + const char *func_name() const override { return "master_pos_wait"; } + bool fix_length_and_dec() override { max_length=21; maybe_null=1; return FALSE; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_master_gtid_wait :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()) || (arg_count > 1 && args[1]->check_type_can_return_real(func_name())); @@ -2996,14 +2996,14 @@ public: :Item_long_func(thd, a) {} Item_master_gtid_wait(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "master_gtid_wait"; } - bool fix_length_and_dec() { max_length=2; return FALSE; } - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + const char *func_name() const override { return "master_gtid_wait"; } + bool fix_length_and_dec() override { max_length=2; return FALSE; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3030,16 +3030,16 @@ public: :Item_hybrid_func(thd, item), m_var_entry(item->m_var_entry), name(item->name) { } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { DBUG_ASSERT(fixed); return create_tmp_field_ex_from_handler(root, table, src, param, type_handler()); } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return create_table_field_from_handler(root, table); } - bool check_vcol_func_processor(void *arg); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool check_vcol_func_processor(void *arg) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } @@ -3082,46 +3082,46 @@ public: null_item(item->null_item), save_result(item->save_result) {} - enum Functype functype() const { return SUSERVAR_FUNC; } - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - double val_result(); - longlong val_int_result(); - bool val_bool_result(); - String *str_result(String *str); - my_decimal *val_decimal_result(my_decimal *); - bool is_null_result(); + enum Functype functype() const override { return SUSERVAR_FUNC; } + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + my_decimal *val_decimal(my_decimal *) override; + double val_result() override; + longlong val_int_result() override; + bool val_bool_result() override; + String *str_result(String *str) override; + my_decimal *val_decimal_result(my_decimal *) override; + bool is_null_result() override; bool update_hash(void *ptr, size_t length, const Type_handler *th, CHARSET_INFO *cs); - bool send(Protocol *protocol, st_value *buffer); - void make_send_field(THD *thd, Send_field *tmp_field); + bool send(Protocol *protocol, st_value *buffer) override; + void make_send_field(THD *thd, Send_field *tmp_field) override; bool check(bool use_result_field); void save_item_result(Item *item); bool update(); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return ASSIGN_PRECEDENCE; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return ASSIGN_PRECEDENCE; } void print_as_stmt(String *str, enum_query_type query_type); - const char *func_name() const { return "set_user_var"; } + const char *func_name() const override { return "set_user_var"; } int save_in_field(Field *field, bool no_conversions, bool can_use_result_field); - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { return save_in_field(field, no_conversions, 1); } void save_org_in_field(Field *field, - fast_field_copier data __attribute__ ((__unused__))) + fast_field_copier data __attribute__ ((__unused__))) override { (void)save_in_field(field, 1, 0); } - bool register_field_in_read_map(void *arg); - bool register_field_in_bitmap(void *arg); + bool register_field_in_read_map(void *arg) override; + bool register_field_in_bitmap(void *arg) override; bool set_entry(THD *thd, bool create_if_not_exists); - void cleanup(); - Item *get_copy(THD *thd) + void cleanup() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool excl_dep_on_table(table_map tab_map) { return false; } + bool excl_dep_on_table(table_map tab_map) override { return false; } }; @@ -3131,30 +3131,30 @@ class Item_func_get_user_var :public Item_func_user_var, public: Item_func_get_user_var(THD *thd, const LEX_CSTRING *a): Item_func_user_var(thd, a) {} - enum Functype functype() const { return GUSERVAR_FUNC; } + enum Functype functype() const override { return GUSERVAR_FUNC; } LEX_CSTRING get_name() { return name; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal*); - String *val_str(String* str); - bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal*) override; + String *val_str(String* str) override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; /* We must always return variables as strings to guard against selects of type select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b) */ - const char *func_name() const { return "get_user_var"; } - bool const_item() const; - table_map used_tables() const + const char *func_name() const override { return "get_user_var"; } + bool const_item() const override; + table_map used_tables() const override { return const_item() ? 0 : RAND_TABLE_BIT; } - bool eq(const Item *item, bool binary_cmp) const; - Item *get_copy(THD *thd) + bool eq(const Item *item, bool binary_cmp) const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); + bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; public: - Settable_routine_parameter *get_settable_routine_parameter() + Settable_routine_parameter *get_settable_routine_parameter() override { return this; } @@ -3183,54 +3183,54 @@ public: org_name= *a; set_name(thd, a->str, a->length, system_charset_info); } - Load_data_outvar *get_load_data_outvar() + Load_data_outvar *get_load_data_outvar() override { return this; } - bool load_data_set_null(THD *thd, const Load_data_param *param) + bool load_data_set_null(THD *thd, const Load_data_param *param) override { set_null_value(param->charset()); return false; } - bool load_data_set_no_data(THD *thd, const Load_data_param *param) + bool load_data_set_no_data(THD *thd, const Load_data_param *param) override { set_null_value(param->charset()); return false; } bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param) + const Load_data_param *param) override { set_value(pos, length, param->charset()); return false; } - void load_data_print_for_log_event(THD *thd, String *to) const; - bool load_data_add_outvar(THD *thd, Load_data_param *param) const + void load_data_print_for_log_event(THD *thd, String *to) const override; + bool load_data_add_outvar(THD *thd, Load_data_param *param) const override { return param->add_outvar_user_var(thd); } - uint load_data_fixed_length() const + uint load_data_fixed_length() const override { return 0; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { DBUG_ASSERT(0); return NULL; } /* We should return something different from FIELD_ITEM here */ - enum Type type() const { return CONST_ITEM;} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - my_decimal *val_decimal(my_decimal *decimal_buffer); + enum Type type() const override { return CONST_ITEM;} + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + my_decimal *val_decimal(my_decimal *decimal_buffer) override; /* fix_fields() binds variable name with its entry structure */ - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; void set_null_value(CHARSET_INFO* cs); void set_value(const char *str, uint length, CHARSET_INFO* cs); - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_double; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3258,24 +3258,24 @@ public: enum_var_type var_type_arg, LEX_CSTRING *component_arg, const char *name_arg, size_t name_len_arg); - enum Functype functype() const { return GSYSVAR_FUNC; } - void update_null_value(); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - bool const_item() const { return true; } - table_map used_tables() const { return 0; } - const Type_handler *type_handler() const; - double val_real(); - longlong val_int(); - String* val_str(String*); - my_decimal *val_decimal(my_decimal *dec_buf) + enum Functype functype() const override { return GSYSVAR_FUNC; } + void update_null_value() override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + bool const_item() const override { return true; } + table_map used_tables() const override { return 0; } + const Type_handler *type_handler() const override; + double val_real() override; + longlong val_int() override; + String* val_str(String*) override; + my_decimal *val_decimal(my_decimal *dec_buf) override { return val_decimal_from_real(dec_buf); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } /* TODO: fix to support views */ - const char *func_name() const { return "get_system_var"; } + const char *func_name() const override { return "get_system_var"; } /** Indicates whether this system variable is written to the binlog or not. @@ -3285,11 +3285,11 @@ public: @return true if the variable is written to the binlog, false otherwise. */ bool is_written_to_binlog(); - bool eq(const Item *item, bool binary_cmp) const; + bool eq(const Item *item, bool binary_cmp) const override; - void cleanup(); - bool check_vcol_func_processor(void *arg); - Item *get_copy(THD *thd) + void cleanup() override; + bool check_vcol_func_processor(void *arg) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3312,7 +3312,7 @@ public: Item_func_match(THD *thd, List &a, uint b): Item_real_func(thd, a), key(0), flags(b), join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { } - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_match::cleanup"); Item_real_func::cleanup(); @@ -3323,34 +3323,34 @@ public: table= 0; // required by Item_func_match::eq() DBUG_VOID_RETURN; } - bool is_expensive_processor(void *arg) { return TRUE; } - enum Functype functype() const { return FT_FUNC; } - const char *func_name() const { return "match"; } - bool eval_not_null_tables(void *opt_arg) + bool is_expensive_processor(void *arg) override { return TRUE; } + enum Functype functype() const override { return FT_FUNC; } + const char *func_name() const override { return "match"; } + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool fix_fields(THD *thd, Item **ref); - bool eq(const Item *, bool binary_cmp) const; + bool fix_fields(THD *thd, Item **ref) override; + bool eq(const Item *, bool binary_cmp) const override; /* The following should be safe, even if we compare doubles */ - longlong val_int() { DBUG_ASSERT(fixed == 1); return val_real() != 0.0; } - double val_real(); - virtual void print(String *str, enum_query_type query_type); + longlong val_int() override { DBUG_ASSERT(fixed == 1); return val_real() != 0.0; } + double val_real() override; + void print(String *str, enum_query_type query_type) override; bool fix_index(); bool init_search(THD *thd, bool no_order); - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("match ... against()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) { return 0; } + Item *build_clone(THD *thd) override { return 0; } private: /** Check whether storage engine for given table, @@ -3393,54 +3393,54 @@ class Item_func_bit_xor : public Item_func_bit_operator public: Item_func_bit_xor(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "^"; } - enum precedence precedence() const { return BITXOR_PRECEDENCE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "^"; } + enum precedence precedence() const override { return BITXOR_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_is_free_lock :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()); } String value; public: Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "is_free_lock"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "is_free_lock"; } + bool fix_length_and_dec() override { decimals=0; max_length=1; maybe_null=1; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_is_used_lock :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()); } String value; public: Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "is_used_lock"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "is_used_lock"; } + bool fix_length_and_dec() override { decimals=0; max_length=10; maybe_null=1; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3485,14 +3485,14 @@ class Item_func_row_count :public Item_longlong_func { public: Item_func_row_count(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "row_count"; } - bool fix_length_and_dec() { decimals= 0; maybe_null=0; return FALSE; } - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + const char *func_name() const override { return "row_count"; } + bool fix_length_and_dec() override { decimals= 0; maybe_null=0; return FALSE; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3512,10 +3512,10 @@ private: bool execute(); protected: - bool is_expensive_processor(void *arg) + bool is_expensive_processor(void *arg) override { return is_expensive(); } - bool check_arguments() const + bool check_arguments() const override { // sp_prepare_func_item() checks that the number of columns is correct return false; @@ -3530,53 +3530,53 @@ public: virtual ~Item_func_sp() = default; - void update_used_tables(); + void update_used_tables() override; - void cleanup(); + void cleanup() override; - const char *func_name() const; + const char *func_name() const override; - const Type_handler *type_handler() const; + const Type_handler *type_handler() const override; Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + const Tmp_field_param *param) override; + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return result_type() != STRING_RESULT ? sp_result_field : create_table_field_from_handler(root, table); } - void make_send_field(THD *thd, Send_field *tmp_field); + void make_send_field(THD *thd, Send_field *tmp_field) override; - longlong val_int() + longlong val_int() override { if (execute()) return (longlong) 0; return sp_result_field->val_int(); } - double val_real() + double val_real() override { if (execute()) return 0.0; return sp_result_field->val_real(); } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { if (execute()) return NULL; return sp_result_field->val_decimal(dec_buf); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { if (execute()) return true; return sp_result_field->get_date(ltime, fuzzydate); } - String *val_str(String *str) + String *val_str(String *str) override { String buf; char buff[20]; @@ -3595,26 +3595,26 @@ public: return str; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (execute()) return true; return null_value= sp_result_field->val_native(to); } - void update_null_value() + void update_null_value() override { execute(); } - virtual bool change_context_processor(void *cntx) + bool change_context_processor(void *cntx) override { context= (Name_resolution_context *)cntx; return FALSE; } - virtual enum Functype functype() const { return FUNC_SP; } + enum Functype functype() const override { return FUNC_SP; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(void); - bool is_expensive(); + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec(void) override; + bool is_expensive() override; inline Field *get_sp_result_field() { @@ -3625,20 +3625,20 @@ public: return m_name; } - bool check_vcol_func_processor(void *arg); - bool limit_index_condition_pushdown_processor(void *opt_arg) + bool check_vcol_func_processor(void *arg) override; + bool limit_index_condition_pushdown_processor(void *opt_arg) override { return TRUE; } - Item *get_copy(THD *) { return 0; } - bool eval_not_null_tables(void *opt_arg) + Item *get_copy(THD *) override { return 0; } + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return false; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } @@ -3649,14 +3649,14 @@ class Item_func_found_rows :public Item_longlong_func { public: Item_func_found_rows(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "found_rows"; } - bool fix_length_and_dec() { decimals= 0; maybe_null=0; return FALSE; } - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + const char *func_name() const override { return "found_rows"; } + bool fix_length_and_dec() override { decimals= 0; maybe_null=0; return FALSE; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3665,17 +3665,17 @@ class Item_func_oracle_sql_rowcount :public Item_longlong_func { public: Item_func_oracle_sql_rowcount(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "SQL%ROWCOUNT"; } - void print(String *str, enum_query_type query_type) + longlong val_int() override; + const char *func_name() const override { return "SQL%ROWCOUNT"; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3684,23 +3684,23 @@ class Item_func_sqlcode: public Item_long_func { public: Item_func_sqlcode(THD *thd): Item_long_func(thd) { } - longlong val_int(); - const char *func_name() const { return "SQLCODE"; } - void print(String *str, enum_query_type query_type) + longlong val_int() override; + const char *func_name() const override { return "SQLCODE"; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null= null_value= false; max_length= 11; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3711,17 +3711,17 @@ class Item_func_uuid_short :public Item_longlong_func { public: Item_func_uuid_short(THD *thd): Item_longlong_func(thd) {} - const char *func_name() const { return "uuid_short"; } - longlong val_int(); - bool const_item() const { return false; } - bool fix_length_and_dec() + const char *func_name() const override { return "uuid_short"; } + longlong val_int() override; + bool const_item() const override { return false; } + bool fix_length_and_dec() override { max_length= 21; unsigned_flag=1; return FALSE; } - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) + table_map used_tables() const override { return RAND_TABLE_BIT; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3732,32 +3732,32 @@ protected: Item *last_value; public: Item_func_last_value(THD *thd, List &list): Item_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *); - bool fix_length_and_dec(); - const char *func_name() const { return "last_value"; } - const Type_handler *type_handler() const { return last_value->type_handler(); } - bool eval_not_null_tables(void *) + double val_real() override; + longlong val_int() override; + String *val_str(String *) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "last_value"; } + const Type_handler *type_handler() const override { return last_value->type_handler(); } + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool const_item() const { return 0; } + bool const_item() const override { return 0; } void evaluate_sideeffects(); - void update_used_tables() + void update_used_tables() override { Item_func::update_used_tables(); maybe_null= last_value->maybe_null; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3772,9 +3772,9 @@ protected: public: Item_func_nextval(THD *thd, TABLE_LIST *table_list_arg): Item_longlong_func(thd), table_list(table_list_arg) {} - longlong val_int(); - const char *func_name() const { return "nextval"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "nextval"; } + bool fix_length_and_dec() override { unsigned_flag= 0; max_length= MAX_BIGINT_WIDTH; @@ -3797,11 +3797,11 @@ public: table= table_list->next_local->table; } } - bool const_item() const { return 0; } - Item *get_copy(THD *thd) + bool const_item() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NEXTVAL); } @@ -3815,9 +3815,9 @@ class Item_func_lastval :public Item_func_nextval public: Item_func_lastval(THD *thd, TABLE_LIST *table_list_arg): Item_func_nextval(thd, table_list_arg) {} - longlong val_int(); - const char *func_name() const { return "lastval"; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "lastval"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3835,10 +3835,10 @@ public: : Item_func_nextval(thd, table_list_arg), nextval(nextval_arg), round(round_arg), is_used(is_used_arg) {} - longlong val_int(); - const char *func_name() const { return "setval"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "setval"; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index bda59295c9a..5160bfdc4bb 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -2790,7 +2790,7 @@ public: protected: Create_func_area() = default; - virtual ~Create_func_area() = default; + ~Create_func_area() override = default; }; @@ -2806,7 +2806,7 @@ public: protected: Create_func_as_wkb() = default; - virtual ~Create_func_as_wkb() = default; + ~Create_func_as_wkb() override = default; }; @@ -2822,7 +2822,7 @@ public: protected: Create_func_as_wkt() = default; - virtual ~Create_func_as_wkt() = default; + ~Create_func_as_wkt() override = default; }; @@ -2839,7 +2839,7 @@ public: protected: Create_func_centroid() = default; - virtual ~Create_func_centroid() = default; + ~Create_func_centroid() override = default; }; @@ -2855,7 +2855,7 @@ public: protected: Create_func_convexhull() = default; - virtual ~Create_func_convexhull() = default; + ~Create_func_convexhull() override = default; }; @@ -2871,7 +2871,7 @@ public: protected: Create_func_pointonsurface() = default; - virtual ~Create_func_pointonsurface() = default; + ~Create_func_pointonsurface() override = default; }; @@ -2888,7 +2888,7 @@ public: protected: Create_func_mbr_contains() = default; - virtual ~Create_func_mbr_contains() = default; + ~Create_func_mbr_contains() override = default; }; @@ -2904,7 +2904,7 @@ public: protected: Create_func_contains() = default; - virtual ~Create_func_contains() = default; + ~Create_func_contains() override = default; }; @@ -2920,7 +2920,7 @@ public: protected: Create_func_crosses() = default; - virtual ~Create_func_crosses() = default; + ~Create_func_crosses() override = default; }; @@ -2936,7 +2936,7 @@ public: protected: Create_func_dimension() = default; - virtual ~Create_func_dimension() = default; + ~Create_func_dimension() override = default; }; @@ -2953,7 +2953,7 @@ public: protected: Create_func_mbr_disjoint() = default; - virtual ~Create_func_mbr_disjoint() = default; + ~Create_func_mbr_disjoint() override = default; }; @@ -2969,7 +2969,7 @@ public: protected: Create_func_disjoint() = default; - virtual ~Create_func_disjoint() = default; + ~Create_func_disjoint() override = default; }; @@ -2985,7 +2985,7 @@ public: protected: Create_func_distance() = default; - virtual ~Create_func_distance() = default; + ~Create_func_distance() override = default; }; @@ -2998,7 +2998,7 @@ public: protected: Create_func_distance_sphere() = default; - virtual ~Create_func_distance_sphere() = default; + ~Create_func_distance_sphere() override = default; }; @@ -3033,7 +3033,7 @@ public: protected: Create_func_endpoint() = default; - virtual ~Create_func_endpoint() = default; + ~Create_func_endpoint() override = default; }; @@ -3049,7 +3049,7 @@ public: protected: Create_func_envelope() = default; - virtual ~Create_func_envelope() = default; + ~Create_func_envelope() override = default; }; class Create_func_boundary : public Create_func_arg1 @@ -3064,7 +3064,7 @@ public: protected: Create_func_boundary() = default; - virtual ~Create_func_boundary() = default; + ~Create_func_boundary() override = default; }; @@ -3081,7 +3081,7 @@ public: protected: Create_func_mbr_equals() = default; - virtual ~Create_func_mbr_equals() = default; + ~Create_func_mbr_equals() override = default; }; @@ -3098,7 +3098,7 @@ public: protected: Create_func_equals() = default; - virtual ~Create_func_equals() = default; + ~Create_func_equals() override = default; }; @@ -3115,7 +3115,7 @@ public: protected: Create_func_exteriorring() = default; - virtual ~Create_func_exteriorring() = default; + ~Create_func_exteriorring() override = default; }; @@ -3130,7 +3130,7 @@ public: protected: Create_func_geometry_from_text() = default; - virtual ~Create_func_geometry_from_text() = default; + ~Create_func_geometry_from_text() override = default; }; @@ -3181,7 +3181,7 @@ public: protected: Create_func_geometry_from_wkb() = default; - virtual ~Create_func_geometry_from_wkb() = default; + ~Create_func_geometry_from_wkb() override = default; }; @@ -3231,7 +3231,7 @@ public: protected: Create_func_geometry_from_json() = default; - virtual ~Create_func_geometry_from_json() = default; + ~Create_func_geometry_from_json() override = default; }; @@ -3291,7 +3291,7 @@ public: protected: Create_func_as_geojson() = default; - virtual ~Create_func_as_geojson() = default; + ~Create_func_as_geojson() override = default; }; @@ -3351,7 +3351,7 @@ public: protected: Create_func_geometry_type() = default; - virtual ~Create_func_geometry_type() = default; + ~Create_func_geometry_type() override = default; }; @@ -3368,7 +3368,7 @@ public: protected: Create_func_geometryn() = default; - virtual ~Create_func_geometryn() = default; + ~Create_func_geometryn() override = default; }; @@ -3385,7 +3385,7 @@ public: protected: Create_func_gis_debug() = default; - virtual ~Create_func_gis_debug() = default; + ~Create_func_gis_debug() override = default; }; #endif @@ -3402,7 +3402,7 @@ public: protected: Create_func_glength() = default; - virtual ~Create_func_glength() = default; + ~Create_func_glength() override = default; }; @@ -3419,7 +3419,7 @@ public: protected: Create_func_interiorringn() = default; - virtual ~Create_func_interiorringn() = default; + ~Create_func_interiorringn() override = default; }; @@ -3435,7 +3435,7 @@ public: protected: Create_func_relate() = default; - virtual ~Create_func_relate() = default; + ~Create_func_relate() override = default; }; @@ -3452,7 +3452,7 @@ public: protected: Create_func_mbr_intersects() = default; - virtual ~Create_func_mbr_intersects() = default; + ~Create_func_mbr_intersects() override = default; }; @@ -3469,7 +3469,7 @@ public: protected: Create_func_intersects() = default; - virtual ~Create_func_intersects() = default; + ~Create_func_intersects() override = default; }; @@ -3486,7 +3486,7 @@ public: protected: Create_func_intersection() = default; - virtual ~Create_func_intersection() = default; + ~Create_func_intersection() override = default; }; @@ -3503,7 +3503,7 @@ public: protected: Create_func_difference() = default; - virtual ~Create_func_difference() = default; + ~Create_func_difference() override = default; }; @@ -3520,7 +3520,7 @@ public: protected: Create_func_union() = default; - virtual ~Create_func_union() = default; + ~Create_func_union() override = default; }; @@ -3537,7 +3537,7 @@ public: protected: Create_func_symdifference() = default; - virtual ~Create_func_symdifference() = default; + ~Create_func_symdifference() override = default; }; @@ -3553,7 +3553,7 @@ public: protected: Create_func_buffer() = default; - virtual ~Create_func_buffer() = default; + ~Create_func_buffer() override = default; }; @@ -3569,7 +3569,7 @@ public: protected: Create_func_isclosed() = default; - virtual ~Create_func_isclosed() = default; + ~Create_func_isclosed() override = default; }; @@ -3585,7 +3585,7 @@ public: protected: Create_func_isring() = default; - virtual ~Create_func_isring() = default; + ~Create_func_isring() override = default; }; @@ -3601,7 +3601,7 @@ public: protected: Create_func_isempty() = default; - virtual ~Create_func_isempty() = default; + ~Create_func_isempty() override = default; }; @@ -3617,7 +3617,7 @@ public: protected: Create_func_issimple() = default; - virtual ~Create_func_issimple() = default; + ~Create_func_issimple() override = default; }; @@ -3634,7 +3634,7 @@ public: protected: Create_func_numgeometries() = default; - virtual ~Create_func_numgeometries() = default; + ~Create_func_numgeometries() override = default; }; @@ -3650,7 +3650,7 @@ public: protected: Create_func_numinteriorring() = default; - virtual ~Create_func_numinteriorring() = default; + ~Create_func_numinteriorring() override = default; }; @@ -3666,7 +3666,7 @@ public: protected: Create_func_numpoints() = default; - virtual ~Create_func_numpoints() = default; + ~Create_func_numpoints() override = default; }; @@ -3683,7 +3683,7 @@ public: protected: Create_func_mbr_overlaps() = default; - virtual ~Create_func_mbr_overlaps() = default; + ~Create_func_mbr_overlaps() override = default; }; @@ -3700,7 +3700,7 @@ public: protected: Create_func_overlaps() = default; - virtual ~Create_func_overlaps() = default; + ~Create_func_overlaps() override = default; }; @@ -3719,7 +3719,7 @@ public: protected: Create_func_pointn() = default; - virtual ~Create_func_pointn() = default; + ~Create_func_pointn() override = default; }; @@ -3737,7 +3737,7 @@ public: protected: Create_func_srid() = default; - virtual ~Create_func_srid() = default; + ~Create_func_srid() override = default; }; @@ -3754,7 +3754,7 @@ public: protected: Create_func_startpoint() = default; - virtual ~Create_func_startpoint() = default; + ~Create_func_startpoint() override = default; }; @@ -3772,7 +3772,7 @@ public: protected: Create_func_touches() = default; - virtual ~Create_func_touches() = default; + ~Create_func_touches() override = default; }; @@ -3789,7 +3789,7 @@ public: protected: Create_func_mbr_within() = default; - virtual ~Create_func_mbr_within() = default; + ~Create_func_mbr_within() override = default; }; @@ -3806,7 +3806,7 @@ public: protected: Create_func_within() = default; - virtual ~Create_func_within() = default; + ~Create_func_within() override = default; }; @@ -3822,7 +3822,7 @@ public: protected: Create_func_x() = default; - virtual ~Create_func_x() = default; + ~Create_func_x() override = default; }; @@ -3838,7 +3838,7 @@ public: protected: Create_func_y() = default; - virtual ~Create_func_y() = default; + ~Create_func_y() override = default; }; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 0ccb5edc9bb..6c57ac52563 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -42,8 +42,8 @@ public: Item_geometry_func(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} Item_geometry_func(THD *thd, List &list): Item_str_func(thd, list) {} - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_geometry; } + bool fix_length_and_dec() override; + const Type_handler *type_handler() const override { return &type_handler_geometry; } }; @@ -54,7 +54,7 @@ class Item_real_func_args_geometry: public Item_real_func { protected: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -71,7 +71,7 @@ public: */ class Item_long_func_args_geometry: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -92,7 +92,7 @@ class Item_bool_func_args_geometry: public Item_bool_func { protected: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -110,7 +110,7 @@ public: class Item_str_ascii_func_args_geometry: public Item_str_ascii_func { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -132,7 +132,7 @@ public: class Item_binary_func_args_geometry: public Item_str_func { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -150,7 +150,7 @@ public: class Item_geometry_func_args_geometry: public Item_geometry_func { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); return Type_handler_geometry::check_type_geom_or_binary(func_name(), @@ -170,7 +170,7 @@ public: class Item_real_func_args_geometry_geometry: public Item_real_func { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); return Type_handler_geometry::check_types_geom_or_binary(func_name(), @@ -189,7 +189,7 @@ class Item_bool_func_args_geometry_geometry: public Item_bool_func { protected: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); return Type_handler_geometry::check_types_geom_or_binary(func_name(), @@ -203,7 +203,7 @@ public: class Item_func_geometry_from_text: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name()) || check_argument_types_can_return_int(1, MY_MIN(2, arg_count)); @@ -212,15 +212,15 @@ public: Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {} Item_func_geometry_from_text(THD *thd, Item *a, Item *srid): Item_geometry_func(thd, a, srid) {} - const char *func_name() const { return "st_geometryfromtext"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_geometryfromtext"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_geometry_from_wkb: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { return Type_handler_geometry::check_type_geom_or_binary(func_name(), args[0]) || @@ -230,9 +230,9 @@ public: Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {} Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid): Item_geometry_func(thd, a, srid) {} - const char *func_name() const { return "st_geometryfromwkb"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_geometryfromwkb"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -240,7 +240,7 @@ public: class Item_func_geometry_from_json: public Item_geometry_func { String tmp_js; - bool check_arguments() const + bool check_arguments() const override { // TODO: check with Alexey, for better args[1] and args[2] type control return args[0]->check_type_general_purpose_string(func_name()) || @@ -252,9 +252,9 @@ public: Item_geometry_func(thd, js, opt) {} Item_func_geometry_from_json(THD *thd, Item *js, Item *opt, Item *srid): Item_geometry_func(thd, js, opt, srid) {} - const char *func_name() const { return "st_geomfromgeojson"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_geomfromgeojson"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -264,10 +264,10 @@ class Item_func_as_wkt: public Item_str_ascii_func_args_geometry public: Item_func_as_wkt(THD *thd, Item *a) :Item_str_ascii_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_astext"; } - String *val_str_ascii(String *); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_astext"; } + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -276,10 +276,10 @@ class Item_func_as_wkb: public Item_binary_func_args_geometry public: Item_func_as_wkb(THD *thd, Item *a) :Item_binary_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_aswkb"; } - String *val_str(String *); - const Type_handler *type_handler() const { return &type_handler_long_blob; } - bool fix_length_and_dec() + const char *func_name() const override { return "st_aswkb"; } + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_long_blob; } + bool fix_length_and_dec() override { collation.set(&my_charset_bin); decimals=0; @@ -287,14 +287,14 @@ public: maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_as_geojson: public Item_str_ascii_func_args_geometry { - bool check_arguments() const + bool check_arguments() const override { // TODO: check with Alexey, for better args[1] and args[2] type control return Item_str_ascii_func_args_geometry::check_arguments() || @@ -307,10 +307,10 @@ public: :Item_str_ascii_func_args_geometry(thd, js, max_dec_digits) {} Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits, Item *opt) :Item_str_ascii_func_args_geometry(thd, js, max_dec_digits, opt) {} - const char *func_name() const { return "st_asgeojson"; } - bool fix_length_and_dec(); - String *val_str_ascii(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_asgeojson"; } + bool fix_length_and_dec() override; + String *val_str_ascii(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -320,16 +320,16 @@ class Item_func_geometry_type: public Item_str_ascii_func_args_geometry public: Item_func_geometry_type(THD *thd, Item *a) :Item_str_ascii_func_args_geometry(thd, a) {} - String *val_str_ascii(String *); - const char *func_name() const { return "st_geometrytype"; } - bool fix_length_and_dec() + String *val_str_ascii(String *) override; + const char *func_name() const override { return "st_geometrytype"; } + bool fix_length_and_dec() override { // "GeometryCollection" is the longest fix_length_and_charset(20, default_charset()); maybe_null= 1; return FALSE; }; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -362,9 +362,9 @@ public: :Item_geometry_func_args_geometry(thd, a), res_heap(8192, sizeof(ch_node)) {} - const char *func_name() const { return "st_convexhull"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_convexhull"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -374,13 +374,13 @@ class Item_func_centroid: public Item_geometry_func_args_geometry public: Item_func_centroid(THD *thd, Item *a) :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_centroid"; } - String *val_str(String *); - const Type_handler *type_handler() const + const char *func_name() const override { return "st_centroid"; } + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -389,13 +389,13 @@ class Item_func_envelope: public Item_geometry_func_args_geometry public: Item_func_envelope(THD *thd, Item *a) :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_envelope"; } - String *val_str(String *); - const Type_handler *type_handler() const + const char *func_name() const override { return "st_envelope"; } + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_polygon; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -412,43 +412,43 @@ class Item_func_boundary: public Item_geometry_func_args_geometry Transporter(Gcalc_result_receiver *receiver) : Gcalc_shape_transporter(NULL), m_receiver(receiver) {} - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); + int single_point(double x, double y) override; + int start_line() override; + int complete_line() override; + int start_poly() override; + int complete_poly() override; + int start_ring() override; + int complete_ring() override; + int add_point(double x, double y) override; - int start_collection(int n_objects); + int start_collection(int n_objects) override; }; Gcalc_result_receiver res_receiver; public: Item_func_boundary(THD *thd, Item *a) :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_boundary"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_boundary"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_point: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_real(0, 2); } public: Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {} Item_func_point(THD *thd, Item *a, Item *b, Item *srid): Item_geometry_func(thd, a, b, srid) {} - const char *func_name() const { return "point"; } - String *val_str(String *); - const Type_handler *type_handler() const + const char *func_name() const override { return "point"; } + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -458,7 +458,7 @@ class Item_func_spatial_decomp: public Item_geometry_func_args_geometry public: Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft): Item_geometry_func_args_geometry(thd, a) { decomp_func = ft; } - const char *func_name() const + const char *func_name() const override { switch (decomp_func) { @@ -473,15 +473,15 @@ public: return "spatial_decomp_unknown"; } } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry { enum Functype decomp_func_n; - bool check_arguments() const + bool check_arguments() const override { return Item_geometry_func_args_geometry::check_arguments() || args[1]->check_type_can_return_int(func_name()); @@ -491,7 +491,7 @@ public: :Item_geometry_func_args_geometry(thd, a, b), decomp_func_n(ft) { } - const char *func_name() const + const char *func_name() const override { switch (decomp_func_n) { @@ -506,14 +506,14 @@ public: return "spatial_decomp_n_unknown"; } } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_spatial_collection: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { return Type_handler_geometry::check_types_geom_or_binary(func_name(), args, 0, arg_count); @@ -528,8 +528,8 @@ public: coll_type=ct; item_type=it; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { if (Item_geometry_func::fix_length_and_dec()) return TRUE; @@ -558,12 +558,12 @@ public: Geometry::wkb_geometrycollection, Geometry::wkb_point) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_geometrycollection; } - const char *func_name() const { return "geometrycollection"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "geometrycollection"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -576,9 +576,9 @@ public: Geometry::wkb_linestring, Geometry::wkb_point) { } - const Type_handler *type_handler() const { return &type_handler_linestring; } - const char *func_name() const { return "linestring"; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_linestring; } + const char *func_name() const override { return "linestring"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -591,9 +591,9 @@ public: Geometry::wkb_polygon, Geometry::wkb_linestring) { } - const Type_handler *type_handler() const { return &type_handler_polygon; } - const char *func_name() const { return "polygon"; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_polygon; } + const char *func_name() const override { return "polygon"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -606,12 +606,12 @@ public: Geometry::wkb_multilinestring, Geometry::wkb_linestring) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multilinestring; } - const char *func_name() const { return "multilinestring"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "multilinestring"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -624,12 +624,12 @@ public: Geometry::wkb_multipoint, Geometry::wkb_point) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multipoint; } - const char *func_name() const { return "multipoint"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "multipoint"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -642,12 +642,12 @@ public: Geometry::wkb_multipolygon, Geometry::wkb_polygon) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multipolygon; } - const char *func_name() const { return "multipolygon"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "multipolygon"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -664,8 +664,8 @@ protected: String tmp_value1, tmp_value2; SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); - bool check_arguments() const + Item_func::Functype type, Item *value) override; + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); return Type_handler_geometry::check_types_geom_or_binary(func_name(), @@ -677,8 +677,8 @@ public: { maybe_null= true; } - enum Functype functype() const { return spatial_rel; } - enum Functype rev_functype() const + enum Functype functype() const override { return spatial_rel; } + enum Functype rev_functype() const override { switch (spatial_rel) { @@ -690,16 +690,16 @@ public: return spatial_rel; } } - bool is_null() { (void) val_int(); return null_value; } + bool is_null() override { (void) val_int(); return null_value; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) + SARGABLE_PARAM **sargables) override { return add_key_fields_optimize_op(join, key_fields, and_level, usable_tables, sargables, false); } - bool need_parentheses_in_default() { return false; } - Item *build_clone(THD *thd) { return 0; } + bool need_parentheses_in_default() override { return false; } + Item *build_clone(THD *thd) override { return 0; } }; @@ -709,9 +709,9 @@ public: Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_func_spatial_rel(thd, a, b, sp_rel) { } - longlong val_int(); - const char *func_name() const; - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -725,9 +725,9 @@ public: Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_func_spatial_rel(thd, a, b, sp_rel), collector() { } - longlong val_int(); - const char *func_name() const; - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -738,7 +738,7 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry Gcalc_scan_iterator scan_it; Gcalc_function func; String tmp_value1, tmp_value2, tmp_matrix; - bool check_arguments() const + bool check_arguments() const override { return Item_bool_func_args_geometry_geometry::check_arguments() || args[2]->check_type_general_purpose_string(func_name()); @@ -747,10 +747,10 @@ public: Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix): Item_bool_func_args_geometry_geometry(thd, a, b, matrix) { } - longlong val_int(); - const char *func_name() const { return "st_relate"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_relate"; } + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -761,7 +761,7 @@ public: class Item_func_spatial_operation: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); return Type_handler_geometry::check_types_geom_or_binary(func_name(), @@ -781,20 +781,20 @@ public: Item_geometry_func(thd, a, b), spatial_op(sp_op) {} virtual ~Item_func_spatial_operation(); - String *val_str(String *); - const char *func_name() const; - virtual inline void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + const char *func_name() const override; + void print(String *str, enum_query_type query_type) override { Item_func::print(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_buffer: public Item_geometry_func_args_geometry { - bool check_arguments() const + bool check_arguments() const override { return Item_geometry_func_args_geometry::check_arguments() || args[1]->check_type_can_return_real(func_name()); @@ -822,16 +822,16 @@ protected: Gcalc_function::op_difference), skip_line(FALSE) {} - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); + int single_point(double x, double y) override; + int start_line() override; + int complete_line() override; + int start_poly() override; + int complete_poly() override; + int start_ring() override; + int complete_ring() override; + int add_point(double x, double y) override; - int start_collection(int n_objects); + int start_collection(int n_objects) override; }; Gcalc_heap collector; Gcalc_function func; @@ -842,9 +842,9 @@ protected: public: Item_func_buffer(THD *thd, Item *obj, Item *distance) :Item_geometry_func_args_geometry(thd, obj, distance) {} - const char *func_name() const { return "st_buffer"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "st_buffer"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -854,11 +854,11 @@ class Item_func_isempty: public Item_bool_func_args_geometry public: Item_func_isempty(THD *thd, Item *a) :Item_bool_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isempty"; } - bool fix_length_and_dec() { maybe_null= 1; return FALSE; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_isempty"; } + bool fix_length_and_dec() override { maybe_null= 1; return FALSE; } + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -871,11 +871,11 @@ class Item_func_issimple: public Item_long_func_args_geometry public: Item_func_issimple(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_issimple"; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_issimple"; } + bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } + uint decimal_precision() const override { return 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -884,11 +884,11 @@ class Item_func_isclosed: public Item_long_func_args_geometry public: Item_func_isclosed(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isclosed"; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_isclosed"; } + bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } + uint decimal_precision() const override { return 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -896,9 +896,9 @@ class Item_func_isring: public Item_func_issimple { public: Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isring"; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_isring"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -907,10 +907,10 @@ class Item_func_dimension: public Item_long_func_args_geometry public: Item_func_dimension(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_dimension"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_dimension"; } + bool fix_length_and_dec() override { max_length= 10; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -919,16 +919,16 @@ class Item_func_x: public Item_real_func_args_geometry { public: Item_func_x(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_x"; } - bool fix_length_and_dec() + double val_real() override; + const char *func_name() const override { return "st_x"; } + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -937,16 +937,16 @@ class Item_func_y: public Item_real_func_args_geometry { public: Item_func_y(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_y"; } - bool fix_length_and_dec() + double val_real() override; + const char *func_name() const override { return "st_y"; } + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -956,10 +956,10 @@ class Item_func_numgeometries: public Item_long_func_args_geometry public: Item_func_numgeometries(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numgeometries"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_numgeometries"; } + bool fix_length_and_dec() override { max_length= 10; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -969,10 +969,10 @@ class Item_func_numinteriorring: public Item_long_func_args_geometry public: Item_func_numinteriorring(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numinteriorrings"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_numinteriorrings"; } + bool fix_length_and_dec() override { max_length= 10; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -982,10 +982,10 @@ class Item_func_numpoints: public Item_long_func_args_geometry public: Item_func_numpoints(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numpoints"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "st_numpoints"; } + bool fix_length_and_dec() override { max_length= 10; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -994,16 +994,16 @@ class Item_func_area: public Item_real_func_args_geometry { public: Item_func_area(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_area"; } - bool fix_length_and_dec() + double val_real() override; + const char *func_name() const override { return "st_area"; } + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1014,16 +1014,16 @@ class Item_func_glength: public Item_real_func_args_geometry public: Item_func_glength(THD *thd, Item *a) :Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_length"; } - bool fix_length_and_dec() + double val_real() override; + const char *func_name() const override { return "st_length"; } + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1033,10 +1033,10 @@ class Item_func_srid: public Item_long_func_args_geometry public: Item_func_srid(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "srid"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + longlong val_int() override; + const char *func_name() const override { return "srid"; } + bool fix_length_and_dec() override { max_length= 10; maybe_null= 1; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1051,9 +1051,9 @@ class Item_func_distance: public Item_real_func_args_geometry_geometry public: Item_func_distance(THD *thd, Item *a, Item *b) :Item_real_func_args_geometry_geometry(thd, a, b) {} - double val_real(); - const char *func_name() const { return "st_distance"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "st_distance"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1065,9 +1065,9 @@ class Item_func_sphere_distance: public Item_real_func public: Item_func_sphere_distance(THD *thd, List &list): Item_real_func(thd, list) {} - double val_real(); - const char *func_name() const { return "st_distance_sphere"; } - Item *get_copy(THD *thd) + double val_real() override; + const char *func_name() const override { return "st_distance_sphere"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1081,13 +1081,13 @@ class Item_func_pointonsurface: public Item_geometry_func_args_geometry public: Item_func_pointonsurface(THD *thd, Item *a) :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_pointonsurface"; } - String *val_str(String *); - const Type_handler *type_handler() const + const char *func_name() const override { return "st_pointonsurface"; } + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1098,14 +1098,14 @@ class Item_func_gis_debug: public Item_long_func public: Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a) { null_value= false; } - bool fix_length_and_dec() { fix_char_length(10); return FALSE; } - const char *func_name() const { return "st_gis_debug"; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + bool fix_length_and_dec() override { fix_char_length(10); return FALSE; } + const char *func_name() const override { return "st_gis_debug"; } + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index c8e920dc083..b96189b3c8f 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -75,23 +75,23 @@ protected: public: Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {} - longlong val_int(); - const char *func_name() const { return "json_valid"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "json_valid"; } + bool fix_length_and_dec() override { if (Item_bool_func::fix_length_and_dec()) return TRUE; maybe_null= 1; return FALSE; } - bool set_format_by_check_constraint(Send_field_extended_metadata *to) const + bool set_format_by_check_constraint(Send_field_extended_metadata *to) const override { static const Lex_cstring fmt(STRING_WITH_LEN("json")); return to->set_format_name(fmt); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - enum Functype functype() const { return JSON_VALID_FUNC; } + enum Functype functype() const override { return JSON_VALID_FUNC; } }; @@ -104,11 +104,11 @@ protected: public: Item_func_json_exists(THD *thd, Item *js, Item *i_path): Item_bool_func(thd, js, i_path) {} - const char *func_name() const { return "json_exists"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_exists"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -186,10 +186,10 @@ protected: public: Item_func_json_quote(THD *thd, Item *s): Item_str_func(thd, s) {} - const char *func_name() const { return "json_quote"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_quote"; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -201,10 +201,10 @@ protected: String *read_json(json_engine_t *je); public: Item_func_json_unquote(THD *thd, Item *s): Item_str_func(thd, s) {} - const char *func_name() const { return "json_unquote"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_unquote"; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -233,7 +233,7 @@ public: Item_json_func(thd, list), paths(NULL), tmp_paths(0), n_paths(0) {} virtual ~Item_json_str_multipath(); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; virtual uint get_n_paths() const = 0; }; @@ -247,15 +247,15 @@ public: char **out_val, int *value_len); Item_func_json_extract(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - const char *func_name() const { return "json_extract"; } - enum Functype functype() const { return JSON_EXTRACT_FUNC; } - bool fix_length_and_dec(); - String *val_str(String *); - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - uint get_n_paths() const { return arg_count - 1; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_extract"; } + enum Functype functype() const override { return JSON_EXTRACT_FUNC; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + longlong val_int() override; + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; + uint get_n_paths() const override { return arg_count - 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -271,10 +271,10 @@ protected: public: Item_func_json_contains(THD *thd, List &list): Item_bool_func(thd, list) {} - const char *func_name() const { return "json_contains"; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_contains"; } + bool fix_length_and_dec() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -293,11 +293,11 @@ public: Item_func_json_contains_path(THD *thd, List &list): Item_bool_func(thd, list), tmp_paths(0) {} virtual ~Item_func_json_contains_path(); - const char *func_name() const { return "json_contains_path"; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_contains_path"; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -312,10 +312,10 @@ public: Item_json_func(thd) {} Item_func_json_array(THD *thd, List &list): Item_json_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "json_array"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "json_array"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -328,11 +328,11 @@ protected: public: Item_func_json_array_append(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } - const char *func_name() const { return "json_array_append"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count/2; } + const char *func_name() const override { return "json_array_append"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -342,9 +342,9 @@ class Item_func_json_array_insert: public Item_func_json_array_append public: Item_func_json_array_insert(THD *thd, List &list): Item_func_json_array_append(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_array_insert"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const char *func_name() const override { return "json_array_insert"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -356,9 +356,9 @@ public: Item_func_json_array(thd) {} Item_func_json_object(THD *thd, List &list): Item_func_json_array(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_object"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const char *func_name() const override { return "json_object"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -370,9 +370,9 @@ protected: public: Item_func_json_merge(THD *thd, List &list): Item_func_json_array(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_merge_preserve"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const char *func_name() const override { return "json_merge_preserve"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -381,15 +381,15 @@ class Item_func_json_merge_patch: public Item_func_json_merge public: Item_func_json_merge_patch(THD *thd, List &list): Item_func_json_merge(thd, list) {} - const char *func_name() const { return "json_merge_patch"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_merge_patch"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_json_length: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { if (arg_count == 0 || arg_count > 2) { @@ -407,26 +407,26 @@ protected: public: Item_func_json_length(THD *thd, List &list): Item_long_func(thd, list) {} - const char *func_name() const { return "json_length"; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_length"; } + bool fix_length_and_dec() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_json_depth: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_text(func_name()); } protected: String tmp_js; public: Item_func_json_depth(THD *thd, Item *js): Item_long_func(thd, js) {} - const char *func_name() const { return "json_depth"; } - bool fix_length_and_dec() { max_length= 10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_depth"; } + bool fix_length_and_dec() override { max_length= 10; return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -437,10 +437,10 @@ protected: String tmp_js; public: Item_func_json_type(THD *thd, Item *js): Item_str_func(thd, js) {} - const char *func_name() const { return "json_type"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_type"; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -455,15 +455,15 @@ public: Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List &list): Item_json_str_multipath(thd, list), mode_insert(i_mode), mode_replace(r_mode) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } - const char *func_name() const + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count/2; } + const char *func_name() const override { return mode_insert ? (mode_replace ? "json_set" : "json_insert") : "json_replace"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -475,11 +475,11 @@ protected: public: Item_func_json_remove(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count - 1; } - const char *func_name() const { return "json_remove"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count - 1; } + const char *func_name() const override { return "json_remove"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -493,10 +493,10 @@ protected: public: Item_func_json_keys(THD *thd, List &list): Item_str_func(thd, list) {} - const char *func_name() const { return "json_keys"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_keys"; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -516,12 +516,12 @@ protected: public: Item_func_json_search(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - const char *func_name() const { return "json_search"; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count > 4 ? arg_count - 4 : 0; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "json_search"; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -545,11 +545,11 @@ public: Item_func_json_format(THD *thd, List &list): Item_json_func(thd, list), fmt(DETAILED) {} - const char *func_name() const; - bool fix_length_and_dec(); - String *val_str(String *str); - String *val_json(String *str); - Item *get_copy(THD *thd) + const char *func_name() const override; + bool fix_length_and_dec() override; + String *val_str(String *str) override; + String *val_json(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_row.h b/sql/item_row.h index 2872a498d55..3c004e96341 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -57,104 +57,104 @@ public: not_null_tables_cache(0), with_null(0) { } - bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } - enum Type type() const { return ROW_ITEM; }; - const Type_handler *type_handler() const { return &type_handler_row; } + bool with_subquery() const override { DBUG_ASSERT(fixed); return m_with_subquery; } + enum Type type() const override { return ROW_ITEM; }; + const Type_handler *type_handler() const override { return &type_handler_row; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { return NULL; // Check with Vicentiu why it's called for Item_row } void illegal_method_call(const char *); - bool is_null() { return null_value; } - void make_send_field(THD *thd, Send_field *) + bool is_null() override { return null_value; } + void make_send_field(THD *thd, Send_field *) override { illegal_method_call((const char*)"make_send_field"); }; - double val_real() + double val_real() override { illegal_method_call((const char*)"val"); return 0; }; - longlong val_int() + longlong val_int() override { illegal_method_call((const char*)"val_int"); return 0; }; - String *val_str(String *) + String *val_str(String *) override { illegal_method_call((const char*)"val_str"); return 0; }; - my_decimal *val_decimal(my_decimal *) + my_decimal *val_decimal(my_decimal *) override { illegal_method_call((const char*)"val_decimal"); return 0; }; - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { illegal_method_call((const char*)"get_date"); return true; } - bool fix_fields(THD *thd, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void cleanup(); + bool fix_fields(THD *thd, Item **ref) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) override; + void cleanup() override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - table_map used_tables() const { return used_tables_cache; }; - bool const_item() const { return const_item_cache; }; - void update_used_tables() + List &fields, uint flags) override; + bool with_sum_func() const override { return m_with_sum_func; } + With_sum_func_cache* get_with_sum_func_cache() override { return this; } + table_map used_tables() const override { return used_tables_cache; }; + bool const_item() const override { return const_item_cache; }; + void update_used_tables() override { used_tables_and_const_cache_init(); used_tables_and_const_cache_update_and_join(arg_count, args); } - table_map not_null_tables() const { return not_null_tables_cache; } - virtual void print(String *str, enum_query_type query_type); + table_map not_null_tables() const override { return not_null_tables_cache; } + void print(String *str, enum_query_type query_type) override; - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { if (walk_args(processor, walk_subquery, arg)) return true; return (this->*processor)(arg); } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; - uint cols() const { return arg_count; } - Item* element_index(uint i) { return args[i]; } - Item** addr(uint i) { return args + i; } - bool check_cols(uint c); - bool null_inside() { return with_null; }; - void bring_value(); + uint cols() const override { return arg_count; } + Item* element_index(uint i) override { return args[i]; } + Item** addr(uint i) override { return args + i; } + bool check_cols(uint c) override; + bool null_inside() override { return with_null; }; + void bring_value() override; - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Item_args::propagate_equal_fields(thd, Context_identity(), cond); return this; } - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { return Item_args::excl_dep_on_table(tab_map); } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return Item_args::excl_dep_on_grouping_fields(sel); } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override { return Item_args::excl_dep_on_in_subq_left_part(subq_pred); } - bool check_vcol_func_processor(void *arg) {return FALSE; } - Item *get_copy(THD *thd) + bool check_vcol_func_processor(void *arg) override {return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd); + Item *build_clone(THD *thd) override; }; #endif /* ITEM_ROW_INCLUDED */ diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index f7b534cfbf3..e40726ce255 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -64,14 +64,14 @@ public: Item_func(thd, a, b, c, d, e) { decimals=NOT_FIXED_DEC; } Item_str_func(THD *thd, List &list): Item_func(thd, list) { decimals=NOT_FIXED_DEC; } - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + longlong val_int() override; + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_string(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return string_type_handler(); } + const Type_handler *type_handler() const override { return string_type_handler(); } void left_right_max_length(); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; }; @@ -88,11 +88,11 @@ public: Item_str_ascii_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_str_ascii_func(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - String *val_str(String *str) + String *val_str(String *str) override { return val_str_from_val_str_ascii(str, &ascii_buf); } - String *val_str_ascii(String *)= 0; + String *val_str_ascii(String *) override= 0; }; @@ -108,7 +108,7 @@ public: :Item_str_ascii_func(thd, a) { } Item_str_ascii_checksum_func(THD *thd, Item *a, Item *b) :Item_str_ascii_func(thd, a, b) { } - bool eq(const Item *item, bool binary_cmp) const + bool eq(const Item *item, bool binary_cmp) const override { // Always use binary argument comparison: MD5('x') != MD5('X') return Item_func::eq(item, true); @@ -128,7 +128,7 @@ public: :Item_str_func(thd, a) { } Item_str_binary_checksum_func(THD *thd, Item *a, Item *b) :Item_str_func(thd, a, b) { } - bool eq(const Item *item, bool binary_cmp) const + bool eq(const Item *item, bool binary_cmp) const override { /* Always use binary argument comparison: @@ -143,14 +143,14 @@ class Item_func_md5 :public Item_str_ascii_checksum_func { public: Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec() + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { fix_length_and_charset(32, default_charset()); return FALSE; } - const char *func_name() const { return "md5"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "md5"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -159,10 +159,10 @@ class Item_func_sha :public Item_str_ascii_checksum_func { public: Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "sha"; } - Item *get_copy(THD *thd) + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "sha"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -171,10 +171,10 @@ class Item_func_sha2 :public Item_str_ascii_checksum_func public: Item_func_sha2(THD *thd, Item *a, Item *b) :Item_str_ascii_checksum_func(thd, a, b) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "sha2"; } - Item *get_copy(THD *thd) + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "sha2"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -184,10 +184,10 @@ class Item_func_to_base64 :public Item_str_ascii_checksum_func public: Item_func_to_base64(THD *thd, Item *a) :Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "to_base64"; } - Item *get_copy(THD *thd) + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "to_base64"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -197,10 +197,10 @@ class Item_func_from_base64 :public Item_str_binary_checksum_func public: Item_func_from_base64(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) { } - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "from_base64"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "from_base64"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -217,7 +217,7 @@ protected: public: Item_aes_crypt(THD *thd, Item *a, Item *b) :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); + String *val_str(String *) override; }; class Item_func_aes_encrypt :public Item_aes_crypt @@ -225,9 +225,9 @@ class Item_func_aes_encrypt :public Item_aes_crypt public: Item_func_aes_encrypt(THD *thd, Item *a, Item *b) :Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "aes_encrypt"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "aes_encrypt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -236,9 +236,9 @@ class Item_func_aes_decrypt :public Item_aes_crypt public: Item_func_aes_decrypt(THD *thd, Item *a, Item *b): Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "aes_decrypt"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "aes_decrypt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -259,16 +259,16 @@ protected: public: Item_func_concat(THD *thd, List &list): Item_str_func(thd, list) {} Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "concat"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "concat"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -286,9 +286,9 @@ public: Item_func_concat_operator_oracle(THD *thd, Item *a, Item *b) :Item_func_concat(thd, a, b) { } - String *val_str(String *); - const Schema *schema() const { return &oracle_schema_ref; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + const Schema *schema() const override { return &oracle_schema_ref; } + void print(String *str, enum_query_type query_type) override { if (query_type & QT_FOR_FRM) { @@ -299,7 +299,7 @@ public: print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } @@ -311,16 +311,16 @@ class Item_func_decode_histogram :public Item_str_func public: Item_func_decode_histogram(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(system_charset_info); max_length= MAX_BLOB_WIDTH; maybe_null= 1; return FALSE; } - const char *func_name() const { return "decode_histogram"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "decode_histogram"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -329,11 +329,11 @@ class Item_func_concat_ws :public Item_str_func String tmp_value; public: Item_func_concat_ws(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "concat_ws"; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "concat_ws"; } + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -342,10 +342,10 @@ class Item_func_reverse :public Item_str_func String tmp_value; public: Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "reverse"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "reverse"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -358,16 +358,16 @@ protected: public: Item_func_replace(THD *thd, Item *org, Item *find, Item *replace): Item_str_func(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, false); }; - bool fix_length_and_dec(); - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + String *val_str(String *to) override { return val_str_internal(to, false); }; + bool fix_length_and_dec() override; + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "replace"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "replace"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -378,9 +378,9 @@ class Item_func_replace_oracle :public Item_func_replace public: Item_func_replace_oracle(THD *thd, Item *org, Item *find, Item *replace): Item_func_replace(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, true); }; - const Schema *schema() const { return &oracle_schema_ref; } - void print(String *str, enum_query_type query_type) + String *val_str(String *to) override { return val_str_internal(to, true); }; + const Schema *schema() const override { return &oracle_schema_ref; } + void print(String *str, enum_query_type query_type) override { if (query_type & QT_FOR_FRM) { @@ -391,7 +391,7 @@ public: print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -408,26 +408,26 @@ public: Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_replace::cleanup"); Item_str_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - String *val_str(String *str) + String *val_str(String *str) override { return val_str_internal(str, false); } - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_replace"; } - Item *get_copy(THD *thd) { return 0;} + bool fix_length_and_dec() override; + const char *func_name() const override { return "regexp_replace"; } + Item *get_copy(THD *thd) override { return 0;} }; @@ -437,14 +437,14 @@ public: Item_func_regexp_replace_oracle(THD *thd, Item *a, Item *b, Item *c) :Item_func_regexp_replace(thd, a, b, c) {} - const Schema *schema() const { return &oracle_schema_ref; } - bool fix_length_and_dec() + const Schema *schema() const override { return &oracle_schema_ref; } + bool fix_length_and_dec() override { bool rc= Item_func_regexp_replace::fix_length_and_dec(); maybe_null= true; // Empty result is converted to NULL return rc; } - String *val_str(String *str) + String *val_str(String *str) override { return val_str_internal(str, true); } @@ -458,17 +458,17 @@ public: Item_func_regexp_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_substr::cleanup"); Item_str_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_substr"; } - Item *get_copy(THD *thd) { return 0; } + String *val_str(String *str) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "regexp_substr"; } + Item *get_copy(THD *thd) override { return 0; } }; @@ -479,10 +479,10 @@ public: Item_func_insert(THD *thd, Item *org, Item *start, Item *length, Item *new_str): Item_str_func(thd, org, start, length, new_str) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "insert"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "insert"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -495,7 +495,7 @@ protected: String tmp_value; public: Item_str_conv(THD *thd, Item *item): Item_str_func(thd, item) {} - String *val_str(String *); + String *val_str(String *) override; }; @@ -503,9 +503,9 @@ class Item_func_lcase :public Item_str_conv { public: Item_func_lcase(THD *thd, Item *item): Item_str_conv(thd, item) {} - const char *func_name() const { return "lcase"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "lcase"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -513,9 +513,9 @@ class Item_func_ucase :public Item_str_conv { public: Item_func_ucase(THD *thd, Item *item): Item_str_conv(thd, item) {} - const char *func_name() const { return "ucase"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "ucase"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -525,11 +525,11 @@ class Item_func_left :public Item_str_func String tmp_value; public: Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - bool hash_not_null(Hasher *hasher); - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "left"; } - Item *get_copy(THD *thd) + bool hash_not_null(Hasher *hasher) override; + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "left"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -539,10 +539,10 @@ class Item_func_right :public Item_str_func String tmp_value; public: Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "right"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "right"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -558,25 +558,25 @@ public: Item_str_func(thd, a, b, c) {} Item_func_substr(THD *thd, List &list) :Item_str_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "substr"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "substr"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_substr_oracle :public Item_func_substr { protected: - longlong get_position() + longlong get_position() override { longlong pos= args[1]->val_int(); return pos == 0 ? 1 : pos; } - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_substr_oracle(THD *thd, Item *a, Item *b): @@ -585,14 +585,14 @@ public: Item_func_substr(thd, a, b, c) {} Item_func_substr_oracle(THD *thd, List &list) :Item_func_substr(thd, list) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_substr::fix_length_and_dec(); maybe_null= true; return res; } - const Schema *schema() const { return &oracle_schema_ref; } - void print(String *str, enum_query_type query_type) + const Schema *schema() const override { return &oracle_schema_ref; } + void print(String *str, enum_query_type query_type) override { if (query_type & QT_FOR_FRM) { @@ -603,7 +603,7 @@ public: print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -613,10 +613,10 @@ class Item_func_substr_index :public Item_str_func public: Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c): Item_str_func(thd, a, b, c) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "substring_index"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "substring_index"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -648,14 +648,14 @@ protected: public: Item_func_trim(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const; - String *val_str(String *); - bool fix_length_and_dec(); - const Schema *schema() const { return &mariadb_schema; } - const char *func_name() const { return "trim"; } - void print(String *str, enum_query_type query_type); + Sql_mode_dependency value_depends_on_sql_mode() const override; + String *val_str(String *) override; + bool fix_length_and_dec() override; + const Schema *schema() const override { return &mariadb_schema; } + const char *func_name() const override { return "trim"; } + void print(String *str, enum_query_type query_type) override; virtual const char *mode_name() const { return "both"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -663,20 +663,20 @@ public: class Item_func_trim_oracle :public Item_func_trim { protected: - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_trim_oracle(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} Item_func_trim_oracle(THD *thd, Item *a): Item_func_trim(thd, a) {} - const Schema *schema() const { return &oracle_schema_ref; } - bool fix_length_and_dec() + const Schema *schema() const override { return &oracle_schema_ref; } + bool fix_length_and_dec() override { bool res= Item_func_trim::fix_length_and_dec(); maybe_null= true; return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -686,15 +686,15 @@ class Item_func_ltrim :public Item_func_trim public: Item_func_ltrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} Item_func_ltrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const + Sql_mode_dependency value_depends_on_sql_mode() const override { return Item_func::value_depends_on_sql_mode(); } - String *val_str(String *); - const Schema *schema() const { return &mariadb_schema; } - const char *func_name() const { return "ltrim"; } - const char *mode_name() const { return "leading"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const Schema *schema() const override { return &mariadb_schema; } + const char *func_name() const override { return "ltrim"; } + const char *mode_name() const override { return "leading"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -702,20 +702,20 @@ public: class Item_func_ltrim_oracle :public Item_func_ltrim { protected: - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_ltrim_oracle(THD *thd, Item *a, Item *b): Item_func_ltrim(thd, a, b) {} Item_func_ltrim_oracle(THD *thd, Item *a): Item_func_ltrim(thd, a) {} - const Schema *schema() const { return &oracle_schema_ref; } - bool fix_length_and_dec() + const Schema *schema() const override { return &oracle_schema_ref; } + bool fix_length_and_dec() override { bool res= Item_func_ltrim::fix_length_and_dec(); maybe_null= true; return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -725,11 +725,11 @@ class Item_func_rtrim :public Item_func_trim public: Item_func_rtrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} Item_func_rtrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - String *val_str(String *); - const Schema *schema() const { return &mariadb_schema; } - const char *func_name() const { return "rtrim"; } - const char *mode_name() const { return "trailing"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const Schema *schema() const override { return &mariadb_schema; } + const char *func_name() const override { return "rtrim"; } + const char *mode_name() const override { return "trailing"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -737,20 +737,20 @@ public: class Item_func_rtrim_oracle :public Item_func_rtrim { protected: - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_rtrim_oracle(THD *thd, Item *a, Item *b): Item_func_rtrim(thd, a, b) {} Item_func_rtrim_oracle(THD *thd, Item *a): Item_func_rtrim(thd, a) {} - const Schema *schema() const { return &oracle_schema_ref; } - bool fix_length_and_dec() + const Schema *schema() const override { return &oracle_schema_ref; } + bool fix_length_and_dec() override { bool res= Item_func_rtrim::fix_length_and_dec(); maybe_null= true; return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -775,9 +775,9 @@ public: Item_str_ascii_checksum_func(thd, a), alg(NEW), deflt(1) {} Item_func_password(THD *thd, Item *a, PW_Alg al): Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {} - String *val_str_ascii(String *str); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + String *val_str_ascii(String *str) override; + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { fix_length_and_charset((alg == 1 ? SCRAMBLED_PASSWORD_CHAR_LENGTH : @@ -785,11 +785,11 @@ public: default_charset()); return FALSE; } - const char *func_name() const { return ((deflt || alg == 1) ? + const char *func_name() const override { return ((deflt || alg == 1) ? "password" : "old_password"); } static char *alloc(THD *thd, const char *password, size_t pass_len, enum PW_Alg al); - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -803,16 +803,16 @@ public: :Item_str_binary_checksum_func(thd, a) {} Item_func_des_encrypt(THD *thd, Item *a, Item *b) :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { maybe_null=1; /* 9 = MAX ((8- (arg_len % 8)) + 1) */ max_length = args[0]->max_length + 9; return FALSE; } - const char *func_name() const { return "des_encrypt"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "des_encrypt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -824,8 +824,8 @@ public: :Item_str_binary_checksum_func(thd, a) {} Item_func_des_decrypt(THD *thd, Item *a, Item *b) :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { maybe_null=1; /* 9 = MAX ((8- (arg_len % 8)) + 1) */ @@ -834,8 +834,8 @@ public: max_length-= 9U; return FALSE; } - const char *func_name() const { return "des_decrypt"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "des_decrypt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -864,14 +864,14 @@ public: { constructor_helper(); } - String *val_str(String *); - bool fix_length_and_dec() { maybe_null=1; max_length = 13; return FALSE; } - const char *func_name() const { return "encrypt"; } - bool check_vcol_func_processor(void *arg) + String *val_str(String *) override; + bool fix_length_and_dec() override { maybe_null=1; max_length = 13; return FALSE; } + const char *func_name() const override { return "encrypt"; } + bool check_vcol_func_processor(void *arg) override { return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -888,10 +888,10 @@ protected: public: Item_func_encode(THD *thd, Item *a, Item *seed_arg): Item_str_binary_checksum_func(thd, a, seed_arg) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "encode"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "encode"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } protected: virtual void crypto_transform(String *); @@ -905,17 +905,17 @@ class Item_func_decode :public Item_func_encode { public: Item_func_decode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(thd, a, seed_arg) {} - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "decode"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "decode"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } protected: - void crypto_transform(String *); + void crypto_transform(String *) override; }; @@ -924,19 +924,19 @@ class Item_func_sysconst :public Item_str_func public: Item_func_sysconst(THD *thd): Item_str_func(thd) { collation.set(system_charset_info,DERIVATION_SYSCONST); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override; /* Used to create correct Item name in new converted item in safe_charset_converter, return string representation of this function call */ virtual const char *fully_qualified_func_name() const = 0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(fully_qualified_func_name(), arg, VCOL_SESSION_FUNC); } - bool const_item() const; + bool const_item() const override; }; @@ -944,16 +944,16 @@ class Item_func_database :public Item_func_sysconst { public: Item_func_database(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= NAME_CHAR_LEN * system_charset_info->mbmaxlen; maybe_null=1; return FALSE; } - const char *func_name() const { return "database"; } - const char *fully_qualified_func_name() const { return "database()"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "database"; } + const char *fully_qualified_func_name() const override { return "database()"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -962,20 +962,20 @@ class Item_func_sqlerrm :public Item_func_sysconst { public: Item_func_sqlerrm(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); - const char *func_name() const { return "SQLERRM"; } - const char *fully_qualified_func_name() const { return "SQLERRM"; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + const char *func_name() const override { return "SQLERRM"; } + const char *fully_qualified_func_name() const override { return "SQLERRM"; } + void print(String *str, enum_query_type query_type) override { str->append(func_name()); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 512 * system_charset_info->mbmaxlen; null_value= maybe_null= false; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -990,25 +990,25 @@ public: { str_value.set("", 0, system_charset_info); } - String *val_str(String *) + String *val_str(String *) override { DBUG_ASSERT(fixed == 1); return (null_value ? 0 : &str_value); } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= (uint32) (username_char_length + HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN; return FALSE; } - const char *func_name() const { return "user"; } - const char *fully_qualified_func_name() const { return "user()"; } - int save_in_field(Field *field, bool no_conversions) + const char *func_name() const override { return "user"; } + const char *fully_qualified_func_name() const override { return "user()"; } + int save_in_field(Field *field, bool no_conversions) override { return save_str_value_in_field(field, &str_value); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1020,10 +1020,10 @@ class Item_func_current_user :public Item_func_user public: Item_func_current_user(THD *thd, Name_resolution_context *context_arg): Item_func_user(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); - const char *func_name() const { return "current_user"; } - const char *fully_qualified_func_name() const { return "current_user()"; } - bool check_vcol_func_processor(void *arg) + bool fix_fields(THD *thd, Item **ref) override; + const char *func_name() const override { return "current_user"; } + const char *fully_qualified_func_name() const override { return "current_user()"; } + bool check_vcol_func_processor(void *arg) override { context= 0; return mark_unsupported_function(fully_qualified_func_name(), arg, @@ -1039,29 +1039,29 @@ class Item_func_current_role :public Item_func_sysconst public: Item_func_current_role(THD *thd, Name_resolution_context *context_arg): Item_func_sysconst(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN; return FALSE; } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { return save_str_value_in_field(field, &str_value); } - const char *func_name() const { return "current_role"; } - const char *fully_qualified_func_name() const { return "current_role()"; } - String *val_str(String *) + const char *func_name() const override { return "current_role"; } + const char *fully_qualified_func_name() const override { return "current_role()"; } + String *val_str(String *) override { DBUG_ASSERT(fixed == 1); return null_value ? NULL : &str_value; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { context= 0; return mark_unsupported_function(fully_qualified_func_name(), arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1071,10 +1071,10 @@ class Item_func_soundex :public Item_str_func String tmp_value; public: Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "soundex"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "soundex"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1083,12 +1083,12 @@ class Item_func_elt :public Item_str_func { public: Item_func_elt(THD *thd, List &list): Item_str_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "elt"; } - Item *get_copy(THD *thd) + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "elt"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1099,10 +1099,10 @@ class Item_func_make_set :public Item_str_func public: Item_func_make_set(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "make_set"; } - Item *get_copy(THD *thd) + String *val_str(String *str) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "make_set"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1116,10 +1116,10 @@ public: Item_func_format(THD *thd, Item *org, Item *dec, Item *lang): Item_str_ascii_func(thd, org, dec, lang) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "format"; } - Item *get_copy(THD *thd) + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "format"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1135,16 +1135,16 @@ public: Item_func_char(THD *thd, Item *arg1, CHARSET_INFO *cs): Item_str_func(thd, arg1) { collation.set(cs); } - String *val_str(String *); + String *val_str(String *) override; void append_char(String * str, int32 num); - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= arg_count * 4; return FALSE; } - const char *func_name() const { return "char"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + const char *func_name() const override { return "char"; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1153,14 +1153,14 @@ class Item_func_chr :public Item_func_char public: Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs): Item_func_char(thd, arg1, cs) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= 4; return FALSE; } - const char *func_name() const { return "chr"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "chr"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1170,10 +1170,10 @@ class Item_func_repeat :public Item_str_func public: Item_func_repeat(THD *thd, Item *arg1, Item *arg2): Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "repeat"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "repeat"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1182,10 +1182,10 @@ class Item_func_space :public Item_str_func { public: Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "space"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "space"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1195,14 +1195,14 @@ class Item_func_binlog_gtid_pos :public Item_str_func public: Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2): Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "binlog_gtid_pos"; } - bool check_vcol_func_processor(void *arg) + String *val_str(String *) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "binlog_gtid_pos"; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1218,7 +1218,7 @@ public: Item_str_func(thd, arg1, arg2) {} Item_func_pad(THD *thd, List &list): Item_str_func(thd,list) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; }; @@ -1231,23 +1231,23 @@ public: Item_func_pad(thd, arg1, arg2) {} Item_func_rpad(THD *thd, List &list): Item_func_pad(thd,list) {} - String *val_str(String *); - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "rpad"; } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + const char *func_name() const override { return "rpad"; } + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_rpad_oracle :public Item_func_rpad { - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): @@ -1256,14 +1256,14 @@ public: Item_func_rpad(thd, arg1, arg2) {} Item_func_rpad_oracle(THD *thd, List &list): Item_func_rpad(thd,list) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_rpad::fix_length_and_dec(); maybe_null= true; return res; } - const Schema *schema() const { return &oracle_schema_ref; } - void print(String *str, enum_query_type query_type) + const Schema *schema() const override { return &oracle_schema_ref; } + void print(String *str, enum_query_type query_type) override { if (query_type & QT_FOR_FRM) { @@ -1274,7 +1274,7 @@ public: print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1288,22 +1288,22 @@ public: Item_func_pad(thd, arg1, arg2) {} Item_func_lpad(THD *thd, List &list): Item_func_pad(thd,list) {} - String *val_str(String *); - const Schema *schema() const { return &mariadb_schema; } - void print(String *str, enum_query_type query_type) + String *val_str(String *) override; + const Schema *schema() const override { return &mariadb_schema; } + void print(String *str, enum_query_type query_type) override { print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - const char *func_name() const { return "lpad"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "lpad"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_lpad_oracle :public Item_func_lpad { - String *make_empty_result(String *str) + String *make_empty_result(String *str) override { null_value= 1; return NULL; } public: Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): @@ -1312,14 +1312,14 @@ public: Item_func_lpad(thd, arg1, arg2) {} Item_func_lpad_oracle(THD *thd, List &list): Item_func_lpad(thd,list) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_lpad::fix_length_and_dec(); maybe_null= true; return res; } - const Schema *schema() const { return &oracle_schema_ref; } - void print(String *str, enum_query_type query_type) + const Schema *schema() const override { return &oracle_schema_ref; } + void print(String *str, enum_query_type query_type) override { if (query_type & QT_FOR_FRM) { @@ -1330,7 +1330,7 @@ public: print_sql_mode_qualified_name(str, query_type); print_args_parenthesized(str, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1340,16 +1340,16 @@ class Item_func_conv :public Item_str_func public: Item_func_conv(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - const char *func_name() const { return "conv"; } - String *val_str(String *); - bool fix_length_and_dec() + const char *func_name() const override { return "conv"; } + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(default_charset()); fix_char_length(64); maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1368,16 +1368,16 @@ protected: public: Item_func_hex(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a), m_arg0_type_handler(NULL) {} - const char *func_name() const { return "hex"; } + const char *func_name() const override { return "hex"; } String *val_str_ascii_from_val_int(String *str); String *val_str_ascii_from_val_real(String *str); String *val_str_ascii_from_val_str(String *str); - String *val_str_ascii(String *str) + String *val_str_ascii(String *str) override { DBUG_ASSERT(fixed); return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); decimals=0; @@ -1385,7 +1385,7 @@ public: m_arg0_type_handler= args[0]->type_handler(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1398,16 +1398,16 @@ public: /* there can be bad hex strings */ maybe_null= 1; } - const char *func_name() const { return "unhex"; } - String *val_str(String *); - bool fix_length_and_dec() + const char *func_name() const override { return "unhex"; } + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(&my_charset_bin); decimals=0; max_length=(1+args[0]->max_length)/2; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1423,8 +1423,8 @@ public: Item_func_like_range(THD *thd, Item *a, Item *b, bool is_min_arg): Item_str_func(thd, a, b), is_min(is_min_arg) { maybe_null= 1; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(args[0]->collation); decimals=0; @@ -1439,8 +1439,8 @@ class Item_func_like_range_min :public Item_func_like_range public: Item_func_like_range_min(THD *thd, Item *a, Item *b): Item_func_like_range(thd, a, b, true) { } - const char *func_name() const { return "like_range_min"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "like_range_min"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1450,8 +1450,8 @@ class Item_func_like_range_max :public Item_func_like_range public: Item_func_like_range_max(THD *thd, Item *a, Item *b): Item_func_like_range(thd, a, b, false) { } - const char *func_name() const { return "like_range_max"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "like_range_max"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif @@ -1461,7 +1461,7 @@ class Item_func_binary :public Item_str_func { public: Item_func_binary(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *a) + String *val_str(String *a) override { DBUG_ASSERT(fixed == 1); String *tmp=args[0]->val_str(a); @@ -1470,16 +1470,16 @@ public: tmp->set_charset(&my_charset_bin); return tmp; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(&my_charset_bin); max_length=args[0]->max_length; return FALSE; } - void print(String *str, enum_query_type query_type); - const char *func_name() const { return "cast_as_binary"; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + const char *func_name() const override { return "cast_as_binary"; } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1489,20 +1489,20 @@ class Item_load_file :public Item_str_func String tmp_value; public: Item_load_file(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - const char *func_name() const { return "load_file"; } - bool fix_length_and_dec() + String *val_str(String *) override; + const char *func_name() const override { return "load_file"; } + bool fix_length_and_dec() override { collation.set(&my_charset_bin, DERIVATION_COERCIBLE); maybe_null=1; max_length=MAX_BLOB_WIDTH; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1516,10 +1516,10 @@ class Item_func_export_set: public Item_str_func Item_str_func(thd, a, b, c, d) {} Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e): Item_str_func(thd, a, b, c, d, e) {} - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "export_set"; } - Item *get_copy(THD *thd) + String *val_str(String *str) override; + bool fix_length_and_dec() override; + const char *func_name() const override { return "export_set"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1529,9 +1529,9 @@ class Item_func_quote :public Item_str_func String tmp_value; public: Item_func_quote(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "quote"; } - String *val_str(String *); - bool fix_length_and_dec() + const char *func_name() const override { return "quote"; } + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(args[0]->collation); ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + @@ -1542,7 +1542,7 @@ public: max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1594,8 +1594,8 @@ public: (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII)))); } } - String *val_str(String *); - longlong val_int() + String *val_str(String *) override; + longlong val_int() override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_int(); @@ -1604,7 +1604,7 @@ public: return 0; return res; } - double val_real() + double val_real() override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_real(); @@ -1613,7 +1613,7 @@ public: return 0; return res; } - my_decimal *val_decimal(my_decimal *d) + my_decimal *val_decimal(my_decimal *d) override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_decimal(d); @@ -1622,7 +1622,7 @@ public: return NULL; return res; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::get_date(thd, ltime, fuzzydate); @@ -1631,10 +1631,10 @@ public: return 1; return res; } - bool fix_length_and_dec(); - const char *func_name() const { return "convert"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return "convert"; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1644,20 +1644,20 @@ class Item_func_set_collation :public Item_str_func public: Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation): Item_str_func(thd, a), m_set_collation(set_collation) {} - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - const char *func_name() const { return "collate"; } - enum precedence precedence() const { return COLLATE_PRECEDENCE; } - enum Functype functype() const { return COLLATE_FUNC; } - void print(String *str, enum_query_type query_type); - Item_field *field_for_view_update() + String *val_str(String *) override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; + const char *func_name() const override { return "collate"; } + enum precedence precedence() const override { return COLLATE_PRECEDENCE; } + enum Functype functype() const override { return COLLATE_FUNC; } + void print(String *str, enum_query_type query_type) override; + Item_field *field_for_view_update() override { /* this function is transparent for view updating */ return args[0]->field_for_view_update(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1666,17 +1666,17 @@ class Item_func_expr_str_metadata :public Item_str_func { public: Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough maybe_null= 0; return FALSE; }; - table_map not_null_tables() const { return 0; } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + table_map not_null_tables() const override { return 0; } + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { return this; } - bool const_item() const { return true; } + bool const_item() const override { return true; } }; @@ -1685,9 +1685,9 @@ class Item_func_charset :public Item_func_expr_str_metadata public: Item_func_charset(THD *thd, Item *a) :Item_func_expr_str_metadata(thd, a) { } - String *val_str(String *); - const char *func_name() const { return "charset"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const char *func_name() const override { return "charset"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1697,9 +1697,9 @@ class Item_func_collation :public Item_func_expr_str_metadata public: Item_func_collation(THD *thd, Item *a) :Item_func_expr_str_metadata(thd, a) {} - String *val_str(String *); - const char *func_name() const { return "collation"; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + const char *func_name() const override { return "collation"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1719,10 +1719,10 @@ public: flags= flags_arg; result_length= result_length_arg; } - const char *func_name() const { return "weight_string"; } - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const + const char *func_name() const override { return "weight_string"; } + String *val_str(String *) override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override { if (!Item_str_func::eq(item, binary_cmp)) return false; @@ -1731,25 +1731,25 @@ public: this->nweights == that->nweights && this->result_length == that->result_length; } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { return this; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_crc32 :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name()); } String value; public: Item_func_crc32(THD *thd, Item *a): Item_long_func(thd, a) { unsigned_flag= 1; } - const char *func_name() const { return "crc32"; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "crc32"; } + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1759,10 +1759,10 @@ class Item_func_uncompressed_length : public Item_long_func_length public: Item_func_uncompressed_length(THD *thd, Item *a) :Item_long_func_length(thd, a) {} - const char *func_name() const{return "uncompressed_length";} - bool fix_length_and_dec() { max_length=10; maybe_null= true; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + const char *func_name() const override{return "uncompressed_length";} + bool fix_length_and_dec() override { max_length=10; maybe_null= true; return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1778,14 +1778,14 @@ class Item_func_compress: public Item_str_binary_checksum_func public: Item_func_compress(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= (args[0]->max_length * 120) / 100 + 12; return FALSE; } - const char *func_name() const{return "compress";} - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) + const char *func_name() const override{return "compress";} + String *val_str(String *) override ZLIB_DEPENDED_FUNCTION + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1795,14 +1795,14 @@ class Item_func_uncompress: public Item_str_binary_checksum_func public: Item_func_uncompress(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null= 1; max_length= MAX_BLOB_WIDTH; return FALSE; } - const char *func_name() const{return "uncompress";} - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) + const char *func_name() const override{return "uncompress";} + String *val_str(String *) override ZLIB_DEPENDED_FUNCTION + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1811,21 +1811,21 @@ class Item_func_uuid: public Item_str_func { public: Item_func_uuid(THD *thd): Item_str_func(thd) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(DTCollation_numeric()); fix_char_length(MY_UUID_STRING_LENGTH); return FALSE; } - bool const_item() const { return false; } - table_map used_tables() const { return RAND_TABLE_BIT; } - const char *func_name() const{ return "uuid"; } - String *val_str(String *); - bool check_vcol_func_processor(void *arg) + bool const_item() const override { return false; } + table_map used_tables() const override { return RAND_TABLE_BIT; } + const char *func_name() const override{ return "uuid"; } + String *val_str(String *) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1842,13 +1842,13 @@ protected: void print_arguments(String *str, enum_query_type query_type); public: Item_func_dyncol_create(THD *thd, List &args, DYNCALL_CREATE_DEF *dfs); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - const char *func_name() const{ return "column_create"; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - enum Functype functype() const { return DYNCOL_FUNC; } - Item *get_copy(THD *thd) + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + const char *func_name() const override{ return "column_create"; } + String *val_str(String *) override; + void print(String *str, enum_query_type query_type) override; + enum Functype functype() const override { return DYNCOL_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1859,10 +1859,10 @@ public: Item_func_dyncol_add(THD *thd, List &args_arg, DYNCALL_CREATE_DEF *dfs): Item_func_dyncol_create(thd, args_arg, dfs) {} - const char *func_name() const{ return "column_add"; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + const char *func_name() const override{ return "column_add"; } + String *val_str(String *) override; + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1871,16 +1871,16 @@ class Item_func_dyncol_json: public Item_str_func public: Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str) {collation.set(DYNCOL_UTF);} - const char *func_name() const{ return "column_json"; } - String *val_str(String *); - bool fix_length_and_dec() + const char *func_name() const override{ return "column_json"; } + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= MAX_BLOB_WIDTH; maybe_null= 1; decimals= 0; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1893,15 +1893,15 @@ class Item_dyncol_get: public Item_str_func public: Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null= 1;; max_length= MAX_BLOB_WIDTH; return FALSE; } /* Mark that collation can change between calls */ - bool dynamic_result() { return 1; } + bool dynamic_result() override { return 1; } - const char *func_name() const { return "column_get"; } - String *val_str(String *); - longlong val_int(); - longlong val_int_signed_typecast() + const char *func_name() const override { return "column_get"; } + String *val_str(String *) override; + longlong val_int() override; + longlong val_int_signed_typecast() override { unsigned_flag= false; // Mark that we want to have a signed value longlong value= val_int(); // val_int() can change unsigned_flag @@ -1909,7 +1909,7 @@ public: push_note_converted_to_negative_complement(current_thd); return value; } - longlong val_int_unsigned_typecast() + longlong val_int_unsigned_typecast() override { unsigned_flag= true; // Mark that we want to have an unsigned value longlong value= val_int(); // val_int() can change unsigned_flag @@ -1917,12 +1917,12 @@ public: push_note_converted_to_positive_complement(current_thd); return value; } - double val_real(); - my_decimal *val_decimal(my_decimal *); + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1932,11 +1932,11 @@ class Item_func_dyncol_list: public Item_str_func public: Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) {collation.set(DYNCOL_UTF);} - bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null= 1; max_length= MAX_BLOB_WIDTH; return FALSE; }; - const char *func_name() const{ return "column_list"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override{ return "column_list"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1950,14 +1950,14 @@ class Item_temptable_rowid :public Item_str_func public: TABLE *table; Item_temptable_rowid(TABLE *table_arg); - const Type_handler *type_handler() const { return &type_handler_string; } + const Type_handler *type_handler() const override { return &type_handler_string; } Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) { return create_table_field_from_handler(root, table); } - String *val_str(String *str); - enum Functype functype() const { return TEMPTABLE_ROWID; } - const char *func_name() const { return ""; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + String *val_str(String *str) override; + enum Functype functype() const override { return TEMPTABLE_ROWID; } + const char *func_name() const override { return ""; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #ifdef WITH_WSREP @@ -1969,15 +1969,15 @@ class Item_func_wsrep_last_written_gtid: public Item_str_ascii_func String gtid_str; public: Item_func_wsrep_last_written_gtid(THD *thd): Item_str_ascii_func(thd) {} - const char *func_name() const { return "wsrep_last_written_gtid"; } - String *val_str_ascii(String *); - bool fix_length_and_dec() + const char *func_name() const override { return "wsrep_last_written_gtid"; } + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { max_length= WSREP_GTID_STR_LEN; maybe_null= true; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1986,15 +1986,15 @@ class Item_func_wsrep_last_seen_gtid: public Item_str_ascii_func String gtid_str; public: Item_func_wsrep_last_seen_gtid(THD *thd): Item_str_ascii_func(thd) {} - const char *func_name() const { return "wsrep_last_seen_gtid"; } - String *val_str_ascii(String *); - bool fix_length_and_dec() + const char *func_name() const override { return "wsrep_last_seen_gtid"; } + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { max_length= WSREP_GTID_STR_LEN; maybe_null= true; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2004,10 +2004,10 @@ class Item_func_wsrep_sync_wait_upto: public Item_int_func public: Item_func_wsrep_sync_wait_upto(THD *thd, Item *a): Item_int_func(thd, a) {} Item_func_wsrep_sync_wait_upto(THD *thd, Item *a, Item* b): Item_int_func(thd, a, b) {} - const Type_handler *type_handler() const { return &type_handler_string; } - const char *func_name() const { return "wsrep_sync_wait_upto_gtid"; } - longlong val_int(); - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_string; } + const char *func_name() const override { return "wsrep_sync_wait_upto_gtid"; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif /* WITH_WSREP */ diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 83b496278ca..8ff9850e1b3 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -468,7 +468,7 @@ class Field_fixer: public Field_enumerator public: table_map used_tables; /* Collect used_tables here */ st_select_lex *new_parent; /* Select we're in */ - virtual void visit_field(Item_field *item) + void visit_field(Item_field *item) override { //for (TABLE_LIST *tbl= new_parent->leaf_tables; tbl; tbl= tbl->next_local) //{ diff --git a/sql/item_subselect.h b/sql/item_subselect.h index d3572e1abe7..c1b531dc361 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -307,29 +307,29 @@ public: Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0) {} - void cleanup(); - subs_type substype() { return SINGLEROW_SUBS; } + void cleanup() override; + subs_type substype() override { return SINGLEROW_SUBS; } - void reset(); - void no_rows_in_result(); - bool select_transformer(JOIN *join); + void reset() override; + void no_rows_in_result() override; + bool select_transformer(JOIN *join) override; void store(uint i, Item* item); - double val_real(); - longlong val_int (); - String *val_str (String *); - bool val_native(THD *thd, Native *); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const; - bool fix_length_and_dec(); + double val_real() override; + longlong val_int () override; + String *val_str (String *) override; + bool val_native(THD *thd, Native *) override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + const Type_handler *type_handler() const override; + bool fix_length_and_dec() override; - uint cols() const; - Item* element_index(uint i) { return reinterpret_cast(row[i]); } - Item** addr(uint i) { return (Item**)row + i; } - bool check_cols(uint c); - bool null_inside(); - void bring_value(); + uint cols() const override; + Item* element_index(uint i) override { return reinterpret_cast(row[i]); } + Item** addr(uint i) override { return (Item**)row + i; } + bool check_cols(uint c) override; + bool null_inside() override; + void bring_value() override; /** This method is used to implement a special case of semantic tree @@ -345,7 +345,7 @@ public: */ st_select_lex* invalidate_and_restore_select_lex(); - Item* expr_cache_insert_transformer(THD *thd, uchar *unused); + Item* expr_cache_insert_transformer(THD *thd, uchar *unused) override; friend class select_singlerow_subselect; }; @@ -360,12 +360,12 @@ protected: public: Item_maxmin_subselect(THD *thd, Item_subselect *parent, st_select_lex *select_lex, bool max); - virtual void print(String *str, enum_query_type query_type); - void cleanup(); + void print(String *str, enum_query_type query_type) override; + void cleanup() override; bool any_value() { return was_values; } void register_value() { was_values= TRUE; } - void reset_value_registration() { was_values= FALSE; } - void no_rows_in_result(); + void reset_value_registration() override { was_values= FALSE; } + void no_rows_in_result() override; }; /* exists subselect */ @@ -800,16 +800,16 @@ public: chooser_compare_func_creator fc, st_select_lex *select_lex, bool all); - void cleanup(); + void cleanup() override; // only ALL subquery has upper not - subs_type substype() { return all?ALL_SUBS:ANY_SUBS; } - bool select_transformer(JOIN *join); + subs_type substype() override { return all?ALL_SUBS:ANY_SUBS; } + bool select_transformer(JOIN *join) override; void create_comp_func(bool invert) { func= func_creator(invert); } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return CMP_PRECEDENCE; } bool is_maxmin_applicable(JOIN *join); bool transform_into_max_min(JOIN *join); - void no_rows_in_result(); + void no_rows_in_result() override; }; @@ -1066,9 +1066,9 @@ public: check_null(chk_null), having(having_arg) { DBUG_ASSERT(subs); } - int exec(); - void print (String *str, enum_query_type query_type); - virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; } + int exec() override; + void print (String *str, enum_query_type query_type) override; + enum_engine_type engine_type() override { return INDEXSUBQUERY_ENGINE; } }; /* @@ -1509,7 +1509,7 @@ protected: bool test_null_row(rownum_t row_num); bool exists_complementing_null_row(MY_BITMAP *keys_to_complement); - bool partial_match(); + bool partial_match() override; public: subselect_rowid_merge_engine(subselect_uniquesubquery_engine *engine_arg, TABLE *tmp_table_arg, uint merge_keys_count_arg, @@ -1528,15 +1528,15 @@ public: {} ~subselect_rowid_merge_engine(); bool init(MY_BITMAP *non_null_key_parts, MY_BITMAP *partial_match_key_parts); - void cleanup(); - virtual enum_engine_type engine_type() { return ROWID_MERGE_ENGINE; } + void cleanup() override; + enum_engine_type engine_type() override { return ROWID_MERGE_ENGINE; } }; class subselect_table_scan_engine: public subselect_partial_match_engine { protected: - bool partial_match(); + bool partial_match() override; public: subselect_table_scan_engine(subselect_uniquesubquery_engine *engine_arg, TABLE *tmp_table_arg, Item_subselect *item_arg, @@ -1545,7 +1545,7 @@ public: bool has_covering_null_row_arg, bool has_covering_null_columns_arg, uint count_columns_with_nulls_arg); - void cleanup(); - virtual enum_engine_type engine_type() { return TABLE_SCAN_ENGINE; } + void cleanup() override; + enum_engine_type engine_type() override { return TABLE_SCAN_ENGINE; } }; #endif /* ITEM_SUBSELECT_INCLUDED */ diff --git a/sql/item_sum.h b/sql/item_sum.h index 847407c6c0c..d46c0561c91 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -418,7 +418,7 @@ public: Item_sum(THD *thd, List &list); //Copy constructor, need to perform subselects with temporary tables Item_sum(THD *thd, Item_sum *item); - enum Type type() const { return SUM_FUNC_ITEM; } + enum Type type() const override { return SUM_FUNC_ITEM; } virtual enum Sumfunctype sum_func () const=0; bool is_aggr_sum_func() { @@ -468,14 +468,14 @@ public: Updated value is then saved in the field. */ virtual void update_field()=0; - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null=1; null_value=1; return FALSE; } virtual Item *result_item(THD *thd, Field *field); - void update_used_tables (); + void update_used_tables () override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref) + COND_EQUAL **cond_equal_ref) override { /* Item_sum (and derivants) of the original WHERE/HAVING clauses @@ -486,7 +486,7 @@ public: return Item::build_equal_items(thd, inherited, link_item_fields, cond_equal_ref); } - bool is_null() { return null_value; } + bool is_null() override { return null_value; } /** make_const() Called if we've managed to calculate the value of this Item in @@ -499,8 +499,8 @@ public: const_item_cache= true; } void reset_forced_const() { const_item_cache= false; } - virtual bool const_during_execution() const { return false; } - virtual void print(String *str, enum_query_type query_type); + bool const_during_execution() const override { return false; } + void print(String *str, enum_query_type query_type) override; void fix_num_length_and_dec(); /** @@ -513,7 +513,7 @@ public: may be initialized to 0 by clear() and to NULL by no_rows_in_result(). */ - virtual void no_rows_in_result() + void no_rows_in_result() override { set_aggregator(with_distinct ? Aggregator::DISTINCT_AGGREGATOR : @@ -521,14 +521,14 @@ public: aggregator_clear(); } virtual void make_unique() { force_copy_fields= TRUE; } - Item *get_tmp_table_item(THD *thd); + Item *get_tmp_table_item(THD *thd) override; virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { return create_tmp_field(root, param->group(), table); } - virtual bool collect_outer_ref_processor(void *param); + bool collect_outer_ref_processor(void *param) override; bool init_sum_func_check(THD *thd); bool check_sum_func(THD *thd, Item **ref); bool register_sum_func(THD *thd, Item **ref); @@ -588,14 +588,14 @@ public: virtual bool supports_removal() const { return false; } virtual void remove() { DBUG_ASSERT(0); } - virtual void cleanup(); - bool check_vcol_func_processor(void *arg); + void cleanup() override; + bool check_vcol_func_processor(void *arg) override; virtual void setup_window_func(THD *thd, Window_spec *window_spec) {} void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; } bool is_window_func_sum_expr() { return window_func_sum_expr_flag; } virtual void setup_caches(THD *thd) {}; - bool with_sum_func() const { return true; } + bool with_sum_func() const override { return true; } virtual void set_partition_row_count(ulonglong count) { DBUG_ASSERT(0); } /* @@ -702,15 +702,15 @@ public: Aggregator(sum), table(NULL), tmp_table_param(NULL), tree(NULL), always_null(false), use_distinct_values(false) {} virtual ~Aggregator_distinct (); - Aggregator_type Aggrtype() { return DISTINCT_AGGREGATOR; } + Aggregator_type Aggrtype() override { return DISTINCT_AGGREGATOR; } - bool setup(THD *); - void clear(); - bool add(); - void endup(); - virtual my_decimal *arg_val_decimal(my_decimal * value); - virtual double arg_val_real(); - virtual bool arg_is_null(bool use_null_value); + bool setup(THD *) override; + void clear() override; + bool add() override; + void endup() override; + my_decimal *arg_val_decimal(my_decimal * value) override; + double arg_val_real() override; + bool arg_is_null(bool use_null_value) override; bool unique_walk_function(void *element); bool unique_walk_function_for_count(void *element); @@ -729,15 +729,15 @@ public: Aggregator_simple (Item_sum *sum) : Aggregator(sum) {} - Aggregator_type Aggrtype() { return Aggregator::SIMPLE_AGGREGATOR; } + Aggregator_type Aggrtype() override { return Aggregator::SIMPLE_AGGREGATOR; } - bool setup(THD * thd) { return item_sum->setup(thd); } - void clear() { item_sum->clear(); } - bool add() { return item_sum->add(); } - void endup() {}; - virtual my_decimal *arg_val_decimal(my_decimal * value); - virtual double arg_val_real(); - virtual bool arg_is_null(bool use_null_value); + bool setup(THD * thd) override { return item_sum->setup(thd); } + void clear() override { item_sum->clear(); } + bool add() override { return item_sum->add(); } + void endup() override {}; + my_decimal *arg_val_decimal(my_decimal * value) override; + double arg_val_real() override; + bool arg_is_null(bool use_null_value) override; }; @@ -753,7 +753,7 @@ public: Item_sum(thd, list) {} Item_sum_num(THD *thd, Item_sum_num *item): Item_sum(thd, item) {} - bool fix_fields(THD *, Item **); + bool fix_fields(THD *, Item **) override; }; @@ -764,23 +764,23 @@ public: Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} Item_sum_double(THD *thd, List &list): Item_sum_num(thd, list) {} Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {} - longlong val_int() + longlong val_int() override { return val_int_from_real(); } - String *val_str(String*str) + String *val_str(String*str) override { return val_string_from_real(str); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return val_decimal_from_real(to); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_real(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return &type_handler_double; } + const Type_handler *type_handler() const override { return &type_handler_double; } }; @@ -791,14 +791,14 @@ public: Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} Item_sum_int(THD *thd, List &list): Item_sum_num(thd, list) {} Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {} - double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double val_real() override { DBUG_ASSERT(fixed == 1); return (double) val_int(); } + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_int(thd, ltime, fuzzydate); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=21; maybe_null=null_value=0; return FALSE; } }; @@ -815,7 +815,7 @@ protected: my_decimal direct_sum_decimal; my_decimal dec_buffs[2]; uint curr_dec_buff; - bool fix_length_and_dec(); + bool fix_length_and_dec() override; public: Item_sum_sum(THD *thd, Item *item_par, bool distinct): @@ -825,40 +825,40 @@ public: set_distinct(distinct); } Item_sum_sum(THD *thd, Item_sum_sum *item); - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return has_with_distinct() ? SUM_DISTINCT_FUNC : SUM_FUNC; } - void cleanup(); + void cleanup() override; void direct_add(my_decimal *add_sum_decimal); void direct_add(double add_sum_real, bool add_sum_is_null); - void clear(); - bool add(); - double val_real(); - longlong val_int(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void clear() override; + bool add() override; + double val_real() override; + longlong val_int() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - void reset_field(); - void update_field(); - void no_rows_in_result() {} - const char *func_name() const + void reset_field() override; + void update_field() override; + void no_rows_in_result() override {} + const char *func_name() const override { return has_with_distinct() ? "sum(distinct " : "sum("; } - Item *copy_or_same(THD* thd); - void remove(); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + void remove() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -878,10 +878,10 @@ class Item_sum_count :public Item_sum_int friend class Aggregator_distinct; - void clear(); - bool add(); - void cleanup(); - void remove(); + void clear() override; + bool add() override; + void cleanup() override; + void remove() override; public: Item_sum_count(THD *thd, Item *item_par): @@ -907,30 +907,30 @@ public: Item_sum_int(thd, item), direct_counted(FALSE), direct_reseted_field(FALSE), count(item->count) {} - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return has_with_distinct() ? COUNT_DISTINCT_FUNC : COUNT_FUNC; } - void no_rows_in_result() { count=0; } + void no_rows_in_result() override { count=0; } void make_const(longlong count_arg) { count=count_arg; Item_sum::make_const(); } - const Type_handler *type_handler() const { return &type_handler_slonglong; } - longlong val_int(); - void reset_field(); - void update_field(); + const Type_handler *type_handler() const override { return &type_handler_slonglong; } + longlong val_int() override; + void reset_field() override; + void update_field() override; void direct_add(longlong add_count); - const char *func_name() const + const char *func_name() const override { return has_with_distinct() ? "count(distinct " : "count("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -955,38 +955,38 @@ public: void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - enum Sumfunctype sum_func () const + bool fix_length_and_dec() override; + enum Sumfunctype sum_func () const override { return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC; } - void clear(); - bool add(); - void remove(); - double val_real(); + void clear() override; + bool add() override; + void remove() override; + double val_real() override; // In SPs we might force the "wrong" type with select into a declare variable - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str); - void reset_field(); - void update_field(); - Item *result_item(THD *thd, Field *field); - void no_rows_in_result() {} - const char *func_name() const + longlong val_int() override { return val_int_from_real(); } + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String *str) override; + void reset_field() override; + void update_field() override; + Item *result_item(THD *thd, Field *field) override; + void no_rows_in_result() override {} + const char *func_name() const override { return has_with_distinct() ? "avg(distinct " : "avg("; } - Item *copy_or_same(THD* thd); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void cleanup() + Item *copy_or_same(THD* thd) override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + void cleanup() override { count= 0; Item_sum_sum::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -1111,7 +1111,7 @@ public: :Item_sum(thd, item), Type_handler_hybrid_field_type(item) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } bool fix_length_and_dec_generic(); bool fix_length_and_dec_numeric(const Type_handler *h); @@ -1145,35 +1145,35 @@ public: direct_added(FALSE), value(item->value), arg_cache(0), cmp_sign(item->cmp_sign), was_values(item->was_values) { } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; void setup_hybrid(THD *thd, Item *item, Item *value_arg); - void clear(); + void clear() override; void direct_add(Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *); - const Type_handler *real_type_handler() const + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + void reset_field() override; + String *val_str(String *) override; + bool val_native(THD *thd, Native *) override; + const Type_handler *real_type_handler() const override { return get_arg(0)->real_type_handler(); } - const TYPELIB *get_typelib() const { return args[0]->get_typelib(); } - void update_field(); + const TYPELIB *get_typelib() const override { return args[0]->get_typelib(); } + void update_field() override; void min_max_update_str_field(); void min_max_update_real_field(); void min_max_update_int_field(); void min_max_update_decimal_field(); void min_max_update_native_field(); - void cleanup(); + void cleanup() override; bool any_value() { return was_values; } - void no_rows_in_result(); - void restore_to_before_no_rows_in_result(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void setup_caches(THD *thd) { setup_hybrid(thd, arguments()[0], NULL); } + void no_rows_in_result() override; + void restore_to_before_no_rows_in_result() override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + void setup_caches(THD *thd) override { setup_hybrid(thd, arguments()[0], NULL); } }; @@ -1182,12 +1182,12 @@ class Item_sum_min final :public Item_sum_min_max public: Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {} Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_min_max(thd, item) {} - enum Sumfunctype sum_func () const {return MIN_FUNC;} + enum Sumfunctype sum_func () const override {return MIN_FUNC;} - bool add(); - const char *func_name() const { return "min("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool add() override; + const char *func_name() const override { return "min("; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1197,12 +1197,12 @@ class Item_sum_max final :public Item_sum_min_max public: Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {} Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_min_max(thd, item) {} - enum Sumfunctype sum_func () const {return MAX_FUNC;} + enum Sumfunctype sum_func () const override {return MAX_FUNC;} - bool add(); - const char *func_name() const { return "max("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool add() override; + const char *func_name() const override { return "max("; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1221,20 +1221,20 @@ public: if (as_window_function) memcpy(bit_counters, item->bit_counters, sizeof(bit_counters)); } - enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;} - void clear(); - longlong val_int(); - void reset_field(); - void update_field(); - const Type_handler *type_handler() const { return &type_handler_ulonglong; } - bool fix_length_and_dec() + enum Sumfunctype sum_func () const override {return SUM_BIT_FUNC;} + void clear() override; + longlong val_int() override; + void reset_field() override; + void update_field() override; + const Type_handler *type_handler() const override { return &type_handler_ulonglong; } + bool fix_length_and_dec() override { if (args[0]->check_type_can_return_int(func_name())) return true; decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0; return FALSE; } - void cleanup() + void cleanup() override { bits= reset_bits; if (as_window_function) @@ -1242,12 +1242,12 @@ public: Item_sum_int::cleanup(); } void setup_window_func(THD *thd __attribute__((unused)), - Window_spec *window_spec __attribute__((unused))) + Window_spec *window_spec __attribute__((unused))) override { as_window_function= TRUE; clear_as_window(); } - void remove() + void remove() override { if (as_window_function) { @@ -1258,7 +1258,7 @@ public: DBUG_ASSERT(0); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -1286,14 +1286,14 @@ class Item_sum_or final :public Item_sum_bit public: Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_or("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool add() override; + const char *func_name() const override { return "bit_or("; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - void set_bits_from_counters(); + void set_bits_from_counters() override; }; @@ -1303,14 +1303,14 @@ public: Item_sum_and(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, ULONGLONG_MAX) {} Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_and("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool add() override; + const char *func_name() const override { return "bit_and("; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - void set_bits_from_counters(); + void set_bits_from_counters() override; }; class Item_sum_xor final :public Item_sum_bit @@ -1318,14 +1318,14 @@ class Item_sum_xor final :public Item_sum_bit public: Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_xor("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool add() override; + const char *func_name() const override { return "bit_xor("; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - void set_bits_from_counters(); + void set_bits_from_counters() override; }; class sp_head; @@ -1394,48 +1394,48 @@ public: sp_head *sp, List &list); Item_sum_sp(THD *thd, Item_sum_sp *item); - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return SP_AGGREGATE_FUNC; } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return create_table_field_from_handler(root, table); } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - const char *func_name() const; - const Type_handler *type_handler() const; - bool add(); + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; + const char *func_name() const override; + const Type_handler *type_handler() const override; + bool add() override; /* val_xx functions */ - longlong val_int() + longlong val_int() override { if(execute()) return 0; return sp_result_field->val_int(); } - double val_real() + double val_real() override { if(execute()) return 0.0; return sp_result_field->val_real(); } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { if(execute()) return NULL; return sp_result_field->val_decimal(dec_buf); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { return null_value= execute() || sp_result_field->val_native(to); } - String *val_str(String *str) + String *val_str(String *str) override { String buf; char buff[20]; @@ -1453,11 +1453,11 @@ public: str->copy(buf); return str; } - void reset_field(){DBUG_ASSERT(0);} - void update_field(){DBUG_ASSERT(0);} - void clear(); - void cleanup(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void reset_field() override{DBUG_ASSERT(0);} + void update_field() override{DBUG_ASSERT(0);} + void clear() override; + void cleanup() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return execute() || sp_result_field->get_date(ltime, fuzzydate); } @@ -1465,9 +1465,9 @@ public: { return sp_result_field; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *copy_or_same(THD *thd); + Item *copy_or_same(THD *thd) override; }; /* Items to get the value of a stored sum function */ @@ -1486,18 +1486,18 @@ public: max_length= item->max_length; unsigned_flag= item->unsigned_flag; } - table_map used_tables() const { return (table_map) 1L; } + table_map used_tables() const override { return (table_map) 1L; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { return create_tmp_field_ex_simple(root, table, src, param); } - void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } - bool check_vcol_func_processor(void *arg) + void save_in_result_field(bool no_conversions) override { DBUG_ASSERT(0); } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(name.str, arg, VCOL_IMPOSSIBLE); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } @@ -1512,8 +1512,8 @@ public: Item_avg_field(THD *thd, Item_sum_avg *item) :Item_sum_field(thd, item), prec_increment(item->prec_increment) { } - enum Type type() const { return FIELD_AVG_ITEM; } - bool is_null() { update_null_value(); return null_value; } + enum Type type() const override { return FIELD_AVG_ITEM; } + bool is_null() override { update_null_value(); return null_value; } }; @@ -1523,12 +1523,12 @@ public: Item_avg_field_double(THD *thd, Item_sum_avg *item) :Item_avg_field(thd, item) { } - const Type_handler *type_handler() const { return &type_handler_double; } - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *dec) { return val_decimal_from_real(dec); } - String *val_str(String *str) { return val_string_from_real(str); } - double val_real(); - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override { return &type_handler_double; } + longlong val_int() override { return val_int_from_real(); } + my_decimal *val_decimal(my_decimal *dec) override { return val_decimal_from_real(dec); } + String *val_str(String *str) override { return val_string_from_real(str); } + double val_real() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1543,21 +1543,21 @@ public: f_scale(item->f_scale), dec_bin_size(item->dec_bin_size) { } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - double val_real() + const Type_handler *type_handler() const override { return &type_handler_newdecimal; } + double val_real() override { return VDec(this).to_double(); } - longlong val_int() + longlong val_int() override { return VDec(this).to_longlong(unsigned_flag); } - String *val_str(String *str) + String *val_str(String *str) override { return VDec(this).to_string_round(str, decimals); } - my_decimal *val_decimal(my_decimal *); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1569,16 +1569,16 @@ public: Item_variance_field(THD *thd, Item_sum_variance *item) :Item_sum_field(thd, item), sample(item->sample) { } - enum Type type() const {return FIELD_VARIANCE_ITEM; } - double val_real(); - longlong val_int() { return val_int_from_real(); } - String *val_str(String *str) + enum Type type() const override {return FIELD_VARIANCE_ITEM; } + double val_real() override; + longlong val_int() override { return val_int_from_real(); } + String *val_str(String *str) override { return val_string_from_real(str); } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { return val_decimal_from_real(dec_buf); } - bool is_null() { update_null_value(); return null_value; } - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) + bool is_null() override { update_null_value(); return null_value; } + const Type_handler *type_handler() const override { return &type_handler_double; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1589,9 +1589,9 @@ public: Item_std_field(THD *thd, Item_sum_std *item) :Item_variance_field(thd, item) { } - enum Type type() const { return FIELD_STD_ITEM; } - double val_real(); - Item *get_copy(THD *thd) + enum Type type() const override { return FIELD_STD_ITEM; } + double val_real() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1617,8 +1617,8 @@ public: Item_udf_sum(THD *thd, Item_udf_sum *item) :Item_sum(thd, item), udf(item->udf) { udf.not_original= TRUE; } - const char *func_name() const { return udf.name(); } - bool fix_fields(THD *thd, Item **ref) + const char *func_name() const override { return udf.name(); } + bool fix_fields(THD *thd, Item **ref) override { DBUG_ASSERT(fixed == 0); @@ -1650,18 +1650,18 @@ public: memcpy (orig_args, args, sizeof (Item *) * arg_count); return check_sum_func(thd, ref); } - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } + enum Sumfunctype sum_func () const override { return UDF_SUM_FUNC; } virtual bool have_field_update(void) const { return 0; } - void clear(); - bool add(); - bool supports_removal() const; - void remove(); - void reset_field() {}; - void update_field() {}; - void cleanup(); - virtual void print(String *str, enum_query_type query_type); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void clear() override; + bool add() override; + bool supports_removal() const override; + void remove() override; + void reset_field() override {}; + void update_field() override {}; + void cleanup() override; + void print(String *str, enum_query_type query_type) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } @@ -1677,14 +1677,14 @@ class Item_sum_udf_float :public Item_udf_sum Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_float(THD *thd, Item_sum_udf_float *item) :Item_udf_sum(thd, item) {} - longlong val_int() { return val_int_from_real(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + longlong val_int() override { return val_int_from_real(); } + double val_real() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override { return &type_handler_double; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1698,20 +1698,20 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_int(THD *thd, Item_sum_udf_int *item) :Item_udf_sum(thd, item) {} - longlong val_int(); - double val_real() + longlong val_int() override; + double val_real() override { DBUG_ASSERT(fixed == 1); return (double) Item_sum_udf_int::val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1725,8 +1725,8 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_str(THD *thd, Item_sum_udf_str *item) :Item_udf_sum(thd, item) {} - String *val_str(String *); - double val_real() + String *val_str(String *) override; + double val_real() override { int err_not_used; char *end_not_used; @@ -1735,7 +1735,7 @@ public: return res ? res->charset()->strntod((char*) res->ptr(),res->length(), &end_not_used, &err_not_used) : 0.0; } - longlong val_int() + longlong val_int() override { int err_not_used; char *end; @@ -1748,11 +1748,11 @@ public: end= (char*) res->ptr()+res->length(); return cs->strtoll10(res->ptr(), &end, &err_not_used); } - my_decimal *val_decimal(my_decimal *dec); - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *dec) override; + const Type_handler *type_handler() const override { return string_type_handler(); } + bool fix_length_and_dec() override; + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1766,23 +1766,23 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item) :Item_udf_sum(thd, item) {} - String *val_str(String *str) + String *val_str(String *str) override { return VDec(this).to_string_round(str, decimals); } - double val_real() + double val_real() override { return VDec(this).to_double(); } - longlong val_int() + longlong val_int() override { return VDec(this).to_longlong(unsigned_flag); } - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override { return &type_handler_newdecimal; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index cd0e88544e0..072cb34c0f5 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2462,21 +2462,21 @@ String *Item_char_typecast::val_str_binary_from_native(String *str) class Item_char_typecast_func_handler: public Item_handled_func::Handler_str { public: - const Type_handler *return_type_handler(const Item_handled_func *item) const + const Type_handler *return_type_handler(const Item_handled_func *item) const override { return Type_handler::string_type_handler(item->max_length); } const Type_handler * - type_handler_for_create_select(const Item_handled_func *item) const + type_handler_for_create_select(const Item_handled_func *item) const override { return return_type_handler(item)->type_handler_for_tmp_table(item); } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { return false; } - String *val_str(Item_handled_func *item, String *to) const + String *val_str(Item_handled_func *item, String *to) const override { DBUG_ASSERT(dynamic_cast(item)); return static_cast(item)->val_str_generic(to); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index d8012c74e05..6ef2d02238e 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -32,7 +32,7 @@ bool get_interval_value(THD *thd, Item *args, class Item_long_func_date_field: public Item_long_ge0_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()); } public: Item_long_func_date_field(THD *thd, Item *a) @@ -42,7 +42,7 @@ public: class Item_long_func_time_field: public Item_long_ge0_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_time(func_name()); } public: Item_long_func_time_field(THD *thd, Item *a) @@ -52,37 +52,37 @@ public: class Item_func_period_add :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2); } public: Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "period_add"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "period_add"; } + bool fix_length_and_dec() override { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_period_diff :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2); } public: Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "period_diff"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "period_diff"; } + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -91,53 +91,53 @@ class Item_func_to_days :public Item_long_func_date_field { public: Item_func_to_days(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "to_days"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "to_days"; } + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_to_seconds :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_date(0, arg_count); } public: Item_func_to_seconds(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "to_seconds"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "to_seconds"; } + bool fix_length_and_dec() override { decimals=0; fix_char_length(12); maybe_null= 1; return FALSE; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *bool_arg) { return FALSE;} + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *bool_arg) override { return FALSE;} /* Only meaningful with date part and optional time part */ - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -146,22 +146,22 @@ class Item_func_dayofmonth :public Item_long_func_date_field { public: Item_func_dayofmonth(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "dayofmonth"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "dayofmonth"; } + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -171,22 +171,22 @@ class Item_func_month :public Item_long_ge0_func public: Item_func_month(THD *thd, Item *a): Item_long_ge0_func(thd, a) { } - longlong val_int(); - const char *func_name() const { return "month"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "month"; } + bool fix_length_and_dec() override { decimals= 0; fix_char_length(2); maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -196,19 +196,19 @@ class Item_func_monthname :public Item_str_func MY_LOCALE *locale; public: Item_func_monthname(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "monthname"; } - String *val_str(String *str); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_valid_arguments_processor(void *int_arg) + const char *func_name() const override { return "monthname"; } + String *val_str(String *str) override; + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -217,22 +217,22 @@ class Item_func_dayofyear :public Item_long_func_date_field { public: Item_func_dayofyear(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "dayofyear"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "dayofyear"; } + bool fix_length_and_dec() override { decimals= 0; fix_char_length(3); maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -241,22 +241,22 @@ class Item_func_hour :public Item_long_func_time_field { public: Item_func_hour(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "hour"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "hour"; } + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -265,22 +265,22 @@ class Item_func_minute :public Item_long_func_time_field { public: Item_func_minute(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "minute"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "minute"; } + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -289,22 +289,22 @@ class Item_func_quarter :public Item_long_func_date_field { public: Item_func_quarter(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "quarter"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "quarter"; } + bool fix_length_and_dec() override { decimals=0; max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -313,29 +313,29 @@ class Item_func_second :public Item_long_func_time_field { public: Item_func_second(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "second"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "second"; } + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_week :public Item_long_ge0_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()) || (arg_count > 1 && args[1]->check_type_can_return_int(func_name())); @@ -343,32 +343,32 @@ class Item_func_week :public Item_long_ge0_func public: Item_func_week(THD *thd, Item *a): Item_long_ge0_func(thd, a) {} Item_func_week(THD *thd, Item *a, Item *b): Item_long_ge0_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "week"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "week"; } + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { if (arg_count == 2) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return arg_count == 2; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_yearweek :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()) || args[1]->check_type_can_return_int(func_name()); @@ -376,22 +376,22 @@ class Item_func_yearweek :public Item_long_func public: Item_func_yearweek(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "yearweek"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "yearweek"; } + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -400,24 +400,24 @@ class Item_func_year :public Item_long_func_date_field { public: Item_func_year(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "year"; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "year"; } + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool fix_length_and_dec() override { decimals=0; max_length=4*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -428,29 +428,29 @@ class Item_func_weekday :public Item_long_func public: Item_func_weekday(THD *thd, Item *a, bool type_arg): Item_long_func(thd, a), odbc_type(type_arg) { } - longlong val_int(); - const char *func_name() const + longlong val_int() override; + const char *func_name() const override { return (odbc_type ? "dayofweek" : "weekday"); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_char_length(1); maybe_null=1; return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -459,20 +459,20 @@ class Item_func_dayname :public Item_str_func MY_LOCALE *locale; public: Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "dayname"; } - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_varchar; } - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "dayname"; } + String *val_str(String *str) override; + const Type_handler *type_handler() const override { return &type_handler_varchar; } + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -493,9 +493,9 @@ public: else set_handler(type_handler_long_or_longlong()); } - double real_op() { DBUG_ASSERT(0); return 0; } - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double real_op() override { DBUG_ASSERT(0); return 0; } + String *str_op(String *str) override { DBUG_ASSERT(0); return 0; } + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { DBUG_ASSERT(0); return true; @@ -510,34 +510,34 @@ public: Item_func_unix_timestamp(THD *thd): Item_func_seconds_hybrid(thd) {} Item_func_unix_timestamp(THD *thd, Item *a): Item_func_seconds_hybrid(thd, a) {} - const char *func_name() const { return "unix_timestamp"; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} + const char *func_name() const override { return "unix_timestamp"; } + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} /* UNIX_TIMESTAMP() depends on the current timezone (and thus may not be used as a partitioning function) when its argument is NOT of the TIMESTAMP type. */ - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_timestamp_args(); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { if (arg_count) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_length_and_dec_generic(arg_count ? args[0]->datetime_precision(current_thd) : 0); return FALSE; } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) + longlong int_op() override; + my_decimal *decimal_op(my_decimal* buf) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -547,21 +547,21 @@ class Item_func_time_to_sec :public Item_func_seconds_hybrid public: Item_func_time_to_sec(THD *thd, Item *item): Item_func_seconds_hybrid(thd, item) {} - const char *func_name() const { return "time_to_sec"; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + const char *func_name() const override { return "time_to_sec"; } + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_length_and_dec_generic(args[0]->time_precision(current_thd)); return FALSE; } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) + longlong int_op() override; + my_decimal *decimal_op(my_decimal* buf) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -572,12 +572,12 @@ public: Item_datefunc(THD *thd): Item_func(thd) { } Item_datefunc(THD *thd, Item *a): Item_func(thd, a) { } Item_datefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) { } - const Type_handler *type_handler() const { return &type_handler_newdate; } - longlong val_int() { return Date(this).to_longlong(); } - double val_real() { return Date(this).to_double(); } - String *val_str(String *to) { return Date(this).to_string(to); } - my_decimal *val_decimal(my_decimal *to) { return Date(this).to_decimal(to); } - bool fix_length_and_dec() + const Type_handler *type_handler() const override { return &type_handler_newdate; } + longlong val_int() override { return Date(this).to_longlong(); } + double val_real() override { return Date(this).to_double(); } + String *val_str(String *to) override { return Date(this).to_string(to); } + my_decimal *val_decimal(my_decimal *to) override { return Date(this).to_decimal(to); } + bool fix_length_and_dec() override { fix_attributes_date(); maybe_null= (arg_count > 0); @@ -593,12 +593,12 @@ public: Item_timefunc(THD *thd, Item *a): Item_func(thd, a) {} Item_timefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} Item_timefunc(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_time2; } - longlong val_int() { return Time(this).to_longlong(); } - double val_real() { return Time(this).to_double(); } - String *val_str(String *to) { return Time(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); } - bool val_native(THD *thd, Native *to) + const Type_handler *type_handler() const override { return &type_handler_time2; } + longlong val_int() override { return Time(this).to_longlong(); } + double val_real() override { return Time(this).to_double(); } + String *val_str(String *to) override { return Time(this).to_string(to, decimals); } + my_decimal *val_decimal(my_decimal *to) override { return Time(this).to_decimal(to); } + bool val_native(THD *thd, Native *to) override { return Time(thd, this).to_native(to, decimals); } @@ -613,11 +613,11 @@ public: Item_datetimefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} Item_datetimefunc(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_datetime2; } - longlong val_int() { return Datetime(this).to_longlong(); } - double val_real() { return Datetime(this).to_double(); } - String *val_str(String *to) { return Datetime(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Datetime(this).to_decimal(to); } + const Type_handler *type_handler() const override { return &type_handler_datetime2; } + longlong val_int() override { return Datetime(this).to_longlong(); } + double val_real() override { return Datetime(this).to_double(); } + String *val_str(String *to) override { return Datetime(this).to_string(to, decimals); } + my_decimal *val_decimal(my_decimal *to) override { return Datetime(this).to_decimal(to); } }; @@ -630,20 +630,20 @@ class Item_func_curtime :public Item_timefunc public: Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0) { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() { fix_attributes_time(decimals); return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override { fix_attributes_time(decimals); return FALSE; } + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; /* Abstract method that defines which time zone is used for conversion. Converts time current time in my_time_t representation to broken-down MYSQL_TIME representation using UTC-SYSTEM or per-thread time zone. */ virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; }; @@ -651,9 +651,9 @@ class Item_func_curtime_local :public Item_func_curtime { public: Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {} - const char *func_name() const { return "curtime"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + const char *func_name() const override { return "curtime"; } + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -662,9 +662,9 @@ class Item_func_curtime_utc :public Item_func_curtime { public: Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {} - const char *func_name() const { return "utc_time"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + const char *func_name() const override { return "utc_time"; } + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -677,9 +677,9 @@ class Item_func_curdate :public Item_datefunc MYSQL_TIME ltime; public: Item_func_curdate(THD *thd): Item_datefunc(thd), last_query_id(0) {} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } @@ -690,9 +690,9 @@ class Item_func_curdate_local :public Item_func_curdate { public: Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {} - const char *func_name() const { return "curdate"; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + const char *func_name() const override { return "curdate"; } + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -701,9 +701,9 @@ class Item_func_curdate_utc :public Item_func_curdate { public: Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {} - const char *func_name() const { return "utc_date"; } - void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + const char *func_name() const override { return "utc_date"; } + void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -717,12 +717,12 @@ class Item_func_now :public Item_datetimefunc public: Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0) { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override { fix_attributes_datetime(decimals); return FALSE;} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { /* NOW is safe for replication as slaves will run with same time as @@ -730,7 +730,7 @@ public: */ return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; }; @@ -738,11 +738,11 @@ class Item_func_now_local :public Item_func_now { public: Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "current_timestamp"; } - int save_in_field(Field *field, bool no_conversions); - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_FUNC; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "current_timestamp"; } + int save_in_field(Field *field, bool no_conversions) override; + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + enum Functype functype() const override { return NOW_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -751,15 +751,15 @@ class Item_func_now_utc :public Item_func_now { public: Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "utc_timestamp"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_UTC_FUNC; } - virtual bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "utc_timestamp"; } + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + enum Functype functype() const override { return NOW_UTC_FUNC; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -772,44 +772,44 @@ class Item_func_sysdate_local :public Item_func_now { public: Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - bool const_item() const { return 0; } - const char *func_name() const { return "sysdate"; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) + bool const_item() const override { return 0; } + const char *func_name() const override { return "sysdate"; } + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + table_map used_tables() const override { return RAND_TABLE_BIT; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); } - virtual enum Functype functype() const { return SYSDATE_FUNC; } - Item *get_copy(THD *thd) + enum Functype functype() const override { return SYSDATE_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_from_days :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name()); } public: Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "from_days"; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + const char *func_name() const override { return "from_days"; } + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return has_date_args() || has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_date_format :public Item_str_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()) || check_argument_types_can_return_text(1, arg_count); @@ -824,18 +824,18 @@ public: Item_str_func(thd, a, b), locale(0), is_time_format(false) {} Item_func_date_format(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c), locale(0), is_time_format(false) {} - String *val_str(String *str); - const char *func_name() const { return "date_format"; } - bool fix_length_and_dec(); + String *val_str(String *str) override; + const char *func_name() const override { return "date_format"; } + bool fix_length_and_dec() override; uint format_length(const String *format); - bool eq(const Item *item, bool binary_cmp) const; - bool check_vcol_func_processor(void *arg) + bool eq(const Item *item, bool binary_cmp) const override; + bool check_vcol_func_processor(void *arg) override { if (arg_count > 2) return false; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -844,28 +844,28 @@ class Item_func_time_format: public Item_func_date_format public: Item_func_time_format(THD *thd, Item *a, Item *b): Item_func_date_format(thd, a, b) { is_time_format= true; } - const char *func_name() const { return "time_format"; } - bool check_vcol_func_processor(void *arg) { return false; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "time_format"; } + bool check_vcol_func_processor(void *arg) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_from_unixtime :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_decimal(func_name()); } Time_zone *tz; public: Item_func_from_unixtime(THD *thd, Item *a): Item_datetimefunc(thd, a) {} - const char *func_name() const { return "from_unixtime"; } - bool fix_length_and_dec(); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "from_unixtime"; } + bool fix_length_and_dec() override; + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -886,7 +886,7 @@ class Time_zone; */ class Item_func_convert_tz :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()) || check_argument_types_can_return_text(1, arg_count); @@ -902,35 +902,35 @@ class Item_func_convert_tz :public Item_datetimefunc public: Item_func_convert_tz(THD *thd, Item *a, Item *b, Item *c): Item_datetimefunc(thd, a, b, c), from_tz_cached(0), to_tz_cached(0) {} - const char *func_name() const { return "convert_tz"; } - bool fix_length_and_dec() + const char *func_name() const override { return "convert_tz"; } + bool fix_length_and_dec() override { fix_attributes_datetime(args[0]->datetime_precision(current_thd)); maybe_null= true; return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - void cleanup(); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + void cleanup() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_sec_to_time :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_decimal(func_name()); } public: Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { fix_attributes_time(args[0]->decimals); maybe_null= true; return FALSE; } - const char *func_name() const { return "sec_to_time"; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "sec_to_time"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -944,13 +944,13 @@ public: bool neg_arg): Item_handled_func(thd, a, b), int_type(type_arg), date_sub_interval(neg_arg) {} - const char *func_name() const { return "date_add_interval"; } - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return INTERVAL_PRECEDENCE; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + const char *func_name() const override { return "date_add_interval"; } + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return INTERVAL_PRECEDENCE; } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1004,25 +1004,25 @@ class Item_extract :public Item_int_func, m_date_mode(date_mode_t(0)), int_type(type_arg) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - longlong val_int(); - enum Functype functype() const { return EXTRACT_FUNC; } - const char *func_name() const { return "extract"; } - bool check_arguments() const; - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + enum Functype functype() const override { return EXTRACT_FUNC; } + const char *func_name() const override { return "extract"; } + bool check_arguments() const override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; + void print(String *str, enum_query_type query_type) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { if (int_type != INTERVAL_WEEK) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { switch (int_type) { case INTERVAL_YEAR: @@ -1058,7 +1058,7 @@ class Item_extract :public Item_int_func, } return true; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1085,9 +1085,9 @@ public: Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg): Item_handled_func(thd, a), cast_length(length_arg), cast_cs(cs_arg), m_suppress_warning_to_error_escalation(false) {} - enum Functype functype() const { return CHAR_TYPECAST_FUNC; } - bool eq(const Item *item, bool binary_cmp) const; - const char *func_name() const { return "cast_as_char"; } + enum Functype functype() const override { return CHAR_TYPECAST_FUNC; } + bool eq(const Item *item, bool binary_cmp) const override; + const char *func_name() const override { return "cast_as_char"; } CHARSET_INFO *cast_charset() const { return cast_cs; } String *val_str_generic(String *a); String *val_str_binary_from_native(String *a); @@ -1095,13 +1095,13 @@ public: void fix_length_and_dec_numeric(); void fix_length_and_dec_str(); void fix_length_and_dec_native_to_binary(uint32 octet_length); - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this); } - void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1115,7 +1115,7 @@ public: &my_charset_latin1), m_fsp(fsp) { } - String *val_str(String *to) + String *val_str(String *to) override { Interval_DDhhmmssff it(current_thd, args[0], m_fsp); null_value= !it.is_valid_interval_DDhhmmssff(); @@ -1128,17 +1128,17 @@ class Item_date_typecast :public Item_datefunc { public: Item_date_typecast(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "cast_as_date"; } - void print(String *str, enum_query_type query_type) + const char *func_name() const override { return "cast_as_date"; } + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1148,19 +1148,19 @@ class Item_time_typecast :public Item_timefunc public: Item_time_typecast(THD *thd, Item *a, uint dec_arg): Item_timefunc(thd, a) { decimals= dec_arg; } - const char *func_name() const { return "cast_as_time"; } - void print(String *str, enum_query_type query_type) + const char *func_name() const override { return "cast_as_time"; } + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()-> Item_time_typecast_fix_length_and_dec(this); } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1170,40 +1170,40 @@ class Item_datetime_typecast :public Item_datetimefunc public: Item_datetime_typecast(THD *thd, Item *a, uint dec_arg): Item_datetimefunc(thd, a) { decimals= dec_arg; } - const char *func_name() const { return "cast_as_datetime"; } - void print(String *str, enum_query_type query_type) + const char *func_name() const override { return "cast_as_datetime"; } + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()-> Item_datetime_typecast_fix_length_and_dec(this); } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_makedate :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } public: Item_func_makedate(THD *thd, Item *a, Item *b): Item_datefunc(thd, a, b) {} - const char *func_name() const { return "makedate"; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + const char *func_name() const override { return "makedate"; } + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timestamp :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()) || args[1]->check_type_can_return_time(func_name()); @@ -1212,8 +1212,8 @@ public: Item_func_timestamp(THD *thd, Item *a, Item *b) :Item_datetimefunc(thd, a, b) { } - const char *func_name() const { return "timestamp"; } - bool fix_length_and_dec() + const char *func_name() const override { return "timestamp"; } + bool fix_length_and_dec() override { THD *thd= current_thd; uint dec0= args[0]->datetime_precision(thd); @@ -1222,7 +1222,7 @@ public: maybe_null= true; return false; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { Datetime dt(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd)); if (!dt.is_valid_datetime()) @@ -1233,7 +1233,7 @@ public: return (null_value= Sec6_add(dt.get_mysql_time(), it.get_mysql_time(), 1). to_datetime(ltime)); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1258,21 +1258,21 @@ public: Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg) :Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1) { } - bool fix_length_and_dec(); - const char *func_name() const { return sign > 0 ? "addtime" : "subtime"; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + const char *func_name() const override { return sign > 0 ? "addtime" : "subtime"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timediff :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_time(0, arg_count); } public: Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {} - const char *func_name() const { return "timediff"; } - bool fix_length_and_dec() + const char *func_name() const override { return "timediff"; } + bool fix_length_and_dec() override { THD *thd= current_thd; uint dec= MY_MAX(args[0]->time_precision(thd), @@ -1281,14 +1281,14 @@ public: maybe_null= true; return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_maketime :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2) || args[2]->check_type_can_return_decimal(func_name()); @@ -1297,15 +1297,15 @@ public: Item_func_maketime(THD *thd, Item *a, Item *b, Item *c): Item_timefunc(thd, a, b, c) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_attributes_time(args[2]->decimals); maybe_null= true; return FALSE; } - const char *func_name() const { return "maketime"; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + const char *func_name() const override { return "maketime"; } + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1314,29 +1314,29 @@ class Item_func_microsecond :public Item_long_func_time_field { public: Item_func_microsecond(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "microsecond"; } - bool fix_length_and_dec() + longlong val_int() override; + const char *func_name() const override { return "microsecond"; } + bool fix_length_and_dec() override { decimals=0; maybe_null=1; fix_char_length(6); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timestamp_diff :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_date(0, arg_count); } const interval_type int_type; public: @@ -1345,16 +1345,16 @@ public: public: Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg): Item_longlong_func(thd, a, b), int_type(type_arg) {} - const char *func_name() const { return "timestampdiff"; } - longlong val_int(); - bool fix_length_and_dec() + const char *func_name() const override { return "timestampdiff"; } + longlong val_int() override; + bool fix_length_and_dec() override { decimals=0; maybe_null=1; return FALSE; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1371,17 +1371,17 @@ public: Item_func_get_format(THD *thd, timestamp_type type_arg, Item *a): Item_str_ascii_func(thd, a), type(type_arg) {} - String *val_str_ascii(String *str); - const char *func_name() const { return "get_format"; } - bool fix_length_and_dec() + String *val_str_ascii(String *str) override; + const char *func_name() const override { return "get_format"; } + bool fix_length_and_dec() override { maybe_null= 1; decimals=0; fix_length_and_charset(17, default_charset()); return FALSE; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1399,22 +1399,22 @@ public: {} bool get_date_common(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate, timestamp_type); - const char *func_name() const { return "str_to_date"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const char *func_name() const override { return "str_to_date"; } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_last_day :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name()); } public: Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "last_day"; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + const char *func_name() const override { return "last_day"; } + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1459,7 +1459,7 @@ class Func_handler_date_add_interval_datetime: public Func_handler_date_add_interval { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd), interval_dec(item->arguments()[1], int_type(item))); @@ -1467,7 +1467,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { Datetime::Options opt(TIME_CONV_NONE, thd); Datetime dt(thd, item->arguments()[0], opt); @@ -1486,7 +1486,7 @@ class Func_handler_date_add_interval_datetime_arg0_time: { public: bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const; + MYSQL_TIME *to, date_mode_t fuzzy) const override; }; @@ -1496,7 +1496,7 @@ class Func_handler_date_add_interval_date: { public: bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { /* The first argument is known to be of the DATE data type (not DATETIME). @@ -1518,7 +1518,7 @@ class Func_handler_date_add_interval_time: public Func_handler_date_add_interval { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { uint dec= MY_MAX(item->arguments()[0]->time_precision(current_thd), interval_dec(item->arguments()[1], int_type(item))); @@ -1526,7 +1526,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { Time t(thd, item->arguments()[0]); if (!t.is_valid_time()) @@ -1543,7 +1543,7 @@ class Func_handler_date_add_interval_string: public Func_handler_date_add_interval { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd), interval_dec(item->arguments()[1], int_type(item))); @@ -1555,7 +1555,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { if (item->arguments()[0]-> get_date(thd, to, Datetime::Options(TIME_CONV_NONE, thd)) || @@ -1584,7 +1584,7 @@ public: Func_handler_add_time_datetime(int sign) :Func_handler_sign(sign) { } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { THD *thd= current_thd; uint dec0= item->arguments()[0]->datetime_precision(thd); @@ -1593,7 +1593,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { DBUG_ASSERT(item->is_fixed()); Datetime::Options opt(TIME_CONV_NONE, thd); @@ -1618,7 +1618,7 @@ public: Func_handler_add_time_time(int sign) :Func_handler_sign(sign) { } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { THD *thd= current_thd; uint dec0= item->arguments()[0]->time_precision(thd); @@ -1627,7 +1627,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { DBUG_ASSERT(item->is_fixed()); Time t(thd, item->arguments()[0]); @@ -1651,7 +1651,7 @@ public: Func_handler_add_time_string(int sign) :Func_handler_sign(sign) { } - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { uint dec0= item->arguments()[0]->decimals; uint dec1= Interval_DDhhmmssff::fsp(current_thd, item->arguments()[1]); @@ -1664,7 +1664,7 @@ public: return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { DBUG_ASSERT(item->is_fixed()); // Detect a proper timestamp type based on the argument values @@ -1688,13 +1688,13 @@ class Func_handler_str_to_date_datetime_sec: public Item_handled_func::Handler_datetime { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->fix_attributes_datetime(0); return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { return static_cast(item)-> get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATETIME); @@ -1706,13 +1706,13 @@ class Func_handler_str_to_date_datetime_usec: public Item_handled_func::Handler_datetime { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->fix_attributes_datetime(TIME_SECOND_PART_DIGITS); return false; } bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { return static_cast(item)-> get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATETIME); @@ -1724,7 +1724,7 @@ class Func_handler_str_to_date_date: public Item_handled_func::Handler_date { public: bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { return static_cast(item)-> get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATE); @@ -1736,7 +1736,7 @@ class Func_handler_str_to_date_time: public Item_handled_func::Handler_time { public: bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const + MYSQL_TIME *to, date_mode_t fuzzy) const override { if (static_cast(item)-> get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_TIME)) @@ -1759,7 +1759,7 @@ public: class Func_handler_str_to_date_time_sec: public Func_handler_str_to_date_time { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->fix_attributes_time(0); return false; @@ -1770,7 +1770,7 @@ public: class Func_handler_str_to_date_time_usec: public Func_handler_str_to_date_time { public: - bool fix_length_and_dec(Item_handled_func *item) const + bool fix_length_and_dec(Item_handled_func *item) const override { item->fix_attributes_time(TIME_SECOND_PART_DIGITS); return false; diff --git a/sql/item_vers.h b/sql/item_vers.h index 0799d04a0bc..cff0133ffb3 100644 --- a/sql/item_vers.h +++ b/sql/item_vers.h @@ -33,12 +33,12 @@ public: DBUG_ASSERT(a->type() == Item::FIELD_ITEM); } - virtual bool val_bool(); - virtual longlong val_int() + bool val_bool() override; + longlong val_int() override { return (val_bool() ? 1 : 0); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { maybe_null= 0; null_value= 0; @@ -46,9 +46,9 @@ public: max_length= 1; return FALSE; } - virtual const char* func_name() const { return "is_history"; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + const char* func_name() const override { return "is_history"; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -57,7 +57,7 @@ class Item_func_trt_ts: public Item_datetimefunc TR_table::field_id_t trt_field; public: Item_func_trt_ts(THD *thd, Item* a, TR_table::field_id_t _trt_field); - const char *func_name() const + const char *func_name() const override { if (trt_field == TR_table::FLD_BEGIN_TS) { @@ -65,10 +65,10 @@ public: } return "trt_commit_ts"; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_attributes_datetime(decimals); return FALSE; } }; @@ -84,7 +84,7 @@ public: Item_func_trt_id(THD *thd, Item* a, TR_table::field_id_t _trt_field, bool _backwards= false); Item_func_trt_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _trt_field); - const char *func_name() const + const char *func_name() const override { switch (trt_field) { @@ -100,15 +100,15 @@ public: return NULL; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_int_func::fix_length_and_dec(); max_length= 20; return res; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -119,12 +119,12 @@ protected: public: Item_func_trt_trx_sees(THD *thd, Item* a, Item* b); - const char *func_name() const + const char *func_name() const override { return "trt_trx_sees"; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -137,7 +137,7 @@ public: { accept_eq= true; } - const char *func_name() const + const char *func_name() const override { return "trt_trx_sees_eq"; } diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 99ef738ac69..336ff037fad 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -118,37 +118,37 @@ public: Item_sum_row_number(THD *thd) : Item_sum_int(thd), count(0) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override { return &type_handler_slonglong; } - void clear() + void clear() override { count= 0; } - bool add() + bool add() override { count++; return false; } - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return ROW_NUMBER_FUNC; } - longlong val_int() + longlong val_int() override { return count; } - const char*func_name() const + const char*func_name() const override { return "row_number"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -181,38 +181,38 @@ public: Item_sum_rank(THD *thd) : Item_sum_int(thd), peer_tracker(NULL) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override { return &type_handler_slonglong; } - void clear() + void clear() override { /* This is called on partition start */ cur_rank= 1; row_number= 0; } - bool add(); + bool add() override; - longlong val_int() + longlong val_int() override { return cur_rank; } - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return RANK_FUNC; } - const char*func_name() const + const char*func_name() const override { return "rank"; } - void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_window_func(THD *thd, Window_spec *window_spec) override; - void cleanup() + void cleanup() override { if (peer_tracker) { @@ -221,7 +221,7 @@ public: } Item_sum_int::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -255,35 +255,35 @@ class Item_sum_dense_rank: public Item_sum_int XXX(cvicentiu) This class could potentially be implemented in the rank class, with a switch for the DENSE case. */ - void clear() + void clear() override { dense_rank= 0; first_add= true; } - bool add(); - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} - longlong val_int() + bool add() override; + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} + longlong val_int() override { return dense_rank; } Item_sum_dense_rank(THD *thd) : Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } - enum Sumfunctype sum_func () const + const Type_handler *type_handler() const override { return &type_handler_slonglong; } + enum Sumfunctype sum_func () const override { return DENSE_RANK_FUNC; } - const char*func_name() const + const char*func_name() const override { return "dense_rank"; } - void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_window_func(THD *thd, Window_spec *window_spec) override; - void cleanup() + void cleanup() override { if (peer_tracker) { @@ -292,7 +292,7 @@ class Item_sum_dense_rank: public Item_sum_int } Item_sum_int::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -309,22 +309,22 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid value(NULL) { } - bool add(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + bool add() override; + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; void setup_hybrid(THD *thd, Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *to); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + void reset_field() override; + String *val_str(String *) override; + bool val_native(THD *thd, Native *to) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - void update_field(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void clear() + void update_field() override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + void clear() override { value->clear(); null_value= 1; @@ -345,17 +345,17 @@ class Item_sum_first_value : public Item_sum_hybrid_simple Item_sum_hybrid_simple(thd, arg_expr) {} - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return FIRST_VALUE_FUNC; } - const char*func_name() const + const char*func_name() const override { return "first_value"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -371,17 +371,17 @@ class Item_sum_last_value : public Item_sum_hybrid_simple Item_sum_last_value(THD* thd, Item* arg_expr) : Item_sum_hybrid_simple(thd, arg_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LAST_VALUE_FUNC; } - const char*func_name() const + const char*func_name() const override { return "last_value"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -391,17 +391,17 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple Item_sum_nth_value(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return NTH_VALUE_FUNC; } - const char*func_name() const + const char*func_name() const override { return "nth_value"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -411,17 +411,17 @@ class Item_sum_lead : public Item_sum_hybrid_simple Item_sum_lead(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LEAD_FUNC; } - const char*func_name() const + const char*func_name() const override { return "lead"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -431,17 +431,17 @@ class Item_sum_lag : public Item_sum_hybrid_simple Item_sum_lag(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LAG_FUNC; } - const char*func_name() const + const char*func_name() const override { return "lag"; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -495,7 +495,7 @@ class Item_sum_percent_rank: public Item_sum_double, Item_sum_percent_rank(THD *thd) : Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {} - longlong val_int() + longlong val_int() override { /* Percent rank is a real value so calling the integer value should never @@ -505,7 +505,7 @@ class Item_sum_percent_rank: public Item_sum_double, return 0; } - double val_real() + double val_real() override { /* We can not get the real value without knowing the number of rows @@ -518,43 +518,43 @@ class Item_sum_percent_rank: public Item_sum_double, static_cast(cur_rank - 1) / (partition_rows - 1) : 0; } - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return PERCENT_RANK_FUNC; } - const char*func_name() const + const char*func_name() const override { return "percent_rank"; } - void update_field() {} + void update_field() override {} - void clear() + void clear() override { cur_rank= 1; row_number= 0; } - bool add(); - const Type_handler *type_handler() const { return &type_handler_double; } + bool add() override; + const Type_handler *type_handler() const override { return &type_handler_double; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals = 10; // TODO-cvicentiu find out how many decimals the standard // requires. return FALSE; } - void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_window_func(THD *thd, Window_spec *window_spec) override; - void reset_field() { DBUG_ASSERT(0); } + void reset_field() override { DBUG_ASSERT(0); } - void set_partition_row_count(ulonglong count) + void set_partition_row_count(ulonglong count) override { Partition_row_count::set_partition_row_count(count); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: @@ -563,7 +563,7 @@ class Item_sum_percent_rank: public Item_sum_double, Group_bound_tracker *peer_tracker; - void cleanup() + void cleanup() override { if (peer_tracker) { @@ -596,51 +596,51 @@ class Item_sum_cume_dist: public Item_sum_double, Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { } Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { } - double val_real() + double val_real() override { return calc_val_real(&null_value, current_row_count_); } - bool add() + bool add() override { current_row_count_++; return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return CUME_DIST_FUNC; } - void clear() + void clear() override { current_row_count_= 0; partition_row_count_= 0; } - const char*func_name() const + const char*func_name() const override { return "cume_dist"; } - void update_field() {} - const Type_handler *type_handler() const { return &type_handler_double; } + void update_field() override {} + const Type_handler *type_handler() const override { return &type_handler_double; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals = 10; // TODO-cvicentiu find out how many decimals the standard // requires. return FALSE; } - void reset_field() { DBUG_ASSERT(0); } + void reset_field() override { DBUG_ASSERT(0); } - void set_partition_row_count(ulonglong count) + void set_partition_row_count(ulonglong count) override { Partition_row_count::set_partition_row_count(count); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -654,7 +654,7 @@ class Item_sum_ntile : public Item_sum_int, Item_sum_int(thd, num_quantiles_expr), n_old_val_(0) { } - longlong val_int() + longlong val_int() override { if (get_row_count() == 0) { @@ -681,41 +681,41 @@ class Item_sum_ntile : public Item_sum_int, return (current_row_count_ - 1 - extra_rows) / quantile_size + 1; } - bool add() + bool add() override { current_row_count_++; return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return NTILE_FUNC; } - void clear() + void clear() override { current_row_count_= 0; partition_row_count_= 0; n_old_val_= 0; } - const char*func_name() const + const char*func_name() const override { return "ntile"; } - void update_field() {} + void update_field() override {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override { return &type_handler_slonglong; } - void reset_field() { DBUG_ASSERT(0); } + void reset_field() override { DBUG_ASSERT(0); } - void set_partition_row_count(ulonglong count) + void set_partition_row_count(ulonglong count) override { Partition_row_count::set_partition_row_count(count); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: @@ -734,7 +734,7 @@ public: value(NULL), val_calculated(FALSE), first_call(TRUE), prev_value(0), order_item(NULL){} - double val_real() + double val_real() override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -745,7 +745,7 @@ public: return value->val_real(); } - longlong val_int() + longlong val_int() override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -756,7 +756,7 @@ public: return value->val_int(); } - my_decimal* val_decimal(my_decimal* dec) + my_decimal* val_decimal(my_decimal* dec) override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -767,7 +767,7 @@ public: return value->val_decimal(dec); } - String* val_str(String *str) + String* val_str(String *str) override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -778,7 +778,7 @@ public: return value->val_str(str); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -789,7 +789,7 @@ public: return value->get_date(thd, ltime, fuzzydate); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -800,7 +800,7 @@ public: return value->val_native(thd, to); } - bool add() + bool add() override { Item *arg= get_arg(0); if (arg->is_null()) @@ -841,12 +841,12 @@ public: return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return PERCENTILE_DISC_FUNC; } - void clear() + void clear() override { val_calculated= false; first_call= true; @@ -855,34 +855,34 @@ public: current_row_count_= 0; } - const char*func_name() const + const char*func_name() const override { return "percentile_disc"; } - void update_field() {} - const Type_handler *type_handler() const + void update_field() override {} + const Type_handler *type_handler() const override {return Type_handler_hybrid_field_type::type_handler();} - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals = 10; // TODO-cvicentiu find out how many decimals the standard // requires. return FALSE; } - void reset_field() { DBUG_ASSERT(0); } + void reset_field() override { DBUG_ASSERT(0); } - void set_partition_row_count(ulonglong count) + void set_partition_row_count(ulonglong count) override { Partition_row_count::set_partition_row_count(count); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_window_func(THD *thd, Window_spec *window_spec) override; void setup_hybrid(THD *thd, Item *item); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; private: Item_cache *value; @@ -901,7 +901,7 @@ public: floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0), ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){} - double val_real() + double val_real() override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -928,7 +928,7 @@ public: return ret_val; } - bool add() + bool add() override { Item *arg= get_arg(0); if (arg->is_null()) @@ -978,12 +978,12 @@ public: return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return PERCENTILE_CONT_FUNC; } - void clear() + void clear() override { first_call= true; floor_value->clear(); @@ -994,31 +994,31 @@ public: current_row_count_= 0; } - const char*func_name() const + const char*func_name() const override { return "percentile_cont"; } - void update_field() {} + void update_field() override {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals = 10; // TODO-cvicentiu find out how many decimals the standard // requires. return FALSE; } - void reset_field() { DBUG_ASSERT(0); } + void reset_field() override { DBUG_ASSERT(0); } - void set_partition_row_count(ulonglong count) + void set_partition_row_count(ulonglong count) override { Partition_row_count::set_partition_row_count(count); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_window_func(THD *thd, Window_spec *window_spec) override; void setup_hybrid(THD *thd, Item *item); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; private: Item_cache *floor_value; @@ -1056,7 +1056,7 @@ public: Item_sum *window_func() const { return (Item_sum *) args[0]; } - void update_used_tables(); + void update_used_tables() override; /* This is used by filesort to mark the columns it needs to read (because they @@ -1067,7 +1067,7 @@ public: have been computed. In that case, window function will need to read its temp.table field. In order to allow that, mark that field in the read_set. */ - bool register_field_in_read_map(void *arg) + bool register_field_in_read_map(void *arg) override { TABLE *table= (TABLE*) arg; if (result_field && (result_field->table == table || !table)) @@ -1170,11 +1170,11 @@ public: */ void setup_partition_border_check(THD *thd); - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return ((Item_sum *) args[0])->type_handler(); } - enum Item::Type type() const { return Item::WINDOW_FUNC_ITEM; } + enum Item::Type type() const override { return Item::WINDOW_FUNC_ITEM; } private: /* @@ -1217,7 +1217,7 @@ public: read_value_from_result_field= true; } - bool is_null() + bool is_null() override { if (force_return_blank) return true; @@ -1228,7 +1228,7 @@ public: return window_func()->is_null(); } - double val_real() + double val_real() override { double res; if (force_return_blank) @@ -1249,7 +1249,7 @@ public: return res; } - longlong val_int() + longlong val_int() override { longlong res; if (force_return_blank) @@ -1270,7 +1270,7 @@ public: return res; } - String* val_str(String* str) + String* val_str(String* str) override { String *res; if (force_return_blank) @@ -1293,7 +1293,7 @@ public: return res; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (force_return_blank) return null_value= true; @@ -1302,7 +1302,7 @@ public: return val_native_from_item(thd, window_func(), to); } - my_decimal* val_decimal(my_decimal* dec) + my_decimal* val_decimal(my_decimal* dec) override { my_decimal *res; if (force_return_blank) @@ -1325,7 +1325,7 @@ public: return res; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { bool res; if (force_return_blank) @@ -1349,23 +1349,23 @@ public: } void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); + List &fields, uint flags) override; - bool fix_length_and_dec() + bool fix_length_and_dec() override { Type_std_attributes::set(window_func()); return FALSE; } - const char* func_name() const { return "WF"; } + const char* func_name() const override { return "WF"; } - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; bool resolve_window_name(THD *thd); - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; - Item *get_copy(THD *thd) { return 0; } + Item *get_copy(THD *thd) override { return 0; } }; diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index f6acb7695db..78429e2fe5a 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -141,21 +141,21 @@ public: fltend= (MY_XPATH_FLT*) tmp_native_value.end(); nodeset->length(0); } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_xpath_nodeset; } - const Type_handler *fixed_type_handler() const + const Type_handler *fixed_type_handler() const override { return &type_handler_xpath_nodeset; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { DBUG_ASSERT(0); return NULL; } - String *val_str(String *str) + String *val_str(String *str) override { prepare_nodes(); val_native(current_thd, &tmp2_native_value); @@ -189,7 +189,7 @@ public: } return str; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= MAX_BLOB_WIDTH; collation.collation= pxml->charset(); @@ -198,8 +198,8 @@ public: const_item_cache= false; return FALSE; } - const char *func_name() const { return "nodeset"; } - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "nodeset"; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE); } @@ -213,9 +213,9 @@ class Item_nodeset_func_rootelement :public Item_nodeset_func public: Item_nodeset_func_rootelement(THD *thd, String *pxml): Item_nodeset_func(thd, pxml) {} - const char *func_name() const { return "xpath_rootelement"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_rootelement"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -226,9 +226,9 @@ class Item_nodeset_func_union :public Item_nodeset_func public: Item_nodeset_func_union(THD *thd, Item *a, Item *b, String *pxml): Item_nodeset_func(thd, a, b, pxml) {} - const char *func_name() const { return "xpath_union"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_union"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -242,7 +242,7 @@ public: Item_nodeset_func_axisbyname(THD *thd, Item *a, const char *n_arg, uint l_arg, String *pxml): Item_nodeset_func(thd, a, pxml), node_name(n_arg), node_namelen(l_arg) { } - const char *func_name() const { return "xpath_axisbyname"; } + const char *func_name() const override { return "xpath_axisbyname"; } bool validname(MY_XML_NODE *n) { if (node_name[0] == '*') @@ -260,9 +260,9 @@ public: Item_nodeset_func_selfbyname(THD *thd, Item *a, const char *n_arg, uint l_arg, String *pxml): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {} - const char *func_name() const { return "xpath_selfbyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_selfbyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -274,9 +274,9 @@ public: Item_nodeset_func_childbyname(THD *thd, Item *a, const char *n_arg, uint l_arg, String *pxml): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {} - const char *func_name() const { return "xpath_childbyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_childbyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -290,9 +290,9 @@ public: String *pxml, bool need_self_arg): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml), need_self(need_self_arg) {} - const char *func_name() const { return "xpath_descendantbyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_descendantbyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -306,9 +306,9 @@ public: String *pxml, bool need_self_arg): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml), need_self(need_self_arg) {} - const char *func_name() const { return "xpath_ancestorbyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_ancestorbyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -320,9 +320,9 @@ public: Item_nodeset_func_parentbyname(THD *thd, Item *a, const char *n_arg, uint l_arg, String *pxml): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {} - const char *func_name() const { return "xpath_parentbyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_parentbyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -334,9 +334,9 @@ public: Item_nodeset_func_attributebyname(THD *thd, Item *a, const char *n_arg, uint l_arg, String *pxml): Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {} - const char *func_name() const { return "xpath_attributebyname"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_attributebyname"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -351,9 +351,9 @@ class Item_nodeset_func_predicate :public Item_nodeset_func public: Item_nodeset_func_predicate(THD *thd, Item *a, Item *b, String *pxml): Item_nodeset_func(thd, a, b, pxml) {} - const char *func_name() const { return "xpath_predicate"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_predicate"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -364,9 +364,9 @@ class Item_nodeset_func_elementbyindex :public Item_nodeset_func public: Item_nodeset_func_elementbyindex(THD *thd, Item *a, Item *b, String *pxml): Item_nodeset_func(thd, a, b, pxml) { } - const char *func_name() const { return "xpath_elementbyindex"; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_elementbyindex"; } + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -384,8 +384,8 @@ class Item_xpath_cast_bool :public Item_bool_func public: Item_xpath_cast_bool(THD *thd, Item *a, String *pxml_arg): Item_bool_func(thd, a), pxml(pxml_arg) {} - const char *func_name() const { return "xpath_cast_bool"; } - longlong val_int() + const char *func_name() const override { return "xpath_cast_bool"; } + longlong val_int() override { if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset) { @@ -394,7 +394,7 @@ public: } return args[0]->val_real() ? 1 : 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -406,9 +406,9 @@ class Item_xpath_cast_number :public Item_real_func { public: Item_xpath_cast_number(THD *thd, Item *a): Item_real_func(thd, a) {} - const char *func_name() const { return "xpath_cast_number"; } - virtual double val_real() { return args[0]->val_real(); } - Item *get_copy(THD *thd) + const char *func_name() const override { return "xpath_cast_number"; } + double val_real() override { return args[0]->val_real(); } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -422,12 +422,12 @@ public: Native *native_cache; Item_nodeset_context_cache(THD *thd, Native *native_arg, String *pxml): Item_nodeset_func(thd, pxml), native_cache(native_arg) { } - bool val_native(THD *thd, Native *nodeset) + bool val_native(THD *thd, Native *nodeset) override { return nodeset->copy(*native_cache); } - bool fix_length_and_dec() { max_length= MAX_BLOB_WIDTH;; return FALSE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { max_length= MAX_BLOB_WIDTH;; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -439,16 +439,16 @@ class Item_func_xpath_position :public Item_long_func public: Item_func_xpath_position(THD *thd, Item *a, String *p): Item_long_func(thd, a), pxml(p) {} - const char *func_name() const { return "xpath_position"; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int() + const char *func_name() const override { return "xpath_position"; } + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override { args[0]->val_native(current_thd, &tmp_native_value); if (tmp_native_value.elements() == 1) return tmp_native_value.element(0).pos + 1; return 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -460,9 +460,9 @@ class Item_func_xpath_count :public Item_long_func public: Item_func_xpath_count(THD *thd, Item *a, String *p): Item_long_func(thd, a), pxml(p) {} - const char *func_name() const { return "xpath_count"; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int() + const char *func_name() const override { return "xpath_count"; } + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override { uint predicate_supplied_context_size; args[0]->val_native(current_thd, &tmp_native_value); @@ -471,7 +471,7 @@ public: return predicate_supplied_context_size; return tmp_native_value.elements(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -484,8 +484,8 @@ public: Item_func_xpath_sum(THD *thd, Item *a, String *p): Item_real_func(thd, a), pxml(p) {} - const char *func_name() const { return "xpath_sum"; } - double val_real() + const char *func_name() const override { return "xpath_sum"; } + double val_real() override { double sum= 0; args[0]->val_native(current_thd, &tmp_native_value); @@ -516,7 +516,7 @@ public: } return sum; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -531,13 +531,13 @@ public: CHARSET_INFO *cs): Item_string(thd, str, length, cs) { } - bool const_item() const { return false ; } - bool basic_const_item() const { return false; } + bool const_item() const override { return false ; } + bool basic_const_item() const override { return false; } void set_value(const char *str, uint length, CHARSET_INFO *cs) { str_value.set(str, length, cs); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { /* Item_string::safe_charset_converter() does not accept non-constants. @@ -556,18 +556,18 @@ public: Item_nodeset_to_const_comparator(THD *thd, Item *nodeset, Item *cmpfunc, String *p): Item_bool_func(thd, nodeset, cmpfunc), pxml(p) {} - const char *func_name() const { return "xpath_nodeset_to_const_comparator"; } - bool check_vcol_func_processor(void *arg) + const char *func_name() const override { return "xpath_nodeset_to_const_comparator"; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE); } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { DBUG_ASSERT(0); return NULL; } - longlong val_int() + longlong val_int() override { Item_func *comp= (Item_func*)args[1]; Item_string_xml_non_const *fake= @@ -598,7 +598,7 @@ public: } return 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 806739d1139..992d09b9c74 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -117,9 +117,9 @@ public: { maybe_null= TRUE; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - bool const_item() const + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + bool const_item() const override { return const_item_cache && (!nodeset_func || nodeset_func->const_item()); } @@ -131,9 +131,9 @@ class Item_func_xml_extractvalue: public Item_xml_str_func public: Item_func_xml_extractvalue(THD *thd, Item *a, Item *b): Item_xml_str_func(thd, a, b) {} - const char *func_name() const { return "extractvalue"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "extractvalue"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -148,9 +148,9 @@ class Item_func_xml_update: public Item_xml_str_func public: Item_func_xml_update(THD *thd, Item *a, Item *b, Item *c): Item_xml_str_func(thd, a, b, c) {} - const char *func_name() const { return "updatexml"; } - String *val_str(String *); - Item *get_copy(THD *thd) + const char *func_name() const override { return "updatexml"; } + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/keycaches.cc b/sql/keycaches.cc index 10bec7c1de8..d0ad1c5f56a 100644 --- a/sql/keycaches.cc +++ b/sql/keycaches.cc @@ -48,7 +48,7 @@ public: { return length == name_length && !memcmp(name, name_cmp, length); } - ~NAMED_ILINK() + ~NAMED_ILINK() override { my_free((void *) name); } diff --git a/sql/log.cc b/sql/log.cc index b065657e9a5..52543562737 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -210,14 +210,14 @@ public: m_message[0]= '\0'; } - virtual ~Silence_log_table_errors() = default; + ~Silence_log_table_errors() override = default; - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sql_state, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; const char *message() const { return m_message; } }; diff --git a/sql/log.h b/sql/log.h index 454f0ff63b7..843442bcb56 100644 --- a/sql/log.h +++ b/sql/log.h @@ -101,25 +101,25 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging { public: TC_LOG_DUMMY() = default; - int open(const char *opt_name) { return 0; } - void close() { } + int open(const char *opt_name) override { return 0; } + void close() override { } /* TC_LOG_DUMMY is only used when there are <= 1 XA-capable engines, and we only use internal XA during commit when >= 2 XA-capable engines participate. */ int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered) + bool need_prepare_ordered, bool need_commit_ordered) override { DBUG_ASSERT(0); return 1; } - int unlog(ulong cookie, my_xid xid) { return 0; } - int unlog_xa_prepare(THD *thd, bool all) + int unlog(ulong cookie, my_xid xid) override { return 0; } + int unlog_xa_prepare(THD *thd, bool all) override { return 0; } - void commit_checkpoint_notify(void *cookie) { DBUG_ASSERT(0); }; + void commit_checkpoint_notify(void *cookie) override { DBUG_ASSERT(0); }; }; #define TC_LOG_PAGE_SIZE 8192 @@ -197,16 +197,16 @@ class TC_LOG_MMAP: public TC_LOG public: TC_LOG_MMAP(): inited(0), pending_checkpoint(0) {} - int open(const char *opt_name); - void close(); + int open(const char *opt_name) override; + void close() override; int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered); - int unlog(ulong cookie, my_xid xid); - int unlog_xa_prepare(THD *thd, bool all) + bool need_prepare_ordered, bool need_commit_ordered) override; + int unlog(ulong cookie, my_xid xid) override; + int unlog_xa_prepare(THD *thd, bool all) override { return 0; } - void commit_checkpoint_notify(void *cookie); + void commit_checkpoint_notify(void *cookie) override; int recover(); private: @@ -720,15 +720,15 @@ public: } #endif - int open(const char *opt_name); - void close(); - virtual int generate_new_name(char *new_name, const char *log_name, - ulong next_log_number); + int open(const char *opt_name) override; + void close() override; + int generate_new_name(char *new_name, const char *log_name, + ulong next_log_number) override; int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered); - int unlog(ulong cookie, my_xid xid); - int unlog_xa_prepare(THD *thd, bool all); - void commit_checkpoint_notify(void *cookie); + bool need_prepare_ordered, bool need_commit_ordered) override; + int unlog(ulong cookie, my_xid xid) override; + int unlog_xa_prepare(THD *thd, bool all) override; + void commit_checkpoint_notify(void *cookie) override; int recover(LOG_INFO *linfo, const char *last_log_name, IO_CACHE *first_log, Format_description_log_event *fdle, bool do_xa); int do_binlog_recovery(const char *opt_name, bool do_xa_recovery); @@ -1017,19 +1017,19 @@ class Log_to_csv_event_handler: public Log_event_handler public: Log_to_csv_event_handler(); ~Log_to_csv_event_handler(); - virtual bool init(); - virtual void cleanup(); + bool init() override; + void cleanup() override; - virtual bool log_slow(THD *thd, my_hrtime_t current_time, + bool log_slow(THD *thd, my_hrtime_t current_time, const char *user_host, size_t user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len); - virtual bool log_error(enum loglevel level, const char *format, - va_list args); - virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, + const char *sql_text, size_t sql_text_len) override; + bool log_error(enum loglevel level, const char *format, + va_list args) override; + bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, const char *command_type, size_t command_type_len, const char *sql_text, size_t sql_text_len, - CHARSET_INFO *client_cs); + CHARSET_INFO *client_cs) override; int activate_log(THD *thd, uint log_type); }; @@ -1047,19 +1047,19 @@ class Log_to_file_event_handler: public Log_event_handler public: Log_to_file_event_handler(): is_initialized(FALSE) {} - virtual bool init(); - virtual void cleanup(); + bool init() override; + void cleanup() override; - virtual bool log_slow(THD *thd, my_hrtime_t current_time, + bool log_slow(THD *thd, my_hrtime_t current_time, const char *user_host, size_t user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len); - virtual bool log_error(enum loglevel level, const char *format, - va_list args); - virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, + const char *sql_text, size_t sql_text_len) override; + bool log_error(enum loglevel level, const char *format, + va_list args) override; + bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, const char *command_type, size_t command_type_len, const char *sql_text, size_t sql_text_len, - CHARSET_INFO *client_cs); + CHARSET_INFO *client_cs) override; void flush(); void init_pthread_objects(); MYSQL_QUERY_LOG *get_mysql_slow_log() { return &mysql_slow_log; } diff --git a/sql/log_event.h b/sql/log_event.h index afe4862f152..5cd061df110 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -917,7 +917,7 @@ typedef struct st_print_event_info fflush(file); } } PRINT_EVENT_INFO; -#endif +#endif // MYSQL_CLIENT /** This class encapsulates writing of Log_event objects to IO_CACHE. @@ -2124,13 +2124,13 @@ public: Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, bool using_trans, bool direct, bool suppress_use, int error); - const char* get_db() { return db; } + const char* get_db() override { return db; } #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else bool print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Query_log_event(); @@ -2142,14 +2142,14 @@ public: if (data_buf) my_free(data_buf); } - Log_event_type get_type_code() { return QUERY_EVENT; } + Log_event_type get_type_code() override { return QUERY_EVENT; } static int dummy_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); static int begin_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); #ifdef MYSQL_SERVER - bool write(); + bool write() override; virtual bool write_post_header_for_derived() { return FALSE; } #endif - bool is_valid() const { return query != 0; } + bool is_valid() const override { return query != 0; } /* Returns number of bytes additionally written to post header by derived @@ -2160,8 +2160,8 @@ public: public: /* !!! Public in this patch to allow old usage */ #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); - virtual int do_apply_event(rpl_group_info *rgi); + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; + int do_apply_event(rpl_group_info *rgi) override; int do_apply_event(rpl_group_info *rgi, const char *query_arg, @@ -2208,21 +2208,21 @@ public: if (query_buf) my_free(query_buf); } - Log_event_type get_type_code() { return QUERY_COMPRESSED_EVENT; } + Log_event_type get_type_code() override { return QUERY_COMPRESSED_EVENT; } /* the min length of log_bin_compress_min_len is 10, means that Begin/Commit/Rollback would never be compressed! */ - virtual bool is_begin() { return false; } - virtual bool is_commit() { return false; } - virtual bool is_rollback() { return false; } + bool is_begin() override { return false; } + bool is_commit() override { return false; } + bool is_rollback() override { return false; } #ifdef MYSQL_SERVER Query_compressed_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans, bool direct, bool suppress_use, int error); - virtual bool write(); + bool write() override; #endif }; @@ -2532,12 +2532,12 @@ public: bool using_trans); void set_fields(const char* db, List &fields_arg, Name_resolution_context *context); - const char* get_db() { return db; } + const char* get_db() override { return db; } #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented); #endif @@ -2550,16 +2550,16 @@ public: Load_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event); ~Load_log_event() = default; - Log_event_type get_type_code() + Log_event_type get_type_code() override { return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT; } #ifdef MYSQL_SERVER - bool write_data_header(); - bool write_data_body(); + bool write_data_header() override; + bool write_data_body() override; #endif - bool is_valid() const { return table_name != 0; } - int get_data_size() + bool is_valid() const override { return table_name != 0; } + int get_data_size() override { return (table_name_len + db_len + 2 + fname_len + LOAD_HEADER_LEN @@ -2568,7 +2568,7 @@ public: public: /* !!! Public in this patch to allow old usage */ #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi) + int do_apply_event(rpl_group_info *rgi) override { return do_apply_event(thd->slave_net,rgi,0); } @@ -2630,32 +2630,32 @@ public: #ifdef MYSQL_SERVER Start_log_event_v3(); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else Start_log_event_v3() = default; - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Start_log_event_v3(const char* buf, uint event_len, const Format_description_log_event* description_event); ~Start_log_event_v3() = default; - Log_event_type get_type_code() { return START_EVENT_V3;} - my_off_t get_header_len(my_off_t l __attribute__((unused))) + Log_event_type get_type_code() override { return START_EVENT_V3;} + my_off_t get_header_len(my_off_t l __attribute__((unused))) override { return LOG_EVENT_MINIMAL_HEADER_LEN; } #ifdef MYSQL_SERVER - bool write(); + bool write() override; #endif - bool is_valid() const { return server_version[0] != 0; } - int get_data_size() + bool is_valid() const override { return server_version[0] != 0; } + int get_data_size() override { return START_V3_HEADER_LEN; //no variable-sized part } protected: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info*) + int do_apply_event(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info*) override { /* Events from ourself should be skipped, but they should not @@ -2693,7 +2693,7 @@ public: memcpy(nonce, nonce_arg, BINLOG_NONCE_LENGTH); } - bool write_data_body() + bool write_data_body() override { uchar scheme_buf= crypto_scheme; uchar key_version_buf[BINLOG_KEY_VERSION_LENGTH]; @@ -2703,18 +2703,18 @@ public: write_data(nonce, BINLOG_NONCE_LENGTH); } #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Start_encryption_log_event( const char* buf, uint event_len, const Format_description_log_event* description_event); - bool is_valid() const { return crypto_scheme == 1; } + bool is_valid() const override { return crypto_scheme == 1; } - Log_event_type get_type_code() { return START_ENCRYPTION_EVENT; } + Log_event_type get_type_code() override { return START_ENCRYPTION_EVENT; } - int get_data_size() + int get_data_size() override { return BINLOG_CRYPTO_SCHEME_LENGTH + BINLOG_KEY_VERSION_LENGTH + BINLOG_NONCE_LENGTH; @@ -2726,9 +2726,9 @@ public: protected: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info* rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info* rgi) + int do_apply_event(rpl_group_info* rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info* rgi) override { return Log_event::EVENT_SKIP_NOT; } @@ -2819,9 +2819,9 @@ public: { my_free(post_header_len); } - Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} + Log_event_type get_type_code() override { return FORMAT_DESCRIPTION_EVENT;} #ifdef MYSQL_SERVER - bool write(); + bool write() override; #endif bool header_is_valid() const { @@ -2830,12 +2830,12 @@ public: (post_header_len != NULL)); } - bool is_valid() const + bool is_valid() const override { return header_is_valid() && server_version_split.version_is_valid(); } - int get_data_size() + int get_data_size() override { /* The vector of post-header lengths is considered as part of the @@ -2861,9 +2861,9 @@ public: static bool is_version_before_checksum(const master_version_split *version_split); protected: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -2921,29 +2921,31 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg, cache_type= Log_event::EVENT_NO_CACHE; } #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Intvar_log_event(const char* buf, const Format_description_log_event *description_event); ~Intvar_log_event() = default; - Log_event_type get_type_code() { return INTVAR_EVENT;} + Log_event_type get_type_code() override { return INTVAR_EVENT;} const char* get_var_type_name(); - int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;} + int get_data_size() override { return 9; /* sizeof(type) + sizeof(val) */;} #ifdef MYSQL_SERVER - bool write(); + bool write() override; +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } #endif - bool is_valid() const { return 1; } - bool is_part_of_group() { return 1; } +#endif + bool is_valid() const override { return 1; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -3002,28 +3004,30 @@ class Rand_log_event: public Log_event cache_type= Log_event::EVENT_NO_CACHE; } #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Rand_log_event(const char* buf, const Format_description_log_event *description_event); ~Rand_log_event() = default; - Log_event_type get_type_code() { return RAND_EVENT;} - int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ } + Log_event_type get_type_code() override { return RAND_EVENT;} + int get_data_size() override { return 16; /* sizeof(ulonglong) * 2*/ } #ifdef MYSQL_SERVER - bool write(); + bool write() override; +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } #endif - bool is_valid() const { return 1; } - bool is_part_of_group() { return 1; } +#endif + bool is_valid() const override { return 1; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -3040,14 +3044,14 @@ public: Log_event(buf, description_event) {} ~Xid_apply_log_event() {} - bool is_valid() const { return 1; } + bool is_valid() const override { return 1; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) virtual int do_commit()= 0; - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; int do_record_gtid(THD *thd, rpl_group_info *rgi, bool in_trans, void **out_hton, bool force_err= false); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; virtual const char* get_query()= 0; #endif }; @@ -3077,29 +3081,29 @@ public: if (direct) cache_type= Log_event::EVENT_NO_CACHE; } - const char* get_query() +#ifdef HAVE_REPLICATION + const char* get_query() override { return "COMMIT /* implicit, from Xid_log_event */"; } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Xid_log_event(const char* buf, const Format_description_log_event *description_event); ~Xid_log_event() = default; - Log_event_type get_type_code() { return XID_EVENT;} - int get_data_size() { return sizeof(xid); } + Log_event_type get_type_code() override { return XID_EVENT;} + int get_data_size() override { return sizeof(xid); } #ifdef MYSQL_SERVER - bool write(); + bool write() override; #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - int do_commit(); + int do_commit() override; #endif }; @@ -3228,30 +3232,30 @@ public: cache_type= Log_event::EVENT_NO_CACHE; } #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif XA_prepare_log_event(const char* buf, const Format_description_log_event *description_event); ~XA_prepare_log_event() {} - Log_event_type get_type_code() { return XA_PREPARE_LOG_EVENT; } - bool is_valid() const { return m_xid.formatID != -1; } - int get_data_size() + Log_event_type get_type_code() override { return XA_PREPARE_LOG_EVENT; } + bool is_valid() const override { return m_xid.formatID != -1; } + int get_data_size() override { return xid_subheader_no_data + m_xid.gtrid_length + m_xid.bqual_length; } #ifdef MYSQL_SERVER - bool write(); + bool write() override; #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) char query[sizeof("XA COMMIT ONE PHASE") + 1 + ser_buf_size]; - int do_commit(); - const char* get_query() + int do_commit() override; + const char* get_query() override { sprintf(query, (one_phase ? "XA COMMIT %s ONE PHASE" : "XA PREPARE %s"), @@ -3297,17 +3301,19 @@ public: if (direct) cache_type= Log_event::EVENT_NO_CACHE; } - void pack_info(Protocol* protocol); +#ifdef HAVE_REPLICATION + void pack_info(Protocol* protocol) override; +#endif #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif User_var_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); ~User_var_log_event() = default; - Log_event_type get_type_code() { return USER_VAR_EVENT;} + Log_event_type get_type_code() override { return USER_VAR_EVENT;} #ifdef MYSQL_SERVER - bool write(); + bool write() override; /* Getter and setter for deferred User-event. Returns true if the event is not applied directly @@ -3319,15 +3325,17 @@ public: and the parsing time query id is stored to be used at applying time. */ void set_deferred(query_id_t qid) { deferred= true; query_id= qid; } +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } #endif - bool is_valid() const { return name != 0; } - bool is_part_of_group() { return 1; } +#endif + bool is_valid() const override { return name != 0; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -3347,7 +3355,7 @@ public: Stop_log_event() :Log_event() {} #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Stop_log_event(const char* buf, @@ -3355,13 +3363,13 @@ public: Log_event(buf, description_event) {} ~Stop_log_event() = default; - Log_event_type get_type_code() { return STOP_EVENT;} - bool is_valid() const { return 1; } + Log_event_type get_type_code() override { return STOP_EVENT;} + bool is_valid() const override { return 1; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi) + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override { /* Events from ourself should be skipped, but they should not @@ -3440,10 +3448,10 @@ public: uint ident_len_arg, ulonglong pos_arg, uint flags); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Rotate_log_event(const char* buf, uint event_len, @@ -3453,19 +3461,19 @@ public: if (flags & DUP_NAME) my_free((void*) new_log_ident); } - Log_event_type get_type_code() { return ROTATE_EVENT;} - my_off_t get_header_len(my_off_t l __attribute__((unused))) + Log_event_type get_type_code() override { return ROTATE_EVENT;} + my_off_t get_header_len(my_off_t l __attribute__((unused))) override { return LOG_EVENT_MINIMAL_HEADER_LEN; } - int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} - bool is_valid() const { return new_log_ident != 0; } + int get_data_size() override { return ident_len + ROTATE_HEADER_LEN;} + bool is_valid() const override { return new_log_ident != 0; } #ifdef MYSQL_SERVER - bool write(); + bool write() override; #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -3480,20 +3488,22 @@ public: Binlog_checkpoint_log_event(const char *binlog_file_name_arg, uint binlog_file_len_arg); #ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); + void pack_info(Protocol *protocol) override; #endif #else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif Binlog_checkpoint_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); ~Binlog_checkpoint_log_event() { my_free(binlog_file_name); } - Log_event_type get_type_code() { return BINLOG_CHECKPOINT_EVENT;} - int get_data_size() { return binlog_file_len + BINLOG_CHECKPOINT_HEADER_LEN;} - bool is_valid() const { return binlog_file_name != 0; } + Log_event_type get_type_code() override { return BINLOG_CHECKPOINT_EVENT;} + int get_data_size() override { return binlog_file_len + BINLOG_CHECKPOINT_HEADER_LEN;} + bool is_valid() const override { return binlog_file_name != 0; } #ifdef MYSQL_SERVER - bool write(); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); + bool write() override; +#ifdef HAVE_REPLICATION + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; +#endif #endif }; @@ -3610,26 +3620,26 @@ public: Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone, uint16 flags, bool is_transactional, uint64 commit_id); #ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + void pack_info(Protocol *protocol) override; + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif #else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif Gtid_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); ~Gtid_log_event() = default; - Log_event_type get_type_code() { return GTID_EVENT; } - enum_logged_status logged_status() { return LOGGED_NO_DATA; } - int get_data_size() + Log_event_type get_type_code() override { return GTID_EVENT; } + enum_logged_status logged_status() override { return LOGGED_NO_DATA; } + int get_data_size() override { return GTID_HEADER_LEN + ((flags2 & FL_GROUP_COMMIT_ID) ? 2 : 0); } - bool is_valid() const { return seq_no != 0; } + bool is_valid() const override { return seq_no != 0; } #ifdef MYSQL_SERVER - bool write(); + bool write() override; static int make_compatible_event(String *packet, bool *need_dummy_event, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); static bool peek(const char *event_start, size_t event_len, @@ -3727,16 +3737,16 @@ public: Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags); #ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); + void pack_info(Protocol *protocol) override; #endif #else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif Gtid_list_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); ~Gtid_list_log_event() { my_free(list); my_free(sub_id_list); } - Log_event_type get_type_code() { return GTID_LIST_EVENT; } - int get_data_size() { + Log_event_type get_type_code() override { return GTID_LIST_EVENT; } + int get_data_size() override { /* Replacing with dummy event, needed for older slaves, requires a minimum of 6 bytes in the body. @@ -3744,12 +3754,12 @@ public: return (count==0 ? GTID_LIST_HEADER_LEN+2 : GTID_LIST_HEADER_LEN+count*element_size); } - bool is_valid() const { return list != NULL; } + bool is_valid() const override { return list != NULL; } #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) bool to_packet(String *packet); - bool write(); - virtual int do_apply_event(rpl_group_info *rgi); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); + bool write() override; + int do_apply_event(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif static bool peek(const char *event_start, size_t event_len, enum enum_binlog_checksum_alg checksum_alg, @@ -3791,10 +3801,10 @@ public: uchar* block_arg, uint block_len_arg, bool using_trans); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local); #endif @@ -3806,20 +3816,20 @@ public: my_free((void*) event_buf); } - Log_event_type get_type_code() + Log_event_type get_type_code() override { return fake_base ? Load_log_event::get_type_code() : CREATE_FILE_EVENT; } - int get_data_size() + int get_data_size() override { return (fake_base ? Load_log_event::get_data_size() : Load_log_event::get_data_size() + 4 + 1 + block_len); } - bool is_valid() const { return inited_from_old || block != 0; } + bool is_valid() const override { return inited_from_old || block != 0; } #ifdef MYSQL_SERVER - bool write_data_header(); - bool write_data_body(); + bool write_data_header() override; + bool write_data_body() override; /* Cut out Create_file extensions and write it as Load event - used on the slave @@ -3829,7 +3839,7 @@ public: private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif }; @@ -3863,28 +3873,28 @@ public: Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg, uint block_len_arg, bool using_trans); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; virtual int get_create_or_append() const; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Append_block_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); ~Append_block_log_event() = default; - Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;} - int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;} - bool is_valid() const { return block != 0; } + Log_event_type get_type_code() override { return APPEND_BLOCK_EVENT;} + int get_data_size() override { return block_len + APPEND_BLOCK_HEADER_LEN ;} + bool is_valid() const override { return block != 0; } #ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } + bool write() override; + const char* get_db() override { return db; } #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif }; @@ -3904,10 +3914,10 @@ public: #ifdef MYSQL_SERVER Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local); #endif @@ -3915,17 +3925,17 @@ public: Delete_file_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event); ~Delete_file_log_event() = default; - Log_event_type get_type_code() { return DELETE_FILE_EVENT;} - int get_data_size() { return DELETE_FILE_HEADER_LEN ;} - bool is_valid() const { return file_id != 0; } + Log_event_type get_type_code() override { return DELETE_FILE_EVENT;} + int get_data_size() override { return DELETE_FILE_HEADER_LEN ;} + bool is_valid() const override { return file_id != 0; } #ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } + bool write() override; + const char* get_db() override { return db; } #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif }; @@ -3945,27 +3955,27 @@ public: #ifdef MYSQL_SERVER Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; #endif Execute_load_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); ~Execute_load_log_event() = default; - Log_event_type get_type_code() { return EXEC_LOAD_EVENT;} - int get_data_size() { return EXEC_LOAD_HEADER_LEN ;} - bool is_valid() const { return file_id != 0; } + Log_event_type get_type_code() override { return EXEC_LOAD_EVENT;} + int get_data_size() override { return EXEC_LOAD_HEADER_LEN ;} + bool is_valid() const override { return file_id != 0; } #ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } + bool write() override; + const char* get_db() override { return db; } #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif }; @@ -3988,17 +3998,17 @@ public: bool using_trans); #ifdef HAVE_REPLICATION Begin_load_query_log_event(THD* thd); - int get_create_or_append() const; + int get_create_or_append() const override; #endif /* HAVE_REPLICATION */ #endif Begin_load_query_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); ~Begin_load_query_log_event() = default; - Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; } + Log_event_type get_type_code() override { return BEGIN_LOAD_QUERY_EVENT; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif }; @@ -4041,10 +4051,10 @@ public: bool using_trans, bool direct, bool suppress_use, int errcode); #ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); + void pack_info(Protocol* protocol) override; #endif /* HAVE_REPLICATION */ #else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; /* Prints the query as LOAD DATA LOCAL and with rewritten filename */ bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, const char *local_fname); @@ -4054,17 +4064,17 @@ public: *description_event); ~Execute_load_query_log_event() = default; - Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; } - bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; } + Log_event_type get_type_code() override { return EXECUTE_LOAD_QUERY_EVENT; } + bool is_valid() const override { return Query_log_event::is_valid() && file_id != 0; } - ulong get_post_header_size_for_derived(); + ulong get_post_header_size_for_derived() override; #ifdef MYSQL_SERVER - bool write_post_header_for_derived(); + bool write_post_header_for_derived() override; #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif }; @@ -4091,9 +4101,9 @@ public: /* constructor for hopelessly corrupted events */ Unknown_log_event(): Log_event(), what(ENCRYPTED) {} ~Unknown_log_event() = default; - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - Log_event_type get_type_code() { return UNKNOWN_EVENT;} - bool is_valid() const { return 1; } + bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) override; + Log_event_type get_type_code() override { return UNKNOWN_EVENT;} + bool is_valid() const override { return 1; } }; #endif char *str_to_hex(char *to, const char *from, size_t len); @@ -4120,30 +4130,32 @@ public: const Format_description_log_event*); ~Annotate_rows_log_event(); - virtual int get_data_size(); - virtual Log_event_type get_type_code(); - enum_logged_status logged_status() { return LOGGED_NO_DATA; } - virtual bool is_valid() const; - virtual bool is_part_of_group() { return 1; } + int get_data_size() override; + Log_event_type get_type_code() override; + enum_logged_status logged_status() override { return LOGGED_NO_DATA; } + bool is_valid() const override; #ifndef MYSQL_CLIENT - virtual bool write_data_header(); - virtual bool write_data_body(); +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } +#endif + bool write_data_header() override; + bool write_data_body() override; #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol*); + void pack_info(Protocol*) override; #endif #ifdef MYSQL_CLIENT - virtual bool print(FILE*, PRINT_EVENT_INFO*); + bool print(FILE*, PRINT_EVENT_INFO*) override; #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) private: - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info*); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info*) override; #endif private: @@ -4785,33 +4797,35 @@ public: const char *get_table_name() const { return m_tblnam; } const char *get_db_name() const { return m_dbnam; } - virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; } - virtual enum_logged_status logged_status() { return LOGGED_TABLE_MAP; } - virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ } - virtual bool is_part_of_group() { return 1; } + Log_event_type get_type_code() override { return TABLE_MAP_EVENT; } + enum_logged_status logged_status() override { return LOGGED_TABLE_MAP; } + bool is_valid() const override { return m_memory != NULL; /* we check malloc */ } - virtual int get_data_size() { return (uint) m_data_size; } + int get_data_size() override { return (uint) m_data_size; } #ifdef MYSQL_SERVER +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } +#endif virtual int save_field_metadata(); - virtual bool write_data_header(); - virtual bool write_data_body(); - virtual const char *get_db() { return m_dbnam; } + bool write_data_header() override; + bool write_data_body() override; + const char *get_db() override { return m_dbnam; } #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); + void pack_info(Protocol *protocol) override; #endif #ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; #endif #ifdef MYSQL_SERVER @@ -4961,17 +4975,17 @@ public: flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; } void update_flags() { int2store(temp_buf + m_flags_pos, m_flags); } - Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */ - enum_logged_status logged_status() { return LOGGED_ROW_EVENT; } + Log_event_type get_type_code() override { return m_type; } /* Specific type (_V1 etc) */ + enum_logged_status logged_status() override { return LOGGED_ROW_EVENT; } virtual Log_event_type get_general_type_code() = 0; /* General rows op type, no version */ #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); + void pack_info(Protocol *protocol) override; #endif #ifdef MYSQL_CLIENT /* not for direct call, each derived has its own ::print() */ - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override= 0; void change_to_flashback_event(PRINT_EVENT_INFO *print_event_info, uchar *rows_buff, Log_event_type ev_type); bool print_verbose(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info); @@ -4996,7 +5010,7 @@ public: #endif /* Member functions to implement superclass interface */ - virtual int get_data_size(); + int get_data_size() override; MY_BITMAP const *get_cols() const { return &m_cols; } MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; } @@ -5052,10 +5066,13 @@ public: #endif #ifdef MYSQL_SERVER - virtual bool write_data_header(); - virtual bool write_data_body(); + bool write_data_header() override; + bool write_data_body() override; virtual bool write_compressed(); - virtual const char *get_db() { return m_table->s->db.str; } + const char *get_db() override { return m_table->s->db.str; } +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return get_flags(STMT_END_F) != 0; } +#endif #endif /* Check that malloc() succeeded in allocating memory for the rows @@ -5063,11 +5080,10 @@ public: is valid is done in the Update_rows_log_event::is_valid() function. */ - virtual bool is_valid() const + bool is_valid() const override { return m_rows_buf && m_cols.bitmap; } - bool is_part_of_group() { return get_flags(STMT_END_F) != 0; } uint m_row_count; /* The number of rows added to the event */ @@ -5200,9 +5216,9 @@ protected: private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; /* Primitive to prepare for a sequence of row executions. @@ -5298,20 +5314,20 @@ public: #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() override; #endif private: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() override { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif }; @@ -5321,7 +5337,7 @@ public: #if defined(MYSQL_SERVER) Write_rows_compressed_log_event(THD*, TABLE*, ulong table_id, bool is_transactional); - virtual bool write(); + bool write() override; #endif #ifdef HAVE_REPLICATION Write_rows_compressed_log_event(const char *buf, uint event_len, @@ -5329,7 +5345,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; @@ -5380,26 +5396,26 @@ public: } #endif - virtual bool is_valid() const + bool is_valid() const override { return Rows_log_event::is_valid() && m_cols_ai.bitmap; } #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() override; #endif protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() override { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */ }; @@ -5409,7 +5425,7 @@ public: #if defined(MYSQL_SERVER) Update_rows_compressed_log_event(THD*, TABLE*, ulong table_id, bool is_transactional); - virtual bool write(); + bool write() override; #endif #ifdef HAVE_REPLICATION Update_rows_compressed_log_event(const char *buf, uint event_len, @@ -5417,7 +5433,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; @@ -5471,20 +5487,20 @@ public: #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() override; #endif protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() override { return (Log_event_type)TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif }; @@ -5493,7 +5509,7 @@ class Delete_rows_compressed_log_event : public Delete_rows_log_event public: #if defined(MYSQL_SERVER) Delete_rows_compressed_log_event(THD*, TABLE*, ulong, bool is_transactional); - virtual bool write(); + bool write() override; #endif #ifdef HAVE_REPLICATION Delete_rows_compressed_log_event(const char *buf, uint event_len, @@ -5501,7 +5517,7 @@ public: #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; @@ -5584,10 +5600,11 @@ public: #endif #ifdef MYSQL_SERVER - void pack_info(Protocol*); - - virtual bool write_data_header(); - virtual bool write_data_body(); +#ifdef HAVE_REPLICATION + void pack_info(Protocol*) override; +#endif + bool write_data_header() override; + bool write_data_body() override; #endif Incident_log_event(const char *buf, uint event_len, @@ -5596,20 +5613,20 @@ public: virtual ~Incident_log_event(); #ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; #endif - virtual Log_event_type get_type_code() { return INCIDENT_EVENT; } + Log_event_type get_type_code() override { return INCIDENT_EVENT; } - virtual bool is_valid() const + bool is_valid() const override { return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; } - virtual int get_data_size() { + int get_data_size() override { return INCIDENT_HEADER_LEN + 1 + (uint) m_message.length; } @@ -5659,18 +5676,18 @@ public: virtual ~Ignorable_log_event(); #ifndef MYSQL_CLIENT - void pack_info(Protocol*); +#ifdef HAVE_REPLICATION + void pack_info(Protocol*) override; +#endif +#else + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif -#ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif + Log_event_type get_type_code() override { return IGNORABLE_LOG_EVENT; } - virtual Log_event_type get_type_code() { return IGNORABLE_LOG_EVENT; } + bool is_valid() const override { return 1; } - virtual bool is_valid() const { return 1; } - - virtual int get_data_size() { return IGNORABLE_HEADER_LEN; } + int get_data_size() override { return IGNORABLE_HEADER_LEN; } }; #ifdef MYSQL_CLIENT @@ -5708,8 +5725,8 @@ public: uint8 hb_flags; Heartbeat_log_event(const char* buf, ulong event_len, const Format_description_log_event* description_event); - Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; } - bool is_valid() const + Log_event_type get_type_code() override { return HEARTBEAT_LOG_EVENT; } + bool is_valid() const override { return (log_ident != NULL && ident_len <= FN_REFLEN-1 && log_pos >= BIN_LOG_HEADER_SIZE); diff --git a/sql/log_event_old.h b/sql/log_event_old.h index 3a11313a31f..0930c5c3ae5 100644 --- a/sql/log_event_old.h +++ b/sql/log_event_old.h @@ -111,12 +111,12 @@ public: flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); + void pack_info(Protocol *protocol) override; #endif #ifdef MYSQL_CLIENT /* not for direct call, each derived has its own ::print() */ - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override= 0; #endif #ifndef MYSQL_CLIENT @@ -127,16 +127,19 @@ public: #endif /* Member functions to implement superclass interface */ - virtual int get_data_size(); + int get_data_size() override; MY_BITMAP const *get_cols() const { return &m_cols; } size_t get_width() const { return m_width; } ulong get_table_id() const { return m_table_id; } #ifndef MYSQL_CLIENT - virtual bool write_data_header(); - virtual bool write_data_body(); - virtual const char *get_db() { return m_table->s->db.str; } + bool write_data_header() override; + bool write_data_body() override; + const char *get_db() override { return m_table->s->db.str; } +#ifdef HAVE_REPLICATION + bool is_part_of_group() override { return 1; } +#endif #endif /* Check that malloc() succeeded in allocating memory for the rows @@ -144,11 +147,10 @@ public: is valid is done in the Update_rows_log_event_old::is_valid() function. */ - virtual bool is_valid() const + bool is_valid() const override { return m_rows_buf && m_cols.bitmap; } - bool is_part_of_group() { return 1; } uint m_row_count; /* The number of rows added to the event */ @@ -215,9 +217,9 @@ protected: private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); + int do_apply_event(rpl_group_info *rgi) override; + int do_update_pos(rpl_group_info *rgi) override; + enum_skip_reason do_shall_skip(rpl_group_info *rgi) override; /* Primitive to prepare for a sequence of row executions. @@ -379,13 +381,13 @@ public: private: #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif /********** END OF CUT & PASTE FROM Write_rows_log_event **********/ @@ -397,19 +399,19 @@ public: }; private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_type_code() override { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) + int do_apply_event(rpl_group_info *rgi) override { return Old_rows_log_event::do_apply_event(this, rgi); } // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); + int do_before_row_operations(TABLE *table) override; + int do_after_row_operations(TABLE *table, int error) override; virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); + uchar const *row_start, uchar const **row_end) override; + int do_exec_row(TABLE *table) override; #endif }; @@ -455,13 +457,13 @@ public: protected: #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ /********** END OF CUT & PASTE FROM Update_rows_log_event **********/ @@ -475,19 +477,19 @@ public: }; private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_type_code() override { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) + int do_apply_event(rpl_group_info *rgi) override { return Old_rows_log_event::do_apply_event(this, rgi); } // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); + int do_before_row_operations(TABLE *table) override; + int do_after_row_operations(TABLE *table, int error) override; virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); + uchar const *row_start, uchar const **row_end) override; + int do_exec_row(TABLE *table) override; #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ }; @@ -529,13 +531,13 @@ public: protected: #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const Slave_reporting_capability *const) override; + int do_after_row_operations(const Slave_reporting_capability *const,int) override; + int do_exec_row(rpl_group_info *) override; #endif /********** END CUT & PASTE FROM Delete_rows_log_event **********/ @@ -549,19 +551,19 @@ public: }; private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_type_code() override { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) + int do_apply_event(rpl_group_info *rgi) override { return Old_rows_log_event::do_apply_event(this, rgi); } // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); + int do_before_row_operations(TABLE *table) override; + int do_after_row_operations(TABLE *table, int error) override; virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); + uchar const *row_start, uchar const **row_end) override; + int do_exec_row(TABLE *table) override; #endif }; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 83bbb4a3285..3aacc4154d9 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -8523,6 +8523,7 @@ uint8 Update_rows_log_event::get_trg_event_map() #endif +#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) void Incident_log_event::pack_info(Protocol *protocol) { char buf[256]; @@ -8535,7 +8536,7 @@ void Incident_log_event::pack_info(Protocol *protocol) m_incident, description(), m_message.str); protocol->store(buf, bytes, &my_charset_bin); } - +#endif #if defined(WITH_WSREP) /* @@ -8622,6 +8623,7 @@ Incident_log_event::write_data_body() } +#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) /* Pack info for its unrecognized ignorable event */ void Ignorable_log_event::pack_info(Protocol *protocol) { @@ -8631,7 +8633,7 @@ void Ignorable_log_event::pack_info(Protocol *protocol) number, description); protocol->store(buf, bytes, &my_charset_bin); } - +#endif #if defined(HAVE_REPLICATION) Heartbeat_log_event::Heartbeat_log_event(const char* buf, ulong event_len, diff --git a/sql/mdl.cc b/sql/mdl.cc index 669f2c142db..324d95c2fee 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -199,10 +199,10 @@ public: m_current_search_depth(0), m_found_deadlock(FALSE) {} - virtual bool enter_node(MDL_context *node); - virtual void leave_node(MDL_context *node); + bool enter_node(MDL_context *node) override; + void leave_node(MDL_context *node) override; - virtual bool inspect_edge(MDL_context *dest); + bool inspect_edge(MDL_context *dest) override; MDL_context *get_victim() const { return m_victim; } private: @@ -434,11 +434,11 @@ public: struct MDL_scoped_lock : public MDL_lock_strategy { MDL_scoped_lock() = default; - virtual const bitmap_t *incompatible_granted_types_bitmap() const + const bitmap_t *incompatible_granted_types_bitmap() const override { return m_granted_incompatible; } - virtual const bitmap_t *incompatible_waiting_types_bitmap() const + const bitmap_t *incompatible_waiting_types_bitmap() const override { return m_waiting_incompatible; } - virtual bool needs_notification(const MDL_ticket *ticket) const + bool needs_notification(const MDL_ticket *ticket) const override { return (ticket->get_type() == MDL_SHARED); } /** @@ -449,14 +449,14 @@ public: insert delayed. We need to kill such threads in order to get global shared lock. We do this my calling code outside of MDL. */ - virtual bool conflicting_locks(const MDL_ticket *ticket) const + bool conflicting_locks(const MDL_ticket *ticket) const override { return ticket->get_type() == MDL_INTENTION_EXCLUSIVE; } /* In scoped locks, only IX lock request would starve because of X/S. But that is practically very rare case. So just return 0 from this function. */ - virtual bitmap_t hog_lock_types_bitmap() const + bitmap_t hog_lock_types_bitmap() const override { return 0; } private: static const bitmap_t m_granted_incompatible[MDL_TYPE_END]; @@ -471,11 +471,11 @@ public: struct MDL_object_lock : public MDL_lock_strategy { MDL_object_lock() = default; - virtual const bitmap_t *incompatible_granted_types_bitmap() const + const bitmap_t *incompatible_granted_types_bitmap() const override { return m_granted_incompatible; } - virtual const bitmap_t *incompatible_waiting_types_bitmap() const + const bitmap_t *incompatible_waiting_types_bitmap() const override { return m_waiting_incompatible; } - virtual bool needs_notification(const MDL_ticket *ticket) const + bool needs_notification(const MDL_ticket *ticket) const override { return (MDL_BIT(ticket->get_type()) & (MDL_BIT(MDL_SHARED_NO_WRITE) | @@ -491,7 +491,7 @@ public: lock or some other non-MDL resource we might need to wake it up by calling code outside of MDL. */ - virtual bool conflicting_locks(const MDL_ticket *ticket) const + bool conflicting_locks(const MDL_ticket *ticket) const override { return ticket->get_type() < MDL_SHARED_UPGRADABLE; } /* @@ -499,7 +499,7 @@ public: max_write_lock_count times in a row while other lock types are waiting. */ - virtual bitmap_t hog_lock_types_bitmap() const + bitmap_t hog_lock_types_bitmap() const override { return (MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | @@ -515,11 +515,11 @@ public: struct MDL_backup_lock: public MDL_lock_strategy { MDL_backup_lock() = default; - virtual const bitmap_t *incompatible_granted_types_bitmap() const + const bitmap_t *incompatible_granted_types_bitmap() const override { return m_granted_incompatible; } - virtual const bitmap_t *incompatible_waiting_types_bitmap() const + const bitmap_t *incompatible_waiting_types_bitmap() const override { return m_waiting_incompatible; } - virtual bool needs_notification(const MDL_ticket *ticket) const + bool needs_notification(const MDL_ticket *ticket) const override { return (MDL_BIT(ticket->get_type()) & MDL_BIT(MDL_BACKUP_FTWRL1)); } @@ -529,7 +529,7 @@ public: We need to kill such threads in order to get lock for FTWRL statements. We do this by calling code outside of MDL. */ - virtual bool conflicting_locks(const MDL_ticket *ticket) const + bool conflicting_locks(const MDL_ticket *ticket) const override { return (MDL_BIT(ticket->get_type()) & (MDL_BIT(MDL_BACKUP_DML) | @@ -541,7 +541,7 @@ public: BACKUP statements. This scenario is partically useless in real world, so we just return 0 here. */ - virtual bitmap_t hog_lock_types_bitmap() const + bitmap_t hog_lock_types_bitmap() const override { return 0; } private: static const bitmap_t m_granted_incompatible[MDL_BACKUP_END]; diff --git a/sql/mdl.h b/sql/mdl.h index 0922f525083..17568871381 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -726,8 +726,8 @@ public: bool is_incompatible_when_waiting(enum_mdl_type type) const; /** Implement MDL_wait_for_subgraph interface. */ - virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor); - virtual uint get_deadlock_weight() const; + bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor) override; + uint get_deadlock_weight() const override; /** Status of lock request represented by the ticket as reflected in P_S. */ diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h index 5e7879d9226..32b23c912c1 100644 --- a/sql/multi_range_read.h +++ b/sql/multi_range_read.h @@ -247,11 +247,11 @@ public: void *seq_init_param, uint n_ranges, uint mode, Key_parameters *key_par, Lifo_buffer *key_buffer, - Buffer_manager *buf_manager_arg); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial) { return initial? 0: HA_ERR_END_OF_FILE; } - uchar *get_rowid_ptr() { return file->ref; } - bool skip_record(range_id_t range_id, uchar *rowid) + Buffer_manager *buf_manager_arg) override; + int get_next(range_id_t *range_info) override; + int refill_buffer(bool initial) override { return initial? 0: HA_ERR_END_OF_FILE; } + uchar *get_rowid_ptr() override { return file->ref; } + bool skip_record(range_id_t range_id, uchar *rowid) override { return (file->mrr_funcs.skip_record && file->mrr_funcs.skip_record(file->mrr_iter, range_id, rowid)); @@ -270,12 +270,12 @@ public: void *seq_init_param, uint n_ranges, uint mode, Key_parameters *key_par, Lifo_buffer *key_buffer, - Buffer_manager *buf_manager_arg); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial); - uchar *get_rowid_ptr() { return file->ref; } + Buffer_manager *buf_manager_arg) override; + int get_next(range_id_t *range_info) override; + int refill_buffer(bool initial) override; + uchar *get_rowid_ptr() override { return file->ref; } - bool skip_record(range_id_t range_info, uchar *rowid) + bool skip_record(range_id_t range_info, uchar *rowid) override { return (mrr_funcs.skip_record && mrr_funcs.skip_record(mrr_iter, range_info, rowid)); @@ -292,9 +292,9 @@ public: uchar **space_start, uchar *space_end); void set_no_interruption_temp_buffer(); - void interrupt_read(); - void resume_read(); - void position(); + void interrupt_read() override; + void resume_read() override; + void position() override; private: Key_value_records_iterator kv_it; @@ -365,8 +365,8 @@ class Mrr_ordered_rndpos_reader : public Mrr_reader public: int init(handler *file, Mrr_index_reader *index_reader, uint mode, Lifo_buffer *buf, Rowid_filter *filter); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial); + int get_next(range_id_t *range_info) override; + int refill_buffer(bool initial) override; private: handler *file; /* Handler to use */ diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 36d67bd0d7c..10e1d5cd19a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2269,10 +2269,10 @@ public: TRP_RANGE(SEL_ARG *key_arg, uint idx_arg, uint mrr_flags_arg) : key(key_arg), key_idx(idx_arg), mrr_flags(mrr_flags_arg) {} - virtual ~TRP_RANGE() = default; /* Remove gcc warning */ + ~TRP_RANGE() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc) + MEM_ROOT *parent_alloc) override { DBUG_ENTER("TRP_RANGE::make_quick"); QUICK_RANGE_SELECT *quick; @@ -2285,7 +2285,7 @@ public: DBUG_RETURN(quick); } void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; void TRP_RANGE::trace_basic_info(PARAM *param, @@ -2317,9 +2317,9 @@ class TRP_ROR_INTERSECT : public TABLE_READ_PLAN { public: TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ - virtual ~TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ + ~TRP_ROR_INTERSECT() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc); + MEM_ROOT *parent_alloc) override; /* Array of pointers to ROR range scans used in this intersection */ struct st_ror_scan_info **first_scan; @@ -2328,7 +2328,7 @@ public: bool is_covering; /* TRUE if no row retrieval phase is necessary */ double index_scan_costs; /* SUM(cost(index_scan)) */ void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; @@ -2343,13 +2343,13 @@ class TRP_ROR_UNION : public TABLE_READ_PLAN { public: TRP_ROR_UNION() = default; /* Remove gcc warning */ - virtual ~TRP_ROR_UNION() = default; /* Remove gcc warning */ + ~TRP_ROR_UNION() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc); + MEM_ROOT *parent_alloc) override; TABLE_READ_PLAN **first_ror; /* array of ptrs to plans for merged scans */ TABLE_READ_PLAN **last_ror; /* end of the above array */ void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; void TRP_ROR_UNION::trace_basic_info(PARAM *param, @@ -2376,15 +2376,15 @@ class TRP_INDEX_INTERSECT : public TABLE_READ_PLAN { public: TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ - virtual ~TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ + ~TRP_INDEX_INTERSECT() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc); + MEM_ROOT *parent_alloc) override; TRP_RANGE **range_scans; /* array of ptrs to plans of intersected scans */ TRP_RANGE **range_scans_end; /* end of the array */ /* keys whose scans are to be filtered by cpk conditions */ key_map filtered_scans; void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; @@ -2413,13 +2413,13 @@ class TRP_INDEX_MERGE : public TABLE_READ_PLAN { public: TRP_INDEX_MERGE() = default; /* Remove gcc warning */ - virtual ~TRP_INDEX_MERGE() = default; /* Remove gcc warning */ + ~TRP_INDEX_MERGE() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc); + MEM_ROOT *parent_alloc) override; TRP_RANGE **range_scans; /* array of ptrs to plans of merged scans */ TRP_RANGE **range_scans_end; /* end of the array */ void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; void TRP_INDEX_MERGE::trace_basic_info(PARAM *param, @@ -2481,13 +2481,13 @@ public: if (key_infix_len) memcpy(this->key_infix, key_infix_arg, key_infix_len); } - virtual ~TRP_GROUP_MIN_MAX() = default; /* Remove gcc warning */ + ~TRP_GROUP_MIN_MAX() override = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, - MEM_ROOT *parent_alloc); + MEM_ROOT *parent_alloc) override; void use_index_scan() { is_index_scan= TRUE; } void trace_basic_info(PARAM *param, - Json_writer_object *trace_object) const; + Json_writer_object *trace_object) const override; }; diff --git a/sql/opt_range.h b/sql/opt_range.h index ea0ab9a52e9..ff4c6def9ce 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1161,28 +1161,28 @@ public: { return new QUICK_RANGE_SELECT(thd, head, index, no_alloc, parent_alloc, create_error); } - void need_sorted_output(); - int init(); - int reset(void); - int get_next(); - void range_end(); + void need_sorted_output() override; + int init() override; + int reset(void) override; + int get_next() override; + void range_end() override; int get_next_prefix(uint prefix_length, uint group_key_parts, uchar *cur_prefix); - bool reverse_sorted() { return 0; } - bool unique_key_range(); - int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc); - void save_last_pos() + bool reverse_sorted() override { return 0; } + bool unique_key_range() override; + int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc) override; + void save_last_pos() override { file->position(record); } - int get_type() { return QS_TYPE_RANGE; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); + int get_type() override { return QS_TYPE_RANGE; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; #ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); + void dbug_dump(int indent, bool verbose) override; #endif - virtual void replace_handler(handler *new_file) { file= new_file; } - QUICK_SELECT_I *make_reverse(uint used_key_parts_arg); + void replace_handler(handler *new_file) override { file= new_file; } + QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) override; - virtual void add_used_key_part_to_set(); + void add_used_key_part_to_set() override; private: /* Default copy ctor used by QUICK_SELECT_DESC */ @@ -1230,13 +1230,13 @@ public: :QUICK_RANGE_SELECT(thd, table, index_arg, no_alloc, parent_alloc, create_err) {}; - virtual QUICK_RANGE_SELECT *clone(bool *create_error) + QUICK_RANGE_SELECT *clone(bool *create_error) override { DBUG_ASSERT(0); return new QUICK_RANGE_SELECT_GEOM(thd, head, index, no_alloc, parent_alloc, create_error); } - virtual int get_next(); + int get_next() override; }; @@ -1312,16 +1312,16 @@ public: QUICK_INDEX_SORT_SELECT(THD *thd, TABLE *table); ~QUICK_INDEX_SORT_SELECT(); - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - bool is_keys_used(const MY_BITMAP *fields); + int init() override; + void need_sorted_output() override { DBUG_ASSERT(0); /* Can't do it */ } + int reset(void) override; + bool reverse_sorted() override { return false; } + bool unique_key_range() override { return false; } + bool is_keys_used(const MY_BITMAP *fields) override; #ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); + void dbug_dump(int indent, bool verbose) override; #endif - Explain_quick_select *get_explain(MEM_ROOT *alloc); + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; bool push_quick_back(QUICK_RANGE_SELECT *quick_sel_range); @@ -1333,7 +1333,7 @@ public: MEM_ROOT alloc; THD *thd; - virtual bool is_valid() + bool is_valid() override { List_iterator_fast it(quick_selects); QUICK_RANGE_SELECT *quick; @@ -1352,7 +1352,7 @@ public: /* used to get rows collected in Unique */ READ_RECORD read_record; - virtual void add_used_key_part_to_set(); + void add_used_key_part_to_set() override; }; @@ -1363,31 +1363,31 @@ private: /* true if this select is currently doing a clustered PK scan */ bool doing_pk_scan; protected: - int read_keys_and_merge(); + int read_keys_and_merge() override; public: QUICK_INDEX_MERGE_SELECT(THD *thd_arg, TABLE *table) :QUICK_INDEX_SORT_SELECT(thd_arg, table) {} - int get_next(); - int get_type() { return QS_TYPE_INDEX_MERGE; } - void add_keys_and_lengths(String *key_names, String *used_lengths); + int get_next() override; + int get_type() override { return QS_TYPE_INDEX_MERGE; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; }; class QUICK_INDEX_INTERSECT_SELECT : public QUICK_INDEX_SORT_SELECT { protected: - int read_keys_and_merge(); + int read_keys_and_merge() override; public: QUICK_INDEX_INTERSECT_SELECT(THD *thd_arg, TABLE *table) :QUICK_INDEX_SORT_SELECT(thd_arg, table) {} key_map filtered_scans; - int get_next(); - int get_type() { return QS_TYPE_INDEX_INTERSECT; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); + int get_next() override; + int get_type() override { return QS_TYPE_INDEX_INTERSECT; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; }; @@ -1417,21 +1417,21 @@ public: MEM_ROOT *parent_alloc); ~QUICK_ROR_INTERSECT_SELECT(); - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_ROR_INTERSECT; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); - bool is_keys_used(const MY_BITMAP *fields); - void add_used_key_part_to_set(); + int init() override; + void need_sorted_output() override { DBUG_ASSERT(0); /* Can't do it */ } + int reset(void) override; + int get_next() override; + bool reverse_sorted() override { return false; } + bool unique_key_range() override { return false; } + int get_type() override { return QS_TYPE_ROR_INTERSECT; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; + bool is_keys_used(const MY_BITMAP *fields) override; + void add_used_key_part_to_set() override; #ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); + void dbug_dump(int indent, bool verbose) override; #endif - int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc); + int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc) override; bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range); class QUICK_SELECT_WITH_RECORD : public Sql_alloc @@ -1448,7 +1448,7 @@ public: */ List quick_selects; - virtual bool is_valid() + bool is_valid() override { List_iterator_fast it(quick_selects); QUICK_SELECT_WITH_RECORD *quick; @@ -1497,26 +1497,26 @@ public: QUICK_ROR_UNION_SELECT(THD *thd, TABLE *table); ~QUICK_ROR_UNION_SELECT(); - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_ROR_UNION; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); - bool is_keys_used(const MY_BITMAP *fields); - void add_used_key_part_to_set(); + int init() override; + void need_sorted_output() override { DBUG_ASSERT(0); /* Can't do it */ } + int reset(void) override; + int get_next() override; + bool reverse_sorted() override { return false; } + bool unique_key_range() override { return false; } + int get_type() override { return QS_TYPE_ROR_UNION; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; + bool is_keys_used(const MY_BITMAP *fields) override; + void add_used_key_part_to_set() override; #ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); + void dbug_dump(int indent, bool verbose) override; #endif bool push_quick_back(QUICK_SELECT_I *quick_sel_range); List quick_selects; /* Merged quick selects */ - virtual bool is_valid() + bool is_valid() override { List_iterator_fast it(quick_selects); QUICK_SELECT_I *quick; @@ -1642,21 +1642,21 @@ public: void update_key_stat(); void adjust_prefix_ranges(); bool alloc_buffers(); - int init(); - void need_sorted_output() { /* always do it */ } - int reset(); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_GROUP_MIN_MAX; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - void add_used_key_part_to_set(); + int init() override; + void need_sorted_output() override { /* always do it */ } + int reset() override; + int get_next() override; + bool reverse_sorted() override { return false; } + bool unique_key_range() override { return false; } + int get_type() override { return QS_TYPE_GROUP_MIN_MAX; } + void add_keys_and_lengths(String *key_names, String *used_lengths) override; + void add_used_key_part_to_set() override; #ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); + void dbug_dump(int indent, bool verbose) override; #endif bool is_agg_distinct() { return have_agg_distinct; } bool loose_scan_is_scanning() { return is_index_scan; } - Explain_quick_select *get_explain(MEM_ROOT *alloc); + Explain_quick_select *get_explain(MEM_ROOT *alloc) override; }; @@ -1664,18 +1664,18 @@ class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT { public: QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts); - virtual QUICK_RANGE_SELECT *clone(bool *create_error) + QUICK_RANGE_SELECT *clone(bool *create_error) override { DBUG_ASSERT(0); return new QUICK_SELECT_DESC(this, used_key_parts); } - int get_next(); - bool reverse_sorted() { return 1; } - int get_type() { return QS_TYPE_RANGE_DESC; } - QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) + int get_next() override; + bool reverse_sorted() override { return 1; } + int get_type() override { return QS_TYPE_RANGE_DESC; } + QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) override { return this; // is already reverse sorted } private: bool range_reads_after_key(QUICK_RANGE *range); - int reset(void) { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); } + int reset(void) override { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); } List rev_ranges; List_iterator rev_it; uint used_key_parts; @@ -1774,12 +1774,12 @@ public: QUICK_RANGE_SELECT (thd, table, key, 1, NULL, create_err) { (void) init(); } ~FT_SELECT() { file->ft_end(); } - virtual QUICK_RANGE_SELECT *clone(bool *create_error) + QUICK_RANGE_SELECT *clone(bool *create_error) override { DBUG_ASSERT(0); return new FT_SELECT(thd, head, index, create_error); } - int init() { return file->ft_init(); } - int reset() { return 0; } - int get_next() { return file->ha_ft_read(record); } - int get_type() { return QS_TYPE_FULLTEXT; } + int init() override { return file->ft_init(); } + int reset() override { return 0; } + int get_next() override { return file->ha_ft_read(record); } + int get_type() override { return QS_TYPE_FULLTEXT; } }; FT_SELECT *get_ft_select(THD *thd, TABLE *table, uint key); diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 4fc13204ef3..41f46beb54b 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -5837,7 +5837,7 @@ public: select_value_catcher(THD *thd_arg, Item_subselect *item_arg): select_subselect(thd_arg, item_arg) {} - int send_data(List &items); + int send_data(List &items) override; int setup(List *items); bool assigned; /* TRUE <=> we've caught a value */ uint n_elements; /* How many elements we get */ diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 165dff5544f..3a645e10232 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -251,9 +251,9 @@ public: Field *field; /* Field this object is representing */ /* Iteration over unbound modules that are our dependencies */ - Iterator init_unbound_modules_iter(char *buf); + Iterator init_unbound_modules_iter(char *buf) override; Dep_module* get_next_unbound_module(Dep_analysis_context *dac, - Iterator iter); + Iterator iter) override; void make_unbound_modules_iter_skip_keys(Iterator iter); @@ -310,9 +310,9 @@ public: Dep_module_key *keys; /* Ordered list of Unique keys in this table */ /* Iteration over unbound modules that are our dependencies */ - Iterator init_unbound_modules_iter(char *buf); + Iterator init_unbound_modules_iter(char *buf) override; Dep_module* get_next_unbound_module(Dep_analysis_context *dac, - Iterator iter); + Iterator iter) override; static const size_t iterator_size; private: class Module_iter @@ -394,8 +394,8 @@ public: /* Used during condition analysis only, similar to KEYUSE::level */ uint level; - Iterator init_unbound_values_iter(char *buf); - Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter); + Iterator init_unbound_values_iter(char *buf) override; + Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter) override; static const size_t iterator_size; private: class Value_iter @@ -429,8 +429,8 @@ public: /* Unique keys form a linked list, ordered by keyno */ Dep_module_key *next_table_key; - Iterator init_unbound_values_iter(char *buf); - Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter); + Iterator init_unbound_values_iter(char *buf) override; + Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter) override; static const size_t iterator_size; private: class Value_iter @@ -459,18 +459,18 @@ public: { unbound_args= n_children; } - bool is_final() { return TRUE; } + bool is_final() override { return TRUE; } /* This is the goal module, so the running wave algorithm should terminate once it sees that this module is applicable and should never try to apply it, hence no use for unbound value iterator implementation. */ - Iterator init_unbound_values_iter(char *buf) + Iterator init_unbound_values_iter(char *buf) override { DBUG_ASSERT(0); return NULL; } - Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter) + Dep_value* get_next_unbound_value(Dep_analysis_context *dac, Iterator iter) override { DBUG_ASSERT(0); return NULL; @@ -966,7 +966,7 @@ public: Field_dependency_recorder(Dep_analysis_context *ctx_arg): ctx(ctx_arg) {} - void visit_field(Item_field *item) + void visit_field(Item_field *item) override { Field *field= item->field; Dep_value_table *tbl_dep; diff --git a/sql/parse_file.h b/sql/parse_file.h index 27fa0038d5b..cbfb751f6b8 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -68,8 +68,8 @@ class File_parser_dummy_hook: public Unknown_key_hook { public: File_parser_dummy_hook() = default; /* Remove gcc warning */ - virtual bool process_unknown_string(const char *&unknown_key, uchar* base, - MEM_ROOT *mem_root, const char *end); + bool process_unknown_string(const char *&unknown_key, uchar* base, + MEM_ROOT *mem_root, const char *end) override; }; extern File_parser_dummy_hook file_parser_dummy_hook; diff --git a/sql/procedure.h b/sql/procedure.h index 769eac5f217..3a390c62ae1 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -44,9 +44,9 @@ public: this->name.str= name_par; this->name.length= strlen(name_par); } - enum Type type() const { return Item::PROC_ITEM; } + enum Type type() const override { return Item::PROC_ITEM; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) + const Tmp_field_param *param) override { /* We can get to here when using a CURSOR for a query with PROCEDURE: @@ -58,19 +58,19 @@ public: virtual void set(double nr)=0; virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0; virtual void set(longlong nr)=0; - const Type_handler *type_handler() const=0; + const Type_handler *type_handler() const override=0; void set(const char *str) { set(str,(uint) strlen(str), default_charset()); } unsigned int size_of() { return sizeof(*this);} - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { DBUG_ASSERT(0); // impossible return mark_unsupported_function("proc", arg, VCOL_IMPOSSIBLE); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } - Item* get_copy(THD *thd) { return 0; } + Item* get_copy(THD *thd) override { return 0; } }; class Item_proc_real :public Item_proc @@ -82,23 +82,23 @@ public: { decimals=dec; max_length=float_length(dec); } - const Type_handler *type_handler() const { return &type_handler_double; } - void set(double nr) { value=nr; } - void set(longlong nr) { value=(double) nr; } - void set(const char *str,uint length,CHARSET_INFO *cs) + const Type_handler *type_handler() const override { return &type_handler_double; } + void set(double nr) override { value=nr; } + void set(longlong nr) override { value=(double) nr; } + void set(const char *str,uint length,CHARSET_INFO *cs) override { int err_not_used; char *end_not_used; value= cs->strntod((char*) str,length, &end_not_used, &err_not_used); } - double val_real() { return value; } - longlong val_int() { return (longlong) value; } - String *val_str(String *s) + double val_real() override { return value; } + longlong val_int() override { return (longlong) value; } + String *val_str(String *s) override { s->set_real(value,decimals,default_charset()); return s; } - my_decimal *val_decimal(my_decimal *); + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; @@ -108,20 +108,20 @@ class Item_proc_int :public Item_proc public: Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par) { max_length=11; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - void set(double nr) { value=(longlong) nr; } - void set(longlong nr) { value=nr; } - void set(const char *str,uint length, CHARSET_INFO *cs) + void set(double nr) override { value=(longlong) nr; } + void set(longlong nr) override { value=nr; } + void set(const char *str,uint length, CHARSET_INFO *cs) override { int err; value= cs->strntoll(str,length,10,NULL,&err); } - double val_real() { return (double) value; } - longlong val_int() { return value; } - String *val_str(String *s) { s->set(value, default_charset()); return s; } - my_decimal *val_decimal(my_decimal *); + double val_real() override { return (double) value; } + longlong val_int() override { return value; } + String *val_str(String *s) override { s->set(value, default_charset()); return s; } + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; @@ -131,12 +131,12 @@ class Item_proc_string :public Item_proc public: Item_proc_string(THD *thd, const char *name_par, uint length): Item_proc(thd, name_par) { this->max_length=length; } - const Type_handler *type_handler() const { return &type_handler_varchar; } - void set(double nr) { str_value.set_real(nr, 2, default_charset()); } - void set(longlong nr) { str_value.set(nr, default_charset()); } - void set(const char *str, uint length, CHARSET_INFO *cs) + const Type_handler *type_handler() const override { return &type_handler_varchar; } + void set(double nr) override { str_value.set_real(nr, 2, default_charset()); } + void set(longlong nr) override { str_value.set(nr, default_charset()); } + void set(const char *str, uint length, CHARSET_INFO *cs) override { str_value.copy(str,length,cs); } - double val_real() + double val_real() override { int err_not_used; char *end_not_used; @@ -144,17 +144,17 @@ public: return cs->strntod((char*) str_value.ptr(), str_value.length(), &end_not_used, &err_not_used); } - longlong val_int() + longlong val_int() override { int err; CHARSET_INFO *cs=str_value.charset(); return cs->strntoll(str_value.ptr(),str_value.length(),10,NULL,&err); } - String *val_str(String*) + String *val_str(String*) override { return null_value ? (String*) 0 : (String*) &str_value; } - my_decimal *val_decimal(my_decimal *); + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/rowid_filter.h b/sql/rowid_filter.h index 1e9b2eb5971..34a3ad252e1 100644 --- a/sql/rowid_filter.h +++ b/sql/rowid_filter.h @@ -274,9 +274,9 @@ public: ~Range_rowid_filter(); - build_return_code build(); + build_return_code build() override; - bool check(char *elem) + bool check(char *elem) override { if (container->is_empty()) return false; @@ -372,16 +372,16 @@ public: Rowid_filter_sorted_array(uint elems, uint elem_size) : refpos_container(elems, elem_size), is_checked(false) {} - Rowid_filter_container_type get_type() + Rowid_filter_container_type get_type() override { return SORTED_ARRAY_CONTAINER; } - bool alloc() { return refpos_container.alloc(); } + bool alloc() override { return refpos_container.alloc(); } - bool add(void *ctxt, char *elem) { return refpos_container.add(elem); } + bool add(void *ctxt, char *elem) override { return refpos_container.add(elem); } - bool check(void *ctxt, char *elem); + bool check(void *ctxt, char *elem) override; - bool is_empty() { return refpos_container.is_empty(); } + bool is_empty() override { return refpos_container.is_empty(); } }; /** diff --git a/sql/session_tracker.h b/sql/session_tracker.h index 5715b5837b5..37a4e0cbe89 100644 --- a/sql/session_tracker.h +++ b/sql/session_tracker.h @@ -210,9 +210,9 @@ class Session_sysvars_tracker: public State_tracker public: void init(THD *thd); void deinit(THD *thd); - bool enable(THD *thd); - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); + bool enable(THD *thd) override; + bool update(THD *thd, set_var *var) override; + bool store(THD *thd, String *buf) override; void mark_as_changed(THD *thd, const sys_var *var); void deinit() { orig_list.deinit(); } /* callback */ @@ -237,8 +237,8 @@ bool sysvartrack_global_update(THD *thd, char *str, size_t len); class Current_schema_tracker: public State_tracker { public: - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); + bool update(THD *thd, set_var *var) override; + bool store(THD *thd, String *buf) override; }; @@ -259,8 +259,8 @@ public: class Session_state_change_tracker: public State_tracker { public: - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); + bool update(THD *thd, set_var *var) override; + bool store(THD *thd, String *buf) override; }; @@ -329,7 +329,7 @@ class Transaction_state_tracker : public State_tracker enum_tx_state calc_trx_state(THD *thd, thr_lock_type l, bool has_trx); public: - bool enable(THD *thd) + bool enable(THD *thd) override { m_enabled= false; tx_changed= TX_CHG_NONE; @@ -340,8 +340,8 @@ public: return State_tracker::enable(thd); } - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); + bool update(THD *thd, set_var *var) override; + bool store(THD *thd, String *buf) override; /** Change transaction characteristics */ void set_read_flags(THD *thd, enum enum_tx_read_flags flags); diff --git a/sql/set_var.h b/sql/set_var.h index ce1d01b9bd2..c8da3c1c169 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -326,11 +326,11 @@ public: set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg, const LEX_CSTRING *base_name_arg, Item *value_arg); - virtual bool is_system() { return 1; } - int check(THD *thd); - int update(THD *thd); - int light_check(THD *thd); - virtual bool is_var_optimizer_trace() const + bool is_system() override { return 1; } + int check(THD *thd) override; + int update(THD *thd) override; + int light_check(THD *thd) override; + bool is_var_optimizer_trace() const override { extern sys_var *Sys_optimizer_trace_ptr; return var == Sys_optimizer_trace_ptr; @@ -346,9 +346,9 @@ public: set_var_user(Item_func_set_user_var *item) :user_var_item(item) {} - int check(THD *thd); - int update(THD *thd); - int light_check(THD *thd); + int check(THD *thd) override; + int update(THD *thd) override; + int light_check(THD *thd) override; }; /* For SET PASSWORD */ @@ -359,8 +359,8 @@ class set_var_password: public set_var_base public: set_var_password(LEX_USER *user_arg) :user(user_arg) {} - int check(THD *thd); - int update(THD *thd); + int check(THD *thd) override; + int update(THD *thd) override; }; /* For SET ROLE */ @@ -371,8 +371,8 @@ class set_var_role: public set_var_base privilege_t access; public: set_var_role(LEX_CSTRING role_arg) : role(role_arg), access(NO_ACL) {} - int check(THD *thd); - int update(THD *thd); + int check(THD *thd) override; + int update(THD *thd) override; }; /* For SET DEFAULT ROLE */ @@ -385,8 +385,8 @@ class set_var_default_role: public set_var_base public: set_var_default_role(LEX_USER *user_arg, LEX_CSTRING role_arg) : user(user_arg), role(role_arg) {} - int check(THD *thd); - int update(THD *thd); + int check(THD *thd) override; + int update(THD *thd) override; }; /* For SET NAMES and SET CHARACTER SET */ @@ -404,8 +404,8 @@ public: character_set_results(result_coll_arg), collation_connection(connection_coll_arg) {} - int check(THD *thd); - int update(THD *thd); + int check(THD *thd) override; + int update(THD *thd) override; }; diff --git a/sql/sp.cc b/sql/sp.cc index cd7dc51a6a6..ba5a29364da 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -255,7 +255,7 @@ public: load_from_db(THD *thd, const Database_qualified_name *name, TABLE *proc_tbl); public: - virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) override { return new (mem_root) Stored_routine_creation_ctx(m_client_cs, m_connection_cl, @@ -263,7 +263,7 @@ public: } protected: - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + Object_creation_ctx *create_backup_ctx(THD *thd) const override { DBUG_ENTER("Stored_routine_creation_ctx::create_backup_ctx"); DBUG_RETURN(new Stored_routine_creation_ctx(thd)); @@ -428,7 +428,7 @@ public: Proc_table_intact() : m_print_once(TRUE) { has_keys= TRUE; } protected: - void report_error(uint code, const char *fmt, ...); + void report_error(uint code, const char *fmt, ...) override; }; @@ -804,12 +804,12 @@ Sp_handler::db_find_and_cache_routine(THD *thd, struct Silence_deprecated_warning : public Internal_error_handler { public: - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; }; bool @@ -899,12 +899,12 @@ public: :m_error_caught(false) {} - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* message, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; bool error_caught() const { return m_error_caught; } @@ -1717,7 +1717,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE || diff --git a/sql/sp.h b/sql/sp.h index 32ddc4463cd..26cc78aec7d 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -249,33 +249,33 @@ public: class Sp_handler_procedure: public Sp_handler { public: - enum_sp_type type() const { return SP_TYPE_PROCEDURE; } - LEX_CSTRING type_lex_cstring() const + enum_sp_type type() const override { return SP_TYPE_PROCEDURE; } + LEX_CSTRING type_lex_cstring() const override { static LEX_CSTRING m_type_str= { STRING_WITH_LEN("PROCEDURE")}; return m_type_str; } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const; - const char *show_create_routine_col1_caption() const + LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const override; + const char *show_create_routine_col1_caption() const override { return "Procedure"; } - const char *show_create_routine_col3_caption() const + const char *show_create_routine_col3_caption() const override { return "Create Procedure"; } - MDL_key::enum_mdl_namespace get_mdl_type() const + MDL_key::enum_mdl_namespace get_mdl_type() const override { return MDL_key::PROCEDURE; } - const Sp_handler *package_routine_handler() const; - sp_cache **get_cache(THD *) const; + const Sp_handler *package_routine_handler() const override; + sp_cache **get_cache(THD *) const override; #ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; + HASH *get_priv_hash() const override; #endif - ulong recursion_depth(THD *thd) const; - void recursion_level_error(THD *thd, const sp_head *sp) const; - bool add_instr_preturn(THD *thd, sp_head *sp, sp_pcontext *spcont) const; + ulong recursion_depth(THD *thd) const override; + void recursion_level_error(THD *thd, const sp_head *sp) const override; + bool add_instr_preturn(THD *thd, sp_head *sp, sp_pcontext *spcont) const override; }; @@ -283,13 +283,13 @@ class Sp_handler_package_procedure: public Sp_handler_procedure { public: int sp_cache_routine(THD *thd, const Database_qualified_name *name, - sp_head **sp) const + sp_head **sp) const override { return sp_cache_package_routine(thd, name, sp); } sp_head *sp_find_routine(THD *thd, const Database_qualified_name *name, - bool cache_only) const + bool cache_only) const override { return sp_find_package_routine(thd, name, cache_only); } @@ -299,32 +299,32 @@ public: class Sp_handler_function: public Sp_handler { public: - enum_sp_type type() const { return SP_TYPE_FUNCTION; } - LEX_CSTRING type_lex_cstring() const + enum_sp_type type() const override { return SP_TYPE_FUNCTION; } + LEX_CSTRING type_lex_cstring() const override { static LEX_CSTRING m_type_str= { STRING_WITH_LEN("FUNCTION")}; return m_type_str; } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const; - const char *show_create_routine_col1_caption() const + LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const override; + const char *show_create_routine_col1_caption() const override { return "Function"; } - const char *show_create_routine_col3_caption() const + const char *show_create_routine_col3_caption() const override { return "Create Function"; } - MDL_key::enum_mdl_namespace get_mdl_type() const + MDL_key::enum_mdl_namespace get_mdl_type() const override { return MDL_key::FUNCTION; } - const Sp_handler *package_routine_handler() const; - sp_cache **get_cache(THD *) const; + const Sp_handler *package_routine_handler() const override; + sp_cache **get_cache(THD *) const override; #ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; + HASH *get_priv_hash() const override; #endif bool add_instr_freturn(THD *thd, sp_head *sp, sp_pcontext *spcont, - Item *item, LEX *lex) const; + Item *item, LEX *lex) const override; }; @@ -332,13 +332,13 @@ class Sp_handler_package_function: public Sp_handler_function { public: int sp_cache_routine(THD *thd, const Database_qualified_name *name, - sp_head **sp) const + sp_head **sp) const override { return sp_cache_package_routine(thd, name, sp); } sp_head *sp_find_routine(THD *thd, const Database_qualified_name *name, - bool cache_only) const + bool cache_only) const override { return sp_find_package_routine(thd, name, cache_only); } @@ -357,7 +357,7 @@ public: const st_sp_chistics &chistics, const AUTHID &definer, const DDL_options_st ddl_options, - sql_mode_t sql_mode) const; + sql_mode_t sql_mode) const override; }; @@ -366,34 +366,34 @@ class Sp_handler_package_spec: public Sp_handler_package public: // TODO: make it private or protected int sp_find_and_drop_routine(THD *thd, TABLE *table, const Database_qualified_name *name) - const; + const override; public: - enum_sp_type type() const { return SP_TYPE_PACKAGE; } - LEX_CSTRING type_lex_cstring() const + enum_sp_type type() const override { return SP_TYPE_PACKAGE; } + LEX_CSTRING type_lex_cstring() const override { static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE")}; return m_type_str; } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const + LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const override { static LEX_CSTRING m_empty_body= {STRING_WITH_LEN("BEGIN END")}; return m_empty_body; } - const char *show_create_routine_col1_caption() const + const char *show_create_routine_col1_caption() const override { return "Package"; } - const char *show_create_routine_col3_caption() const + const char *show_create_routine_col3_caption() const override { return "Create Package"; } - MDL_key::enum_mdl_namespace get_mdl_type() const + MDL_key::enum_mdl_namespace get_mdl_type() const override { return MDL_key::PACKAGE_BODY; } - sp_cache **get_cache(THD *) const; + sp_cache **get_cache(THD *) const override; #ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; + HASH *get_priv_hash() const override; #endif }; @@ -401,32 +401,32 @@ public: class Sp_handler_package_body: public Sp_handler_package { public: - enum_sp_type type() const { return SP_TYPE_PACKAGE_BODY; } - LEX_CSTRING type_lex_cstring() const + enum_sp_type type() const override { return SP_TYPE_PACKAGE_BODY; } + LEX_CSTRING type_lex_cstring() const override { static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE BODY")}; return m_type_str; } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const + LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const override { static LEX_CSTRING m_empty_body= {STRING_WITH_LEN("BEGIN END")}; return m_empty_body; } - const char *show_create_routine_col1_caption() const + const char *show_create_routine_col1_caption() const override { return "Package body"; } - const char *show_create_routine_col3_caption() const + const char *show_create_routine_col3_caption() const override { return "Create Package Body"; } - MDL_key::enum_mdl_namespace get_mdl_type() const + MDL_key::enum_mdl_namespace get_mdl_type() const override { return MDL_key::PACKAGE_BODY; } - sp_cache **get_cache(THD *) const; + sp_cache **get_cache(THD *) const override; #ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; + HASH *get_priv_hash() const override; #endif }; @@ -434,18 +434,18 @@ public: class Sp_handler_trigger: public Sp_handler { public: - enum_sp_type type() const { return SP_TYPE_TRIGGER; } - LEX_CSTRING type_lex_cstring() const + enum_sp_type type() const override { return SP_TYPE_TRIGGER; } + LEX_CSTRING type_lex_cstring() const override { static LEX_CSTRING m_type_str= { STRING_WITH_LEN("TRIGGER")}; return m_type_str; } - MDL_key::enum_mdl_namespace get_mdl_type() const + MDL_key::enum_mdl_namespace get_mdl_type() const override { DBUG_ASSERT(0); return MDL_key::TRIGGER; } - const Sp_handler *sp_handler_mysql_proc() const { return NULL; } + const Sp_handler *sp_handler_mysql_proc() const override { return NULL; } }; diff --git a/sql/sp_head.h b/sql/sp_head.h index 02a68833c94..3de8e843753 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -87,7 +87,7 @@ protected: { } protected: - virtual void change_env(THD *thd) const + void change_env(THD *thd) const override { thd->variables.collation_database= m_db_cl; @@ -1044,9 +1044,9 @@ public: return m_routine_implementations.check_dup_qualified(lex->sphead) || m_routine_implementations.push_back(lex, &main_mem_root); } - sp_package *get_package() { return this; } - void init_psi_share(); - bool is_invoked() const + sp_package *get_package() override { return this; } + void init_psi_share() override; + bool is_invoked() const override { /* Cannot flush a package out of the SP cache when: @@ -1081,8 +1081,8 @@ public: Query_arena(thd->lex->sphead->get_main_mem_root(), STMT_INITIALIZED_FOR_SP) { } ~sp_lex_cursor() { free_items(); } - void cleanup_stmt() { } - Query_arena *query_arena() { return this; } + void cleanup_stmt() override { } + Query_arena *query_arena() override { return this; } bool validate() { DBUG_ASSERT(sql_command == SQLCOM_SELECT); @@ -1358,18 +1358,18 @@ public: virtual ~sp_instr_stmt() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_stmt : public sp_instr @@ -1393,11 +1393,11 @@ public: virtual ~sp_instr_set() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; protected: sp_rcontext *get_rcontext(THD *thd) const; @@ -1407,7 +1407,7 @@ protected: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_set : public sp_instr @@ -1436,9 +1436,9 @@ public: virtual ~sp_instr_set_row_field() = default; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; }; // class sp_instr_set_field : public sp_instr_set @@ -1478,9 +1478,9 @@ public: virtual ~sp_instr_set_row_field_by_name() = default; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; }; // class sp_instr_set_field_by_name : public sp_instr_set @@ -1504,11 +1504,11 @@ public: virtual ~sp_instr_set_trigger_field() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: Item_trigger_field *trigger_field; @@ -1516,7 +1516,7 @@ private: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_trigger_field : public sp_instr @@ -1550,7 +1550,7 @@ public: virtual void set_destination(uint old_dest, uint new_dest) = 0; - virtual uint get_cont_dest() const; + uint get_cont_dest() const override; protected: @@ -1576,17 +1576,17 @@ public: virtual ~sp_instr_jump() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads); + uint opt_mark(sp_head *sp, List *leads) override; - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start); + uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override; - virtual void opt_move(uint dst, List *ibp); + void opt_move(uint dst, List *ibp) override; - virtual void backpatch(uint dest, sp_pcontext *dst_ctx) + void backpatch(uint dest, sp_pcontext *dst_ctx) override { /* Calling backpatch twice is a logic flaw in jump resolution. */ DBUG_ASSERT(m_dest == 0); @@ -1596,14 +1596,14 @@ public: /** Update the destination; used by the optimizer. */ - virtual void set_destination(uint old_dest, uint new_dest) + void set_destination(uint old_dest, uint new_dest) override { if (m_dest == old_dest) m_dest= new_dest; } public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_jump : public sp_instr_opt_meta @@ -1627,23 +1627,23 @@ public: virtual ~sp_instr_jump_if_not() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads); + uint opt_mark(sp_head *sp, List *leads) override; /** Override sp_instr_jump's shortcut; we stop here */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) + uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override { return m_ip; } - virtual void opt_move(uint dst, List *ibp); + void opt_move(uint dst, List *ibp) override; - virtual void set_destination(uint old_dest, uint new_dest) + void set_destination(uint old_dest, uint new_dest) override { sp_instr_jump::set_destination(old_dest, new_dest); if (m_cont_dest == old_dest) @@ -1656,7 +1656,7 @@ private: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_jump_if_not : public sp_instr_jump @@ -1674,18 +1674,18 @@ public: virtual ~sp_instr_preturn() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads) + uint opt_mark(sp_head *sp, List *leads) override { marked= 1; return UINT_MAX; } public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_preturn : public sp_instr @@ -1705,13 +1705,13 @@ public: virtual ~sp_instr_freturn() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads) + uint opt_mark(sp_head *sp, List *leads) override { marked= 1; return UINT_MAX; @@ -1724,7 +1724,7 @@ protected: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_freturn : public sp_instr @@ -1753,19 +1753,19 @@ public: m_handler= NULL; } - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads); + uint opt_mark(sp_head *sp, List *leads) override; /** Override sp_instr_jump's shortcut; we stop here. */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) + uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override { return m_ip; } - virtual void backpatch(uint dest, sp_pcontext *dst_ctx) + void backpatch(uint dest, sp_pcontext *dst_ctx) override { DBUG_ASSERT(!m_dest || !m_opt_hpop); if (!m_dest) @@ -1792,7 +1792,7 @@ private: uint m_frame; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_hpush_jump : public sp_instr_jump @@ -1815,16 +1815,16 @@ public: m_count= count; } - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: uint m_count; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_hpop : public sp_instr @@ -1843,24 +1843,24 @@ public: virtual ~sp_instr_hreturn() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; /* This instruction will not be short cut optimized. */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) + uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override { return m_ip; } - virtual uint opt_mark(sp_head *sp, List *leads); + uint opt_mark(sp_head *sp, List *leads) override; private: uint m_frame; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_hreturn : public sp_instr_jump @@ -1879,23 +1879,23 @@ public: virtual ~sp_instr_cpush() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; /** This call is used to cleanup the instruction when a sensitive cursor is closed. For now stored procedures always use materialized cursors and the call is not used. */ - virtual void cleanup_stmt() { /* no op */ } + void cleanup_stmt() override { /* no op */ } private: sp_lex_keeper m_lex_keeper; uint m_cursor; /**< Frame offset (for debugging) */ public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_cpush : public sp_instr @@ -1918,16 +1918,16 @@ public: m_count= count; } - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: uint m_count; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_cpop : public sp_instr @@ -1945,18 +1945,18 @@ public: virtual ~sp_instr_copen() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: uint m_cursor; ///< Stack index public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_copen : public sp_instr_stmt @@ -1981,12 +1981,12 @@ public: m_var(voffs) {} virtual ~sp_instr_cursor_copy_struct() = default; - virtual int execute(THD *thd, uint *nextp); - virtual int exec_core(THD *thd, uint *nextp); - virtual void print(String *str); + int execute(THD *thd, uint *nextp) override; + int exec_core(THD *thd, uint *nextp) override; + void print(String *str) override; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; @@ -2004,16 +2004,16 @@ public: virtual ~sp_instr_cclose() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; private: uint m_cursor; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_cclose : public sp_instr @@ -2033,9 +2033,9 @@ public: virtual ~sp_instr_cfetch() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; void add_to_varlist(sp_variable *var) { @@ -2049,7 +2049,7 @@ private: bool m_error_on_no_data; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_cfetch : public sp_instr @@ -2071,12 +2071,12 @@ public: virtual ~sp_instr_agg_cfetch() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_agg_cfetch : public sp_instr @@ -2096,11 +2096,11 @@ public: virtual ~sp_instr_error() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads) + uint opt_mark(sp_head *sp, List *leads) override { marked= 1; return UINT_MAX; @@ -2111,7 +2111,7 @@ private: int m_errcode; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_error : public sp_instr @@ -2129,17 +2129,17 @@ public: virtual ~sp_instr_set_case_expr() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual int exec_core(THD *thd, uint *nextp); + int exec_core(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; - virtual uint opt_mark(sp_head *sp, List *leads); + uint opt_mark(sp_head *sp, List *leads) override; - virtual void opt_move(uint dst, List *ibp); + void opt_move(uint dst, List *ibp) override; - virtual void set_destination(uint old_dest, uint new_dest) + void set_destination(uint old_dest, uint new_dest) override { if (m_cont_dest == old_dest) m_cont_dest= new_dest; @@ -2152,7 +2152,7 @@ private: sp_lex_keeper m_lex_keeper; public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_set_case_expr : public sp_instr_opt_meta diff --git a/sql/spatial.h b/sql/spatial.h index e47a1da5905..57c5abe9b98 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -399,14 +399,14 @@ class Gis_point: public Geometry public: Gis_point() = default; /* Remove gcc warning */ virtual ~Gis_point() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; int get_xy(double *x, double *y) const { @@ -429,7 +429,7 @@ public: return 1; } - int get_x(double *x) const + int get_x(double *x) const override { if (no_data(m_data, SIZEOF_STORED_DOUBLE)) return 1; @@ -437,7 +437,7 @@ public: return 0; } - int get_y(double *y) const + int get_y(double *y) const override { const char *data= m_data; if (no_data(data, SIZEOF_STORED_DOUBLE * 2)) return 1; @@ -445,16 +445,16 @@ public: return 0; } - int geom_length(double *len, const char **end) const; - int area(double *ar, const char **end) const; - bool dimension(uint32 *dim, const char **end) const + int geom_length(double *len, const char **end) const override; + int area(double *ar, const char **end) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 0; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; double calculate_haversine(const Geometry *g, const double sphere_radius, int *error); int spherical_distance_multipoints(Geometry *g, const double r, double *result, @@ -469,29 +469,29 @@ class Gis_line_string: public Geometry public: Gis_line_string() = default; /* Remove gcc warning */ virtual ~Gis_line_string() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int geom_length(double *len, const char **end) const; - int area(double *ar, const char **end) const; - int is_closed(int *closed) const; - int num_points(uint32 *n_points) const; - int start_point(String *point) const; - int end_point(String *point) const; - int point_n(uint32 n, String *result) const; - bool dimension(uint32 *dim, const char **end) const + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int geom_length(double *len, const char **end) const override; + int area(double *ar, const char **end) const override; + int is_closed(int *closed) const override; + int num_points(uint32 *n_points) const override; + int start_point(String *point) const override; + int end_point(String *point) const override; + int point_n(uint32 n, String *result) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 1; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; }; @@ -502,29 +502,29 @@ class Gis_polygon: public Geometry public: Gis_polygon() = default; /* Remove gcc warning */ virtual ~Gis_polygon() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + uint init_from_opresult(String *bin, const char *opres, uint res_len) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int area(double *ar, const char **end) const; - int exterior_ring(String *result) const; - int num_interior_ring(uint32 *n_int_rings) const; - int interior_ring_n(uint32 num, String *result) const; + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int area(double *ar, const char **end) const override; + int exterior_ring(String *result) const override; + int num_interior_ring(uint32 *n_int_rings) const override; + int interior_ring_n(uint32 num, String *result) const override; int centroid_xy(double *x, double *y) const; - int centroid(String *result) const; - bool dimension(uint32 *dim, const char **end) const + int centroid(String *result) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 2; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; }; @@ -539,25 +539,25 @@ class Gis_multi_point: public Geometry public: Gis_multi_point() = default; /* Remove gcc warning */ virtual ~Gis_multi_point() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + uint init_from_opresult(String *bin, const char *opres, uint res_len) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - bool dimension(uint32 *dim, const char **end) const + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int num_geometries(uint32 *num) const override; + int geometry_n(uint32 num, String *result) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 0; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; int spherical_distance_multipoints(Geometry *g, const double r, double *res, int *error); }; @@ -570,27 +570,27 @@ class Gis_multi_line_string: public Geometry public: Gis_multi_line_string() = default; /* Remove gcc warning */ virtual ~Gis_multi_line_string() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + uint init_from_opresult(String *bin, const char *opres, uint res_len) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - int geom_length(double *len, const char **end) const; - int is_closed(int *closed) const; - bool dimension(uint32 *dim, const char **end) const + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int num_geometries(uint32 *num) const override; + int geometry_n(uint32 num, String *result) const override; + int geom_length(double *len, const char **end) const override; + int is_closed(int *closed) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 1; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; }; @@ -601,27 +601,27 @@ class Gis_multi_polygon: public Geometry public: Gis_multi_polygon() = default; /* Remove gcc warning */ virtual ~Gis_multi_polygon() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - int area(double *ar, const char **end) const; - int centroid(String *result) const; - bool dimension(uint32 *dim, const char **end) const + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int num_geometries(uint32 *num) const override; + int geometry_n(uint32 num, String *result) const override; + int area(double *ar, const char **end) const override; + int centroid(String *result) const override; + bool dimension(uint32 *dim, const char **end) const override { *dim= 2; *end= 0; /* No default end */ return 0; } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; - uint init_from_opresult(String *bin, const char *opres, uint res_len); + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; + uint init_from_opresult(String *bin, const char *opres, uint res_len) override; }; @@ -632,22 +632,22 @@ class Gis_geometry_collection: public Geometry public: Gis_geometry_collection() = default; /* Remove gcc warning */ virtual ~Gis_geometry_collection() = default; /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; + uint32 get_data_size() const override; + bool init_from_wkt(Gis_read_stream *trs, String *wkb) override; + uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res) override; + uint init_from_opresult(String *bin, const char *opres, uint res_len) override; + bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) override; + bool get_data_as_wkt(String *txt, const char **end) const override; bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int area(double *ar, const char **end) const; - int geom_length(double *len, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - bool dimension(uint32 *dim, const char **end) const; - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; + const char **end) const override; + bool get_mbr(MBR *mbr, const char **end) const override; + int area(double *ar, const char **end) const override; + int geom_length(double *len, const char **end) const override; + int num_geometries(uint32 *num) const override; + int geometry_n(uint32 num, String *result) const override; + bool dimension(uint32 *dim, const char **end) const override; + int store_shapes(Gcalc_shape_transporter *trn) const override; + const Class_info *get_class_info() const override; }; struct Geometry_buffer : public diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ee0351cb38f..acbb9fa6d38 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -940,9 +940,9 @@ class User_table_tabular: public User_table { public: - LEX_CSTRING& name() const { return MYSQL_TABLE_NAME_USER; } + LEX_CSTRING& name() const override { return MYSQL_TABLE_NAME_USER; } - int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const + int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const override { mysql_mutex_assert_owner(&acl_cache->lock); u->alloc_auth(root, 1); @@ -985,7 +985,7 @@ class User_table_tabular: public User_table return 0; } - bool set_auth(const ACL_USER &u) const + bool set_auth(const ACL_USER &u) const override { if (u.nauth != 1) return 1; @@ -1006,7 +1006,7 @@ class User_table_tabular: public User_table return 0; } - privilege_t get_access() const + privilege_t get_access() const override { privilege_t access(Grant_table_base::get_access()); if ((num_fields() <= 13) && (access & CREATE_ACL)) @@ -1065,7 +1065,7 @@ class User_table_tabular: public User_table return access & GLOBAL_ACLS; } - void set_access(const privilege_t rights, bool revoke) const + void set_access(const privilege_t rights, bool revoke) const override { ulonglong priv(SELECT_ACL); for (uint i= start_priv_columns; i < end_priv_columns; i++, priv <<= 1) @@ -1075,132 +1075,132 @@ class User_table_tabular: public User_table } } - SSL_type get_ssl_type () const + SSL_type get_ssl_type () const override { Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM); return (SSL_type)(f ? f->val_int()-1 : 0); } - int set_ssl_type (SSL_type x) const + int set_ssl_type (SSL_type x) const override { if (Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM)) return f->store(x+1, 0); else return 1; } - const char* get_ssl_cipher (MEM_ROOT *root) const + const char* get_ssl_cipher (MEM_ROOT *root) const override { Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB); return f ? ::get_field(root,f) : 0; } - int set_ssl_cipher (const char *s, size_t l) const + int set_ssl_cipher (const char *s, size_t l) const override { if (Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB)) return f->store(s, l, &my_charset_latin1); else return 1; } - const char* get_x509_issuer (MEM_ROOT *root) const + const char* get_x509_issuer (MEM_ROOT *root) const override { Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB); return f ? ::get_field(root,f) : 0; } - int set_x509_issuer (const char *s, size_t l) const + int set_x509_issuer (const char *s, size_t l) const override { if (Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB)) return f->store(s, l, &my_charset_latin1); else return 1; } - const char* get_x509_subject (MEM_ROOT *root) const + const char* get_x509_subject (MEM_ROOT *root) const override { Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB); return f ? ::get_field(root,f) : 0; } - int set_x509_subject (const char *s, size_t l) const + int set_x509_subject (const char *s, size_t l) const override { if (Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB)) return f->store(s, l, &my_charset_latin1); else return 1; } - longlong get_max_questions () const + longlong get_max_questions () const override { Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG); return f ? f->val_int() : 0; } - int set_max_questions (longlong x) const + int set_max_questions (longlong x) const override { if (Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG)) return f->store(x, 0); else return 1; } - longlong get_max_updates () const + longlong get_max_updates () const override { Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG); return f ? f->val_int() : 0; } - int set_max_updates (longlong x) const + int set_max_updates (longlong x) const override { if (Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG)) return f->store(x, 0); else return 1; } - longlong get_max_connections () const + longlong get_max_connections () const override { Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG); return f ? f->val_int() : 0; } - int set_max_connections (longlong x) const + int set_max_connections (longlong x) const override { if (Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG)) return f->store(x, 0); else return 1; } - longlong get_max_user_connections () const + longlong get_max_user_connections () const override { Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG); return f ? f->val_int() : 0; } - int set_max_user_connections (longlong x) const + int set_max_user_connections (longlong x) const override { if (Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG)) return f->store(x, 0); else return 1; } - double get_max_statement_time () const + double get_max_statement_time () const override { Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL); return f ? f->val_real() : 0; } - int set_max_statement_time (double x) const + int set_max_statement_time (double x) const override { if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL)) return f->store(x); else return 1; } - bool get_is_role () const + bool get_is_role () const override { Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM); return f ? f->val_int()-1 : 0; } - int set_is_role (bool x) const + int set_is_role (bool x) const override { if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM)) return f->store(x+1, 0); else return 1; } - const char* get_default_role (MEM_ROOT *root) const + const char* get_default_role (MEM_ROOT *root) const override { Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING); return f ? ::get_field(root,f) : 0; } - int set_default_role (const char *s, size_t l) const + int set_default_role (const char *s, size_t l) const override { if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING)) return f->store(s, l, system_charset_info); @@ -1210,12 +1210,12 @@ class User_table_tabular: public User_table /* On a MariaDB 10.3 user table, the account locking accessors will try to get the content of the max_statement_time column, but they will fail due to the typecheck in get_field. */ - bool get_account_locked () const + bool get_account_locked () const override { Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM); return f ? f->val_int()-1 : 0; } - int set_account_locked (bool x) const + int set_account_locked (bool x) const override { if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM)) return f->store(x+1, 0); @@ -1223,14 +1223,14 @@ class User_table_tabular: public User_table return 1; } - bool get_password_expired () const + bool get_password_expired () const override { uint field_num= end_priv_columns + 10; Field *f= get_field(field_num, MYSQL_TYPE_ENUM); return f ? f->val_int()-1 : 0; } - int set_password_expired (bool x) const + int set_password_expired (bool x) const override { uint field_num= end_priv_columns + 10; @@ -1238,14 +1238,14 @@ class User_table_tabular: public User_table return f->store(x+1, 0); return 1; } - my_time_t get_password_last_changed () const + my_time_t get_password_last_changed () const override { ulong unused_dec; if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2)) return f->get_timestamp(&unused_dec); return 0; } - int set_password_last_changed (my_time_t x) const + int set_password_last_changed (my_time_t x) const override { if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2)) { @@ -1254,7 +1254,7 @@ class User_table_tabular: public User_table } return 1; } - longlong get_password_lifetime () const + longlong get_password_lifetime () const override { if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT)) { @@ -1264,7 +1264,7 @@ class User_table_tabular: public User_table } return 0; } - int set_password_lifetime (longlong x) const + int set_password_lifetime (longlong x) const override { if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT)) { @@ -1279,7 +1279,7 @@ class User_table_tabular: public User_table return 1; } - virtual ~User_table_tabular() = default; + ~User_table_tabular() override = default; private: friend class Grant_tables; @@ -1304,7 +1304,7 @@ class User_table_tabular: public User_table return f->real_type() == type ? f : NULL; } - int setup_sysvars() const + int setup_sysvars() const override { username_char_length= MY_MIN(m_table->field[1]->char_length(), USERNAME_CHAR_LENGTH); @@ -1378,9 +1378,9 @@ class User_table_tabular: public User_table */ class User_table_json: public User_table { - LEX_CSTRING& name() const { return MYSQL_TABLE_NAME[USER_TABLE]; } + LEX_CSTRING& name() const override { return MYSQL_TABLE_NAME[USER_TABLE]; } - int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const + int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const override { size_t array_len; const char *array; @@ -1459,7 +1459,7 @@ class User_table_json: public User_table return 0; } - bool set_auth(const ACL_USER &u) const + bool set_auth(const ACL_USER &u) const override { size_t array_len; const char *array; @@ -1584,7 +1584,7 @@ class User_table_json: public User_table return access & ALL_KNOWN_ACL; } - privilege_t get_access() const + privilege_t get_access() const override { ulonglong version_id= (ulonglong) get_int_value("version_id"); ulonglong access= (ulonglong) get_int_value("access"); @@ -1611,7 +1611,7 @@ class User_table_json: public User_table return adjust_access(version_id, access) & GLOBAL_ACLS; } - void set_access(const privilege_t rights, bool revoke) const + void set_access(const privilege_t rights, bool revoke) const override { privilege_t access= get_access(); if (revoke) @@ -1624,77 +1624,77 @@ class User_table_json: public User_table const char *unsafe_str(const char *s) const { return s[0] ? s : NULL; } - SSL_type get_ssl_type () const + SSL_type get_ssl_type () const override { return (SSL_type)get_int_value("ssl_type"); } - int set_ssl_type (SSL_type x) const + int set_ssl_type (SSL_type x) const override { return set_int_value("ssl_type", x); } - const char* get_ssl_cipher (MEM_ROOT *root) const + const char* get_ssl_cipher (MEM_ROOT *root) const override { return unsafe_str(get_str_value(root, "ssl_cipher")); } - int set_ssl_cipher (const char *s, size_t l) const + int set_ssl_cipher (const char *s, size_t l) const override { return set_str_value("ssl_cipher", s, l); } - const char* get_x509_issuer (MEM_ROOT *root) const + const char* get_x509_issuer (MEM_ROOT *root) const override { return unsafe_str(get_str_value(root, "x509_issuer")); } - int set_x509_issuer (const char *s, size_t l) const + int set_x509_issuer (const char *s, size_t l) const override { return set_str_value("x509_issuer", s, l); } - const char* get_x509_subject (MEM_ROOT *root) const + const char* get_x509_subject (MEM_ROOT *root) const override { return unsafe_str(get_str_value(root, "x509_subject")); } - int set_x509_subject (const char *s, size_t l) const + int set_x509_subject (const char *s, size_t l) const override { return set_str_value("x509_subject", s, l); } - longlong get_max_questions () const + longlong get_max_questions () const override { return get_int_value("max_questions"); } - int set_max_questions (longlong x) const + int set_max_questions (longlong x) const override { return set_int_value("max_questions", x); } - longlong get_max_updates () const + longlong get_max_updates () const override { return get_int_value("max_updates"); } - int set_max_updates (longlong x) const + int set_max_updates (longlong x) const override { return set_int_value("max_updates", x); } - longlong get_max_connections () const + longlong get_max_connections () const override { return get_int_value("max_connections"); } - int set_max_connections (longlong x) const + int set_max_connections (longlong x) const override { return set_int_value("max_connections", x); } - longlong get_max_user_connections () const + longlong get_max_user_connections () const override { return get_int_value("max_user_connections"); } - int set_max_user_connections (longlong x) const + int set_max_user_connections (longlong x) const override { return set_int_value("max_user_connections", x); } - double get_max_statement_time () const + double get_max_statement_time () const override { return get_double_value("max_statement_time"); } - int set_max_statement_time (double x) const + int set_max_statement_time (double x) const override { return set_double_value("max_statement_time", x); } - bool get_is_role () const + bool get_is_role () const override { return get_bool_value("is_role"); } - int set_is_role (bool x) const + int set_is_role (bool x) const override { return set_bool_value("is_role", x); } - const char* get_default_role (MEM_ROOT *root) const + const char* get_default_role (MEM_ROOT *root) const override { return get_str_value(root, "default_role"); } - int set_default_role (const char *s, size_t l) const + int set_default_role (const char *s, size_t l) const override { return set_str_value("default_role", s, l); } - bool get_account_locked () const + bool get_account_locked () const override { return get_bool_value("account_locked"); } - int set_account_locked (bool x) const + int set_account_locked (bool x) const override { return set_bool_value("account_locked", x); } - my_time_t get_password_last_changed () const + my_time_t get_password_last_changed () const override { return static_cast(get_int_value("password_last_changed")); } - int set_password_last_changed (my_time_t x) const + int set_password_last_changed (my_time_t x) const override { return set_int_value("password_last_changed", static_cast(x)); } - int set_password_lifetime (longlong x) const + int set_password_lifetime (longlong x) const override { return set_int_value("password_lifetime", x); } - longlong get_password_lifetime () const + longlong get_password_lifetime () const override { return get_int_value("password_lifetime", -1); } /* password_last_changed=0 means the password is manually expired. In MySQL 5.7+ this state is described using the password_expired column in mysql.user */ - bool get_password_expired () const + bool get_password_expired () const override { return get_int_value("password_last_changed", -1) == 0; } - int set_password_expired (bool x) const + int set_password_expired (bool x) const override { return x ? set_password_last_changed(0) : 0; } - ~User_table_json() = default; + ~User_table_json() override = default; private: friend class Grant_tables; static const uint JSON_SIZE=1024; - int setup_sysvars() const + int setup_sysvars() const override { using_global_priv_table= true; username_char_length= MY_MIN(m_table->field[1]->char_length(), @@ -5366,8 +5366,8 @@ public: GRANT_TABLE(const char *h, const char *d,const char *u, const char *t, privilege_t p, privilege_t c); GRANT_TABLE (TABLE *form, TABLE *col_privs); - ~GRANT_TABLE(); - bool ok() { return privs != NO_ACL || cols != NO_ACL; } + ~GRANT_TABLE() override; + bool ok() override { return privs != NO_ACL || cols != NO_ACL; } void init_hash() { my_hash_init2(key_memory_acl_memex, &hash_columns, 4, system_charset_info, @@ -11628,14 +11628,14 @@ public: : is_grave(FALSE) {} - virtual ~Silence_routine_definer_errors() = default; + ~Silence_routine_definer_errors() override = default; - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; bool has_errors() { return is_grave; } diff --git a/sql/sql_acl.h b/sql/sql_acl.h index b4288b05bfb..44f3fa64b88 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -311,7 +311,7 @@ public: :m_command(command) { } bool is_revoke() const { return m_command == SQLCOM_REVOKE; } - enum_sql_command sql_command_code() const { return m_command; } + enum_sql_command sql_command_code() const override { return m_command; } }; @@ -325,7 +325,7 @@ public: Sql_cmd_grant_proxy(enum_sql_command command, privilege_t grant_option) :Sql_cmd_grant(command), m_grant_option(grant_option) { } - bool execute(THD *thd); + bool execute(THD *thd) override; }; @@ -352,7 +352,7 @@ public: Sql_cmd_grant_table(enum_sql_command command, const Grant_privilege &grant) :Sql_cmd_grant_object(command, grant) { } - bool execute(THD *thd); + bool execute(THD *thd) override; }; @@ -366,7 +366,7 @@ public: :Sql_cmd_grant_object(command, grant), m_sph(sph) { } - bool execute(THD *thd); + bool execute(THD *thd) override; }; #endif /* SQL_ACL_INCLUDED */ diff --git a/sql/sql_admin.h b/sql/sql_admin.h index ac20653dc63..4f7f9bae00d 100644 --- a/sql/sql_admin.h +++ b/sql/sql_admin.h @@ -38,9 +38,9 @@ public: ~Sql_cmd_analyze_table() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ANALYZE; } @@ -61,9 +61,9 @@ public: ~Sql_cmd_check_table() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_CHECK; } @@ -83,9 +83,9 @@ public: ~Sql_cmd_optimize_table() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_OPTIMIZE; } @@ -106,9 +106,9 @@ public: ~Sql_cmd_repair_table() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_REPAIR; } diff --git a/sql/sql_alter.h b/sql/sql_alter.h index e0de81e2b40..65643eac46f 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -362,7 +362,7 @@ protected: virtual ~Sql_cmd_common_alter_table() = default; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } @@ -383,9 +383,9 @@ public: ~Sql_cmd_alter_table() = default; - Storage_engine_name *option_storage_engine_name() { return this; } + Storage_engine_name *option_storage_engine_name() override { return this; } - bool execute(THD *thd); + bool execute(THD *thd) override; }; @@ -405,11 +405,11 @@ public: ~Sql_cmd_alter_sequence() = default; - enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_SEQUENCE; } - bool execute(THD *thd); + bool execute(THD *thd) override; }; @@ -429,7 +429,7 @@ public: : m_tablespace_op(tablespace_op_arg) {} - bool execute(THD *thd); + bool execute(THD *thd) override; private: const enum_tablespace_op_type m_tablespace_op; diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 9cdb93f4d6f..07be346ab20 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -123,13 +123,13 @@ public: { init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2, free_string, NULL, MYF(MY_THREAD_SPECIFIC)); }; - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *not_used __attribute__((unused))) + void add() override; + void get_opt_type(String*, ha_rows) override; + String *get_min_arg(String *not_used __attribute__((unused))) override { return &min_arg; } - String *get_max_arg(String *not_used __attribute__((unused))) + String *get_max_arg(String *not_used __attribute__((unused))) override { return &max_arg; } - String *avg(String *s, ha_rows rows) + String *avg(String *s, ha_rows rows) override { if (!(rows - nulls)) s->set_real((double) 0.0, 1,my_thd_charset); @@ -140,10 +140,10 @@ public: } friend int collect_string(String *element, element_count count, TREE_INFO *info); - tree_walk_action collect_enum() + tree_walk_action collect_enum() override { return (tree_walk_action) collect_string; } String *std(String *s __attribute__((unused)), - ha_rows rows __attribute__((unused))) + ha_rows rows __attribute__((unused))) override { return (String*) 0; } }; @@ -165,16 +165,16 @@ public: 0, (void *)&bin_size, MYF(MY_THREAD_SPECIFIC)); }; - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *); - String *get_max_arg(String *); - String *avg(String *s, ha_rows rows); + void add() override; + void get_opt_type(String*, ha_rows) override; + String *get_min_arg(String *) override; + String *get_max_arg(String *) override; + String *avg(String *s, ha_rows rows) override; friend int collect_decimal(uchar *element, element_count count, TREE_INFO *info); - tree_walk_action collect_enum() + tree_walk_action collect_enum() override { return (tree_walk_action) collect_decimal; } - String *std(String *s, ha_rows rows); + String *std(String *s, ha_rows rows) override; }; @@ -193,19 +193,19 @@ public: (qsort_cmp2) compare_double2, NULL, NULL, MYF(MY_THREAD_SPECIFIC)); } - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) + void add() override; + void get_opt_type(String*, ha_rows) override; + String *get_min_arg(String *s) override { s->set_real(min_arg, item->decimals, my_thd_charset); return s; } - String *get_max_arg(String *s) + String *get_max_arg(String *s) override { s->set_real(max_arg, item->decimals, my_thd_charset); return s; } - String *avg(String *s, ha_rows rows) + String *avg(String *s, ha_rows rows) override { if (!(rows - nulls)) s->set_real((double) 0.0, 1,my_thd_charset); @@ -213,7 +213,7 @@ public: s->set_real(((double)sum / (double) (rows - nulls)), item->decimals,my_thd_charset); return s; } - String *std(String *s, ha_rows rows) + String *std(String *s, ha_rows rows) override { double tmp = ulonglong2double(rows); if (!(tmp - nulls)) @@ -226,10 +226,10 @@ public: } return s; } - uint decimals() { return item->decimals; } + uint decimals() override { return item->decimals; } friend int collect_real(double *element, element_count count, TREE_INFO *info); - tree_walk_action collect_enum() + tree_walk_action collect_enum() override { return (tree_walk_action) collect_real;} }; @@ -248,11 +248,11 @@ public: (qsort_cmp2) compare_longlong2, NULL, NULL, MYF(MY_THREAD_SPECIFIC)); } - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; } - String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; } - String *avg(String *s, ha_rows rows) + void add() override; + void get_opt_type(String*, ha_rows) override; + String *get_min_arg(String *s) override { s->set(min_arg,my_thd_charset); return s; } + String *get_max_arg(String *s) override { s->set(max_arg,my_thd_charset); return s; } + String *avg(String *s, ha_rows rows) override { if (!(rows - nulls)) s->set_real((double) 0.0, 1,my_thd_charset); @@ -260,7 +260,7 @@ public: s->set_real(((double) sum / (double) (rows - nulls)), DEC_IN_AVG,my_thd_charset); return s; } - String *std(String *s, ha_rows rows) + String *std(String *s, ha_rows rows) override { double tmp = ulonglong2double(rows); if (!(tmp - nulls)) @@ -275,7 +275,7 @@ public: } friend int collect_longlong(longlong *element, element_count count, TREE_INFO *info); - tree_walk_action collect_enum() + tree_walk_action collect_enum() override { return (tree_walk_action) collect_longlong;} }; @@ -293,11 +293,11 @@ public: { init_tree(&tree, 0, 0, sizeof(ulonglong), (qsort_cmp2) compare_ulonglong2, NULL, NULL, MYF(MY_THREAD_SPECIFIC)); } - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; } - String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; } - String *avg(String *s, ha_rows rows) + void add() override; + void get_opt_type(String*, ha_rows) override; + String *get_min_arg(String *s) override { s->set(min_arg,my_thd_charset); return s; } + String *get_max_arg(String *s) override { s->set(max_arg,my_thd_charset); return s; } + String *avg(String *s, ha_rows rows) override { if (!(rows - nulls)) s->set_real((double) 0.0, 1,my_thd_charset); @@ -306,7 +306,7 @@ public: DEC_IN_AVG,my_thd_charset); return s; } - String *std(String *s, ha_rows rows) + String *std(String *s, ha_rows rows) override { double tmp = ulonglong2double(rows); if (!(tmp - nulls)) @@ -322,7 +322,7 @@ public: } friend int collect_ulonglong(ulonglong *element, element_count count, TREE_INFO *info); - tree_walk_action collect_enum() + tree_walk_action collect_enum() override { return (tree_walk_action) collect_ulonglong; } }; @@ -354,11 +354,11 @@ public: delete (*f); } } - virtual void add() {} - virtual bool change_columns(THD *thd, List &fields); - virtual int send_row(List &field_list); - virtual void end_group(void) {} - virtual int end_of_records(void); + void add() override {} + bool change_columns(THD *thd, List &fields) override; + int send_row(List &field_list) override; + void end_group(void) override {} + int end_of_records(void) override; friend Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result, List &field_list); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index bac6026cb1e..14bcaf86423 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -116,7 +116,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; /** Returns TRUE if there were ER_NO_SUCH_/WRONG_MRG_TABLE and there @@ -517,7 +517,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { *cond_hdl= NULL; if (sql_errno == ER_OPEN_AS_READONLY) @@ -1400,14 +1400,14 @@ public: : m_ot_ctx(ot_ctx_arg), m_is_active(FALSE) {} - virtual ~MDL_deadlock_handler() = default; + ~MDL_deadlock_handler() override = default; - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; private: /** Open table context to be used for back-off request. */ @@ -3167,12 +3167,12 @@ request_backoff_action(enum_open_table_action action_arg, class MDL_deadlock_discovery_repair_handler : public Internal_error_handler { public: - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { if (sql_errno == ER_LOCK_DEADLOCK) { diff --git a/sql/sql_base.h b/sql/sql_base.h index 7cfe10ea2d1..e3d2a1dae56 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -419,13 +419,13 @@ public: class DML_prelocking_strategy : public Prelocking_strategy { public: - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, - Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking); - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); + bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, + Sroutine_hash_entry *rt, sp_head *sp, + bool *need_prelocking) override; + bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; + bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; }; @@ -436,8 +436,8 @@ public: class Lock_tables_prelocking_strategy : public DML_prelocking_strategy { - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); + bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; }; @@ -452,13 +452,13 @@ class Lock_tables_prelocking_strategy : public DML_prelocking_strategy class Alter_table_prelocking_strategy : public Prelocking_strategy { public: - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, - Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking); - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); + bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, + Sroutine_hash_entry *rt, sp_head *sp, + bool *need_prelocking) override; + bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; + bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; }; @@ -650,7 +650,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; /** Returns TRUE if one or more ER_NO_SUCH_TABLE errors have been diff --git a/sql/sql_class.h b/sql/sql_class.h index 7324ba73bf1..63e21a35d86 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -486,7 +486,7 @@ public: Used to make a clone of this object for ALTER/CREATE TABLE @sa comment for Key_part_spec::clone */ - virtual Key *clone(MEM_ROOT *mem_root) const + Key *clone(MEM_ROOT *mem_root) const override { return new (mem_root) Foreign_key(*this, mem_root); } /* Used to validate foreign key options */ bool validate(List &table_fields); @@ -1372,7 +1372,7 @@ public: void set_n_backup_statement(Statement *stmt, Statement *backup); void restore_backup_statement(Statement *stmt, Statement *backup); /* return class type */ - virtual Type type() const; + Type type() const override; }; @@ -1924,7 +1924,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { /* Ignore error */ return TRUE; @@ -1946,7 +1946,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { if (*level == Sql_condition::WARN_LEVEL_ERROR) errors++; @@ -1974,7 +1974,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl); + Sql_condition ** cond_hdl) override; private: }; @@ -1995,7 +1995,7 @@ public: const char *sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition **cond_hdl); + Sql_condition **cond_hdl) override; bool need_reopen() const { return m_need_reopen; }; void init() { m_need_reopen= FALSE; }; @@ -2011,7 +2011,7 @@ struct Suppress_warnings_error_handler : public Internal_error_handler const char *sqlstate, Sql_condition::enum_warning_level *level, const char *msg, - Sql_condition **cond_hdl) + Sql_condition **cond_hdl) override { return *level == Sql_condition::WARN_LEVEL_WARN; } @@ -3659,7 +3659,7 @@ public: enter_cond(mysql_cond_t *cond, mysql_mutex_t* mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, - int src_line) + int src_line) override { mysql_mutex_assert_owner(mutex); mysys_var->current_mutex = mutex; @@ -3671,7 +3671,7 @@ public: } inline void exit_cond(const PSI_stage_info *stage, const char *src_function, const char *src_file, - int src_line) + int src_line) override { /* Putting the mutex unlock in thd->exit_cond() ensures that @@ -3688,8 +3688,8 @@ public: mysql_mutex_unlock(&mysys_var->mutex); return; } - virtual int is_killed() { return killed; } - virtual THD* get_thd() { return this; } + int is_killed() override { return killed; } + THD* get_thd() override { return this; } /** A callback to the server internals that is used to address @@ -3714,8 +3714,8 @@ public: @retval TRUE if the thread was woken up @retval FALSE otherwise. */ - virtual bool notify_shared_lock(MDL_context_owner *ctx_in_use, - bool needs_thr_lock_abort); + bool notify_shared_lock(MDL_context_owner *ctx_in_use, + bool needs_thr_lock_abort) override; // End implementation of MDL_context_owner interface. @@ -4825,7 +4825,7 @@ public: public: /** Overloaded to guard query/query_length fields */ - virtual void set_statement(Statement *stmt); + void set_statement(Statement *stmt) override; inline void set_command(enum enum_server_command command) { DBUG_ASSERT(command != COM_SLEEP); @@ -5707,7 +5707,7 @@ public: TABLE *dst_table; /* table to write into */ /* The following is called in the child thread: */ - int send_data(List &items); + int send_data(List &items) override; }; @@ -5721,7 +5721,7 @@ class select_result_text_buffer : public select_result_sink { public: select_result_text_buffer(THD *thd_arg): select_result_sink(thd_arg) {} - int send_data(List &items); + int send_data(List &items) override; bool send_result_set_metadata(List &fields, uint flag); void save_to(String *res); @@ -5749,9 +5749,9 @@ public: DBUG_PRINT("enter", ("this %p", this)); DBUG_VOID_RETURN; } /* Remove gcc warning */ - uint field_count(List &fields) const { return 0; } - bool send_result_set_metadata(List &fields, uint flag) { return FALSE; } - select_result_interceptor *result_interceptor() { return this; } + uint field_count(List &fields) const override { return 0; } + bool send_result_set_metadata(List &fields, uint flag) override { return FALSE; } + select_result_interceptor *result_interceptor() override { return this; } /* Instruct the object to not call my_ok(). Client output will be handled @@ -5819,10 +5819,10 @@ private: uint get_field_count() { return field_count; } void set_spvar_list(List *vars) { spvar_list= vars; } - virtual bool send_eof() { return FALSE; } - virtual int send_data(List &items); - virtual int prepare(List &list, SELECT_LEX_UNIT *u); - virtual bool view_structure_only() const { return m_view_structure_only; } + bool send_eof() override { return FALSE; } + int send_data(List &items) override; + int prepare(List &list, SELECT_LEX_UNIT *u) override; + bool view_structure_only() const override { return m_view_structure_only; } }; public: @@ -5879,13 +5879,13 @@ class select_send :public select_result { public: select_send(THD *thd_arg): select_result(thd_arg), is_result_set_started(FALSE) {} - bool send_result_set_metadata(List &list, uint flags); - int send_data(List &items); - bool send_eof(); - virtual bool check_simple_select() const { return FALSE; } - void abort_result_set(); - virtual void cleanup(); - select_result_interceptor *result_interceptor() { return NULL; } + bool send_result_set_metadata(List &list, uint flags) override; + int send_data(List &items) override; + bool send_eof() override; + bool check_simple_select() const override { return FALSE; } + void abort_result_set() override; + void cleanup() override; + select_result_interceptor *result_interceptor() override { return NULL; } }; @@ -5897,9 +5897,9 @@ public: class select_send_analyze : public select_send { - bool send_result_set_metadata(List &list, uint flags) { return 0; } - bool send_eof() { return 0; } - void abort_result_set() {} + bool send_result_set_metadata(List &list, uint flags) override { return 0; } + bool send_eof() override { return 0; } + void abort_result_set() override {} public: select_send_analyze(THD *thd_arg): select_send(thd_arg) {} }; @@ -5918,8 +5918,8 @@ public: select_result_interceptor(thd_arg), exchange(ex), file(-1),row_count(0L) { path[0]=0; } ~select_to_file(); - bool send_eof(); - void cleanup(); + bool send_eof() override; + void cleanup() override; }; @@ -5959,16 +5959,16 @@ class select_export :public select_to_file { public: select_export(THD *thd_arg, sql_exchange *ex): select_to_file(thd_arg, ex) {} ~select_export(); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int send_data(List &items) override; }; class select_dump :public select_to_file { public: select_dump(THD *thd_arg, sql_exchange *ex): select_to_file(thd_arg, ex) {} - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int send_data(List &items) override; }; @@ -5986,17 +5986,17 @@ class select_insert :public select_result_interceptor { List *update_values, enum_duplicates duplic, bool ignore, select_result *sel_ret_list); ~select_insert(); - int prepare(List &list, SELECT_LEX_UNIT *u); - virtual int prepare2(JOIN *join); - virtual int send_data(List &items); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int prepare2(JOIN *join) override; + int send_data(List &items) override; virtual bool store_values(List &values); virtual bool can_rollback_data() { return 0; } bool prepare_eof(); bool send_ok_packet(); - bool send_eof(); - virtual void abort_result_set(); + bool send_eof() override; + void abort_result_set() override; /* not implemented: select_insert is never re-used in prepared statements */ - void cleanup(); + void cleanup() override; }; @@ -6028,18 +6028,18 @@ public: m_plock(NULL), exit_done(0), saved_tmp_table_share(0) {} - int prepare(List &list, SELECT_LEX_UNIT *u); + int prepare(List &list, SELECT_LEX_UNIT *u) override; int binlog_show_create_table(TABLE **tables, uint count); - bool store_values(List &values); - bool send_eof(); - virtual void abort_result_set(); - virtual bool can_rollback_data() { return 1; } + bool store_values(List &values) override; + bool send_eof() override; + void abort_result_set() override; + bool can_rollback_data() override { return 1; } // Needed for access from local class MY_HOOKS in prepare(), since thd is proteted. const THD *get_thd(void) { return thd; } const HA_CREATE_INFO *get_create_info() { return create_info; }; - int prepare2(JOIN *join) { return 0; } + int prepare2(JOIN *join) override { return 0; } private: TABLE *create_table_from_items(THD *thd, @@ -6198,7 +6198,7 @@ public: init(); tmp_table_param.init(); } - int prepare(List &list, SELECT_LEX_UNIT *u); + int prepare(List &list, SELECT_LEX_UNIT *u) override; /** Do prepare() and prepare2() if they have been postponed until column type information is computed (used by select_union_direct). @@ -6209,13 +6209,13 @@ public: */ virtual bool postponed_prepare(List &types) { return false; } - int send_data(List &items); + int send_data(List &items) override; int write_record(); int update_counter(Field *counter, longlong value); int delete_record(); - bool send_eof(); + bool send_eof() override; virtual bool flush(); - void cleanup(); + void cleanup() override; virtual bool create_result_table(THD *thd, List *column_types, bool is_distinct, ulonglong options, const LEX_CSTRING *alias, @@ -6342,11 +6342,11 @@ public: curr_op_type(UNSPECIFIED) { }; - int send_data(List &items); - void change_select(); + int send_data(List &items) override; + void change_select() override; int unfold_record(ha_rows cnt); - bool send_eof(); - bool force_enable_index_if_needed() + bool send_eof() override; + bool force_enable_index_if_needed() override { is_index_enabled= true; return true; @@ -6403,15 +6403,15 @@ class select_union_recursive :public select_unit row_counter(0) { incr_table_param.init(); }; - int send_data(List &items); + int send_data(List &items) override; bool create_result_table(THD *thd, List *column_types, bool is_distinct, ulonglong options, const LEX_CSTRING *alias, bool bit_fields_as_long, bool create_table, bool keep_row_order, - uint hidden); - void cleanup(); + uint hidden) override; + void cleanup() override; }; /** @@ -6458,30 +6458,30 @@ public: done_send_result_set_metadata(false), done_initialize_tables(false), limit_found_rows(0) { send_records= 0; } - bool change_result(select_result *new_result); - uint field_count(List &fields) const + bool change_result(select_result *new_result) override; + uint field_count(List &fields) const override { // Only called for top-level select_results, usually select_send DBUG_ASSERT(false); /* purecov: inspected */ return 0; /* purecov: inspected */ } - bool postponed_prepare(List &types); - bool send_result_set_metadata(List &list, uint flags); - int send_data(List &items); - bool initialize_tables (JOIN *join); - bool send_eof(); - bool flush() { return false; } - bool check_simple_select() const + bool postponed_prepare(List &types) override; + bool send_result_set_metadata(List &list, uint flags) override; + int send_data(List &items) override; + bool initialize_tables (JOIN *join) override; + bool send_eof() override; + bool flush() override { return false; } + bool check_simple_select() const override { /* Only called for top-level select_results, usually select_send */ DBUG_ASSERT(false); /* purecov: inspected */ return false; /* purecov: inspected */ } - void abort_result_set() + void abort_result_set() override { result->abort_result_set(); /* purecov: inspected */ } - void cleanup() + void cleanup() override { send_records= 0; } @@ -6499,7 +6499,11 @@ public: // EXPLAIN should never output to a select_union_direct DBUG_ASSERT(false); /* purecov: inspected */ } +#ifdef EMBEDDED_LIBRARY + void begin_dataset() override +#else void begin_dataset() +#endif { // Only called for sp_cursor::Select_fetch_into_spvars DBUG_ASSERT(false); /* purecov: inspected */ @@ -6515,8 +6519,8 @@ protected: public: select_subselect(THD *thd_arg, Item_subselect *item_arg): select_result_interceptor(thd_arg), item(item_arg) {} - int send_data(List &items)=0; - bool send_eof() { return 0; }; + int send_data(List &items) override=0; + bool send_eof() override { return 0; }; }; /* Single value subselect interface class */ @@ -6526,7 +6530,7 @@ public: select_singlerow_subselect(THD *thd_arg, Item_subselect *item_arg): select_subselect(thd_arg, item_arg) {} - int send_data(List &items); + int send_data(List &items) override; }; @@ -6577,10 +6581,10 @@ public: bool bit_fields_as_long, bool create_table, bool keep_row_order, - uint hidden); + uint hidden) override; bool init_result_table(ulonglong select_options); - int send_data(List &items); - void cleanup(); + int send_data(List &items) override; + void cleanup() override; ha_rows get_null_count_of_col(uint idx) { DBUG_ASSERT(idx < table->s->fields); @@ -6613,8 +6617,8 @@ public: bool mx, bool all): select_subselect(thd_arg, item_arg), cache(0), fmax(mx), is_all(all) {} - void cleanup(); - int send_data(List &items); + void cleanup() override; + int send_data(List &items) override; bool cmp_real(); bool cmp_int(); bool cmp_decimal(); @@ -6629,7 +6633,7 @@ class select_exists_subselect :public select_subselect public: select_exists_subselect(THD *thd_arg, Item_subselect *item_arg): select_subselect(thd_arg, item_arg) {} - int send_data(List &items); + int send_data(List &items) override; }; @@ -6886,15 +6890,15 @@ public: public: multi_delete(THD *thd_arg, TABLE_LIST *dt, uint num_of_tables); ~multi_delete(); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool initialize_tables (JOIN *join); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int send_data(List &items) override; + bool initialize_tables (JOIN *join) override; int do_deletes(); int do_table_deletes(TABLE *table, SORT_INFO *sort_info, bool ignore); - bool send_eof(); + bool send_eof() override; inline ha_rows num_deleted() const { return deleted; } - virtual void abort_result_set(); - void prepare_to_read_rows(); + void abort_result_set() override; + void prepare_to_read_rows() override; }; @@ -6941,17 +6945,17 @@ public: enum_duplicates handle_duplicates, bool ignore); ~multi_update(); bool init(THD *thd); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool initialize_tables (JOIN *join); - int prepare2(JOIN *join); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int send_data(List &items) override; + bool initialize_tables (JOIN *join) override; + int prepare2(JOIN *join) override; int do_updates(); - bool send_eof(); + bool send_eof() override; inline ha_rows num_found() const { return found; } inline ha_rows num_updated() const { return updated; } - virtual void abort_result_set(); - void update_used_tables(); - void prepare_to_read_rows(); + void abort_result_set() override; + void update_used_tables() override; + void prepare_to_read_rows() override; }; class my_var_sp; @@ -6983,8 +6987,8 @@ public: m_rcontext_handler(rcontext_handler), m_type_handler(type_handler), offset(o), sp(s) { } ~my_var_sp() = default; - bool set(THD *thd, Item *val); - my_var_sp *get_my_var_sp() { return this; } + bool set(THD *thd, Item *val) override; + my_var_sp *get_my_var_sp() override { return this; } const Type_handler *type_handler() const { return m_type_handler; } sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const; }; @@ -7004,7 +7008,7 @@ public: &type_handler_double/*Not really used*/, s), m_field_offset(field_idx) { } - bool set(THD *thd, Item *val); + bool set(THD *thd, Item *val) override; }; class my_var_user: public my_var { @@ -7012,7 +7016,7 @@ public: my_var_user(const LEX_CSTRING *j) : my_var(j, SESSION_VAR) { } ~my_var_user() = default; - bool set(THD *thd, Item *val); + bool set(THD *thd, Item *val) override; }; class select_dumpvar :public select_result_interceptor { @@ -7025,11 +7029,11 @@ public: :select_result_interceptor(thd_arg), row_count(0), m_var_sp_row(NULL) { var_list.empty(); } ~select_dumpvar() = default; - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool send_eof(); - virtual bool check_simple_select() const; - void cleanup(); + int prepare(List &list, SELECT_LEX_UNIT *u) override; + int send_data(List &items) override; + bool send_eof() override; + bool check_simple_select() const override; + void cleanup() override; }; /* Bits in sql_command_flags */ @@ -7676,7 +7680,7 @@ public: ErrConvDQName(const Database_qualified_name *name) :m_name(name) { } - const char *ptr() const + const char *ptr() const override { m_name->make_qname(err_buffer, sizeof(err_buffer), false); return err_buffer; @@ -7696,10 +7700,10 @@ public: m_maybe_null(false) { } - void set_maybe_null(bool maybe_null_arg) { m_maybe_null= maybe_null_arg; } + void set_maybe_null(bool maybe_null_arg) override { m_maybe_null= maybe_null_arg; } bool get_maybe_null() const { return m_maybe_null; } - uint decimal_precision() const + uint decimal_precision() const override { /* Type_holder is not used directly to create fields, so @@ -7711,11 +7715,11 @@ public: DBUG_ASSERT(0); return 0; } - void set_typelib(const TYPELIB *typelib) + void set_typelib(const TYPELIB *typelib) override { m_typelib= typelib; } - const TYPELIB *get_typelib() const + const TYPELIB *get_typelib() const override { return m_typelib; } diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index 53dd6e750f8..ea518375226 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -220,9 +220,9 @@ public: :show_all_slaves_status(status_all) {} - enum_sql_command sql_command_code() const { return SQLCOM_SHOW_SLAVE_STAT; } + enum_sql_command sql_command_code() const override { return SQLCOM_SHOW_SLAVE_STAT; } - bool execute(THD *thd); + bool execute(THD *thd) override; bool is_show_all_slaves_stat() { return show_all_slaves_status; } }; @@ -231,20 +231,20 @@ class Sql_cmd_create_table_like: public Sql_cmd, public Storage_engine_name { public: - Storage_engine_name *option_storage_engine_name() { return this; } - bool execute(THD *thd); + Storage_engine_name *option_storage_engine_name() override { return this; } + bool execute(THD *thd) override; }; class Sql_cmd_create_table: public Sql_cmd_create_table_like { public: - enum_sql_command sql_command_code() const { return SQLCOM_CREATE_TABLE; } + enum_sql_command sql_command_code() const override { return SQLCOM_CREATE_TABLE; } }; class Sql_cmd_create_sequence: public Sql_cmd_create_table_like { public: - enum_sql_command sql_command_code() const { return SQLCOM_CREATE_SEQUENCE; } + enum_sql_command sql_command_code() const override { return SQLCOM_CREATE_SEQUENCE; } }; @@ -268,9 +268,9 @@ public: @param thd the current thread. @return false on success. */ - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_CALL; } diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 3e9fe8076fc..3dcfb953c3e 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -49,15 +49,15 @@ public: Materialized_cursor(select_result *result, TABLE *table); int send_result_set_metadata(THD *thd, List &send_result_set_metadata); - virtual bool is_open() const { return table != 0; } - virtual int open(JOIN *join __attribute__((unused))); - virtual void fetch(ulong num_rows); - virtual void close(); - bool export_structure(THD *thd, Row_definition_list *defs) + bool is_open() const override { return table != 0; } + int open(JOIN *join __attribute__((unused))) override; + void fetch(ulong num_rows) override; + void close() override; + bool export_structure(THD *thd, Row_definition_list *defs) override { return table->export_structure(thd, defs); } - virtual ~Materialized_cursor(); + ~Materialized_cursor() override; void on_table_fill_finished(); }; @@ -79,9 +79,9 @@ public: Materialized_cursor *materialized_cursor; Select_materialize(THD *thd_arg, select_result *result_arg): select_unit(thd_arg), result(result_arg), materialized_cursor(0) {} - virtual bool send_result_set_metadata(List &list, uint flags); - bool send_eof() { return false; } - bool view_structure_only() const + bool send_result_set_metadata(List &list, uint flags) override; + bool send_eof() override { return false; } + bool view_structure_only() const override { return result->view_structure_only(); } diff --git a/sql/sql_error.h b/sql/sql_error.h index c00de1d471e..92bc0b821a9 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -888,7 +888,7 @@ public: : ErrConv(), str(str_arg), len(strlen(str_arg)), cs(cs_arg) {} ErrConvString(const String *s) : ErrConv(), str(s->ptr()), len(s->length()), cs(s->charset()) {} - const char *ptr() const + const char *ptr() const override { return set_str(str, len, cs); } @@ -899,7 +899,7 @@ class ErrConvInteger : public ErrConv, public Longlong_hybrid public: ErrConvInteger(const Longlong_hybrid &nr) : ErrConv(), Longlong_hybrid(nr) { } - const char *ptr() const + const char *ptr() const override { return set_longlong(static_cast(*this)); } @@ -910,7 +910,7 @@ class ErrConvDouble: public ErrConv double num; public: ErrConvDouble(double num_arg) : ErrConv(), num(num_arg) {} - const char *ptr() const + const char *ptr() const override { return set_double(num); } @@ -921,7 +921,7 @@ class ErrConvTime : public ErrConv const MYSQL_TIME *ltime; public: ErrConvTime(const MYSQL_TIME *ltime_arg) : ErrConv(), ltime(ltime_arg) {} - const char *ptr() const + const char *ptr() const override { return set_mysql_time(ltime); } @@ -932,7 +932,7 @@ class ErrConvDecimal : public ErrConv const decimal_t *d; public: ErrConvDecimal(const decimal_t *d_arg) : ErrConv(), d(d_arg) {} - const char *ptr() const + const char *ptr() const override { return set_decimal(d); } diff --git a/sql/sql_explain.h b/sql/sql_explain.h index d85011a4b0f..e7b054ed75b 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -161,21 +161,21 @@ class Explain_table_access; class Explain_basic_join : public Explain_node { public: - enum explain_node_type get_type() { return EXPLAIN_BASIC_JOIN; } + enum explain_node_type get_type() override { return EXPLAIN_BASIC_JOIN; } Explain_basic_join(MEM_ROOT *root) : Explain_node(root), join_tabs(NULL) {} ~Explain_basic_join(); bool add_table(Explain_table_access *tab, Explain_query *query); - int get_select_id() { return select_id; } + int get_select_id() override { return select_id; } int select_id; int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); + uint8 explain_flags, bool is_analyze) override; void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + bool is_analyze) override; void print_explain_json_interns(Explain_query *query, Json_writer *writer, bool is_analyze); @@ -205,7 +205,7 @@ class Explain_aggr_node; class Explain_select : public Explain_basic_join { public: - enum explain_node_type get_type() { return EXPLAIN_SELECT; } + enum explain_node_type get_type() override { return EXPLAIN_SELECT; } Explain_select(MEM_ROOT *root, bool is_analyze) : Explain_basic_join(root), @@ -260,9 +260,9 @@ public: Explain_aggr_node* aggr_tree; int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); + uint8 explain_flags, bool is_analyze) override; void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + bool is_analyze) override; Table_access_tracker *get_using_temporary_read_tracker() { @@ -299,7 +299,7 @@ class Explain_aggr_filesort : public Explain_aggr_node List sort_items; List sort_directions; public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_FILESORT; } + enum_explain_aggr_node_type get_type() override { return AGGR_OP_FILESORT; } Filesort_tracker tracker; Explain_aggr_filesort(MEM_ROOT *mem_root, bool is_analyze, @@ -311,20 +311,20 @@ public: class Explain_aggr_tmp_table : public Explain_aggr_node { public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_TEMP_TABLE; } + enum_explain_aggr_node_type get_type() override { return AGGR_OP_TEMP_TABLE; } }; class Explain_aggr_remove_dups : public Explain_aggr_node { public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_REMOVE_DUPLICATES; } + enum_explain_aggr_node_type get_type() override { return AGGR_OP_REMOVE_DUPLICATES; } }; class Explain_aggr_window_funcs : public Explain_aggr_node { List sorts; public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_WINDOW_FUNCS; } + enum_explain_aggr_node_type get_type() override { return AGGR_OP_WINDOW_FUNCS; } void print_json_members(Json_writer *writer, bool is_analyze); friend class Window_funcs_computation; @@ -351,10 +351,10 @@ public: fake_select_lex_explain(root, is_analyze) {} - enum explain_node_type get_type() { return EXPLAIN_UNION; } + enum explain_node_type get_type() override { return EXPLAIN_UNION; } unit_common_op operation; - int get_select_id() + int get_select_id() override { DBUG_ASSERT(union_members.elements() > 0); return union_members.at(0); @@ -377,9 +377,9 @@ public: union_members.append(select_no); } int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); + uint8 explain_flags, bool is_analyze) override; void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + bool is_analyze) override; const char *fake_select_type; bool using_filesort; @@ -886,8 +886,8 @@ public: command_tracker(is_analyze) {} - virtual enum explain_node_type get_type() { return EXPLAIN_UPDATE; } - virtual int get_select_id() { return 1; /* always root */ } + enum explain_node_type get_type() override { return EXPLAIN_UPDATE; } + int get_select_id() override { return 1; /* always root */ } const char *select_type; @@ -943,10 +943,10 @@ public: /* TODO: This tracks time to read rows from the table */ Exec_time_tracker table_tracker; - virtual int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - virtual void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + int print_explain(Explain_query *query, select_result_sink *output, + uint8 explain_flags, bool is_analyze) override; + void print_explain_json(Explain_query *query, Json_writer *writer, + bool is_analyze) override; }; @@ -966,13 +966,13 @@ public: StringBuffer<64> table_name; - enum explain_node_type get_type() { return EXPLAIN_INSERT; } - int get_select_id() { return 1; /* always root */ } + enum explain_node_type get_type() override { return EXPLAIN_INSERT; } + int get_select_id() override { return 1; /* always root */ } int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); + uint8 explain_flags, bool is_analyze) override; void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + bool is_analyze) override; }; @@ -993,13 +993,13 @@ public: */ bool deleting_all_rows; - virtual enum explain_node_type get_type() { return EXPLAIN_DELETE; } - virtual int get_select_id() { return 1; /* always root */ } + enum explain_node_type get_type() override { return EXPLAIN_DELETE; } + int get_select_id() override { return 1; /* always root */ } - virtual int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - virtual void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); + int print_explain(Explain_query *query, select_result_sink *output, + uint8 explain_flags, bool is_analyze) override; + void print_explain_json(Explain_query *query, Json_writer *writer, + bool is_analyze) override; }; diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h index 88436837a2d..fd5dffc0e5a 100644 --- a/sql/sql_expression_cache.h +++ b/sql/sql_expression_cache.h @@ -113,19 +113,19 @@ class Expression_cache_tmptable :public Expression_cache public: Expression_cache_tmptable(THD *thd, List &dependants, Item *value); virtual ~Expression_cache_tmptable(); - virtual result check_value(Item **value); - virtual my_bool put_value(Item *value); + result check_value(Item **value) override; + my_bool put_value(Item *value) override; - void print(String *str, enum_query_type query_type); - bool is_inited() { return inited; }; - void init(); + void print(String *str, enum_query_type query_type) override; + bool is_inited() override { return inited; }; + void init() override; void set_tracker(Expression_cache_tracker *st) { tracker= st; update_tracker(); } - virtual void update_tracker() + void update_tracker() override { if (tracker) { diff --git a/sql/sql_get_diagnostics.h b/sql/sql_get_diagnostics.h index f283aa5b2c6..ccabfb8a99e 100644 --- a/sql/sql_get_diagnostics.h +++ b/sql/sql_get_diagnostics.h @@ -39,12 +39,12 @@ public: : m_info(info) {} - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_GET_DIAGNOSTICS; } - virtual bool execute(THD *thd); + bool execute(THD *thd) override; private: /** The information to be obtained. */ @@ -223,7 +223,7 @@ public: {} /** Obtain statement information in the context of a diagnostics area. */ - bool aggregate(THD *thd, const Diagnostics_area *da); + bool aggregate(THD *thd, const Diagnostics_area *da) override; private: /* List of statement information items. */ @@ -301,7 +301,7 @@ public: {} /** Obtain condition information in the context of a diagnostics area. */ - bool aggregate(THD *thd, const Diagnostics_area *da); + bool aggregate(THD *thd, const Diagnostics_area *da) override; private: /** diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a6b12ed7cff..2792ca8e015 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2298,7 +2298,7 @@ public: forced_insert_id(0), query(query_arg), time_zone(0), user(0), host(0), ip(0) {} - ~delayed_row() + ~delayed_row() override { my_free(query.str); my_free(record); @@ -2381,7 +2381,7 @@ public: TL_WRITE_LOW_PRIORITY : TL_WRITE; DBUG_VOID_RETURN; } - ~Delayed_insert() + ~Delayed_insert() override { /* The following is not really needed, but just for safety */ delayed_row *row; @@ -3057,13 +3057,13 @@ void kill_delayed_threads(void) class Delayed_prelocking_strategy : public Prelocking_strategy { public: - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, + bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking); - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); + bool *need_prelocking) override; + bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; + bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) override; }; @@ -4729,7 +4729,7 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) } private: - virtual int do_postlock(TABLE **tables, uint count) + int do_postlock(TABLE **tables, uint count) override { int error; THD *thd= const_cast(ptr->get_thd()); diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index 7b5e221b104..3d0377ed443 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -940,7 +940,7 @@ protected: } /* Get the total length of all prefixes of a record in hashed join buffer */ - uint get_prefix_length() + uint get_prefix_length() override { return base_prefix_length + get_size_of_rec_offset(); } @@ -949,13 +949,13 @@ protected: Get maximum size of the additional space per record used for the hash table with record keys */ - uint get_max_key_addon_space_per_record(); + uint get_max_key_addon_space_per_record() override; /* Calculate how much space in the buffer would not be occupied by records, key entries and additional memory for the MMR buffer. */ - size_t rem_space() + size_t rem_space() override { return MY_MAX(last_key_entry-end_pos-aux_buff_size,0); } @@ -964,25 +964,25 @@ protected: Calculate how much space is taken by allocation of the key entry for a record in the join buffer */ - uint extra_key_length() { return key_entry_length; } + uint extra_key_length() override { return key_entry_length; } /* Skip record from a hashed join buffer if its match flag is set to MATCH_FOUND */ - bool skip_if_matched(); + bool skip_if_matched() override; /* Skip record from a hashed join buffer if its match flag setting commands to do so */ - bool skip_if_not_needed_match(); + bool skip_if_not_needed_match() override; /* Search for a key in the hash table of the join buffer */ bool key_search(uchar *key, uint key_len, uchar **key_ref_ptr); /* Reallocate the join buffer of a hashed join cache */ - int realloc_buffer(); + int realloc_buffer() override; /* This constructor creates an unlinked hashed join cache. The cache is to be @@ -1003,16 +1003,16 @@ protected: public: /* Initialize a hashed join cache */ - int init(bool for_explain); + int init(bool for_explain) override; /* Reset the buffer of a hashed join cache for reading/writing */ - void reset(bool for_writing); + void reset(bool for_writing) override; /* Add a record into the buffer of a hashed join cache */ - bool put_record(); + bool put_record() override; /* Read the next record from the buffer of a hashed join cache */ - bool get_record(); + bool get_record() override; /* Shall check whether all records in a key chain have @@ -1112,13 +1112,13 @@ private: protected: - bool prepare_look_for_matches(bool skip_last); + bool prepare_look_for_matches(bool skip_last) override; - uchar *get_next_candidate_for_match(); + uchar *get_next_candidate_for_match() override; - bool skip_next_candidate_for_match(uchar *rec_ptr); + bool skip_next_candidate_for_match(uchar *rec_ptr) override; - void read_next_candidate_for_match(uchar *rec_ptr); + void read_next_candidate_for_match(uchar *rec_ptr) override; public: @@ -1139,11 +1139,11 @@ public: :JOIN_CACHE(j, tab, prev) {} /* Initialize the BNL cache */ - int init(bool for_explain); + int init(bool for_explain) override; - enum Join_algorithm get_join_alg() { return BNL_JOIN_ALG; } + enum Join_algorithm get_join_alg() override { return BNL_JOIN_ALG; } - bool is_key_access() { return FALSE; } + bool is_key_access() override { return FALSE; } }; @@ -1179,13 +1179,13 @@ protected: */ uchar *get_matching_chain_by_join_key(); - bool prepare_look_for_matches(bool skip_last); + bool prepare_look_for_matches(bool skip_last) override; - uchar *get_next_candidate_for_match(); + uchar *get_next_candidate_for_match() override; - bool skip_next_candidate_for_match(uchar *rec_ptr); + bool skip_next_candidate_for_match(uchar *rec_ptr) override; - void read_next_candidate_for_match(uchar *rec_ptr); + void read_next_candidate_for_match(uchar *rec_ptr) override; public: @@ -1206,11 +1206,11 @@ public: : JOIN_CACHE_HASHED(j, tab, prev) {} /* Initialize the BNLH cache */ - int init(bool for_explain); + int init(bool for_explain) override; - enum Join_algorithm get_join_alg() { return BNLH_JOIN_ALG; } + enum Join_algorithm get_join_alg() override { return BNLH_JOIN_ALG; } - bool is_key_access() { return TRUE; } + bool is_key_access() override { return TRUE; } }; @@ -1253,11 +1253,11 @@ public: JOIN_TAB_SCAN_MRR(JOIN *j, JOIN_TAB *tab, uint flags, RANGE_SEQ_IF rs_funcs) :JOIN_TAB_SCAN(j, tab), range_seq_funcs(rs_funcs), mrr_mode(flags) {} - uint aux_buffer_incr(size_t recno); + uint aux_buffer_incr(size_t recno) override; - int open(); + int open() override; - int next(); + int next() override; friend class JOIN_CACHE_BKA; /* it needs to add an mrr_mode flag after JOIN_CACHE::init() call */ }; @@ -1293,26 +1293,26 @@ protected: Get the number of ranges in the cache buffer passed to the MRR interface. For each record its own range is passed. */ - uint get_number_of_ranges_for_mrr() { return (uint)records; } + uint get_number_of_ranges_for_mrr() override { return (uint)records; } /* Setup the MRR buffer as the space between the last record put into the join buffer and the very end of the join buffer */ - int setup_aux_buffer(HANDLER_BUFFER &aux_buff) + int setup_aux_buffer(HANDLER_BUFFER &aux_buff) override { aux_buff.buffer= end_pos; aux_buff.buffer_end= buff+buff_size; return 0; } - bool prepare_look_for_matches(bool skip_last); + bool prepare_look_for_matches(bool skip_last) override; - uchar *get_next_candidate_for_match(); + uchar *get_next_candidate_for_match() override; - bool skip_next_candidate_for_match(uchar *rec_ptr); + bool skip_next_candidate_for_match(uchar *rec_ptr) override; - void read_next_candidate_for_match(uchar *rec_ptr); + void read_next_candidate_for_match(uchar *rec_ptr) override; public: @@ -1338,14 +1338,14 @@ public: :JOIN_CACHE(bka->join, bka->join_tab, bka->prev_cache), mrr_mode(bka->mrr_mode) {} - uchar **get_curr_association_ptr() { return &curr_association; } + uchar **get_curr_association_ptr() override { return &curr_association; } /* Initialize the BKA cache */ - int init(bool for_explain); + int init(bool for_explain) override; - enum Join_algorithm get_join_alg() { return BKA_JOIN_ALG; } + enum Join_algorithm get_join_alg() override { return BKA_JOIN_ALG; } - bool is_key_access() { return TRUE; } + bool is_key_access() override { return TRUE; } /* Get the key built over the next record from the join buffer */ uint get_next_key(uchar **key); @@ -1353,7 +1353,7 @@ public: /* Check index condition of the joined table for a record from BKA cache */ bool skip_index_tuple(range_id_t range_info); - bool save_explain_data(EXPLAIN_BKA_TYPE *explain); + bool save_explain_data(EXPLAIN_BKA_TYPE *explain) override; }; @@ -1389,21 +1389,21 @@ private: protected: - uint get_number_of_ranges_for_mrr() { return key_entries; } + uint get_number_of_ranges_for_mrr() override { return key_entries; } /* Initialize the MRR buffer allocating some space within the join buffer. The entire space between the last record put into the join buffer and the last key entry added to the hash table is used for the MRR buffer. */ - int setup_aux_buffer(HANDLER_BUFFER &aux_buff) + int setup_aux_buffer(HANDLER_BUFFER &aux_buff) override { aux_buff.buffer= end_pos; aux_buff.buffer_end= last_key_entry; return 0; } - bool prepare_look_for_matches(bool skip_last); + bool prepare_look_for_matches(bool skip_last) override; /* The implementations of the methods @@ -1438,15 +1438,15 @@ public: :JOIN_CACHE_BNLH(bkah->join, bkah->join_tab, bkah->prev_cache), mrr_mode(bkah->mrr_mode) {} - uchar **get_curr_association_ptr() { return &curr_matching_chain; } + uchar **get_curr_association_ptr() override { return &curr_matching_chain; } /* Initialize the BKAH cache */ - int init(bool for_explain); + int init(bool for_explain) override; - enum Join_algorithm get_join_alg() { return BKAH_JOIN_ALG; } + enum Join_algorithm get_join_alg() override { return BKAH_JOIN_ALG; } /* Check index condition of the joined table for a record from BKAH cache */ bool skip_index_tuple(range_id_t range_info); - bool save_explain_data(EXPLAIN_BKA_TYPE *explain); + bool save_explain_data(EXPLAIN_BKA_TYPE *explain) override; }; diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h index 2d648271898..04496ef74b8 100644 --- a/sql/sql_lifo_buffer.h +++ b/sql/sql_lifo_buffer.h @@ -162,22 +162,22 @@ class Forward_lifo_buffer: public Lifo_buffer { uchar *pos; public: - enum_direction type() { return FORWARD; } - size_t used_size() + enum_direction type() override { return FORWARD; } + size_t used_size() override { return (size_t)(pos - start); } - void reset() + void reset() override { pos= start; } - uchar *end_of_space() { return pos; } - bool have_space_for(size_t bytes) + uchar *end_of_space() override { return pos; } + bool have_space_for(size_t bytes) override { return (pos + bytes < end); } - void write() + void write() override { write_bytes(write_ptr1, size1); if (size2) @@ -199,8 +199,8 @@ public: *position= (*position) - bytes; return *position; } - bool read() { return read(&pos, &read_ptr1, &read_ptr2); } - bool read(uchar **position, uchar **ptr1, uchar **ptr2) + bool read() override { return read(&pos, &read_ptr1, &read_ptr2); } + bool read(uchar **position, uchar **ptr1, uchar **ptr2) override { if (!have_data(*position, size1 + size2)) return TRUE; @@ -209,7 +209,7 @@ public: *ptr1= read_bytes(position, size1); return FALSE; } - void remove_unused_space(uchar **unused_start, uchar **unused_end) + void remove_unused_space(uchar **unused_start, uchar **unused_end) override { DBUG_ASSERT(0); /* Don't need this yet */ } @@ -228,9 +228,9 @@ public: end= unused_end; } /* Return pointer to start of the memory area that is occupied by the data */ - uchar *used_area() { return start; } + uchar *used_area() override { return start; } friend class Lifo_buffer_iterator; - uchar *get_pos() { return pos; } + uchar *get_pos() override { return pos; } }; @@ -254,22 +254,22 @@ class Backward_lifo_buffer: public Lifo_buffer { uchar *pos; public: - enum_direction type() { return BACKWARD; } + enum_direction type() override { return BACKWARD; } - size_t used_size() + size_t used_size() override { return (size_t)(end - pos); } - void reset() + void reset() override { pos= end; } - uchar *end_of_space() { return end; } - bool have_space_for(size_t bytes) + uchar *end_of_space() override { return end; } + bool have_space_for(size_t bytes) override { return (pos - bytes >= start); } - void write() + void write() override { if (write_ptr2) write_bytes(write_ptr2, size2); @@ -281,11 +281,11 @@ public: pos -= bytes; memcpy(pos, data, bytes); } - bool read() + bool read() override { return read(&pos, &read_ptr1, &read_ptr2); } - bool read(uchar **position, uchar **ptr1, uchar **ptr2) + bool read(uchar **position, uchar **ptr1, uchar **ptr2) override { if (!have_data(*position, size1 + size2)) return TRUE; @@ -310,7 +310,7 @@ public: @param unused_start OUT Start of the unused space @param unused_end OUT End of the unused space */ - void remove_unused_space(uchar **unused_start, uchar **unused_end) + void remove_unused_space(uchar **unused_start, uchar **unused_end) override { *unused_start= start; *unused_end= pos; @@ -321,9 +321,9 @@ public: DBUG_ASSERT(0); /* Not used for backward buffers */ } /* Return pointer to start of the memory area that is occupied by the data */ - uchar *used_area() { return pos; } + uchar *used_area() override { return pos; } friend class Lifo_buffer_iterator; - uchar *get_pos() { return pos; } + uchar *get_pos() override { return pos; } }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 96aad2e01bf..30646f494ff 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1528,14 +1528,14 @@ class Silence_all_errors : public Internal_error_handler int error; public: Silence_all_errors():error(0) {} - virtual ~Silence_all_errors() {} + ~Silence_all_errors() override {} - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sql_state, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { error= sql_errno; *cond_hdl= NULL; diff --git a/sql/sql_partition_admin.h b/sql/sql_partition_admin.h index b50c3555bcb..eee021b5fb4 100644 --- a/sql/sql_partition_admin.h +++ b/sql/sql_partition_admin.h @@ -129,7 +129,7 @@ public: ~Sql_cmd_alter_table_exchange_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; private: bool exchange_partition(THD *thd, TABLE_LIST *, Alter_info *); @@ -151,10 +151,10 @@ public: ~Sql_cmd_alter_table_analyze_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; /* Override SQLCOM_ANALYZE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } @@ -176,10 +176,10 @@ public: ~Sql_cmd_alter_table_check_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; /* Override SQLCOM_CHECK, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } @@ -201,10 +201,10 @@ public: ~Sql_cmd_alter_table_optimize_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } @@ -226,10 +226,10 @@ public: ~Sql_cmd_alter_table_repair_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; /* Override SQLCOM_REPAIR, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } @@ -249,10 +249,10 @@ public: virtual ~Sql_cmd_alter_table_truncate_partition() = default; - bool execute(THD *thd); + bool execute(THD *thd) override; /* Override SQLCOM_TRUNCATE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 69dbe0d7749..22767d3025e 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -314,22 +314,22 @@ public: sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, st_plugin_int *p, st_mysql_sys_var *plugin_var_arg, const char *substitute); - sys_var_pluginvar *cast_pluginvar() { return this; } + sys_var_pluginvar *cast_pluginvar() override { return this; } uchar* real_value_ptr(THD *thd, enum_var_type type) const; TYPELIB* plugin_var_typelib(void) const; const uchar* do_value_ptr(THD *thd, enum_var_type type, const LEX_CSTRING *base) const; - const uchar* session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar* session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return do_value_ptr(thd, OPT_SESSION, base); } - const uchar* global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar* global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return do_value_ptr(thd, OPT_GLOBAL, base); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return do_value_ptr(thd, OPT_DEFAULT, 0); } - bool do_check(THD *thd, set_var *var); - virtual void session_save_default(THD *thd, set_var *var) {} - virtual void global_save_default(THD *thd, set_var *var) {} - bool session_update(THD *thd, set_var *var); - bool global_update(THD *thd, set_var *var); - bool session_is_default(THD *thd); + bool do_check(THD *thd, set_var *var) override; + void session_save_default(THD *thd, set_var *var) override {} + void global_save_default(THD *thd, set_var *var) override {} + bool session_update(THD *thd, set_var *var) override; + bool global_update(THD *thd, set_var *var) override; + bool session_is_default(THD *thd) override; }; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7cbf554c472..405464c119b 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -140,11 +140,11 @@ class Select_fetch_protocol_binary: public select_send Protocol_binary protocol; public: Select_fetch_protocol_binary(THD *thd); - virtual bool send_result_set_metadata(List &list, uint flags); - virtual int send_data(List &items); - virtual bool send_eof(); + bool send_result_set_metadata(List &list, uint flags) override; + int send_data(List &items) override; + bool send_eof() override; #ifdef EMBEDDED_LIBRARY - void begin_dataset() + void begin_dataset() override { protocol.begin_dataset(); } @@ -204,10 +204,10 @@ public: String *expanded_query); public: Prepared_statement(THD *thd_arg); - virtual ~Prepared_statement(); + ~Prepared_statement() override; void setup_set_params(); - virtual Query_arena::Type type() const; - virtual void cleanup_stmt(); + Query_arena::Type type() const override; + void cleanup_stmt() override; bool set_name(const LEX_CSTRING *name); inline void close_cursor() { delete cursor; cursor= 0; } inline bool is_in_use() { return flags & (uint) IS_IN_USE; } @@ -252,7 +252,7 @@ class Execute_sql_statement: public Server_runnable { public: Execute_sql_statement(LEX_STRING sql_text); - virtual bool execute_server_code(THD *thd); + bool execute_server_code(THD *thd) override; private: LEX_STRING m_sql_text; }; @@ -5535,29 +5535,33 @@ public: thd->set_binlog_bit(); } protected: - bool net_store_data(const uchar *from, size_t length); + bool net_store_data(const uchar *from, size_t length) override; bool net_store_data_cs(const uchar *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count); + CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override; + bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count) override; bool net_send_ok(THD *, uint, uint, ulonglong, ulonglong, const char *, - bool, bool); - bool net_send_error_packet(THD *, uint, const char *, const char *); + bool, bool) override; + bool net_send_error_packet(THD *, uint, const char *, const char *) override; bool begin_dataset(); bool begin_dataset(THD *thd, uint numfields); - bool write(); - bool flush(); + bool write() override; + bool flush() override; bool store_field_metadata(const THD *thd, const Send_field &field, CHARSET_INFO *charset_for_protocol, uint pos); - bool send_result_set_metadata(List *list, uint flags); + bool send_result_set_metadata(List *list, uint flags) override; +#ifdef EMBEDDED_LIBRARY + void remove_last_row() override; +#else void remove_last_row(); - bool store_null(); - void prepare_for_resend(); +#endif + bool store_null() override; + void prepare_for_resend() override; bool send_list_fields(List *list, const TABLE_LIST *table_list); - enum enum_protocol_type type() { return PROTOCOL_LOCAL; }; + enum enum_protocol_type type() override { return PROTOCOL_LOCAL; }; }; static diff --git a/sql/sql_schema.cc b/sql/sql_schema.cc index 7a6c0c99398..0dcd9aa9f86 100644 --- a/sql/sql_schema.cc +++ b/sql/sql_schema.cc @@ -26,7 +26,7 @@ public: :Schema(name) { } const Type_handler *map_data_type(THD *thd, const Type_handler *src) - const + const override { if (src == &type_handler_newdate) return thd->type_handler_for_datetime(); @@ -34,7 +34,7 @@ public: } Create_func *find_native_function_builder(THD *thd, const LEX_CSTRING &name) - const + const override { return native_functions_hash_oracle.find(thd, name); } @@ -42,10 +42,10 @@ public: Item *make_item_func_replace(THD *thd, Item *subj, Item *find, - Item *replace) const; + Item *replace) const override; Item *make_item_func_substr(THD *thd, - const Lex_substring_spec_st &spec) const; - Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const; + const Lex_substring_spec_st &spec) const override; + Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const override; }; @@ -56,7 +56,7 @@ public: :Schema(name) { } const Type_handler *map_data_type(THD *thd, const Type_handler *src) - const + const override { if (src == &type_handler_timestamp || src == &type_handler_timestamp2) diff --git a/sql/sql_select.h b/sql/sql_select.h index a5d6e769408..49632077ed8 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -770,13 +770,13 @@ class Duplicate_weedout_picker : public Semi_join_strategy_picker bool is_used; public: - void set_empty() + void set_empty() override { dupsweedout_tables= 0; first_dupsweedout_table= MAX_TABLES; is_used= FALSE; } - void set_from_prev(POSITION *prev); + void set_from_prev(POSITION *prev) override; bool check_qep(JOIN *join, uint idx, @@ -786,9 +786,9 @@ public: double *read_time, table_map *handled_fanout, sj_strategy_enum *stratey, - POSITION *loose_scan_pos); + POSITION *loose_scan_pos) override; - void mark_used() { is_used= TRUE; } + void mark_used() override { is_used= TRUE; } friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); }; @@ -816,13 +816,13 @@ class Firstmatch_picker : public Semi_join_strategy_picker bool in_firstmatch_prefix() { return (first_firstmatch_table != MAX_TABLES); } void invalidate_firstmatch_prefix() { first_firstmatch_table= MAX_TABLES; } public: - void set_empty() + void set_empty() override { invalidate_firstmatch_prefix(); is_used= FALSE; } - void set_from_prev(POSITION *prev); + void set_from_prev(POSITION *prev) override; bool check_qep(JOIN *join, uint idx, table_map remaining_tables, @@ -831,9 +831,9 @@ public: double *read_time, table_map *handled_fanout, sj_strategy_enum *strategy, - POSITION *loose_scan_pos); + POSITION *loose_scan_pos) override; - void mark_used() { is_used= TRUE; } + void mark_used() override { is_used= TRUE; } friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); }; @@ -859,13 +859,13 @@ public: uint loosescan_parts; /* Number of keyparts to be kept distinct */ bool is_used; - void set_empty() + void set_empty() override { first_loosescan_table= MAX_TABLES; is_used= FALSE; } - void set_from_prev(POSITION *prev); + void set_from_prev(POSITION *prev) override; bool check_qep(JOIN *join, uint idx, table_map remaining_tables, @@ -874,8 +874,8 @@ public: double *read_time, table_map *handled_fanout, sj_strategy_enum *strategy, - POSITION *loose_scan_pos); - void mark_used() { is_used= TRUE; } + POSITION *loose_scan_pos) override; + void mark_used() override { is_used= TRUE; } friend class Loose_scan_opt; friend void best_access_path(JOIN *join, @@ -907,13 +907,13 @@ class Sj_materialization_picker : public Semi_join_strategy_picker table_map sjm_scan_need_tables; public: - void set_empty() + void set_empty() override { sjm_scan_need_tables= 0; sjm_scan_last_inner= 0; is_used= FALSE; } - void set_from_prev(POSITION *prev); + void set_from_prev(POSITION *prev) override; bool check_qep(JOIN *join, uint idx, table_map remaining_tables, @@ -922,8 +922,8 @@ public: double *read_time, table_map *handled_fanout, sj_strategy_enum *strategy, - POSITION *loose_scan_pos); - void mark_used() { is_used= TRUE; } + POSITION *loose_scan_pos) override; + void mark_used() override { is_used= TRUE; } friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); }; @@ -2012,8 +2012,8 @@ class store_key_field: public store_key } } - enum Type type() const { return FIELD_STORE_KEY; } - const char *name() const { return field_name; } + enum Type type() const override { return FIELD_STORE_KEY; } + const char *name() const override { return field_name; } void change_source_field(Item_field *fld_item) { @@ -2022,7 +2022,7 @@ class store_key_field: public store_key } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { TABLE *table= copy_field.to_field->table; MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, @@ -2065,11 +2065,11 @@ public: {} - enum Type type() const { return ITEM_STORE_KEY; } - const char *name() const { return "func"; } + enum Type type() const override { return ITEM_STORE_KEY; } + const char *name() const override { return "func"; } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { TABLE *table= to_field->table; MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, @@ -2118,12 +2118,12 @@ public: :store_key_item(arg, new_item, FALSE), inited(0) {} - enum Type type() const { return CONST_ITEM_STORE_KEY; } - const char *name() const { return "const"; } - bool store_key_is_const() { return true; } + enum Type type() const override { return CONST_ITEM_STORE_KEY; } + const char *name() const override { return "const"; } + bool store_key_is_const() override { return true; } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { int res; if (!inited) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ca291bd9e5d..ed32d298d19 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1061,7 +1061,7 @@ public: bool handle_condition(THD *thd, uint sql_errno, const char * /* sqlstate */, Sql_condition::enum_warning_level *level, - const char *message, Sql_condition ** /* cond_hdl */) + const char *message, Sql_condition ** /* cond_hdl */) override { /* The handler does not handle the errors raised by itself. @@ -5101,7 +5101,7 @@ class Warnings_only_error_handler : public Internal_error_handler public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, - const char* msg, Sql_condition ** cond_hdl) + const char* msg, Sql_condition ** cond_hdl) override { if (sql_errno == ER_TRG_NO_DEFINER || sql_errno == ER_TRG_NO_CREATION_CTX || sql_errno == ER_PARSE_ERROR) @@ -10304,12 +10304,12 @@ class IS_internal_schema_access : public ACL_internal_schema_access public: IS_internal_schema_access() = default; - ~IS_internal_schema_access() = default; + ~IS_internal_schema_access() override = default; ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + privilege_t *save_priv) const override; - const ACL_internal_table_access *lookup(const char *name) const; + const ACL_internal_table_access *lookup(const char *name) const override; }; ACL_internal_access_result diff --git a/sql/sql_show.h b/sql/sql_show.h index 3d7a4d1146c..1fd2509250b 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -174,7 +174,7 @@ public: String query_str; /* Overloaded virtual function */ - void call_in_target_thread(); + void call_in_target_thread() override; }; /** diff --git a/sql/sql_signal.h b/sql/sql_signal.h index abc9905aefb..b2fe8eb69c4 100644 --- a/sql/sql_signal.h +++ b/sql/sql_signal.h @@ -85,12 +85,12 @@ public: virtual ~Sql_cmd_signal() = default; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_SIGNAL; } - virtual bool execute(THD *thd); + bool execute(THD *thd) override; }; /** @@ -111,12 +111,12 @@ public: virtual ~Sql_cmd_resignal() = default; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_RESIGNAL; } - virtual bool execute(THD *thd); + bool execute(THD *thd) override; }; #endif diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index fb9364e0002..26b4c088a98 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -746,7 +746,7 @@ private: table_name_field= stat_table->field[TABLE_STAT_TABLE_NAME]; } - void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) + void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) override { db_name_field->store(db->str, db->length, system_charset_info); table_name_field->store(tab->str, tab->length, system_charset_info); @@ -816,7 +816,7 @@ public: the field write_stat.cardinality' from the TABLE structure for 'table'. */ - void store_stat_fields() + void store_stat_fields() override { Field *stat_field= stat_table->field[TABLE_STAT_CARDINALITY]; if (table->collected_stats->cardinality_is_null) @@ -843,7 +843,7 @@ public: for 'table' accordingly. */ - void get_stat_values() + void get_stat_values() override { Table_statistics *read_stats= table_share->stats_cb.table_stats; read_stats->cardinality_is_null= TRUE; @@ -890,7 +890,7 @@ private: column_name_field= stat_table->field[COLUMN_STAT_COLUMN_NAME]; } - void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) + void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) override { db_name_field->store(db->str, db->length, system_charset_info); table_name_field->store(tab->str, tab->length, system_charset_info); @@ -1019,7 +1019,7 @@ public: length of the column. */ - void store_stat_fields() + void store_stat_fields() override { StringBuffer val; @@ -1097,7 +1097,7 @@ public: 'table_field'. */ - void get_stat_values() + void get_stat_values() override { table_field->read_stats->set_all_nulls(); @@ -1233,7 +1233,7 @@ private: prefix_arity_field= stat_table->field[INDEX_STAT_PREFIX_ARITY]; } - void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) + void change_full_table_name(const LEX_CSTRING *db, const LEX_CSTRING *tab) override { db_name_field->store(db->str, db->length, system_charset_info); table_name_field->store(tab->str, tab->length, system_charset_info); @@ -1355,7 +1355,7 @@ public: equal to 0, the value of the column is set to NULL. */ - void store_stat_fields() + void store_stat_fields() override { Field *stat_field= stat_table->field[INDEX_STAT_AVG_FREQUENCY]; double avg_frequency= @@ -1386,7 +1386,7 @@ public: set to the value of the column. */ - void get_stat_values() + void get_stat_values() override { double avg_frequency= 0; if(find_stat()) @@ -1760,7 +1760,7 @@ public: tree_key_length, max_heap_table_size, 1); } - bool add() + bool add() override { longlong val= table_field->val_int(); return tree->unique_add(&val); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 8a0d761f51d..4f9c71d2bab 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -62,7 +62,7 @@ public: :Stored_program_creation_ctx(client_cs, connection_cl, db_cl) { } - virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) override { return new (mem_root) Trigger_creation_ctx(m_client_cs, m_connection_cl, @@ -70,7 +70,7 @@ public: } protected: - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + Object_creation_ctx *create_backup_ctx(THD *thd) const override { return new Trigger_creation_ctx(thd); } @@ -261,8 +261,8 @@ public: Handle_old_incorrect_sql_modes_hook(const char *file_path) :path(file_path) {}; - virtual bool process_unknown_string(const char *&unknown_key, uchar* base, - MEM_ROOT *mem_root, const char *end); + bool process_unknown_string(const char *&unknown_key, uchar* base, + MEM_ROOT *mem_root, const char *end) override; }; @@ -273,8 +273,8 @@ public: LEX_CSTRING *trigger_table_arg) :path(file_path), trigger_table_value(trigger_table_arg) {}; - virtual bool process_unknown_string(const char *&unknown_key, uchar* base, - MEM_ROOT *mem_root, const char *end); + bool process_unknown_string(const char *&unknown_key, uchar* base, + MEM_ROOT *mem_root, const char *end) override; private: const char *path; LEX_CSTRING *trigger_table_value; @@ -301,12 +301,12 @@ public: Deprecated_trigger_syntax_handler() : m_trigger_name(NULL) {} - virtual bool handle_condition(THD *thd, + bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, const char* message, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { if (sql_errno != EE_OUTOFMEMORY && sql_errno != ER_OUT_OF_RESOURCES) diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h index 5704da1dd7b..52d8e385fba 100644 --- a/sql/sql_truncate.h +++ b/sql/sql_truncate.h @@ -40,9 +40,9 @@ public: @param thd the current thread. @return false on success. */ - bool execute(THD *thd); + bool execute(THD *thd) override; - virtual enum_sql_command sql_command_code() const + enum_sql_command sql_command_code() const override { return SQLCOM_TRUNCATE; } diff --git a/sql/sql_type.h b/sql/sql_type.h index 62bb8945b5b..874623e4316 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -3583,13 +3583,13 @@ public: class Vers_type_timestamp: public Vers_type_handler { public: - virtual vers_kind_t kind() const + vers_kind_t kind() const override { return VERS_TIMESTAMP; } bool check_sys_fields(const LEX_CSTRING &table_name, const Column_definition *row_start, - const Column_definition *row_end) const; + const Column_definition *row_end) const override; }; extern Vers_type_timestamp vers_type_timestamp; @@ -3597,13 +3597,13 @@ extern Vers_type_timestamp vers_type_timestamp; class Vers_type_trx: public Vers_type_handler { public: - virtual vers_kind_t kind() const + vers_kind_t kind() const override { return VERS_TRX_ID; } bool check_sys_fields(const LEX_CSTRING &table_name, const Column_definition *row_start, - const Column_definition *row_end) const; + const Column_definition *row_end) const override; }; extern MYSQL_PLUGIN_IMPORT Vers_type_trx vers_type_trx; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 91e8e70e809..92cb4191fc6 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1689,8 +1689,8 @@ class Multiupdate_prelocking_strategy : public DML_prelocking_strategy bool done; bool has_prelocking_list; public: - void reset(THD *thd); - bool handle_end(THD *thd); + void reset(THD *thd) override; + bool handle_end(THD *thd) override; }; void Multiupdate_prelocking_strategy::reset(THD *thd) diff --git a/sql/sql_window.cc b/sql/sql_window.cc index e783d8ed5b4..2be6059f2a1 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -954,7 +954,7 @@ protected: class Table_read_cursor : public Rowid_seq_cursor { public: - virtual ~Table_read_cursor() = default; + ~Table_read_cursor() override = default; void init(READ_RECORD *info) { @@ -1022,7 +1022,7 @@ public: /* This returns -1 when end of partition was reached. */ - int next() + int next() override { int res; if (end_of_partition) @@ -1312,12 +1312,12 @@ public: item_add->fix_fields(thd, &item_add); } - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { // Save the value of FUNC(current_row) range_expr->fetch_value_from(item_add); @@ -1326,19 +1326,19 @@ public: end_of_partition= false; } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { walk_till_non_peer(); } - void pre_next_row() + void pre_next_row() override { if (end_of_partition) return; range_expr->fetch_value_from(item_add); } - void next_row() + void next_row() override { if (end_of_partition) return; @@ -1350,12 +1350,12 @@ public: walk_till_non_peer(); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } - bool is_outside_computation_bounds() const + bool is_outside_computation_bounds() const override { if (end_of_partition) return true; @@ -1452,12 +1452,12 @@ public: item_add->fix_fields(thd, &item_add); } - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { // Save the value of FUNC(current_row) range_expr->fetch_value_from(item_add); @@ -1467,20 +1467,20 @@ public: added_values= false; } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { cursor.move_to(rownum); walk_till_non_peer(); } - void pre_next_row() + void pre_next_row() override { if (end_of_partition) return; range_expr->fetch_value_from(item_add); } - void next_row() + void next_row() override { if (end_of_partition) return; @@ -1492,14 +1492,14 @@ public: walk_till_non_peer(); } - bool is_outside_computation_bounds() const + bool is_outside_computation_bounds() const override { if (!added_values) return true; return false; } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { if (end_of_partition) return cursor.get_rownum(); // Cursor does not pass over partition bound. @@ -1561,13 +1561,13 @@ public: { } - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); peer_tracker.init(); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { // Save the value of the current_row peer_tracker.check_if_next_group(); @@ -1576,17 +1576,17 @@ public: add_value_to_items(); } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { walk_till_non_peer(); } - void pre_next_row() + void pre_next_row() override { dont_move= !peer_tracker.check_if_next_group(); } - void next_row() + void next_row() override { // Check if our cursor is pointing at a peer of the current row. // If not, move forward until that becomes true @@ -1601,7 +1601,7 @@ public: walk_till_non_peer(); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -1658,7 +1658,7 @@ public: move(false) {} - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { bound_tracker.init(); @@ -1666,23 +1666,23 @@ public: peer_tracker.init(); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { // Fetch the value from the first row peer_tracker.check_if_next_group(); cursor.move_to(rownum); } - void next_partition(ha_rows rownum) {} + void next_partition(ha_rows rownum) override {} - void pre_next_row() + void pre_next_row() override { // Check if the new current_row is a peer of the row that our cursor is // pointing to. move= peer_tracker.check_if_next_group(); } - void next_row() + void next_row() override { if (move) { @@ -1710,7 +1710,7 @@ public: } } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -1732,9 +1732,9 @@ public: SQL_I_List *order_list) {} - void init(READ_RECORD *info) {} + void init(READ_RECORD *info) override {} - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { /* UNBOUNDED PRECEDING frame end just stays on the first row of the @@ -1744,12 +1744,12 @@ public: curr_rownum= rownum; } - void next_row() + void next_row() override { /* Do nothing, UNBOUNDED PRECEDING frame end doesn't move. */ } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return curr_rownum; } @@ -1774,17 +1774,17 @@ public: SQL_I_List *order_list) : cursor(thd, partition_list) {} - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { cursor.on_next_partition(rownum); } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { /* Activate the first row */ cursor.fetch(); @@ -1797,12 +1797,12 @@ public: } } - void next_row() + void next_row() override { /* Do nothing, UNBOUNDED FOLLOWING frame end doesn't move */ } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -1817,7 +1817,7 @@ public: SQL_I_List *partition_list, SQL_I_List *order_list) : Frame_unbounded_following(thd, partition_list, order_list) {} - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { ha_rows num_rows_in_partition= 0; if (cursor.fetch()) @@ -1830,7 +1830,7 @@ public: set_win_funcs_row_count(num_rows_in_partition); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -1857,7 +1857,7 @@ public: { order_item= order_list->first->item[0]; } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { ha_rows num_rows_in_partition= 0; if (cursor.fetch()) @@ -1873,7 +1873,7 @@ public: set_win_funcs_row_count(num_rows_in_partition); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -1904,12 +1904,12 @@ public: is_top_bound(is_top_bound_arg), n_rows(n_rows_arg), n_rows_behind(0) {} - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { /* Position our cursor to point at the first row in the new partition @@ -1935,13 +1935,13 @@ public: } - void next_row() + void next_row() override { n_rows_behind++; move_cursor_if_possible(); } - bool is_outside_computation_bounds() const + bool is_outside_computation_bounds() const override { /* As a bottom boundary, rows have not yet been added. */ if (!is_top_bound && n_rows - n_rows_behind) @@ -1949,7 +1949,7 @@ public: return false; } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -2007,26 +2007,26 @@ public: Frame_rows_current_row_bottom() : curr_rownum(0) {} - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { add_value_to_items(); curr_rownum= rownum; } - void next_partition(ha_rows rownum) {} + void next_partition(ha_rows rownum) override {} - void pre_next_row() + void pre_next_row() override { /* Temp table's current row is current_row. Add it to the window func */ add_value_to_items(); } - void next_row() + void next_row() override { curr_rownum++; }; - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return curr_rownum; } @@ -2083,13 +2083,13 @@ public: { } - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); at_partition_end= false; } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { at_partition_end= false; @@ -2097,7 +2097,7 @@ public: } /* Move our cursor to be n_rows ahead. */ - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { if (is_top_bound) next_part_top(rownum); @@ -2105,7 +2105,7 @@ public: next_part_bottom(rownum); } - void next_row() + void next_row() override { if (is_top_bound) next_row_top(); @@ -2113,7 +2113,7 @@ public: next_row_bottom(); } - bool is_outside_computation_bounds() const + bool is_outside_computation_bounds() const override { /* The top bound can go over the current partition. In this case, @@ -2124,7 +2124,7 @@ public: return false; } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return cursor.get_rownum(); } @@ -2210,12 +2210,12 @@ public: const Frame_cursor &bottom_bound) : top_bound(top_bound), bottom_bound(bottom_bound) {} - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { /* TODO(cvicentiu) Sum functions get cleared on next partition anyway during the window function computation algorithm. Either perform this only in @@ -2225,23 +2225,23 @@ public: clear_sum_functions(); } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { compute_values_for_current_row(); } - void pre_next_row() + void pre_next_row() override { clear_sum_functions(); } - void next_row() + void next_row() override { curr_rownum++; compute_values_for_current_row(); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return curr_rownum; } @@ -2301,36 +2301,36 @@ class Frame_positional_cursor : public Frame_cursor bottom_bound(&bottom_bound), offset(&offset), negative_offset(negative_offset) {} - void init(READ_RECORD *info) + void init(READ_RECORD *info) override { cursor.init(info); } - void pre_next_partition(ha_rows rownum) + void pre_next_partition(ha_rows rownum) override { /* The offset is dependant on the current row values. We can only get * it here accurately. When fetching other rows, it changes. */ save_offset_value(); } - void next_partition(ha_rows rownum) + void next_partition(ha_rows rownum) override { save_positional_value(); } - void pre_next_row() + void pre_next_row() override { /* The offset is dependant on the current row values. We can only get * it here accurately. When fetching other rows, it changes. */ save_offset_value(); } - void next_row() + void next_row() override { save_positional_value(); } - ha_rows get_curr_rownum() const + ha_rows get_curr_rownum() const override { return position_cursor.get_curr_rownum(); } diff --git a/sql/sql_window.h b/sql/sql_window.h index 1c02740e769..6d5bc7e21c9 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -173,7 +173,7 @@ class Window_def : public Window_spec : Window_spec(win_ref, part_list, ord_list, win_frame), window_name(win_name) {} - const char *name() { return window_name->str; } + const char *name() override { return window_name->str; } }; diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl index a0f2a7268a7..f42923a0565 100644 --- a/sql/sys_vars.inl +++ b/sql/sys_vars.inl @@ -198,7 +198,7 @@ public: SYSVAR_ASSERT(block_size > 0); SYSVAR_ASSERT(def_val % block_size == 0); } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { my_bool fixed= FALSE, unused; longlong v= var->value->val_int(); @@ -245,23 +245,23 @@ public: return throw_bounds_warning(thd, name.str, fixed, var->value->unsigned_flag, v); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, T)= static_cast(var->save_result.ulonglong_value); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(T)= static_cast(var->save_result.ulonglong_value); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= (ulonglong)*(T*)global_value_ptr(thd, 0); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } private: T get_max_var() { return *((T*) max_var_ptr()); } - const uchar *default_value_ptr(THD *thd) const { return (uchar*) &option.def_value; } + const uchar *default_value_ptr(THD *thd) const override { return (uchar*) &option.def_value; } }; typedef Sys_var_integer Sys_var_int; @@ -327,7 +327,7 @@ public: typelib.type_lengths= 0; // only used by Fields_enum and Field_set option.typelib= &typelib; } - bool do_check(THD *thd, set_var *var) // works for enums and my_bool + bool do_check(THD *thd, set_var *var) override // works for enums and my_bool { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff, sizeof(buff), system_charset_info), *res; @@ -395,7 +395,7 @@ public: SYSVAR_ASSERT(size == sizeof(ulong)); } bool check_maximum(THD *thd, set_var *var, - const char *c_val, longlong i_val) + const char *c_val, longlong i_val) override { if (!max_var_ptr() || var->save_result.ulonglong_value <= get_max_var()) @@ -406,27 +406,27 @@ public: throw_bounds_warning(thd, name.str, TRUE, var->value->unsigned_flag, i_val); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, ulong)= static_cast(var->save_result.ulonglong_value); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(ulong)= static_cast(var->save_result.ulonglong_value); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= global_var(ulong); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } const uchar *valptr(THD *thd, ulong val) const { return reinterpret_cast(typelib.type_names[val]); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, ulong)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(ulong)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, (ulong)option.def_value); } ulong get_max_var() { return *((ulong *) max_var_ptr()); } @@ -460,21 +460,21 @@ public: SYSVAR_ASSERT(getopt.arg_type == OPT_ARG || getopt.id < 0); SYSVAR_ASSERT(size == sizeof(my_bool)); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, my_bool)= var->save_result.ulonglong_value != 0; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(my_bool)= var->save_result.ulonglong_value != 0; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= (ulonglong)*(my_bool *)global_value_ptr(thd, 0); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { thd->sys_var_tmp.my_bool_value=(my_bool) option.def_value; return (uchar*) &thd->sys_var_tmp.my_bool_value; @@ -518,7 +518,7 @@ public: option.var_type|= (flags & ALLOCATED) ? GET_STR_ALLOC : GET_STR; global_var(const char*)= def_val; } - void cleanup() + void cleanup() override { if (flags & ALLOCATED) { @@ -556,9 +556,9 @@ public: return false; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { return do_string_check(thd, var, charset(thd)); } - bool session_update(THD *thd, set_var *var)= 0; + bool session_update(THD *thd, set_var *var) override= 0; char *global_update_prepare(THD *thd, set_var *var) { char *new_val, *ptr= var->save_result.string_value.str; @@ -581,14 +581,14 @@ public: flags|= ALLOCATED; global_var(char*)= new_val; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { char *new_val= global_update_prepare(thd, var); global_update_finish(new_val); return (new_val == 0 && var->save_result.string_value.str != 0); } - void session_save_default(THD *thd, set_var *var)= 0; - void global_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override= 0; + void global_save_default(THD *thd, set_var *var) override { char *ptr= (char*)(intptr)option.def_value; var->save_result.string_value.str= ptr; @@ -615,12 +615,12 @@ public: SYSVAR_ASSERT(size == sizeof(char *)); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } }; @@ -649,7 +649,7 @@ public: getopt, def_val, lock, VARIABLE_NOT_IN_BINLOG, 0, 0, 0) {} - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { if (Sys_var_charptr_base::do_check(thd, var) || sysvartrack_validate_value(thd, var->save_result.string_value.str, @@ -657,7 +657,7 @@ public: return TRUE; return FALSE; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { char *new_val= global_update_prepare(thd, var); if (new_val) @@ -673,9 +673,9 @@ public: global_update_finish(new_val); return (new_val == 0 && var->save_result.string_value.str != 0); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { return thd->session_tracker.sysvars.update(thd, var); } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.string_value.str= global_var(char*); var->save_result.string_value.length= @@ -707,27 +707,27 @@ public: { option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } protected: - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return thd->security_ctx->proxy_user[0] ? (uchar *) &(thd->security_ctx->proxy_user[0]) : NULL; @@ -742,7 +742,7 @@ public: {} protected: - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return (uchar*)thd->security_ctx->external_user; } @@ -827,7 +827,7 @@ public: SYSVAR_ASSERT(size == sizeof(LEX_CSTRING)); *const_cast(&show_val_type)= SHOW_LEX_STRING; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { if (Sys_var_charptr::global_update(thd, var)) return true; @@ -861,7 +861,7 @@ public: SYSVAR_ASSERT(scope() == ONLY_SESSION) *const_cast(&show_val_type)= SHOW_LEX_STRING; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff, sizeof(buff), system_charset_info), *res; @@ -885,7 +885,7 @@ public: } return false; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { LEX_CSTRING *tmp= &session_var(thd, LEX_CSTRING); tmp->length= var->save_result.string_value.length; @@ -893,22 +893,22 @@ public: strmake((char*) tmp->str, var->save_result.string_value.str, tmp->length); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { char *ptr= (char*)(intptr)option.def_value; var->save_result.string_value.str= ptr; var->save_result.string_value.length= strlen(ptr); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(FALSE); return NULL; @@ -945,14 +945,14 @@ public: lock, binlog_status_arg, on_check_func, on_update_func, substitute) { option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { bool rc= Sys_var_charptr::do_string_check(thd, var, charset(thd)); if (var->save_result.string_value.str == nullptr) var->save_result.string_value.str= const_cast(""); return rc; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { const char *val= var->save_result.string_value.str; if (!var->value) @@ -961,33 +961,33 @@ public: DBUG_SET(val); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { const char *val= var->save_result.string_value.str; DBUG_SET_INITIAL(val); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { char *ptr= (char*)(intptr)option.def_value; var->save_result.string_value.str= ptr; var->save_result.string_value.length= safe_strlen(ptr); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { char buf[256]; DBUG_EXPLAIN(buf, sizeof(buf)); return (uchar*) thd->strdup(buf); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { char buf[256]; DBUG_EXPLAIN_INITIAL(buf, sizeof(buf)); return (uchar*) thd->strdup(buf); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return (uchar*)""; } }; #endif @@ -1033,7 +1033,7 @@ public: offset= global_var_ptr() - (uchar*)dflt_key_cache; SYSVAR_ASSERT(scope() == GLOBAL); } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { ulonglong new_value= var->save_result.ulonglong_value; LEX_CSTRING *base_name= &var->base; @@ -1063,7 +1063,7 @@ public: return keycache_update(thd, key_cache, offset, new_value); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { KEY_CACHE *key_cache= get_key_cache(base); if (!key_cache) @@ -1197,7 +1197,7 @@ public: SYSVAR_ASSERT(max_val >= def_val); SYSVAR_ASSERT(size == sizeof(double)); } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { my_bool fixed; double v= var->value->val_real(); @@ -1205,19 +1205,19 @@ public: return throw_bounds_warning(thd, name.str, fixed, v); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, double)= var->save_result.double_value; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(double)= var->save_result.double_value; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.double_value= global_var(double); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.double_value= getopt_ulonglong2double(option.def_value); } }; @@ -1248,7 +1248,7 @@ public: lock, binlog_status_arg, on_check_func, on_update_func, substitute) { } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { if (thd->user_connect && thd->user_connect->user_resources.user_conn) return (uchar*) &(thd->user_connect->user_resources.user_conn); @@ -1294,7 +1294,7 @@ public: SYSVAR_ASSERT(strcmp(values[typelib.count-1], "default") == 0); SYSVAR_ASSERT(size == sizeof(ulonglong)); } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff, sizeof(buff), system_charset_info), *res; @@ -1346,27 +1346,27 @@ public: return false; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, ulonglong)= var->save_result.ulonglong_value; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(ulonglong)= var->save_result.ulonglong_value; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= global_var(ulonglong); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } const uchar *valptr(THD *thd, ulonglong val) const { return (uchar*)flagset_to_string(thd, 0, val, typelib.type_names); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, ulonglong)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(ulonglong)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, option.def_value); } }; @@ -1409,7 +1409,7 @@ public: SYSVAR_ASSERT(size == sizeof(ulonglong)); } bool check_maximum(THD *thd, set_var *var, - const char *c_val, longlong i_val) + const char *c_val, longlong i_val) override { if (!max_var_ptr() || (var->save_result.ulonglong_value & ~(get_max_var())) == 0) @@ -1420,7 +1420,7 @@ public: throw_bounds_warning(thd, name.str, TRUE, var->value->unsigned_flag, i_val); } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff, sizeof(buff), system_charset_info), *res; @@ -1460,27 +1460,27 @@ public: var->save_result.ulonglong_value= tmp; return check_maximum(thd, var, 0, tmp); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, ulonglong)= var->save_result.ulonglong_value; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(ulonglong)= var->save_result.ulonglong_value; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= global_var(ulonglong); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } const uchar *valptr(THD *thd, ulonglong val) const { return reinterpret_cast(set_to_string(thd, 0, val, typelib.type_names)); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, ulonglong)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(ulonglong)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, option.def_value); } ulonglong get_max_var() { return *((ulonglong*) max_var_ptr()); } @@ -1521,7 +1521,7 @@ public: SYSVAR_ASSERT(size == sizeof(plugin_ref)); SYSVAR_ASSERT(getopt.id < 0); // force NO_CMD_LINE } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff,sizeof(buff), system_charset_info), *res; @@ -1560,19 +1560,19 @@ public: plugin_unlock(NULL, oldval); } } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { do_update((plugin_ref*)session_var_ptr(thd), var->save_result.plugin); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { do_update((plugin_ref*)global_var_ptr(), var->save_result.plugin); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { plugin_ref plugin= global_var(plugin_ref); var->save_result.plugin= plugin ? my_plugin_lock(thd, plugin) : 0; @@ -1594,7 +1594,7 @@ public: return my_plugin_lock(thd, plugin); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.plugin= get_default(thd); } @@ -1604,11 +1604,11 @@ public: return (uchar*)(plugin ? thd->strmake(plugin_name(plugin)->str, plugin_name(plugin)->length) : 0); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, plugin_ref)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(plugin_ref)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, get_default(thd)); } }; @@ -1657,7 +1657,7 @@ public: SYSVAR_ASSERT(size == sizeof(plugin_ref)); SYSVAR_ASSERT(getopt.id < 0); // force NO_CMD_LINE } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff,sizeof(buff), system_charset_info), *res; @@ -1678,19 +1678,19 @@ public: *valptr= copy_engine_list(newval); free_engine_list(oldval); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { do_update((plugin_ref**)session_var_ptr(thd), var->save_result.plugins); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { do_update((plugin_ref**)global_var_ptr(), var->save_result.plugins); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { plugin_ref* plugins= global_var(plugin_ref *); var->save_result.plugins= plugins ? temp_copy_engine_list(thd, plugins) : 0; @@ -1704,7 +1704,7 @@ public: false, true); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.plugins= get_default(thd); } @@ -1713,11 +1713,11 @@ public: { return reinterpret_cast(pretty_print_engine_list(thd, plugins)); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, plugin_ref*)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(plugin_ref*)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, get_default(thd)); } }; @@ -1747,7 +1747,7 @@ public: SYSVAR_ASSERT(scope() == ONLY_SESSION); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[STRING_BUFFER_USUAL_SIZE]; String str(buff, sizeof(buff), system_charset_info), *res; @@ -1762,35 +1762,35 @@ public: } return false; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { return debug_sync_update(thd, var->save_result.string_value.str, var->save_result.string_value.length); } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.string_value.str= const_cast(""); var->save_result.string_value.length= 0; } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return debug_sync_value_ptr(thd); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(FALSE); return 0; } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return (uchar*)""; } }; #endif /* defined(ENABLED_DEBUG_SYNC) */ @@ -1848,22 +1848,22 @@ public: SYSVAR_ASSERT(def_val < 2); SYSVAR_ASSERT(size == sizeof(ulonglong)); } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { set(session_var_ptr(thd), var->save_result.ulonglong_value); return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { set(global_var_ptr(), var->save_result.ulonglong_value); return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= (reverse_semantics == !(global_var(ulonglong) & bitmask)); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.ulonglong_value= option.def_value; } uchar *valptr(THD *thd, ulonglong val) const @@ -1871,11 +1871,11 @@ public: thd->sys_var_tmp.my_bool_value= (reverse_semantics == !(val & bitmask)); return (uchar*) &thd->sys_var_tmp.my_bool_value; } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, ulonglong)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(ulonglong)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { thd->sys_var_tmp.my_bool_value= option.def_value != 0; return (uchar*) &thd->sys_var_tmp.my_bool_value; @@ -1923,28 +1923,28 @@ public: SYSVAR_ASSERT(scope() == ONLY_SESSION); SYSVAR_ASSERT(getopt.id < 0); // NO_CMD_LINE, because the offset is fake } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { return update_func(thd, var); } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->value= 0; } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { thd->sys_var_tmp.ulonglong_value= read_func(thd); return (uchar*) &thd->sys_var_tmp.ulonglong_value; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(FALSE); return 0; } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { thd->sys_var_tmp.ulonglong_value= 0; return (uchar*) &thd->sys_var_tmp.ulonglong_value; @@ -1976,7 +1976,7 @@ public: SYSVAR_ASSERT(scope() == ONLY_SESSION); SYSVAR_ASSERT(getopt.id < 0); // NO_CMD_LINE, because the offset is fake } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { if (var->value) { @@ -1987,36 +1987,36 @@ public: thd->user_time.val= 0; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - bool session_is_default(THD *thd) + bool session_is_default(THD *thd) override { return thd->user_time.val == 0; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->value= 0; } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { thd->sys_var_tmp.double_value= thd->start_time + thd->start_time_sec_part/(double)TIME_SECOND_PART_FACTOR; return (uchar*) &thd->sys_var_tmp.double_value; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(FALSE); return 0; } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { thd->sys_var_tmp.double_value= 0; return (uchar*) &thd->sys_var_tmp.double_value; } - bool on_check_access_session(THD *thd) const; + bool on_check_access_session(THD *thd) const override; }; @@ -2055,28 +2055,28 @@ public: SYSVAR_ASSERT(size == sizeof(enum SHOW_COMP_OPTION)); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) { + bool do_check(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(FALSE); return true; } - void session_save_default(THD *thd, set_var *var) { } - void global_save_default(THD *thd, set_var *var) { } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + void session_save_default(THD *thd, set_var *var) override { } + void global_save_default(THD *thd, set_var *var) override { } + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(FALSE); return 0; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return (uchar*)show_comp_option_name[global_var(enum SHOW_COMP_OPTION)]; } @@ -2127,32 +2127,32 @@ public: SYSVAR_ASSERT(getopt.id < 0); SYSVAR_ASSERT(size == sizeof(void *)); } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { return false; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, const void*)= var->save_result.ptr; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(const void*)= var->save_result.ptr; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.ptr= global_var(void*); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { void **default_value= reinterpret_cast(option.def_value); var->save_result.ptr= *default_value; } uchar *valptr(THD *thd, uchar *val) const { return val ? *(uchar**)(val+name_offset) : 0; } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, session_var(thd, uchar*)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(uchar*)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, *(uchar**)option.def_value); } }; @@ -2186,7 +2186,7 @@ public: SYSVAR_ASSERT(size == sizeof(Time_zone *)); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { char buff[MAX_TIME_ZONE_NAME_LENGTH]; String str(buff, sizeof(buff), &my_charset_latin1); @@ -2203,28 +2203,28 @@ public: } return false; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { session_var(thd, Time_zone*)= var->save_result.time_zone; return false; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { global_var(Time_zone*)= var->save_result.time_zone; return false; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { var->save_result.time_zone= global_var(Time_zone*); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { var->save_result.time_zone= *(Time_zone**)(intptr)option.def_value; } const uchar *valptr(THD *thd, Time_zone *val) const { return reinterpret_cast(val->get_name()->ptr()); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { /* This is an ugly fix for replication: we don't replicate properly queries @@ -2237,9 +2237,9 @@ public: thd->time_zone_used= 1; return valptr(thd, session_var(thd, Time_zone *)); } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return valptr(thd, global_var(Time_zone*)); } - const uchar *default_value_ptr(THD *thd) const + const uchar *default_value_ptr(THD *thd) const override { return valptr(thd, *(Time_zone**)option.def_value); } }; @@ -2265,7 +2265,7 @@ public: :Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values, def_val, lock, binlog_status_arg, on_check_func) {} - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { if (var->type == OPT_SESSION && Sys_var_enum::session_update(thd, var)) return TRUE; @@ -2326,7 +2326,7 @@ public: :Sys_var_mybool(name_arg, comment, flag_args, off, size, getopt, def_val, lock, binlog_status_arg, on_check_func) {} - virtual bool session_update(THD *thd, set_var *var); + bool session_update(THD *thd, set_var *var) override; }; /* @@ -2345,7 +2345,7 @@ public: :Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values, def_val, lock, binlog_status_arg) {} - bool global_update(THD *thd, set_var *var); + bool global_update(THD *thd, set_var *var) override; }; /* @@ -2386,16 +2386,16 @@ public: mi_accessor_func(mi_accessor_arg), update_multi_source_variable_func(on_update_func) { } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { return session_update(thd, var); } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { /* Use value given in variable declaration */ global_save_default(thd, var); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { ulonglong *tmp, res; tmp= (ulonglong*) (((uchar*)&(thd->variables)) + offset); @@ -2403,7 +2403,7 @@ public: *tmp= res; return (uchar*) tmp; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return session_value_ptr(thd, base); } @@ -2432,35 +2432,35 @@ public: SYSVAR_ASSERT(is_readonly()); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(false); return NULL; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const; + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override; }; @@ -2481,35 +2481,35 @@ public: SYSVAR_ASSERT(is_readonly()); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(false); return NULL; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const; + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override; }; @@ -2528,31 +2528,31 @@ public: { option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var); - bool session_update(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override; + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool global_update(THD *thd, set_var *var); - void session_save_default(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override; + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { /* Record the attempt to use default so we can error. */ var->value= 0; } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(false); return NULL; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const; - const uchar *default_value_ptr(THD *thd) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override; + const uchar *default_value_ptr(THD *thd) const override { return 0; } - bool on_check_access_global(THD *thd) const + bool on_check_access_global(THD *thd) const override { return check_global_access(thd, PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_SLAVE_POS); } @@ -2574,31 +2574,31 @@ public: { option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var); - bool session_update(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override; + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool global_update(THD *thd, set_var *var); - void session_save_default(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override; + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { /* Record the attempt to use default so we can error. */ var->value= 0; } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(false); return NULL; } - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const; - const uchar *default_value_ptr(THD *thd) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override; + const uchar *default_value_ptr(THD *thd) const override { return 0; } - bool on_check_access_global(THD *thd) const + bool on_check_access_global(THD *thd) const override { return check_global_access(thd, PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_BINLOG_STATE); @@ -2622,31 +2622,31 @@ public: SYSVAR_ASSERT(is_readonly()); option.var_type|= GET_STR; } - bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { DBUG_ASSERT(false); return true; } - void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { DBUG_ASSERT(false); } - const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const; - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override; + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { DBUG_ASSERT(false); return NULL; @@ -2671,8 +2671,8 @@ public: option.value= (uchar**)1; // crash me, please SYSVAR_ASSERT(scope() == GLOBAL); } - bool global_update(THD *thd, set_var *var); - const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const; + bool global_update(THD *thd, set_var *var) override; + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override; }; @@ -2693,7 +2693,7 @@ public: { option.var_type= GET_STR; } - virtual bool do_check(THD *thd, set_var *var) + bool do_check(THD *thd, set_var *var) override { if (!var->value) return false; @@ -2732,26 +2732,26 @@ private: } public: - virtual bool global_update(THD *thd, set_var *var) + bool global_update(THD *thd, set_var *var) override { return update(thd, var, &global_var(vers_asof_timestamp_t)); } - virtual bool session_update(THD *thd, set_var *var) + bool session_update(THD *thd, set_var *var) override { return update(thd, var, &session_var(thd, vers_asof_timestamp_t)); } - virtual bool session_is_default(THD *thd) + bool session_is_default(THD *thd) override { const vers_asof_timestamp_t &var= session_var(thd, vers_asof_timestamp_t); return var.type == SYSTEM_TIME_UNSPECIFIED; } - virtual void session_save_default(THD *thd, set_var *var) + void session_save_default(THD *thd, set_var *var) override { save_default(var, &session_var(thd, vers_asof_timestamp_t)); } - virtual void global_save_default(THD *thd, set_var *var) + void global_save_default(THD *thd, set_var *var) override { save_default(var, &global_var(vers_asof_timestamp_t)); } @@ -2789,8 +2789,8 @@ private: } public: - virtual const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return value_ptr(thd, session_var(thd, vers_asof_timestamp_t)); } - virtual const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const + const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const override { return value_ptr(thd, global_var(vers_asof_timestamp_t)); } }; diff --git a/sql/sys_vars_shared.h b/sql/sys_vars_shared.h index 508a0a70c8f..708021b4127 100644 --- a/sql/sys_vars_shared.h +++ b/sql/sys_vars_shared.h @@ -52,9 +52,9 @@ class PolyLock_mutex: public PolyLock mysql_mutex_t *mutex; public: PolyLock_mutex(mysql_mutex_t *arg): mutex(arg) {} - void rdlock() { mysql_mutex_lock(mutex); } - void wrlock() { mysql_mutex_lock(mutex); } - void unlock() { mysql_mutex_unlock(mutex); } + void rdlock() override { mysql_mutex_lock(mutex); } + void wrlock() override { mysql_mutex_lock(mutex); } + void unlock() override { mysql_mutex_unlock(mutex); } }; class PolyLock_rwlock: public PolyLock @@ -62,9 +62,9 @@ class PolyLock_rwlock: public PolyLock mysql_rwlock_t *rwlock; public: PolyLock_rwlock(mysql_rwlock_t *arg): rwlock(arg) {} - void rdlock() { mysql_rwlock_rdlock(rwlock); } - void wrlock() { mysql_rwlock_wrlock(rwlock); } - void unlock() { mysql_rwlock_unlock(rwlock); } + void rdlock() override { mysql_rwlock_rdlock(rwlock); } + void wrlock() override { mysql_rwlock_wrlock(rwlock); } + void unlock() override { mysql_rwlock_unlock(rwlock); } }; class AutoWLock diff --git a/sql/table.cc b/sql/table.cc index 8f5b0ce3bcc..74b478cb816 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8618,7 +8618,7 @@ public: const char* sqlstate, Sql_condition::enum_warning_level *level, const char* msg, - Sql_condition ** cond_hdl) + Sql_condition ** cond_hdl) override { *cond_hdl= NULL; if (*level == Sql_condition::WARN_LEVEL_ERROR) diff --git a/sql/table.h b/sql/table.h index 16a42b6e81e..6910ff0aff1 100644 --- a/sql/table.h +++ b/sql/table.h @@ -172,9 +172,9 @@ protected: CHARSET_INFO *connection_cl); protected: - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const; + Object_creation_ctx *create_backup_ctx(THD *thd) const override; - virtual void change_env(THD *thd) const; + void change_env(THD *thd) const override; protected: /** @@ -565,7 +565,7 @@ public: class Table_check_intact_log_error : public Table_check_intact { protected: - void report_error(uint, const char *fmt, ...); + void report_error(uint, const char *fmt, ...) override; public: Table_check_intact_log_error() : Table_check_intact(true) {} }; @@ -591,9 +591,9 @@ public: MDL_context *get_ctx() const { return m_ctx; } - virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor); + bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor) override; - virtual uint get_deadlock_weight() const; + uint get_deadlock_weight() const override; /** Pointers for participating in the list of waiters for table share. @@ -2982,13 +2982,13 @@ class Field_iterator_table: public Field_iterator Field **ptr; public: Field_iterator_table() :ptr(0) {} - void set(TABLE_LIST *table) { ptr= table->table->field; } + void set(TABLE_LIST *table) override { ptr= table->table->field; } void set_table(TABLE *table) { ptr= table->field; } - void next() { ptr++; } - bool end_of_fields() { return *ptr == 0; } - LEX_CSTRING *name(); - Item *create_item(THD *thd); - Field *field() { return *ptr; } + void next() override { ptr++; } + bool end_of_fields() override { return *ptr == 0; } + LEX_CSTRING *name() override; + Item *create_item(THD *thd) override; + Field *field() override { return *ptr; } }; @@ -3000,13 +3000,13 @@ class Field_iterator_view: public Field_iterator TABLE_LIST *view; public: Field_iterator_view() :ptr(0), array_end(0) {} - void set(TABLE_LIST *table); - void next() { ptr++; } - bool end_of_fields() { return ptr == array_end; } - LEX_CSTRING *name(); - Item *create_item(THD *thd); + void set(TABLE_LIST *table) override; + void next() override { ptr++; } + bool end_of_fields() override { return ptr == array_end; } + LEX_CSTRING *name() override; + Item *create_item(THD *thd) override; Item **item_ptr() {return &ptr->item; } - Field *field() { return 0; } + Field *field() override { return 0; } inline Item *item() { return ptr->item; } Field_translator *field_translator() { return ptr; } }; @@ -3024,12 +3024,12 @@ class Field_iterator_natural_join: public Field_iterator public: Field_iterator_natural_join() :cur_column_ref(NULL) {} ~Field_iterator_natural_join() = default; - void set(TABLE_LIST *table); - void next(); - bool end_of_fields() { return !cur_column_ref; } - LEX_CSTRING *name() { return cur_column_ref->name(); } - Item *create_item(THD *thd) { return cur_column_ref->create_item(thd); } - Field *field() { return cur_column_ref->field(); } + void set(TABLE_LIST *table) override; + void next() override; + bool end_of_fields() override { return !cur_column_ref; } + LEX_CSTRING *name() override { return cur_column_ref->name(); } + Item *create_item(THD *thd) override { return cur_column_ref->create_item(thd); } + Field *field() override { return cur_column_ref->field(); } Natural_join_column *column_ref() { return cur_column_ref; } }; @@ -3060,16 +3060,16 @@ class Field_iterator_table_ref: public Field_iterator void set_field_iterator(); public: Field_iterator_table_ref() :field_it(NULL) {} - void set(TABLE_LIST *table); - void next(); - bool end_of_fields() + void set(TABLE_LIST *table) override; + void next() override; + bool end_of_fields() override { return (table_ref == last_leaf && field_it->end_of_fields()); } - LEX_CSTRING *name() { return field_it->name(); } + LEX_CSTRING *name() override { return field_it->name(); } const char *get_table_name(); const char *get_db_name(); GRANT_INFO *grant(); - Item *create_item(THD *thd) { return field_it->create_item(thd); } - Field *field() { return field_it->field(); } + Item *create_item(THD *thd) override { return field_it->create_item(thd); } + Field *field() override { return field_it->field(); } Natural_join_column *get_or_create_column_ref(THD *thd, TABLE_LIST *parent_table_ref); Natural_join_column *get_natural_column_ref(); }; diff --git a/sql/threadpool.h b/sql/threadpool.h index e9fed450ae7..bba64b82c2c 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -136,12 +136,12 @@ struct TP_pool struct TP_pool_win:TP_pool { TP_pool_win(); - virtual int init(); - virtual ~TP_pool_win(); - virtual TP_connection *new_connection(CONNECT *c); - virtual void add(TP_connection *); - virtual int set_max_threads(uint); - virtual int set_min_threads(uint); + int init() override; + ~TP_pool_win() override; + TP_connection *new_connection(CONNECT *c) override; + void add(TP_connection *) override; + int set_max_threads(uint) override; + int set_min_threads(uint) override; }; #endif @@ -149,12 +149,12 @@ struct TP_pool_generic :TP_pool { TP_pool_generic(); ~TP_pool_generic(); - virtual int init(); - virtual TP_connection *new_connection(CONNECT *c); - virtual void add(TP_connection *); - virtual int set_pool_size(uint); - virtual int set_stall_limit(uint); - virtual int get_idle_thread_count(); + int init() override; + TP_connection *new_connection(CONNECT *c) override; + void add(TP_connection *) override; + int set_pool_size(uint) override; + int set_stall_limit(uint) override; + int get_idle_thread_count() override; }; #endif /* HAVE_POOL_OF_THREADS */ diff --git a/sql/threadpool_generic.h b/sql/threadpool_generic.h index acf5ec6978b..e3508a179b8 100644 --- a/sql/threadpool_generic.h +++ b/sql/threadpool_generic.h @@ -75,11 +75,11 @@ struct TP_connection_generic :public TP_connection TP_connection_generic(CONNECT* c); ~TP_connection_generic(); - virtual int init() { return 0; }; - virtual void set_io_timeout(int sec); - virtual int start_io(); - virtual void wait_begin(int type); - virtual void wait_end(); + int init() override { return 0; }; + void set_io_timeout(int sec) override; + int start_io() override; + void wait_begin(int type) override; + void wait_end() override; thread_group_t* thread_group; TP_connection_generic* next_in_queue; diff --git a/sql/tztime.cc b/sql/tztime.cc index 1480de96333..9885fa88cf8 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1028,9 +1028,9 @@ class Time_zone_system : public Time_zone { public: Time_zone_system() = default; /* Remove gcc warning */ - virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; - virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; - virtual const String * get_name() const; + my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const override; + void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const override; + const String * get_name() const override; }; @@ -1124,10 +1124,10 @@ class Time_zone_utc : public Time_zone { public: Time_zone_utc() = default; /* Remove gcc warning */ - virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, - uint *error_code) const; - virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; - virtual const String * get_name() const; + my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, + uint *error_code) const override; + void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const override; + const String * get_name() const override; }; @@ -1207,9 +1207,9 @@ class Time_zone_db : public Time_zone { public: Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg); - virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; - virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; - virtual const String * get_name() const; + my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const override; + void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const override; + const String * get_name() const override; private: TIME_ZONE_INFO *tz_info; const String *tz_name; @@ -1305,10 +1305,10 @@ class Time_zone_offset : public Time_zone { public: Time_zone_offset(long tz_offset_arg); - virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, - uint *error_code) const; - virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; - virtual const String * get_name() const; + my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, + uint *error_code) const override; + void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const override; + const String * get_name() const override; /* This have to be public because we want to be able to access it from my_offset_tzs_get_key() function diff --git a/sql/wsrep_client_service.h b/sql/wsrep_client_service.h index b74c52b038f..f53d9be083d 100644 --- a/sql/wsrep_client_service.h +++ b/sql/wsrep_client_service.h @@ -36,38 +36,38 @@ class Wsrep_client_service : public wsrep::client_service public: Wsrep_client_service(THD*, Wsrep_client_state&); - bool interrupted(wsrep::unique_lock&) const; - void reset_globals(); - void store_globals(); - int prepare_data_for_replication(); - void cleanup_transaction(); - bool statement_allowed_for_streaming() const; - size_t bytes_generated() const; - int prepare_fragment_for_replication(wsrep::mutable_buffer&, size_t&); - int remove_fragments(); - void emergency_shutdown() + bool interrupted(wsrep::unique_lock&) const override; + void reset_globals() override; + void store_globals() override; + int prepare_data_for_replication() override; + void cleanup_transaction() override; + bool statement_allowed_for_streaming() const override; + size_t bytes_generated() const override; + int prepare_fragment_for_replication(wsrep::mutable_buffer&, size_t&) override; + int remove_fragments() override; + void emergency_shutdown() override { throw wsrep::not_implemented_error(); } - void will_replay(); - void signal_replayed(); - enum wsrep::provider::status replay(); - enum wsrep::provider::status replay_unordered(); - void wait_for_replayers(wsrep::unique_lock&); - enum wsrep::provider::status commit_by_xid(); - bool is_explicit_xa() + void will_replay() override; + void signal_replayed() override; + enum wsrep::provider::status replay() override; + enum wsrep::provider::status replay_unordered() override; + void wait_for_replayers(wsrep::unique_lock&) override; + enum wsrep::provider::status commit_by_xid() override; + bool is_explicit_xa() override { return false; } - bool is_prepared_xa() + bool is_prepared_xa() override { return false; } - bool is_xa_rollback() + bool is_xa_rollback() override { return false; } - void debug_sync(const char*); - void debug_crash(const char*); - int bf_rollback(); + void debug_sync(const char*) override; + void debug_crash(const char*) override; + int bf_rollback() override; private: friend class Wsrep_server_service; THD* m_thd; diff --git a/sql/wsrep_condition_variable.h b/sql/wsrep_condition_variable.h index d9798bb9548..a4a121aa662 100644 --- a/sql/wsrep_condition_variable.h +++ b/sql/wsrep_condition_variable.h @@ -31,17 +31,17 @@ public: { } ~Wsrep_condition_variable() = default; - void notify_one() + void notify_one() override { mysql_cond_signal(m_cond); } - void notify_all() + void notify_all() override { mysql_cond_broadcast(m_cond); } - void wait(wsrep::unique_lock& lock) + void wait(wsrep::unique_lock& lock) override { mysql_mutex_t* mutex= static_cast(lock.mutex()->native()); mysql_cond_wait(m_cond, mutex); diff --git a/sql/wsrep_high_priority_service.h b/sql/wsrep_high_priority_service.h index c275c352de2..33b85ec8a24 100644 --- a/sql/wsrep_high_priority_service.h +++ b/sql/wsrep_high_priority_service.h @@ -33,31 +33,31 @@ public: Wsrep_high_priority_service(THD*); ~Wsrep_high_priority_service(); int start_transaction(const wsrep::ws_handle&, - const wsrep::ws_meta&); - int next_fragment(const wsrep::ws_meta&); - const wsrep::transaction& transaction() const; - int adopt_transaction(const wsrep::transaction&); + const wsrep::ws_meta&) override; + int next_fragment(const wsrep::ws_meta&) override; + const wsrep::transaction& transaction() const override; + int adopt_transaction(const wsrep::transaction&) override; int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&) = 0; + wsrep::mutable_buffer&) override = 0; int append_fragment_and_commit(const wsrep::ws_handle&, const wsrep::ws_meta&, const wsrep::const_buffer&, - const wsrep::xid&); - int remove_fragments(const wsrep::ws_meta&); - int commit(const wsrep::ws_handle&, const wsrep::ws_meta&); - int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&); + const wsrep::xid&) override; + int remove_fragments(const wsrep::ws_meta&) override; + int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) override; + int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&) override; int apply_toi(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); - void store_globals(); - void reset_globals(); - void switch_execution_context(wsrep::high_priority_service&); + wsrep::mutable_buffer&) override; + void store_globals() override; + void reset_globals() override; + void switch_execution_context(wsrep::high_priority_service&) override; int log_dummy_write_set(const wsrep::ws_handle&, const wsrep::ws_meta&, - wsrep::mutable_buffer&); - void adopt_apply_error(wsrep::mutable_buffer&); + wsrep::mutable_buffer&) override; + void adopt_apply_error(wsrep::mutable_buffer&) override; virtual bool check_exit_status() const = 0; - void debug_crash(const char*); + void debug_crash(const char*) override; protected: friend Wsrep_server_service; THD* m_thd; @@ -84,12 +84,12 @@ public: Wsrep_applier_service(THD*); ~Wsrep_applier_service(); int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); + wsrep::mutable_buffer&) override; int apply_nbo_begin(const wsrep::ws_meta&, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err); - void after_apply(); - bool is_replaying() const { return false; } - bool check_exit_status() const; + wsrep::mutable_buffer& err) override; + void after_apply() override; + bool is_replaying() const override { return false; } + bool check_exit_status() const override; }; class Wsrep_replayer_service : public Wsrep_high_priority_service @@ -98,21 +98,21 @@ public: Wsrep_replayer_service(THD* replayer_thd, THD* orig_thd); ~Wsrep_replayer_service(); int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); + wsrep::mutable_buffer&) override; int apply_nbo_begin(const wsrep::ws_meta&, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err) + wsrep::mutable_buffer& err) override { DBUG_ASSERT(0); /* DDL should never cause replaying */ return 0; } - void after_apply() { } - bool is_replaying() const { return true; } + void after_apply() override { } + bool is_replaying() const override { return true; } void replay_status(enum wsrep::provider::status status) { m_replay_status = status; } enum wsrep::provider::status replay_status() const { return m_replay_status; } /* Replayer should never be forced to exit */ - bool check_exit_status() const { return false; } + bool check_exit_status() const override { return false; } private: THD* m_orig_thd; struct da_shadow diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h index f396c1be331..456358ee85d 100644 --- a/sql/wsrep_mutex.h +++ b/sql/wsrep_mutex.h @@ -29,17 +29,17 @@ public: : m_mutex(mutex) { } - void lock() + void lock() override { mysql_mutex_lock(m_mutex); } - void unlock() + void unlock() override { mysql_mutex_unlock(m_mutex); } - void* native() + void* native() override { return m_mutex; } diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h index 0fc48402024..3a7da229cd4 100644 --- a/sql/wsrep_server_service.h +++ b/sql/wsrep_server_service.h @@ -32,49 +32,49 @@ public: : m_server_state(server_state) { } - wsrep::storage_service* storage_service(wsrep::client_service&); + wsrep::storage_service* storage_service(wsrep::client_service&) override; - wsrep::storage_service* storage_service(wsrep::high_priority_service&); + wsrep::storage_service* storage_service(wsrep::high_priority_service&) override; - void release_storage_service(wsrep::storage_service*); + void release_storage_service(wsrep::storage_service*) override; wsrep::high_priority_service* - streaming_applier_service(wsrep::client_service&); + streaming_applier_service(wsrep::client_service&) override; wsrep::high_priority_service* - streaming_applier_service(wsrep::high_priority_service&); + streaming_applier_service(wsrep::high_priority_service&) override; - void release_high_priority_service(wsrep::high_priority_service*); + void release_high_priority_service(wsrep::high_priority_service*) override; void background_rollback(wsrep::unique_lock &, - wsrep::client_state &); + wsrep::client_state &) override; - void bootstrap(); - void log_message(enum wsrep::log::level, const char*); + void bootstrap() override; + void log_message(enum wsrep::log::level, const char*) override; - void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&) + void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&) override { throw wsrep::not_implemented_error(); } - void log_view(wsrep::high_priority_service*, const wsrep::view&); + void log_view(wsrep::high_priority_service*, const wsrep::view&) override; - void recover_streaming_appliers(wsrep::client_service&); - void recover_streaming_appliers(wsrep::high_priority_service&); - wsrep::view get_view(wsrep::client_service&, const wsrep::id& own_id); + void recover_streaming_appliers(wsrep::client_service&) override; + void recover_streaming_appliers(wsrep::high_priority_service&) override; + wsrep::view get_view(wsrep::client_service&, const wsrep::id& own_id) override; - wsrep::gtid get_position(wsrep::client_service&); - void set_position(wsrep::client_service&, const wsrep::gtid&); + wsrep::gtid get_position(wsrep::client_service&) override; + void set_position(wsrep::client_service&, const wsrep::gtid&) override; void log_state_change(enum wsrep::server_state::state, - enum wsrep::server_state::state); + enum wsrep::server_state::state) override; - bool sst_before_init() const; + bool sst_before_init() const override; - std::string sst_request(); - int start_sst(const std::string&, const wsrep::gtid&, bool); + std::string sst_request() override; + int start_sst(const std::string&, const wsrep::gtid&, bool) override; - int wait_committing_transactions(int); + int wait_committing_transactions(int) override; - void debug_sync(const char*); + void debug_sync(const char*) override; private: Wsrep_server_state& m_server_state; }; diff --git a/sql/wsrep_storage_service.h b/sql/wsrep_storage_service.h index f39543a89bc..e4b4402b410 100644 --- a/sql/wsrep_storage_service.h +++ b/sql/wsrep_storage_service.h @@ -28,19 +28,19 @@ class Wsrep_storage_service : public: Wsrep_storage_service(THD*); ~Wsrep_storage_service(); - int start_transaction(const wsrep::ws_handle&); - void adopt_transaction(const wsrep::transaction&); + int start_transaction(const wsrep::ws_handle&) override; + void adopt_transaction(const wsrep::transaction&) override; int append_fragment(const wsrep::id&, wsrep::transaction_id, int flags, const wsrep::const_buffer&, - const wsrep::xid&); - int update_fragment_meta(const wsrep::ws_meta&); - int remove_fragments(); - int commit(const wsrep::ws_handle&, const wsrep::ws_meta&); - int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&); - void store_globals(); - void reset_globals(); + const wsrep::xid&) override; + int update_fragment_meta(const wsrep::ws_meta&) override; + int remove_fragments() override; + int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) override; + int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&) override; + void store_globals() override; + void reset_globals() override; private: friend class Wsrep_server_service; THD* m_thd; diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 2e03ac639b5..10e1f108dce 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -88,8 +88,8 @@ class ha_archive final : public handler public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); ~ha_archive() = default; - const char *index_type(uint inx) { return "NONE"; } - ulonglong table_flags() const + const char *index_type(uint inx) override { return "NONE"; } + ulonglong table_flags() const override { return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_CAN_BIT_FIELD | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | @@ -97,66 +97,66 @@ public: HA_HAS_RECORDS | HA_CAN_REPAIR | HA_SLOW_RND_POS | HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY); } - ulong index_flags(uint idx, uint part, bool all_parts) const + ulong index_flags(uint idx, uint part, bool all_parts) const override { return HA_ONLY_WHOLE_INDEX; } - virtual void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values); - uint max_supported_keys() const { return 1; } - uint max_supported_key_length() const { return sizeof(ulonglong); } - uint max_supported_key_part_length() const { return sizeof(ulonglong); } - ha_rows records() { return share->rows_recorded; } - int index_init(uint keynr, bool sorted); - virtual int index_read(uchar * buf, const uchar * key, - uint key_len, enum ha_rkey_function find_flag); - virtual int index_read_idx(uchar * buf, uint index, const uchar * key, - uint key_len, enum ha_rkey_function find_flag); - int index_next(uchar * buf); - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(const uchar * buf); + void get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) override; + uint max_supported_keys() const override { return 1; } + uint max_supported_key_length() const override { return sizeof(ulonglong); } + uint max_supported_key_part_length() const override { return sizeof(ulonglong); } + ha_rows records() override { return share->rows_recorded; } + int index_init(uint keynr, bool sorted) override; + int index_read(uchar * buf, const uchar * key, + uint key_len, enum ha_rkey_function find_flag) override; + int index_read_idx(uchar * buf, uint index, const uchar * key, + uint key_len, enum ha_rkey_function find_flag); + int index_next(uchar * buf) override; + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; + int write_row(const uchar * buf) override; int real_write_row(const uchar *buf, azio_stream *writer); - int truncate(); - int rnd_init(bool scan=1); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); + int truncate() override; + int rnd_init(bool scan=1) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; int get_row(azio_stream *file_to_read, uchar *buf); int get_row_version2(azio_stream *file_to_read, uchar *buf); int get_row_version3(azio_stream *file_to_read, uchar *buf); Archive_share *get_share(const char *table_name, int *rc); int init_archive_reader(); // Always try auto_repair in case of HA_ERR_CRASHED_ON_USAGE - bool auto_repair(int error) const + bool auto_repair(int error) const override { return error == HA_ERR_CRASHED_ON_USAGE; } int read_data_header(azio_stream *file_to_read); - void position(const uchar *record); - int info(uint); - int extra(enum ha_extra_function operation); - void update_create_info(HA_CREATE_INFO *create_info); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - int repair(THD* thd, HA_CHECK_OPT* check_opt); - int check_for_upgrade(HA_CHECK_OPT *check_opt); - void start_bulk_insert(ha_rows rows, uint flags); - int end_bulk_insert(); - enum row_type get_row_type() const + void position(const uchar *record) override; + int info(uint) override; + int extra(enum ha_extra_function operation) override; + void update_create_info(HA_CREATE_INFO *create_info) override; + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; + int optimize(THD* thd, HA_CHECK_OPT* check_opt) override; + int repair(THD* thd, HA_CHECK_OPT* check_opt) override; + int check_for_upgrade(HA_CHECK_OPT *check_opt) override; + void start_bulk_insert(ha_rows rows, uint flags) override; + int end_bulk_insert() override; + enum row_type get_row_type() const override { return ROW_TYPE_COMPRESSED; } THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - bool is_crashed() const; - int check(THD* thd, HA_CHECK_OPT* check_opt); - bool check_and_repair(THD *thd); + enum thr_lock_type lock_type) override; + bool is_crashed() const override; + int check(THD* thd, HA_CHECK_OPT* check_opt) override; + bool check_and_repair(THD *thd) override; uint32 max_row_length(const uchar *buf); bool fix_rec_buff(unsigned int length); int unpack_row(azio_stream *file_to_read, uchar *record); unsigned int pack_row(const uchar *record, azio_stream *writer); - bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); - int external_lock(THD *thd, int lock_type); + bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) override; + int external_lock(THD *thd, int lock_type) override; private: void flush_and_clear_pending_writes(); }; diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 04ca65f2a53..287f1db6bfa 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -49,15 +49,15 @@ public: The name of the index type that will be used for display don't implement this method unless you really have indexes */ - const char *index_type(uint key_number); - ulonglong table_flags() const + const char *index_type(uint key_number) override; + ulonglong table_flags() const override { return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_CAN_ONLINE_BACKUPS | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED); } - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | @@ -67,39 +67,39 @@ public: #define BLACKHOLE_MAX_KEY MAX_KEY /* Max allowed keys */ #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ #define BLACKHOLE_MAX_KEY_LENGTH 3500 /* Like in InnoDB */ - uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } - uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int truncate(); - int rnd_init(bool scan); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); + uint max_supported_keys() const override { return BLACKHOLE_MAX_KEY; } + uint max_supported_key_length() const override { return BLACKHOLE_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const override { return BLACKHOLE_MAX_KEY_LENGTH; } + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; + int truncate() override; + int rnd_init(bool scan) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); + enum ha_rkey_function find_flag) override; int index_read_idx_map(uchar * buf, uint idx, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - void position(const uchar *record); - int info(uint flag); - int external_lock(THD *thd, int lock_type); + enum ha_rkey_function find_flag) override; + int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map) override; + int index_next(uchar * buf) override; + int index_prev(uchar * buf) override; + int index_first(uchar * buf) override; + int index_last(uchar * buf) override; + void position(const uchar *record) override; + int info(uint flag) override; + int external_lock(THD *thd, int lock_type) override; int create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info); + HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - int delete_table(const char *name) + enum thr_lock_type lock_type) override; + int delete_table(const char *name) override { return 0; } private: - virtual int write_row(const uchar *buf); - virtual int update_row(const uchar *old_data, const uchar *new_data); - virtual int delete_row(const uchar *buf); + int write_row(const uchar *buf) override; + int update_row(const uchar *old_data, const uchar *new_data) override; + int delete_row(const uchar *buf) override; }; diff --git a/storage/connect/array.h b/storage/connect/array.h index bd38344de06..af8e101594a 100644 --- a/storage/connect/array.h +++ b/storage/connect/array.h @@ -38,11 +38,11 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock //ARRAY(PGLOBAL g, PARRAY par, int k); // Implementation - virtual int GetType(void) {return TYPE_ARRAY;} - virtual int GetResultType(void) {return Type;} - virtual int GetLength(void) {return Len;} - virtual int GetLengthEx(void) {return Len;} - virtual int GetScale() {return 0;} + int GetType(void) override {return TYPE_ARRAY;} + int GetResultType(void) override {return Type;} + int GetLength(void) override {return Len;} + int GetLengthEx(void) override {return Len;} + int GetScale() override {return 0;} int GetNval(void) {return Nval;} int GetSize(void) {return Size;} // PVAL GetValp(void) {return Valp;} @@ -51,13 +51,13 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock // Methods using XOBJECT::GetIntValue; - virtual void Reset(void) {Bot = -1;} - virtual int Qcompare(int *, int *); - virtual bool Compare(PXOB) {assert(false); return false;} - virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;} + void Reset(void) override {Bot = -1;} + int Qcompare(int *, int *) override; + bool Compare(PXOB) override {assert(false); return false;} + bool SetFormat(PGLOBAL, FORMAT&) override {assert(false); return false;} //virtual int CheckSpcCol(PTDB, int) {return 0;} - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; // void Empty(void); void SetPrecision(PGLOBAL g, int p); bool AddValue(PGLOBAL g, PSZ sp); @@ -119,7 +119,7 @@ class MULAR : public CSORT, public BLOCK { // No need to be an XOBJECT void SetPars(PARRAY par, int i) {Pars[i] = par;} // Methods - virtual int Qcompare(int *i1, int *i2); // Sort compare routine + int Qcompare(int *i1, int *i2) override; // Sort compare routine bool Sort(PGLOBAL g); protected: diff --git a/storage/connect/blkfil.h b/storage/connect/blkfil.h index 27e6fd4b166..0fe5252d4c5 100644 --- a/storage/connect/blkfil.h +++ b/storage/connect/blkfil.h @@ -27,8 +27,8 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */ // Methods virtual void Reset(PGLOBAL) = 0; virtual int BlockEval(PGLOBAL) = 0; - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; protected: BLOCKFILTER(void) = default; // Standard constructor not to be used @@ -50,8 +50,8 @@ class DllExport BLKFILLOG : public BLOCKFILTER { /* Logical Op Block Filter */ BLKFILLOG(PTDBDOS tdbp, int op, PBF *bfp, int n); // Methods - virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); + void Reset(PGLOBAL g) override; + int BlockEval(PGLOBAL g) override; protected: BLKFILLOG(void) = default; // Standard constructor not to be used @@ -70,8 +70,8 @@ class DllExport BLKFILARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ BLKFILARI(PGLOBAL g, PTDBDOS tdbp, int op, PXOB *xp); // Methods - virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); + void Reset(PGLOBAL g) override; + int BlockEval(PGLOBAL g) override; virtual void MakeValueBitmap(void) {} protected: @@ -93,8 +93,8 @@ class DllExport BLKFILAR2 : public BLKFILARI { /* Arithm. Op Block Filter */ BLKFILAR2(PGLOBAL g, PTDBDOS tdbp, int op, PXOB *xp); // Methods - virtual int BlockEval(PGLOBAL g); - virtual void MakeValueBitmap(void); + int BlockEval(PGLOBAL g) override; + void MakeValueBitmap(void) override; protected: BLKFILAR2(void) = default; // Standard constructor not to be used @@ -114,8 +114,8 @@ class DllExport BLKFILMR2 : public BLKFILARI { /* Arithm. Op Block Filter */ BLKFILMR2(PGLOBAL g, PTDBDOS tdbp, int op, PXOB *xp); // Methods - virtual int BlockEval(PGLOBAL g); - virtual void MakeValueBitmap(void); + int BlockEval(PGLOBAL g) override; + void MakeValueBitmap(void) override; protected: BLKFILMR2(void) = default; // Standard constructor not to be used @@ -137,8 +137,8 @@ class DllExport BLKSPCARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ BLKSPCARI(PTDBDOS tdbp, int op, PXOB *xp, int bsize); // Methods - virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); + void Reset(PGLOBAL g) override; + int BlockEval(PGLOBAL g) override; protected: BLKSPCARI(void) = default; // Standard constructor not to be used @@ -159,8 +159,8 @@ class DllExport BLKFILIN : public BLOCKFILTER { // With array arguments. BLKFILIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp); // Methods - virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); + void Reset(PGLOBAL g) override; + int BlockEval(PGLOBAL g) override; virtual void MakeValueBitmap(void) {} protected: @@ -181,8 +181,8 @@ class DllExport BLKFILIN2 : public BLKFILIN { // With array arguments. // Methods //virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); - virtual void MakeValueBitmap(void); + int BlockEval(PGLOBAL g) override; + void MakeValueBitmap(void) override; protected: // Member @@ -205,8 +205,8 @@ class DllExport BLKSPCIN : public BLOCKFILTER { // With array arguments. BLKSPCIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp, int bsize); // Methods - virtual void Reset(PGLOBAL g); - virtual int BlockEval(PGLOBAL g); + void Reset(PGLOBAL g) override; + int BlockEval(PGLOBAL g) override; protected: // Member diff --git a/storage/connect/cmgfam.h b/storage/connect/cmgfam.h index 9c5f91f0d23..d5c637cbdd7 100644 --- a/storage/connect/cmgfam.h +++ b/storage/connect/cmgfam.h @@ -26,18 +26,18 @@ public: CMGFAM(PCMGFAM txfp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_MGO; } + AMT GetAmType(void) override { return TYPE_AM_MGO; } virtual bool GetUseTemp(void) { return false; } virtual int GetPos(void); virtual int GetNextPos(void); void SetTdbp(PTDBDOS tdbp) { Tdbp = tdbp; } - virtual PTXF Duplicate(PGLOBAL g) { return (PTXF)new(g) CMGFAM(this); } + PTXF Duplicate(PGLOBAL g) { return (PTXF)new(g) CMGFAM(this); } void SetLrecl(int lrecl) { Lrecl = lrecl; } // Methods virtual void Reset(void); virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); + int Cardinality(PGLOBAL g) override; virtual int MaxBlkSize(PGLOBAL g, int s); virtual bool AllocateBuffer(PGLOBAL g) { return false; } virtual int GetRowID(void); diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index e67ba3ba3f9..4a2f572ec2d 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -27,12 +27,12 @@ class DllExport COLBLK : public XOBJECT { public: // Implementation - virtual int GetType(void) {return TYPE_COLBLK;} - virtual int GetResultType(void) {return Buf_Type;} - virtual int GetScale(void) {return Format.Prec;} + int GetType(void) override {return TYPE_COLBLK;} + int GetResultType(void) override {return Buf_Type;} + int GetScale(void) override {return Format.Prec;} virtual int GetPrecision(void) {return Precision;} - virtual int GetLength(void) {return Long;} - virtual int GetLengthEx(void); + int GetLength(void) override {return Long;} + int GetLengthEx(void) override; virtual int GetAmType() {return TYPE_AM_ERROR;} virtual void SetOk(void) {Status |= BUF_EMPTY;} virtual PTDB GetTo_Tdb(void) {return To_Tdb;} @@ -65,17 +65,17 @@ class DllExport COLBLK : public XOBJECT { void SetNullable(bool b) {Nullable = b;} void SetName(PSZ name_var) { Name= name_var; } // Methods - virtual void Reset(void); - virtual bool Compare(PXOB xp); - virtual bool SetFormat(PGLOBAL, FORMAT&); + void Reset(void) override; + bool Compare(PXOB xp) override; + bool SetFormat(PGLOBAL, FORMAT&) override; virtual bool IsSpecial(void) {return false;} - virtual bool Eval(PGLOBAL g); + bool Eval(PGLOBAL g) override; virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); virtual void SetTo_Val(PVAL) {} virtual void ReadColumn(PGLOBAL g); virtual void WriteColumn(PGLOBAL g); - virtual void Printf(PGLOBAL g, FILE *, uint); - virtual void Prints(PGLOBAL g, char *, uint); + void Printf(PGLOBAL g, FILE *, uint) override; + void Prints(PGLOBAL g, char *, uint) override; virtual bool VarSize(void) {return false;} bool InitValue(PGLOBAL g); @@ -108,13 +108,12 @@ class DllExport SPCBLK : public COLBLK { SPCBLK(PCOLUMN cp); // Implementation - virtual int GetAmType(void) = 0; virtual bool GetRnm(void) {return false;} // Methods - virtual bool IsSpecial(void) {return true;} - virtual void ReadColumn(PGLOBAL g) = 0; - virtual void WriteColumn(PGLOBAL g); + bool IsSpecial(void) override {return true;} + void ReadColumn(PGLOBAL g) override = 0; + void WriteColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -130,11 +129,11 @@ class DllExport RIDBLK : public SPCBLK { RIDBLK(PCOLUMN cp, bool rnm); // Implementation - virtual int GetAmType(void) {return TYPE_AM_ROWID;} - virtual bool GetRnm(void) {return Rnm;} + int GetAmType(void) override {return TYPE_AM_ROWID;} + bool GetRnm(void) override {return Rnm;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: bool Rnm; // False for RowID, True for RowNum @@ -149,11 +148,11 @@ class DllExport FIDBLK : public SPCBLK { FIDBLK(PCOLUMN cp, OPVAL op); // Implementation - virtual int GetAmType(void) {return TYPE_AM_FILID;} + int GetAmType(void) override {return TYPE_AM_FILID;} // Methods - virtual void Reset(void) {} // This is a pseudo constant column - virtual void ReadColumn(PGLOBAL g); + void Reset(void) override {} // This is a pseudo constant column + void ReadColumn(PGLOBAL g) override; protected: PCSZ Fn; // The current To_File of the table @@ -169,11 +168,11 @@ class DllExport TIDBLK : public SPCBLK { TIDBLK(PCOLUMN cp); // Implementation - virtual int GetAmType(void) {return TYPE_AM_TABID;} + int GetAmType(void) override {return TYPE_AM_TABID;} // Methods - virtual void Reset(void) {} // This is a pseudo constant column - virtual void ReadColumn(PGLOBAL g); + void Reset(void) override {} // This is a pseudo constant column + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -192,11 +191,11 @@ class DllExport PRTBLK : public SPCBLK { PRTBLK(PCOLUMN cp); // Implementation - virtual int GetAmType(void) {return TYPE_AM_PRTID;} + int GetAmType(void) override {return TYPE_AM_PRTID;} // Methods - virtual void Reset(void) {} // This is a pseudo constant column - virtual void ReadColumn(PGLOBAL g); + void Reset(void) override {} // This is a pseudo constant column + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -215,11 +214,11 @@ class DllExport SIDBLK : public SPCBLK { SIDBLK(PCOLUMN cp); // Implementation - virtual int GetAmType(void) {return TYPE_AM_SRVID;} + int GetAmType(void) override {return TYPE_AM_SRVID;} // Methods - virtual void Reset(void) {} // This is a pseudo constant column - virtual void ReadColumn(PGLOBAL g); + void Reset(void) override {} // This is a pseudo constant column + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used diff --git a/storage/connect/domdoc.h b/storage/connect/domdoc.h index dd8936097e2..6a25978f1af 100644 --- a/storage/connect/domdoc.h +++ b/storage/connect/domdoc.h @@ -73,7 +73,7 @@ class DOMNODE : public XMLNODE { // Methods virtual RCODE GetContent(PGLOBAL g, char *buf, int len); virtual bool SetContent(PGLOBAL g, char *txtp, int len); - virtual PXNODE Clone(PGLOBAL g, PXNODE np); + PXNODE Clone(PGLOBAL g, PXNODE np) override; virtual PXLIST GetChildElements(PGLOBAL g, char *xp, PXLIST lp); virtual PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp); virtual PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np); diff --git a/storage/connect/filamap.h b/storage/connect/filamap.h index 774eb8b91b3..b201b3f9903 100644 --- a/storage/connect/filamap.h +++ b/storage/connect/filamap.h @@ -24,32 +24,32 @@ class DllExport MAPFAM : public TXTFAM { MAPFAM(PMAPFAM tmfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_MAP;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_MAP;} + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) MAPFAM(this);} // Methods - virtual void Reset(void); - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;} - virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual bool OpenTableFile(PGLOBAL g); - virtual bool DeferReading(void) {return false;} + void Reset(void) override; + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override {return (g) ? -1 : 0;} + int MaxBlkSize(PGLOBAL g, int s) override {return s;} + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + int SkipRecord(PGLOBAL g, bool header) override; + bool OpenTableFile(PGLOBAL g) override; + bool DeferReading(void) override {return false;} virtual int GetNext(PGLOBAL g) {return RC_EF;} - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: - virtual int InitDelete(PGLOBAL g, int fpos, int spos); + int InitDelete(PGLOBAL g, int fpos, int spos) override; // Members char *Memory; // Pointer on file mapping view. @@ -70,18 +70,18 @@ class DllExport MBKFAM : public MAPFAM { MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {} // Implementation - virtual PTXF Duplicate(PGLOBAL g) + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) MBKFAM(this);} // Methods - virtual void Reset(void); - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s) + void Reset(void) override; + int Cardinality(PGLOBAL g) override; + int MaxBlkSize(PGLOBAL g, int s) override {return TXTFAM::MaxBlkSize(g, s);} - virtual int GetRowID(void); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual int ReadBuffer(PGLOBAL g); - virtual void Rewind(void); + int GetRowID(void) override; + int SkipRecord(PGLOBAL g, bool header) override; + int ReadBuffer(PGLOBAL g) override; + void Rewind(void) override; protected: // No additional members @@ -97,22 +97,22 @@ class DllExport MPXFAM : public MBKFAM { MPXFAM(PMAPFAM tmfp) : MBKFAM(tmfp) {} // Implementation - virtual int GetPos(void); - virtual PTXF Duplicate(PGLOBAL g) + int GetPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) MPXFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);} - virtual int MaxBlkSize(PGLOBAL g, int s) + int Cardinality(PGLOBAL g) override {return TXTFAM::Cardinality(g);} + int MaxBlkSize(PGLOBAL g, int s) override {return TXTFAM::MaxBlkSize(g, s);} - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int GetNextPos(void) {return GetPos() + 1;} - virtual bool DeferReading(void) {return false;} - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); + bool SetPos(PGLOBAL g, int recpos) override; + int GetNextPos(void) override {return GetPos() + 1;} + bool DeferReading(void) override {return false;} + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; protected: - virtual int InitDelete(PGLOBAL g, int fpos, int spos); + int InitDelete(PGLOBAL g, int fpos, int spos) override; // No additional members }; // end of class MPXFAM diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index 6cf6331abd4..7a7a65b0236 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -55,23 +55,23 @@ class DllExport DBFFAM : public FIXFAM, public DBFBASE { DBFFAM(PDBFFAM txfp) : FIXFAM(txfp), DBFBASE((PDBF)txfp) {} // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_DBF;} - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_DBF;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) DBFFAM(this);} // Methods - virtual int GetNerr(void) {return Nerr;} - virtual int Cardinality(PGLOBAL g); - virtual bool OpenTableFile(PGLOBAL g); - virtual bool AllocateBuffer(PGLOBAL g); - virtual void ResetBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + int GetNerr(void) override {return Nerr;} + int Cardinality(PGLOBAL g) override; + bool OpenTableFile(PGLOBAL g) override; + bool AllocateBuffer(PGLOBAL g) override; + void ResetBuffer(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: - virtual bool CopyHeader(PGLOBAL g); + bool CopyHeader(PGLOBAL g) override; //virtual int InitDelete(PGLOBAL g, int fpos, int spos); // Members @@ -88,18 +88,18 @@ class DllExport DBMFAM : public MPXFAM, public DBFBASE { DBMFAM(PDBMFAM txfp) : MPXFAM(txfp), DBFBASE((PDBF)txfp) {} // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_DBF;} - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_DBF;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) DBMFAM(this);} - virtual int GetDelRows(void); + int GetDelRows(void) override; // Methods - virtual int GetNerr(void) {return Nerr;} - virtual int Cardinality(PGLOBAL g); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void Rewind(void); + int GetNerr(void) override {return Nerr;} + int Cardinality(PGLOBAL g) override; + bool AllocateBuffer(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void Rewind(void) override; protected: // Members diff --git a/storage/connect/filamfix.h b/storage/connect/filamfix.h index a99a36af232..60697acc3eb 100644 --- a/storage/connect/filamfix.h +++ b/storage/connect/filamfix.h @@ -25,28 +25,28 @@ class DllExport FIXFAM : public BLKFAM { FIXFAM(PFIXFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_FIX;} - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_FIX;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) FIXFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);} - virtual int MaxBlkSize(PGLOBAL g, int s) + int Cardinality(PGLOBAL g) override {return TXTFAM::Cardinality(g);} + int MaxBlkSize(PGLOBAL g, int s) override {return TXTFAM::MaxBlkSize(g, s);} - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int GetNextPos(void) {return Fpos + 1;} - virtual bool AllocateBuffer(PGLOBAL g); - virtual void ResetBuffer(PGLOBAL g); + bool SetPos(PGLOBAL g, int recpos) override; + int GetNextPos(void) override {return Fpos + 1;} + bool AllocateBuffer(PGLOBAL g) override; + void ResetBuffer(PGLOBAL g) override; virtual int WriteModifiedBlock(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; protected: virtual bool CopyHeader(PGLOBAL g) {return false;} - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b); - virtual int InitDelete(PGLOBAL g, int fpos, int spos); + bool MoveIntermediateLines(PGLOBAL g, bool *b) override; + int InitDelete(PGLOBAL g, int fpos, int spos) override; // No additional members }; // end of class FIXFAM @@ -64,22 +64,22 @@ class BGXFAM : public FIXFAM { BGXFAM(PBGXFAM txfp); // Implementation - virtual PTXF Duplicate(PGLOBAL g) + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) BGXFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g); - virtual bool OpenTableFile(PGLOBAL g); - virtual int WriteModifiedBlock(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + int Cardinality(PGLOBAL g) override; + bool OpenTableFile(PGLOBAL g) override; + int WriteModifiedBlock(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: - virtual bool OpenTempFile(PGLOBAL g); - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL); + bool OpenTempFile(PGLOBAL g) override; + bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL) override; int BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req); bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req); bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos diff --git a/storage/connect/filamgz.h b/storage/connect/filamgz.h index 7a00c0d4bc7..fd5c0d24188 100644 --- a/storage/connect/filamgz.h +++ b/storage/connect/filamgz.h @@ -28,28 +28,28 @@ class DllExport GZFAM : public TXTFAM { GZFAM(PGZFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_GZ;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_GZ;} + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) GZFAM(this);} // Methods - virtual void Reset(void); - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;} - virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + void Reset(void) override; + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override {return (g) ? -1 : 0;} + int MaxBlkSize(PGLOBAL g, int s) override {return s;} + bool AllocateBuffer(PGLOBAL g) override; + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + int SkipRecord(PGLOBAL g, bool header) override; + bool OpenTableFile(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: int Zerror(PGLOBAL g); // GZ error function @@ -71,23 +71,23 @@ class DllExport ZBKFAM : public GZFAM { ZBKFAM(PZBKFAM txfp); // Implementation - virtual int GetPos(void); - virtual int GetNextPos(void) {return 0;} - virtual PTXF Duplicate(PGLOBAL g) + int GetPos(void) override; + int GetNextPos(void) override {return 0;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) ZBKFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + int Cardinality(PGLOBAL g) override; + int MaxBlkSize(PGLOBAL g, int s) override; + bool AllocateBuffer(PGLOBAL g) override; + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + int SkipRecord(PGLOBAL g, bool header) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: // Members @@ -108,15 +108,15 @@ class DllExport GZXFAM : public ZBKFAM { GZXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {} // Implementation - virtual int GetNextPos(void) {return 0;} - virtual PTXF Duplicate(PGLOBAL g) + int GetNextPos(void) override {return 0;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) GZXFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + bool AllocateBuffer(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; protected: // No additional Members @@ -140,21 +140,21 @@ class DllExport ZLBFAM : public BLKFAM { ZLBFAM(PZLBFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_ZLIB;} + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) ZLBFAM(this);} inline void SetOptimized(bool b) {Optimized = b;} // Methods - virtual int GetFileLength(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + int GetFileLength(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + bool AllocateBuffer(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: bool WriteCompressedBuffer(PGLOBAL g); diff --git a/storage/connect/filamtxt.h b/storage/connect/filamtxt.h index 353e06ad3bd..e291167fbd8 100644 --- a/storage/connect/filamtxt.h +++ b/storage/connect/filamtxt.h @@ -134,35 +134,35 @@ class DllExport DOSFAM : public TXTFAM { DOSFAM(PBLKFAM tdfp, PDOSDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_DOS;} - virtual bool GetUseTemp(void) {return UseTemp;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_DOS;} + bool GetUseTemp(void) override {return UseTemp;} + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) DOSFAM(this);} // Methods - virtual void Reset(void); - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + void Reset(void) override; + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override; + int MaxBlkSize(PGLOBAL g, int s) override; + bool AllocateBuffer(PGLOBAL g) override; + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + int SkipRecord(PGLOBAL g, bool header) override; + bool OpenTableFile(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: virtual bool OpenTempFile(PGLOBAL g); virtual bool MoveIntermediateLines(PGLOBAL g, bool *b); virtual int RenameTempFile(PGLOBAL g); - virtual int InitDelete(PGLOBAL g, int fpos, int spos); + int InitDelete(PGLOBAL g, int fpos, int spos) override; // Members FILE *Stream; // Points to Dos file structure @@ -183,25 +183,25 @@ class DllExport BLKFAM : public DOSFAM { BLKFAM(PBLKFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_BLK;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_BLK;} + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) BLKFAM(this);} // Methods - virtual void Reset(void); - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + void Reset(void) override; + int Cardinality(PGLOBAL g) override; + int MaxBlkSize(PGLOBAL g, int s) override; + bool AllocateBuffer(PGLOBAL g) override; + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + int SkipRecord(PGLOBAL g, bool header) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: // Members @@ -222,24 +222,24 @@ public: BINFAM(PBINFAM txfp) : DOSFAM(txfp) {Recsize = txfp->Recsize;} // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_BIN;} + AMT GetAmType(void) override {return TYPE_AM_BIN;} //virtual int GetPos(void); //virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) { return (PTXF)new(g) BINFAM(this); } + PTXF Duplicate(PGLOBAL g) override { return (PTXF)new(g) BINFAM(this); } // Methods //virtual void Reset(void) {TXTFAM::Reset();} //virtual int GetFileLength(PGLOBAL g); //virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual bool AllocateBuffer(PGLOBAL g); + int MaxBlkSize(PGLOBAL g, int s) override {return s;} + bool AllocateBuffer(PGLOBAL g) override; //virtual int GetRowID(void); //virtual bool RecordPos(PGLOBAL g); //virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header) {return RC_OK;} + int SkipRecord(PGLOBAL g, bool header) override {return RC_OK;} //virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; //virtual int DeleteRecords(PGLOBAL g, int irc); //virtual void CloseTableFile(PGLOBAL g, bool abort); //virtual void Rewind(void); diff --git a/storage/connect/filamvct.h b/storage/connect/filamvct.h index 85982403270..2b730e5c66c 100644 --- a/storage/connect/filamvct.h +++ b/storage/connect/filamvct.h @@ -34,27 +34,27 @@ class DllExport VCTFAM : public FIXFAM { VCTFAM(PVCTFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_VCT;} - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_VCT;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) VCTFAM(this);} - virtual int GetFileLength(PGLOBAL g); + int GetFileLength(PGLOBAL g) override; // Methods - virtual void Reset(void); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g); + void Reset(void) override; + int MaxBlkSize(PGLOBAL g, int s) override; + bool AllocateBuffer(PGLOBAL g) override; virtual bool InitInsert(PGLOBAL g); - virtual void ResetBuffer(PGLOBAL g) {} - virtual int Cardinality(PGLOBAL g); - virtual int GetRowID(void); + void ResetBuffer(PGLOBAL g) override {} + int Cardinality(PGLOBAL g) override; + int GetRowID(void) override; // Database routines - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + bool OpenTableFile(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; // Specific functions virtual bool ReadBlock(PGLOBAL g, PVCTCOL colp); @@ -62,9 +62,9 @@ class DllExport VCTFAM : public FIXFAM { protected: virtual bool MakeEmptyFile(PGLOBAL g, PCSZ fn); - virtual bool OpenTempFile(PGLOBAL g); + bool OpenTempFile(PGLOBAL g) override; virtual bool MoveLines(PGLOBAL g) {return false;} - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL); + bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL) override; virtual bool CleanUnusedSpace(PGLOBAL g); virtual int GetBlockInfo(PGLOBAL g); virtual bool SetBlockInfo(PGLOBAL g); @@ -98,25 +98,25 @@ class DllExport VCMFAM : public VCTFAM { VCMFAM(PVCMFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_VMP;} - virtual PTXF Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_VMP;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) VCMFAM(this);} // Methods - virtual bool AllocateBuffer(PGLOBAL g); - virtual bool InitInsert(PGLOBAL g); + bool AllocateBuffer(PGLOBAL g) override; + bool InitInsert(PGLOBAL g) override; // Database routines - virtual bool OpenTableFile(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); + bool OpenTableFile(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; protected: // Specific functions - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL); - virtual bool ReadBlock(PGLOBAL g, PVCTCOL colp); - virtual bool WriteBlock(PGLOBAL g, PVCTCOL colp); + bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL) override; + bool ReadBlock(PGLOBAL g, PVCTCOL colp) override; + bool WriteBlock(PGLOBAL g, PVCTCOL colp) override; // Members char* Memory; // Pointer on file mapping view. @@ -137,29 +137,29 @@ class DllExport VECFAM : public VCTFAM { VECFAM(PVECFAM txfp); // Implementation - virtual PTXF Duplicate(PGLOBAL g) + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) VECFAM(this);} // Methods - virtual bool AllocateBuffer(PGLOBAL g); - virtual bool InitInsert(PGLOBAL g); - virtual void ResetBuffer(PGLOBAL g); + bool AllocateBuffer(PGLOBAL g) override; + bool InitInsert(PGLOBAL g) override; + void ResetBuffer(PGLOBAL g) override; // Database routines - virtual bool OpenTableFile(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); + bool OpenTableFile(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; // Specific functions - virtual bool ReadBlock(PGLOBAL g, PVCTCOL colp); - virtual bool WriteBlock(PGLOBAL g, PVCTCOL colp); + bool ReadBlock(PGLOBAL g, PVCTCOL colp) override; + bool WriteBlock(PGLOBAL g, PVCTCOL colp) override; protected: - virtual bool OpenTempFile(PGLOBAL g); - virtual bool MoveLines(PGLOBAL g); - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL); - virtual int RenameTempFile(PGLOBAL g); + bool OpenTempFile(PGLOBAL g) override; + bool MoveLines(PGLOBAL g) override; + bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL) override; + int RenameTempFile(PGLOBAL g) override; bool OpenColumnFile(PGLOBAL g, PCSZ opmode, int i); // Members @@ -184,16 +184,16 @@ class DllExport VMPFAM : public VCMFAM { VMPFAM(PVMPFAM txfp); // Implementation - virtual PTXF Duplicate(PGLOBAL g) + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) VMPFAM(this);} // Methods - virtual bool AllocateBuffer(PGLOBAL g); + bool AllocateBuffer(PGLOBAL g) override; // Database routines - virtual bool OpenTableFile(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); + bool OpenTableFile(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; protected: bool MapColumnFile(PGLOBAL g, MODE mode, int i); @@ -214,33 +214,33 @@ class BGVFAM : public VCTFAM { BGVFAM(PBGVFAM txfp); // Implementation - virtual PTXF Duplicate(PGLOBAL g) + PTXF Duplicate(PGLOBAL g) override {return (PTXF)new(g) BGVFAM(this);} // Methods - virtual bool AllocateBuffer(PGLOBAL g); + bool AllocateBuffer(PGLOBAL g) override; // Database routines - virtual bool OpenTableFile(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + bool OpenTableFile(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; // Specific functions - virtual bool ReadBlock(PGLOBAL g, PVCTCOL colp); - virtual bool WriteBlock(PGLOBAL g, PVCTCOL colp); + bool ReadBlock(PGLOBAL g, PVCTCOL colp) override; + bool WriteBlock(PGLOBAL g, PVCTCOL colp) override; protected: bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b = false); bool BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req); bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req); - virtual bool MakeEmptyFile(PGLOBAL g, PCSZ fn); - virtual bool OpenTempFile(PGLOBAL g); - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL); - virtual bool CleanUnusedSpace(PGLOBAL g); - virtual bool SetBlockInfo(PGLOBAL g); - virtual int GetBlockInfo(PGLOBAL g); + bool MakeEmptyFile(PGLOBAL g, PCSZ fn) override; + bool OpenTempFile(PGLOBAL g) override; + bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL) override; + bool CleanUnusedSpace(PGLOBAL g) override; + bool SetBlockInfo(PGLOBAL g) override; + int GetBlockInfo(PGLOBAL g) override; // Members HANDLE Hfile; // Handle to big file diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h index 7ff1fb0a543..e46e38d320d 100644 --- a/storage/connect/filamzip.h +++ b/storage/connect/filamzip.h @@ -97,16 +97,16 @@ class DllExport UNZFAM : public MAPFAM { UNZFAM(PUNZFAM txfp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} - virtual PTXF Duplicate(PGLOBAL g) {return (PTXF) new(g) UNZFAM(this);} + AMT GetAmType(void) override {return TYPE_AM_ZIP;} + PTXF Duplicate(PGLOBAL g) override {return (PTXF) new(g) UNZFAM(this);} // Methods - virtual int Cardinality(PGLOBAL g); - virtual int GetFileLength(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetFileLength(PGLOBAL g) override; //virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual bool OpenTableFile(PGLOBAL g); - virtual bool DeferReading(void) { return false; } - virtual int GetNext(PGLOBAL g); + bool OpenTableFile(PGLOBAL g) override; + bool DeferReading(void) override { return false; } + int GetNext(PGLOBAL g) override; //virtual int ReadBuffer(PGLOBAL g); //virtual int WriteBuffer(PGLOBAL g); //virtual int DeleteRecords(PGLOBAL g, int irc); @@ -129,14 +129,14 @@ class DllExport UZXFAM : public MPXFAM { UZXFAM(PUZXFAM txfp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_ZIP; } - virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UZXFAM(this); } + AMT GetAmType(void) override { return TYPE_AM_ZIP; } + PTXF Duplicate(PGLOBAL g) override { return (PTXF) new(g)UZXFAM(this); } // Methods - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual bool OpenTableFile(PGLOBAL g); - virtual int GetNext(PGLOBAL g); + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override; + bool OpenTableFile(PGLOBAL g) override; + int GetNext(PGLOBAL g) override; //virtual int ReadBuffer(PGLOBAL g); protected: @@ -156,14 +156,14 @@ public: UZDFAM(PUZDFAM txfp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_ZIP; } - virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UZDFAM(this); } + AMT GetAmType(void) override { return TYPE_AM_ZIP; } + PTXF Duplicate(PGLOBAL g) override { return (PTXF) new(g)UZDFAM(this); } // Methods - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual bool OpenTableFile(PGLOBAL g); - virtual int GetNext(PGLOBAL g); + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override; + bool OpenTableFile(PGLOBAL g) override; + int GetNext(PGLOBAL g) override; //virtual int ReadBuffer(PGLOBAL g); protected: @@ -184,17 +184,17 @@ class DllExport ZIPFAM : public DOSFAM { ZIPFAM(PDOSDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} + AMT GetAmType(void) override {return TYPE_AM_ZIP;} // Methods - virtual int Cardinality(PGLOBAL g) {return 0;} - virtual int GetFileLength(PGLOBAL g) {return g ? 0 : 1;} + int Cardinality(PGLOBAL g) override {return 0;} + int GetFileLength(PGLOBAL g) override {return g ? 0 : 1;} //virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); + bool OpenTableFile(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; //virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); + void CloseTableFile(PGLOBAL g, bool abort) override; protected: // Members @@ -213,14 +213,14 @@ class DllExport ZPXFAM : public FIXFAM { ZPXFAM(PDOSDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} + AMT GetAmType(void) override {return TYPE_AM_ZIP;} // Methods - virtual int Cardinality(PGLOBAL g) {return 0;} - virtual int GetFileLength(PGLOBAL g) {return g ? 0 : 1;} - virtual bool OpenTableFile(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual void CloseTableFile(PGLOBAL g, bool abort); + int Cardinality(PGLOBAL g) override {return 0;} + int GetFileLength(PGLOBAL g) override {return g ? 0 : 1;} + bool OpenTableFile(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + void CloseTableFile(PGLOBAL g, bool abort) override; protected: // Members diff --git a/storage/connect/filter.h b/storage/connect/filter.h index 0c3fa41046a..8f973b52cd0 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -34,11 +34,11 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ FILTER(PFIL fil1); // Implementation - virtual int GetType(void) {return TYPE_FILTER;} - virtual int GetResultType(void) {return TYPE_INT;} - virtual int GetLength(void) {return 1;} - virtual int GetLengthEx(void) {assert(FALSE); return 0;} - virtual int GetScale() {return 0;}; + int GetType(void) override {return TYPE_FILTER;} + int GetResultType(void) override {return TYPE_INT;} + int GetLength(void) override {return 1;} + int GetLengthEx(void) override {assert(FALSE); return 0;} + int GetScale() override {return 0;}; PFIL GetNext(void) {return Next;} OPVAL GetOpc(void) {return Opc;} int GetOpm(void) {return Opm;} @@ -50,19 +50,19 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ void SetNext(PFIL filp) {Next = filp;} // Methods - virtual void Reset(void); - virtual bool Compare(PXOB) {return FALSE;} // Not used yet - virtual bool Init(PGLOBAL); - virtual bool Eval(PGLOBAL); - virtual bool SetFormat(PGLOBAL, FORMAT&) {return TRUE;} // NUY + void Reset(void) override; + bool Compare(PXOB) override {return FALSE;} // Not used yet + bool Init(PGLOBAL) override; + bool Eval(PGLOBAL) override; + bool SetFormat(PGLOBAL, FORMAT&) override {return TRUE;} // NUY //virtual int CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &xp, int &ag); //virtual int RefNum(PSQL); //virtual PXOB SetSelect(PGLOBAL, PSQL, bool) {return NULL;} // NUY //virtual PXOB CheckSubQuery(PGLOBAL, PSQL); //virtual bool CheckLocal(PTDB); //virtual int CheckSpcCol(PTDB tdbp, int n); - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; // PFIL Linearize(bool nosep); // PFIL Link(PGLOBAL g, PFIL fil2); // PFIL RemoveLastSep(void); @@ -102,7 +102,7 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ class FILTERX : public FILTER { public: // Methods - virtual bool Eval(PGLOBAL) = 0; // just to prevent direct FILTERX use + bool Eval(PGLOBAL) override = 0; // just to prevent direct FILTERX use // Fake operator new used to change a filter into a derived filter void * operator new(size_t, PFIL filp) {return filp;} @@ -123,7 +123,7 @@ class FILTERCMP : public FILTERX { FILTERCMP(PGLOBAL g); // Methods - virtual bool Eval(PGLOBAL); + bool Eval(PGLOBAL) override; }; // end of class FILTEREQ /***********************************************************************/ @@ -132,7 +132,7 @@ class FILTERCMP : public FILTERX { class FILTERAND : public FILTERX { public: // Methods - virtual bool Eval(PGLOBAL); + bool Eval(PGLOBAL) override; }; // end of class FILTERAND /***********************************************************************/ @@ -141,7 +141,7 @@ class FILTERAND : public FILTERX { class FILTEROR : public FILTERX { public: // Methods - virtual bool Eval(PGLOBAL); + bool Eval(PGLOBAL) override; }; // end of class FILTEROR /***********************************************************************/ @@ -150,7 +150,7 @@ class FILTEROR : public FILTERX { class FILTERNOT : public FILTERX { public: // Methods - virtual bool Eval(PGLOBAL); + bool Eval(PGLOBAL) override; }; // end of class FILTERNOT /***********************************************************************/ @@ -159,7 +159,7 @@ class FILTERNOT : public FILTERX { class FILTERIN : public FILTERX { public: // Methods - virtual bool Eval(PGLOBAL); + bool Eval(PGLOBAL) override; }; // end of class FILTERIN /***********************************************************************/ @@ -171,8 +171,8 @@ class FILTERTRUE : public FILTERX { FILTERTRUE(PVAL valp) {Value = valp; Value->SetValue_bool(TRUE);} // Methods - virtual void Reset(void); - virtual bool Eval(PGLOBAL); + void Reset(void) override; + bool Eval(PGLOBAL) override; }; // end of class FILTERTRUE #endif // __FILTER__ diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 71ceb7974ba..3b83e30277f 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -230,7 +230,7 @@ public: The name of the index type that will be used for display. Don't implement this method unless you really have indexes. */ - const char *index_type(uint inx); + const char *index_type(uint inx) override; /** @brief The file extensions. @@ -241,15 +241,15 @@ public: Check if a storage engine supports a particular alter table in-place @note Called without holding thr_lock.c lock. */ - virtual enum_alter_inplace_result + enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *altered_table, - Alter_inplace_info *ha_alter_info); + Alter_inplace_info *ha_alter_info) override; /** @brief This is a list of flags that indicate what functionality the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const; + ulonglong table_flags() const override; /** @brief This is a bitmap of flags that indicates how the storage engine @@ -261,7 +261,7 @@ public: If all_parts is set, MySQL wants to know the flags for the combined index, up to and including 'part'. */ - ulong index_flags(uint inx, uint part, bool all_parts) const; + ulong index_flags(uint inx, uint part, bool all_parts) const override; /** @brief unireg.cc will call max_supported_record_length(), max_supported_keys(), @@ -270,7 +270,7 @@ public: send. Return *real* limits of your storage engine here; MySQL will do min(your_limits, MySQL_limits) automatically. */ - uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } + uint max_supported_record_length() const override { return HA_MAX_REC_LENGTH; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -281,7 +281,7 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_keys() const { return 10; } + uint max_supported_keys() const override { return 10; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -292,7 +292,7 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_key_parts() const { return 10; } + uint max_supported_key_parts() const override { return 10; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -303,17 +303,17 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_key_length() const { return 255; } + uint max_supported_key_length() const override { return 255; } /** @brief Called in test_quick_select to determine if indexes should be used. */ - virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; } + double scan_time() override { return (double) (stats.records+stats.deleted) / 20.0+10; } /** @brief This method will never be called if you do not implement indexes. */ - virtual double read_time(uint, uint, ha_rows rows) + double read_time(uint, uint, ha_rows rows) override { return (double) rows / 20.0+1; } /* @@ -322,7 +322,7 @@ public: Most of these methods are not obligatory, skip them and MySQL will treat them as not implemented */ - virtual bool get_error_message(int error, String *buf); + bool get_error_message(int error, String *buf) override; /** Push condition down to the table handler. @@ -346,27 +346,27 @@ public: Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the condition stack. */ -virtual const COND *cond_push(const COND *cond); +const COND *cond_push(const COND *cond) override; PCFIL CheckCond(PGLOBAL g, PCFIL filp, const Item *cond); const char *GetValStr(OPVAL vop, bool neg); PFIL CondFilter(PGLOBAL g, Item *cond); //PFIL CheckFilter(PGLOBAL g); /** admin commands - called from mysql_admin_table */ -virtual int check(THD* thd, HA_CHECK_OPT* check_opt); +int check(THD* thd, HA_CHECK_OPT* check_opt) override; /** Number of rows in table. It will only be called if (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0 */ - virtual ha_rows records(); + ha_rows records() override; /** Type of table for caching query CONNECT should not use caching because its tables are external data prone to me modified out of MariaDB */ - virtual uint8 table_cache_type(void) + uint8 table_cache_type(void) override { #if defined(MEMORY_TRACE) // Temporary until bug MDEV-4771 is fixed @@ -379,37 +379,37 @@ virtual int check(THD* thd, HA_CHECK_OPT* check_opt); /** @brief We implement this in ha_connect.cc; it's a required method. */ - int open(const char *name, int mode, uint test_if_locked); // required + int open(const char *name, int mode, uint test_if_locked) override; // required /** @brief We implement this in ha_connect.cc; it's a required method. */ - int close(void); // required + int close(void) override; // required /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int write_row(const uchar *buf); + int write_row(const uchar *buf) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int update_row(const uchar *old_data, const uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int delete_row(const uchar *buf); + int delete_row(const uchar *buf) override; // Added to the connect handler - int index_init(uint idx, bool sorted); - int index_end(); + int index_init(uint idx, bool sorted) override; + int index_end() override; int index_read(uchar * buf, const uchar * key, uint key_len, - enum ha_rkey_function find_flag); - int index_next_same(uchar *buf, const uchar *key, uint keylen); + enum ha_rkey_function find_flag) override; + int index_next_same(uchar *buf, const uchar *key, uint keylen) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; @@ -422,25 +422,25 @@ virtual int check(THD* thd, HA_CHECK_OPT* check_opt); We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_next(uchar *buf); + int index_next(uchar *buf) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ -int index_prev(uchar *buf); +int index_prev(uchar *buf) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_first(uchar *buf); + int index_first(uchar *buf) override; /** @brief We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_last(uchar *buf); + int index_last(uchar *buf) override; /* Index condition pushdown implementation */ //Item *idx_cond_push(uint keyno, Item* idx_cond); @@ -453,57 +453,57 @@ int index_prev(uchar *buf); cursor to the start of the table; no need to deallocate and allocate it again. This is a required method. */ - int rnd_init(bool scan); //required - int rnd_end(); - int rnd_next(uchar *buf); ///< required - int rnd_pos(uchar *buf, uchar *pos); ///< required - void position(const uchar *record); ///< required - int info(uint); ///< required - int extra(enum ha_extra_function operation); - int start_stmt(THD *thd, thr_lock_type lock_type); - int external_lock(THD *thd, int lock_type); ///< required - int delete_all_rows(void); + int rnd_init(bool scan) override; //required + int rnd_end() override; + int rnd_next(uchar *buf) override; ///< required + int rnd_pos(uchar *buf, uchar *pos) override; ///< required + void position(const uchar *record) override; ///< required + int info(uint) override; ///< required + int extra(enum ha_extra_function operation) override; + int start_stmt(THD *thd, thr_lock_type lock_type) override; + int external_lock(THD *thd, int lock_type) override; ///< required + int delete_all_rows(void) override; ha_rows records_in_range(uint inx, const key_range *start_key, - const key_range *end_key, page_range *pages); + const key_range *end_key, page_range *pages) override; /** These methods can be overridden, but their default implementation provide useful functionality. */ - int rename_table(const char *from, const char *to); + int rename_table(const char *from, const char *to) override; /** Delete a table in the engine. Called for base as well as temporary tables. */ - int delete_table(const char *name); + int delete_table(const char *name) override; /** Called by delete_table and rename_table */ int delete_or_rename_table(const char *from, const char *to); int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); ///< required + HA_CREATE_INFO *create_info) override; ///< required bool check_if_incompatible_data(HA_CREATE_INFO *info, - uint table_changes); + uint table_changes) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); ///< required - int optimize(THD* thd, HA_CHECK_OPT* check_opt); + enum thr_lock_type lock_type) override; ///< required + int optimize(THD* thd, HA_CHECK_OPT* check_opt) override; /** * Multi Range Read interface */ int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, - uint n_ranges, uint mode, HANDLER_BUFFER *buf); - int multi_range_read_next(range_id_t *range_info); + uint n_ranges, uint mode, HANDLER_BUFFER *buf) override; + int multi_range_read_next(range_id_t *range_info) override; ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, - uint *flags, Cost_estimate *cost); + uint *flags, Cost_estimate *cost) override; ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint *bufsz, - uint *flags, Cost_estimate *cost); - int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); + uint *flags, Cost_estimate *cost) override; + int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) override; - int reset(void) {ds_mrr.dsmrr_close(); return 0;} + int reset(void) override {ds_mrr.dsmrr_close(); return 0;} /* Index condition pushdown implementation */ // Item *idx_cond_push(uint keyno, Item* idx_cond); diff --git a/storage/connect/jdbconn.h b/storage/connect/jdbconn.h index 0c36cccadcf..48734caba93 100644 --- a/storage/connect/jdbconn.h +++ b/storage/connect/jdbconn.h @@ -23,7 +23,7 @@ public: // Constructor JDBConn(PGLOBAL g, PCSZ wrapper); - virtual void AddJars(PSTRG jpop, char sep); + void AddJars(PSTRG jpop, char sep) override; PQRYRES AllocateResult(PGLOBAL g, PTDB tdbp); // Attributes @@ -34,9 +34,9 @@ public: public: // Operations - virtual bool Connect(PJPARM sop); - virtual bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, - PCSZ filter, bool pipe) {return true;} + bool Connect(PJPARM sop) override; + bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, + PCSZ filter, bool pipe) override {return true;} virtual int GetResultSize(PCSZ sql, PCOL colp); virtual int ExecuteCommand(PCSZ sql); virtual int ExecuteQuery(PCSZ sql); diff --git a/storage/connect/jmgfam.h b/storage/connect/jmgfam.h index c5d9d1f57e6..818422edfee 100644 --- a/storage/connect/jmgfam.h +++ b/storage/connect/jmgfam.h @@ -31,35 +31,35 @@ public: JMGFAM(PJMGFAM txfp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_MGO; } - virtual bool GetUseTemp(void) { return false; } - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) { return (PTXF)new(g) JMGFAM(this); } + AMT GetAmType(void) override { return TYPE_AM_MGO; } + bool GetUseTemp(void) override { return false; } + int GetPos(void) override; + int GetNextPos(void) override; + PTXF Duplicate(PGLOBAL g) override { return (PTXF)new(g) JMGFAM(this); } void SetLrecl(int lrecl) { Lrecl = lrecl; } // Methods - virtual void Reset(void); - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g) { return false; } - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); + void Reset(void) override; + int GetFileLength(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override; + int MaxBlkSize(PGLOBAL g, int s) override; + bool AllocateBuffer(PGLOBAL g) override { return false; } + int GetRowID(void) override; + bool RecordPos(PGLOBAL g) override; + bool SetPos(PGLOBAL g, int recpos) override; + int SkipRecord(PGLOBAL g, bool header) override; + bool OpenTableFile(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; + int WriteBuffer(PGLOBAL g) override; + int DeleteRecords(PGLOBAL g, int irc) override; + void CloseTableFile(PGLOBAL g, bool abort) override; + void Rewind(void) override; protected: - virtual bool OpenTempFile(PGLOBAL g) { return false; } - virtual bool MoveIntermediateLines(PGLOBAL g, bool *b) { return false; } - virtual int RenameTempFile(PGLOBAL g) { return RC_OK; } - virtual int InitDelete(PGLOBAL g, int fpos, int spos); + bool OpenTempFile(PGLOBAL g) override { return false; } + bool MoveIntermediateLines(PGLOBAL g, bool *b) override { return false; } + int RenameTempFile(PGLOBAL g) override { return RC_OK; } + int InitDelete(PGLOBAL g, int fpos, int spos) override; bool Init(PGLOBAL g); //bool MakeCursor(PGLOBAL g); diff --git a/storage/connect/jmgoconn.h b/storage/connect/jmgoconn.h index 9fed1907abc..184ff18e0f3 100644 --- a/storage/connect/jmgoconn.h +++ b/storage/connect/jmgoconn.h @@ -61,9 +61,9 @@ public: // Implementation public: - virtual void AddJars(PSTRG jpop, char sep); - virtual bool Connect(PJPARM sop); - virtual bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, PCSZ filter, bool pipe); + void AddJars(PSTRG jpop, char sep) override; + bool Connect(PJPARM sop) override; + bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, PCSZ filter, bool pipe) override; // PQRYRES AllocateResult(PGLOBAL g, TDBEXT *tdbp, int n); // Attributes diff --git a/storage/connect/json.h b/storage/connect/json.h index 53fc5f65e7b..eeca4780baf 100644 --- a/storage/connect/json.h +++ b/storage/connect/json.h @@ -142,14 +142,14 @@ public: JOBJECT(int i) : JSON(i) {} // Methods - virtual void Clear(void) {First = Last = NULL;} + void Clear(void) override {First = Last = NULL;} //virtual JTYP GetValType(void) {return TYPE_JOB;} - virtual PJPR GetFirst(void) {return First;} - virtual int GetSize(bool b); - virtual PJOB GetObject(void) {return this;} - virtual PSZ GetText(PGLOBAL g, PSTRG text); - virtual bool Merge(PGLOBAL g, PJSON jsp); - virtual bool IsNull(void); + PJPR GetFirst(void) override {return First;} + int GetSize(bool b) override; + PJOB GetObject(void) override {return this;} + PSZ GetText(PGLOBAL g, PSTRG text) override; + bool Merge(PGLOBAL g, PJSON jsp) override; + bool IsNull(void) override; // Specific PJPR AddPair(PGLOBAL g, PCSZ key); @@ -174,15 +174,15 @@ class JARRAY : public JSON { JARRAY(int i) : JSON(i) {} // Methods - virtual void Clear(void) {First = Last = NULL; Size = 0;} - virtual int size(void) { return Size; } - virtual PJAR GetArray(void) {return this;} - virtual int GetSize(bool b); - virtual PJVAL GetArrayValue(int i); - virtual PSZ GetText(PGLOBAL g, PSTRG text); - virtual bool Merge(PGLOBAL g, PJSON jsp); - virtual bool DeleteValue(int n); - virtual bool IsNull(void); + void Clear(void) override {First = Last = NULL; Size = 0;} + int size(void) override { return Size; } + PJAR GetArray(void) override {return this;} + int GetSize(bool b) override; + PJVAL GetArrayValue(int i) override; + PSZ GetText(PGLOBAL g, PSTRG text) override; + bool Merge(PGLOBAL g, PJSON jsp) override; + bool DeleteValue(int n) override; + bool IsNull(void) override; // Specific PJVAL AddArrayValue(PGLOBAL g, PJVAL jvp = NULL, int* x = NULL); @@ -221,14 +221,14 @@ public: //using JSON::SetVal; // Methods - virtual void Clear(void); + void Clear(void) override; //virtual JTYP GetType(void) {return TYPE_JVAL;} virtual JTYP GetValType(void); - virtual PJOB GetObject(void); - virtual PJAR GetArray(void); - virtual PJSON GetJsp(void) {return (DataType == TYPE_JSON ? Jsp : NULL);} - virtual PSZ GetText(PGLOBAL g, PSTRG text); - virtual bool IsNull(void); + PJOB GetObject(void) override; + PJAR GetArray(void) override; + PJSON GetJsp(void) override {return (DataType == TYPE_JSON ? Jsp : NULL);} + PSZ GetText(PGLOBAL g, PSTRG text) override; + bool IsNull(void) override; // Specific //inline PVL GetVal(void) { return Val; } @@ -239,7 +239,7 @@ public: long long GetBigint(void); double GetFloat(void); PVAL GetValue(PGLOBAL g); - void SetValue(PJSON jsp); + void SetValue(PJSON jsp) override; void SetValue(PGLOBAL g, PVAL valp); void SetString(PGLOBAL g, PSZ s, int ci = 0); void SetInteger(PGLOBAL g, int n); @@ -288,9 +288,9 @@ class JOUTSTR : public JOUT { public: JOUTSTR(PGLOBAL g); - virtual bool WriteStr(const char* s); - virtual bool WriteChr(const char c); - virtual bool Escape(const char* s); + bool WriteStr(const char* s) override; + bool WriteChr(const char c) override; + bool Escape(const char* s) override; // Member char* Strp; // The serialized string @@ -305,9 +305,9 @@ class JOUTFILE : public JOUT { public: JOUTFILE(PGLOBAL g, FILE* str, int pty) : JOUT(g) { Stream = str; Pretty = pty; } - virtual bool WriteStr(const char* s); - virtual bool WriteChr(const char c); - virtual bool Escape(const char* s); + bool WriteStr(const char* s) override; + bool WriteChr(const char c) override; + bool Escape(const char* s) override; // Member FILE* Stream; @@ -320,8 +320,8 @@ class JOUTPRT : public JOUTFILE { public: JOUTPRT(PGLOBAL g, FILE* str) : JOUTFILE(g, str, 2) { M = 0; B = false; } - virtual bool WriteStr(const char* s); - virtual bool WriteChr(const char c); + bool WriteStr(const char* s) override; + bool WriteChr(const char c) override; // Member int M; diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp index 01b38366d63..d8e8232567b 100644 --- a/storage/connect/libdoc.cpp +++ b/storage/connect/libdoc.cpp @@ -63,23 +63,23 @@ class LIBXMLDOC : public XMLDOCUMENT { LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp); // Properties - virtual short GetDocType(void) {return TYPE_FB_XML2;} - virtual void *GetDocPtr(void) {return Docp;} - virtual void SetNofree(bool b) {Nofreelist = b;} + short GetDocType(void) override {return TYPE_FB_XML2;} + void *GetDocPtr(void) override {return Docp;} + void SetNofree(bool b) override {Nofreelist = b;} // Methods - virtual bool Initialize(PGLOBAL g, PCSZ entry, bool zipped); - virtual bool ParseFile(PGLOBAL g, char *fn); - virtual bool NewDoc(PGLOBAL g, PCSZ ver); - virtual void AddComment(PGLOBAL g, char *com); - virtual PXNODE GetRoot(PGLOBAL g); - virtual PXNODE NewRoot(PGLOBAL g, char *name); - virtual PXNODE NewPnode(PGLOBAL g, char *name); - virtual PXATTR NewPattr(PGLOBAL g); - virtual PXLIST NewPlist(PGLOBAL g); - virtual int DumpDoc(PGLOBAL g, char *ofn); - virtual void CloseDoc(PGLOBAL g, PFBLOCK xp); - virtual PFBLOCK LinkXblock(PGLOBAL g, MODE m, int rc, char *fn); + bool Initialize(PGLOBAL g, PCSZ entry, bool zipped) override; + bool ParseFile(PGLOBAL g, char *fn) override; + bool NewDoc(PGLOBAL g, PCSZ ver) override; + void AddComment(PGLOBAL g, char *com) override; + PXNODE GetRoot(PGLOBAL g) override; + PXNODE NewRoot(PGLOBAL g, char *name) override; + PXNODE NewPnode(PGLOBAL g, char *name) override; + PXATTR NewPattr(PGLOBAL g) override; + PXLIST NewPlist(PGLOBAL g) override; + int DumpDoc(PGLOBAL g, char *ofn) override; + void CloseDoc(PGLOBAL g, PFBLOCK xp) override; + PFBLOCK LinkXblock(PGLOBAL g, MODE m, int rc, char *fn) override; protected: // bool CheckDocument(FILE *of, xmlNodePtr np); @@ -105,23 +105,23 @@ class XML2NODE : public XMLNODE { friend class XML2NODELIST; public: // Properties - virtual char *GetName(PGLOBAL g) {return (char*)Nodep->name;} - virtual int GetType(void); - virtual PXNODE GetNext(PGLOBAL g); - virtual PXNODE GetChild(PGLOBAL g); + char *GetName(PGLOBAL g) override {return (char*)Nodep->name;} + int GetType(void) override; + PXNODE GetNext(PGLOBAL g) override; + PXNODE GetChild(PGLOBAL g) override; // Methods - virtual RCODE GetContent(PGLOBAL g, char *buf, int len); - virtual bool SetContent(PGLOBAL g, char *txtp, int len); - virtual PXNODE Clone(PGLOBAL g, PXNODE np); - virtual PXLIST GetChildElements(PGLOBAL g, char *xp, PXLIST lp); - virtual PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp); - virtual PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np); - virtual PXATTR GetAttribute(PGLOBAL g, char *name, PXATTR ap); - virtual PXNODE AddChildNode(PGLOBAL g, PCSZ name, PXNODE np); - virtual PXATTR AddProperty(PGLOBAL g, char *name, PXATTR ap); - virtual void AddText(PGLOBAL g, PCSZ txtp); - virtual void DeleteChild(PGLOBAL g, PXNODE dnp); + RCODE GetContent(PGLOBAL g, char *buf, int len) override; + bool SetContent(PGLOBAL g, char *txtp, int len) override; + PXNODE Clone(PGLOBAL g, PXNODE np) override; + PXLIST GetChildElements(PGLOBAL g, char *xp, PXLIST lp) override; + PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp) override; + PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np) override; + PXATTR GetAttribute(PGLOBAL g, char *name, PXATTR ap) override; + PXNODE AddChildNode(PGLOBAL g, PCSZ name, PXNODE np) override; + PXATTR AddProperty(PGLOBAL g, char *name, PXATTR ap) override; + void AddText(PGLOBAL g, PCSZ txtp) override; + void DeleteChild(PGLOBAL g, PXNODE dnp) override; protected: // Constructor @@ -141,9 +141,9 @@ class XML2NODELIST : public XMLNODELIST { friend class XML2NODE; public: // Methods - virtual int GetLength(void); - virtual PXNODE GetItem(PGLOBAL g, int n, PXNODE np); - virtual bool DropItem(PGLOBAL g, int n); + int GetLength(void) override; + PXNODE GetItem(PGLOBAL g, int n, PXNODE np) override; + bool DropItem(PGLOBAL g, int n) override; protected: // Constructor @@ -161,12 +161,12 @@ class XML2ATTR : public XMLATTRIBUTE { friend class XML2NODE; public: // Properties - virtual char *GetName(PGLOBAL g) {return (char*)Atrp->name;} - virtual PXATTR GetNext(PGLOBAL g); + char *GetName(PGLOBAL g) override {return (char*)Atrp->name;} + PXATTR GetNext(PGLOBAL g) override; // Methods - virtual RCODE GetText(PGLOBAL g, char *bufp, int len); - virtual bool SetText(PGLOBAL g, char *txtp, int len); + RCODE GetText(PGLOBAL g, char *bufp, int len) override; + bool SetText(PGLOBAL g, char *txtp, int len) override; protected: // Constructor diff --git a/storage/connect/mongo.h b/storage/connect/mongo.h index 7e92a7dc8e9..57652dc534e 100644 --- a/storage/connect/mongo.h +++ b/storage/connect/mongo.h @@ -69,11 +69,11 @@ public: MGODEF(void); // Implementation - virtual const char *GetType(void) { return "MONGO"; } + const char *GetType(void) override { return "MONGO"; } // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h index 147148f4a57..ab93aa051c6 100644 --- a/storage/connect/mycat.h +++ b/storage/connect/mycat.h @@ -101,13 +101,13 @@ class MYCAT : public CATALOG { void SetHandler(PHC hc) {Hc= hc;} // Methods - void Reset(void); + void Reset(void) override; bool StoreIndex(PGLOBAL, PTABDEF) {return false;} // Temporary PTABDEF GetTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR type, PRELDEF *prp = NULL); PTDB GetTable(PGLOBAL g, PTABLE tablep, - MODE mode = MODE_READ, LPCSTR type = NULL); - void ClearDB(PGLOBAL g); + MODE mode = MODE_READ, LPCSTR type = NULL) override; + void ClearDB(PGLOBAL g) override; protected: PTABDEF MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am); diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h index 1b81ae9e3b3..64f3a5e0022 100644 --- a/storage/connect/reldef.h +++ b/storage/connect/reldef.h @@ -91,20 +91,20 @@ public: RECFM GetTableFormat(const char* type); bool SepIndex(void) {return GetBoolCatInfo("SepIndex", false);} bool IsReadOnly(void) {return Read_Only;} - virtual AMT GetDefType(void) {return TYPE_AM_TAB;} + AMT GetDefType(void) override {return TYPE_AM_TAB;} virtual PIXDEF GetIndx(void) {return NULL;} virtual void SetIndx(PIXDEF) {} virtual bool IsHuge(void) {return false;} const CHARSET_INFO *data_charset() {return m_data_charset;} - const char *GetCsName(void) {return csname;} + const char *GetCsName(void) {return csname;} // Methods - int GetColCatInfo(PGLOBAL g); - void SetIndexInfo(void); - bool DropTable(PGLOBAL g, PSZ name); - virtual bool Define(PGLOBAL g, PCATLG cat, - LPCSTR name, LPCSTR schema, LPCSTR am); - virtual bool DefineAM(PGLOBAL, LPCSTR, int) = 0; + int GetColCatInfo(PGLOBAL g); + void SetIndexInfo(void); + bool DropTable(PGLOBAL g, PSZ name); + bool Define(PGLOBAL g, PCATLG cat, + LPCSTR name, LPCSTR schema, LPCSTR am) override; + virtual bool DefineAM(PGLOBAL, LPCSTR, int) = 0; protected: // Members @@ -135,12 +135,12 @@ class DllExport OEMDEF : public TABDEF { /* OEM table */ OEMDEF(void) {Hdll = NULL; Pxdef = NULL; Module = Subtype = NULL;} // Implementation - virtual const char *GetType(void) {return "OEM";} - virtual AMT GetDefType(void) {return TYPE_AM_OEM;} + const char *GetType(void) override {return "OEM";} + AMT GetDefType(void) override {return TYPE_AM_OEM;} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; protected: PTABDEF GetXdef(PGLOBAL g); diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index 9d5a8b7daf5..3694d05a199 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -71,11 +71,11 @@ public: BSONDEF(void); // Implementation - virtual const char* GetType(void) { return "BSON"; } + const char* GetType(void) override { return "BSON"; } // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -170,30 +170,30 @@ public: TDBBSN(TDBBSN* tdbp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_JSN; } - virtual bool SkipHeader(PGLOBAL g); - virtual PTDB Duplicate(PGLOBAL g) { return (PTDB)new(g) TDBBSN(this); } + AMT GetAmType(void) override { return TYPE_AM_JSN; } + bool SkipHeader(PGLOBAL g) override; + PTDB Duplicate(PGLOBAL g) override { return (PTDB)new(g) TDBBSN(this); } PBVAL GetRow(void) { return Row; } // Methods - virtual PTDB Clone(PTABS t); - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual PCOL InsertSpecialColumn(PCOL colp); - virtual int RowNumber(PGLOBAL g, bool b = FALSE) {return (b) ? M : N;} - virtual bool CanBeFiltered(void) + PTDB Clone(PTABS t) override; + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + PCOL InsertSpecialColumn(PCOL colp) override; + int RowNumber(PGLOBAL g, bool b = FALSE) override {return (b) ? M : N;} + bool CanBeFiltered(void) override {return Txfp->GetAmType() == TYPE_AM_MGO || !Xcol;} // Database routines - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual bool PrepareWriting(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual void CloseDB(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + bool PrepareWriting(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + void CloseDB(PGLOBAL g) override; // Specific routine - virtual int EstimatedLength(void); + int EstimatedLength(void) override; protected: PBVAL FindRow(PGLOBAL g); @@ -242,15 +242,15 @@ public: BSONCOL(BSONCOL* colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) { return Tbp->GetAmType(); } - virtual bool Stringify(void) { return Sgfy; } + int GetAmType(void) override { return Tbp->GetAmType(); } + bool Stringify(void) override { return Sgfy; } // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; bool ParseJpath(PGLOBAL g); - virtual PSZ GetJpath(PGLOBAL g, bool proj); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + PSZ GetJpath(PGLOBAL g, bool proj) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: bool CheckExpand(PGLOBAL g, int i, PSZ nm, bool b); @@ -288,30 +288,30 @@ public: TDBBSON(PBTDB tdbp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_JSON; } - virtual PTDB Duplicate(PGLOBAL g) { return (PTDB)new(g) TDBBSON(this); } + AMT GetAmType(void) override { return TYPE_AM_JSON; } + PTDB Duplicate(PGLOBAL g) override { return (PTDB)new(g) TDBBSON(this); } PBVAL GetDoc(void) { return Docp; } // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; // Database routines - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual void ResetSize(void); - virtual int GetProgCur(void) { return N; } - virtual int GetRecpos(void); - virtual bool SetRecpos(PGLOBAL g, int recpos); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual bool PrepareWriting(PGLOBAL g) { return false; } - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + void ResetSize(void) override; + int GetProgCur(void) override { return N; } + int GetRecpos(void) override; + bool SetRecpos(PGLOBAL g, int recpos) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + bool PrepareWriting(PGLOBAL g) override { return false; } + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; int MakeDocument(PGLOBAL g); // Optimization routines - virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add); + int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) override; protected: int MakeNewDoc(PGLOBAL g); @@ -335,7 +335,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabcmg.h b/storage/connect/tabcmg.h index 9effe714fdd..a40c0c9e24a 100644 --- a/storage/connect/tabcmg.h +++ b/storage/connect/tabcmg.h @@ -17,9 +17,9 @@ public: CMGDISC(PGLOBAL g, int *lg) : MGODISC(g, lg) { drv = "C"; } // Methods - virtual void GetDoc(void); -//virtual bool Find(PGLOBAL g, int i, int k, bool b); - virtual bool Find(PGLOBAL g); + void GetDoc(void) override; +//bool Find(PGLOBAL g, int i, int k, bool b) override; + bool Find(PGLOBAL g) override; // BSON Function //bool FindInDoc(PGLOBAL g, bson_iter_t *iter, const bson_t *doc, @@ -49,24 +49,24 @@ public: TDBCMG(TDBCMG *tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_MGO;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBCMG(this);} + AMT GetAmType(void) override {return TYPE_AM_MGO;} + PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBCMG(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual PCOL InsertSpecialColumn(PCOL colp); - virtual int RowNumber(PGLOBAL g, bool b = FALSE) {return N;} + PTDB Clone(PTABS t) override; + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + PCOL InsertSpecialColumn(PCOL colp) override; + int RowNumber(PGLOBAL g, bool b = FALSE) override {return N;} // Database routines - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) override; protected: bool Init(PGLOBAL g); @@ -96,13 +96,13 @@ public: MGOCOL(MGOCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) { return Tmgp->GetAmType(); } - virtual bool Stringify(void) { return Sgfy; } + int GetAmType(void) override { return Tmgp->GetAmType(); } + bool Stringify(void) override { return Sgfy; } // Methods - virtual PSZ GetJpath(PGLOBAL g, bool proj); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + PSZ GetJpath(PGLOBAL g, bool proj) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -124,7 +124,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabcol.h b/storage/connect/tabcol.h index e4657e2f261..973749c18c3 100644 --- a/storage/connect/tabcol.h +++ b/storage/connect/tabcol.h @@ -38,8 +38,8 @@ class DllExport XTAB: public BLOCK { // Table Name-Schema-Srcdef block. // Methods PTABLE Link(PTABLE); - void Printf(PGLOBAL g, FILE *f, uint n); - void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; protected: // Members @@ -64,11 +64,11 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block. COLUMN(LPCSTR name); // Implementation - virtual int GetType(void) {return TYPE_COLUMN;} - virtual int GetResultType(void) {assert(false); return TYPE_VOID;} - virtual int GetLength(void) {assert(false); return 0;} - virtual int GetLengthEx(void) {assert(false); return 0;} - virtual int GetScale() {assert(false); return 0;}; + int GetType(void) override {return TYPE_COLUMN;} + int GetResultType(void) override {assert(false); return TYPE_VOID;} + int GetLength(void) override {assert(false); return 0;} + int GetLengthEx(void) override {assert(false); return 0;} + int GetScale() override {assert(false); return 0;}; LPCSTR GetName(void) {return Name;} LPCSTR GetQualifier(void) {return Qualifier;} PTABLE GetTo_Table(void) {return To_Table;} @@ -78,13 +78,13 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block. void SetTo_Col(PCOL colp) {To_Col = colp;} // Methods - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; // All methods below should never be used for COLUMN's - virtual void Reset(void) {assert(false);} - virtual bool Compare(PXOB) {assert(false); return false;} - virtual bool SetFormat(PGLOBAL, FORMAT&); - virtual bool Eval(PGLOBAL) {assert(false); return true;} + void Reset(void) override {assert(false);} + bool Compare(PXOB) override {assert(false); return false;} + bool SetFormat(PGLOBAL, FORMAT&) override; + bool Eval(PGLOBAL) override {assert(false); return true;} private: // Members diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 22bb5c63ce3..346aad2dba5 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -36,11 +36,11 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ DOSDEF(void); // Implementation - virtual AMT GetDefType(void) {return TYPE_AM_DOS;} - virtual const char *GetType(void) {return "DOS";} - virtual PIXDEF GetIndx(void) {return To_Indx;} - virtual void SetIndx(PIXDEF xdp) {To_Indx = xdp;} - virtual bool IsHuge(void) {return Huge;} + AMT GetDefType(void) override {return TYPE_AM_DOS;} + const char *GetType(void) override {return "DOS";} + PIXDEF GetIndx(void) override {return To_Indx;} + void SetIndx(PIXDEF xdp) override {To_Indx = xdp;} + bool IsHuge(void) override {return Huge;} PCSZ GetFn(void) {return Fn;} PCSZ GetOfn(void) {return Ofn;} PCSZ GetEntry(void) {return Entry;} @@ -63,11 +63,11 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ int *GetTo_Pos(void) {return To_Pos;} // Methods - virtual int Indexable(void) + int Indexable(void) override {return (!Multiple && !Mulentries && Compressed != 1) ? 1 : 0;} virtual bool DeleteIndexFile(PGLOBAL g, PIXDEF pxdf); - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; bool InvalidateIndex(PGLOBAL g); bool GetOptFileName(PGLOBAL g, char *filename); void RemoveOptValues(PGLOBAL g); @@ -133,62 +133,62 @@ class DllExport TDBDOS : public TDBASE { inline PXOB *GetLink(void) {return To_Link;} // Implementation - virtual AMT GetAmType(void) {return Txfp->GetAmType();} - virtual PCSZ GetFile(PGLOBAL) {return Txfp->To_File;} - virtual void SetFile(PGLOBAL, PCSZ fn) {Txfp->To_File = fn;} - virtual void SetAbort(bool b) {Abort = b;} - virtual RECFM GetFtype(void) {return Ftype;} + AMT GetAmType(void) override {return Txfp->GetAmType();} + PCSZ GetFile(PGLOBAL) override {return Txfp->To_File;} + void SetFile(PGLOBAL, PCSZ fn) override {Txfp->To_File = fn;} + void SetAbort(bool b) override {Abort = b;} + RECFM GetFtype(void) override {return Ftype;} virtual bool SkipHeader(PGLOBAL) {return false;} - virtual void RestoreNrec(void) {Txfp->SetNrec(1);} - virtual PTDB Duplicate(PGLOBAL g) + void RestoreNrec(void) override {Txfp->SetNrec(1);} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBDOS(g, this);} // Methods - virtual PTDB Clone(PTABS t); - virtual void ResetDB(void) {Txfp->Reset();} - virtual bool IsUsingTemp(PGLOBAL g); - virtual bool IsIndexed(void) {return Indxd;} - virtual void ResetSize(void) {MaxSize = Cardinal = -1;} - virtual int ResetTableOpt(PGLOBAL g, bool dop, bool dox); + PTDB Clone(PTABS t) override; + void ResetDB(void) override {Txfp->Reset();} + bool IsUsingTemp(PGLOBAL g) override; + bool IsIndexed(void) override {return Indxd;} + void ResetSize(void) override {MaxSize = Cardinal = -1;} + int ResetTableOpt(PGLOBAL g, bool dop, bool dox) override; virtual int MakeBlockValues(PGLOBAL g); virtual bool SaveBlockValues(PGLOBAL g); - virtual bool GetBlockValues(PGLOBAL g); + bool GetBlockValues(PGLOBAL g) override; virtual PBF InitBlockFilter(PGLOBAL g, PFIL filp); //virtual PBX InitBlockIndex(PGLOBAL g); virtual int TestBlock(PGLOBAL g); - virtual void PrintAM(FILE *f, char *m); + void PrintAM(FILE *f, char *m) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; virtual char *GetOpenMode(PGLOBAL, char*) {return NULL;} virtual int GetFileLength(PGLOBAL g) {return Txfp->GetFileLength(g);} - virtual int GetProgMax(PGLOBAL g); - virtual int GetProgCur(void); + int GetProgMax(PGLOBAL g) override; + int GetProgCur(void) override; //virtual int GetAffectedRows(void) {return Txfp->GetDelRows();} - virtual int GetRecpos(void) {return Txfp->GetPos();} - virtual bool SetRecpos(PGLOBAL g, int recpos) + int GetRecpos(void) override {return Txfp->GetPos();} + bool SetRecpos(PGLOBAL g, int recpos) override {return Txfp->SetPos(g, recpos);} - virtual int RowNumber(PGLOBAL g, bool b = false); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + int RowNumber(PGLOBAL g, bool b = false) override; + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; virtual int ReadBuffer(PGLOBAL g) {return Txfp->ReadBuffer(g);} // Specific routine virtual int EstimatedLength(void); // Optimization routines - virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add); + int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) override; bool InitialyzeIndex(PGLOBAL g, PIXDEF xdp, bool sorted); void ResetBlockFilter(PGLOBAL g); bool GetDistinctColumnValues(PGLOBAL g, int nrec); protected: - virtual bool PrepareWriting(PGLOBAL g); + bool PrepareWriting(PGLOBAL g) override; PBF CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv); // Members @@ -219,10 +219,10 @@ class DllExport DOSCOL : public COLBLK { DOSCOL(DOSCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_DOS;} - virtual void SetTo_Val(PVAL valp) {To_Val = valp;} - virtual int GetClustered(void) {return Clustered;} - virtual int IsClustered(void) {return (Clustered && + int GetAmType(void) override {return TYPE_AM_DOS;} + void SetTo_Val(PVAL valp) override {To_Val = valp;} + int GetClustered(void) override {return Clustered;} + int IsClustered(void) override {return (Clustered && ((PDOSDEF)(((PTDBDOS)To_Tdb)->To_Def))->IsOptimized());} virtual int IsSorted(void) {return Sorted;} virtual PVBLK GetMin(void) {return Min;} @@ -233,10 +233,10 @@ class DllExport DOSCOL : public COLBLK { virtual PVBLK GetDval(void) {return Dval;} // Methods - virtual bool VarSize(void); - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + bool VarSize(void) override; + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: virtual bool SetMinMax(PGLOBAL g); diff --git a/storage/connect/tabext.h b/storage/connect/tabext.h index 8a0d6c784a5..01af43c5a4d 100644 --- a/storage/connect/tabext.h +++ b/storage/connect/tabext.h @@ -59,7 +59,7 @@ public: EXTDEF(void); // Constructor // Implementation - virtual const char *GetType(void) { return "EXT"; } + const char *GetType(void) override { return "EXT"; } inline PCSZ GetTabname(void) { return Tabname; } inline PCSZ GetTabschema(void) { return Tabschema; } inline PCSZ GetUsername(void) { return Username; }; @@ -72,8 +72,8 @@ public: inline int GetOptions(void) { return Options; } // Methods - virtual int Indexable(void) { return 2; } - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); + int Indexable(void) override { return 2; } + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; protected: // Members @@ -115,15 +115,15 @@ public: // Implementation // Properties - virtual bool IsRemote(void) { return true; } + bool IsRemote(void) override { return true; } // Methods - virtual PCSZ GetServer(void) { return "Remote"; } - virtual int GetRecpos(void); + PCSZ GetServer(void) override { return "Remote"; } + int GetRecpos(void) override; // Database routines - virtual int GetMaxSize(PGLOBAL g); - virtual int GetProgMax(PGLOBAL g); + int GetMaxSize(PGLOBAL g) override; + int GetProgMax(PGLOBAL g) override; protected: // Internal functions @@ -185,9 +185,9 @@ public: inline void SetCrp(PCOLRES crp) { Crp = crp; } // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL) = 0; - virtual void WriteColumn(PGLOBAL) = 0; + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void ReadColumn(PGLOBAL) override = 0; + void WriteColumn(PGLOBAL) override = 0; protected: // Constructor for count(*) column diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h index 1a0d756bfcf..7f3bb929b50 100644 --- a/storage/connect/tabfix.h +++ b/storage/connect/tabfix.h @@ -28,30 +28,30 @@ class DllExport TDBFIX : public TDBDOS { TDBFIX(PGLOBAL g, PTDBFIX tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_FIX;} - virtual void RestoreNrec(void); - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_FIX;} + void RestoreNrec(void) override; + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBFIX(g, this);} // Methods - virtual PTDB Clone(PTABS t); - virtual void ResetDB(void); - virtual bool IsUsingTemp(PGLOBAL g); - virtual int RowNumber(PGLOBAL g, bool b = false); - virtual int ResetTableOpt(PGLOBAL g, bool dop, bool dox); - virtual void ResetSize(void); - virtual int GetBadLines(void) {return Txfp->GetNerr();} + PTDB Clone(PTABS t) override; + void ResetDB(void) override; + bool IsUsingTemp(PGLOBAL g) override; + int RowNumber(PGLOBAL g, bool b = false) override; + int ResetTableOpt(PGLOBAL g, bool dop, bool dox) override; + void ResetSize(void) override; + int GetBadLines(void) override {return Txfp->GetNerr();} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int GetProgMax(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int GetProgMax(PGLOBAL g) override; + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; protected: - virtual bool PrepareWriting(PGLOBAL g) {return false;} + bool PrepareWriting(PGLOBAL g) override {return false;} // Members char Teds; /* Binary table default endian setting */ @@ -69,14 +69,14 @@ class DllExport BINCOL : public DOSCOL { BINCOL(BINCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_BIN;} + int GetAmType(void) override {return TYPE_AM_BIN;} int GetDeplac(void) {return Deplac;} int GetFileSize(void) {return N ? N : GetTypeSize(Buf_Type, Long);} // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; // Static static void SetEndian(void); @@ -105,7 +105,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g) + PQRYRES GetResult(PGLOBAL g) override {return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, Topt, false);} // Members diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index 268d00b1724..e71ca998ae7 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -27,13 +27,13 @@ public: CSVDEF(void); // Implementation - virtual const char *GetType(void) {return "CSV";} + const char *GetType(void) override {return "CSV";} char GetSep(void) {return Sep;} char GetQot(void) {return Qot;} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; protected: // Members @@ -60,29 +60,29 @@ public: TDBCSV(PGLOBAL g, PTDBCSV tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_CSV;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_CSV;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBCSV(g, this);} // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; //virtual bool IsUsingTemp(PGLOBAL g); - virtual int GetBadLines(void) {return (int)Nerr;} + int GetBadLines(void) override {return (int)Nerr;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual bool OpenDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int CheckWrite(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); // Physical file read + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + bool OpenDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int CheckWrite(PGLOBAL g) override; + int ReadBuffer(PGLOBAL g) override; // Physical file read // Specific routines - virtual int EstimatedLength(void); - virtual bool SkipHeader(PGLOBAL g); + int EstimatedLength(void) override; + bool SkipHeader(PGLOBAL g) override; virtual bool CheckErr(void); protected: - virtual bool PrepareWriting(PGLOBAL g); + bool PrepareWriting(PGLOBAL g) override; // Members PSZ *Field; // Field to write to current line @@ -112,12 +112,12 @@ class DllExport CSVCOL : public DOSCOL { CSVCOL(CSVCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType() {return TYPE_AM_CSV;} + int GetAmType() override {return TYPE_AM_CSV;} // Methods - virtual bool VarSize(void); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + bool VarSize(void) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -143,26 +143,26 @@ class DllExport TDBFMT : public TDBCSV { TDBFMT(PGLOBAL g, PTDBFMT tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_FMT;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_FMT;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBFMT(g, this);} // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); -//virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; +//int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; //virtual int CheckWrite(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); // Physical file read + int ReadBuffer(PGLOBAL g) override; // Physical file read // Specific routines - virtual int EstimatedLength(void); + int EstimatedLength(void) override; protected: - virtual bool PrepareWriting(PGLOBAL g) + bool PrepareWriting(PGLOBAL g) override {snprintf(g->Message, sizeof(g->Message), MSG(TABLE_READ_ONLY), "FMT"); return true;} // Members @@ -182,7 +182,7 @@ class DllExport TDBCCL : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabjdbc.h b/storage/connect/tabjdbc.h index 078129a14e3..8e90ada9a7f 100644 --- a/storage/connect/tabjdbc.h +++ b/storage/connect/tabjdbc.h @@ -29,11 +29,11 @@ public: JDBCDEF(void); // Implementation - virtual const char *GetType(void) { return "JDBC"; } + const char *GetType(void) override { return "JDBC"; } // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; int ParseURL(PGLOBAL g, char *url, bool b = true); bool SetParms(PJPARM sjp); @@ -60,25 +60,25 @@ public: TDBJDBC(PTDBJDBC tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_JDBC;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJDBC(this);} + AMT GetAmType(void) override {return TYPE_AM_JDBC;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBJDBC(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual bool SetRecpos(PGLOBAL g, int recpos); - virtual void ResetSize(void); - virtual PCSZ GetServer(void) { return "JDBC"; } + PTDB Clone(PTABS t) override; + bool SetRecpos(PGLOBAL g, int recpos) override; + void ResetSize(void) override; + PCSZ GetServer(void) override { return "JDBC"; } virtual int Indexable(void) { return 2; } // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) override; protected: // Internal functions @@ -108,12 +108,12 @@ public: JDBCCOL(JDBCCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) { return TYPE_AM_JDBC; } + int GetAmType(void) override { return TYPE_AM_JDBC; } // Methods //virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Constructor for count(*) column @@ -135,19 +135,19 @@ public: TDBXJDC(PJDBCDEF tdp = NULL); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_XDBC;} + AMT GetAmType(void) override {return TYPE_AM_XDBC;} // Methods // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; //virtual int GetProgMax(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - //virtual void CloseDB(PGLOBAL g); + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + //void CloseDB(PGLOBAL g) override; protected: // Internal functions @@ -170,11 +170,11 @@ public: JSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "JDBC"); // Implementation - virtual int GetAmType(void) {return TYPE_AM_JDBC;} + int GetAmType(void) override {return TYPE_AM_JDBC;} // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Members @@ -192,7 +192,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members int Maxres; // Returned lines limit @@ -208,7 +208,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members PCSZ Schema; // Points to schema name or NULL @@ -227,7 +227,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members PCSZ Colpat; // Points to catalog column pattern diff --git a/storage/connect/tabjmg.h b/storage/connect/tabjmg.h index 06c1462d103..6036e73c69f 100644 --- a/storage/connect/tabjmg.h +++ b/storage/connect/tabjmg.h @@ -18,9 +18,9 @@ public: JMGDISC(PGLOBAL g, int *lg); // Methods - virtual bool Init(PGLOBAL g); - virtual void GetDoc(void) {} - virtual bool Find(PGLOBAL g); + bool Init(PGLOBAL g) override; + void GetDoc(void) override {} + bool Find(PGLOBAL g) override; protected: // Function @@ -51,25 +51,25 @@ public: TDBJMG(TDBJMG *tdbp); // Implementation - virtual AMT GetAmType(void) { return TYPE_AM_MGO; } - virtual PTDB Duplicate(PGLOBAL g) { return (PTDB)new(g) TDBJMG(this); } + AMT GetAmType(void) override { return TYPE_AM_MGO; } + PTDB Duplicate(PGLOBAL g) override { return (PTDB)new(g) TDBJMG(this); } // Methods - virtual PTDB Clone(PTABS t); - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual PCOL InsertSpecialColumn(PCOL colp); + PTDB Clone(PTABS t) override; + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + PCOL InsertSpecialColumn(PCOL colp) override; //virtual void SetFilter(PFIL fp); - virtual int RowNumber(PGLOBAL g, bool b = FALSE) { return N; } + int RowNumber(PGLOBAL g, bool b = FALSE) override { return N; } // Database routines - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) override; protected: bool Init(PGLOBAL g); @@ -106,14 +106,14 @@ public: JMGCOL(JMGCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return Tmgp->GetAmType();} - virtual bool Stringify(void) { return Sgfy; } + int GetAmType(void) override {return Tmgp->GetAmType();} + bool Stringify(void) override { return Sgfy; } // Methods //virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual PSZ GetJpath(PGLOBAL g, bool proj); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + PSZ GetJpath(PGLOBAL g, bool proj) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; //bool AddValue(PGLOBAL g, bson_t *doc, char *key, bool upd); protected: @@ -138,7 +138,7 @@ public: protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index dcf40620dae..c3328261195 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -93,11 +93,11 @@ public: JSONDEF(void); // Implementation - virtual const char *GetType(void) {return "JSON";} + const char *GetType(void) override {return "JSON";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -141,32 +141,32 @@ public: TDBJSN(TDBJSN *tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_JSN;} - virtual bool SkipHeader(PGLOBAL g); - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSN(this);} + AMT GetAmType(void) override {return TYPE_AM_JSN;} + bool SkipHeader(PGLOBAL g) override; + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBJSN(this);} PJSON GetRow(void) {return Row;} void SetG(PGLOBAL g) {G = g;} // Methods - virtual PTDB Clone(PTABS t); - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual PCOL InsertSpecialColumn(PCOL colp); - virtual int RowNumber(PGLOBAL g, bool b = FALSE) + PTDB Clone(PTABS t) override; + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + PCOL InsertSpecialColumn(PCOL colp) override; + int RowNumber(PGLOBAL g, bool b = FALSE) override {return (b) ? M : N;} - virtual bool CanBeFiltered(void) + bool CanBeFiltered(void) override {return Txfp->GetAmType() == TYPE_AM_MGO || !Xcol;} // Database routines - //virtual int Cardinality(PGLOBAL g); - //virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual bool PrepareWriting(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual void CloseDB(PGLOBAL g); + //int Cardinality(PGLOBAL g) override; + //int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + bool PrepareWriting(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + void CloseDB(PGLOBAL g) override; // Specific routine - virtual int EstimatedLength(void); + int EstimatedLength(void) override; protected: PJSON FindRow(PGLOBAL g); @@ -216,15 +216,15 @@ public: JSONCOL(JSONCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return Tjp->GetAmType();} - virtual bool Stringify(void) { return Sgfy; } + int GetAmType(void) override {return Tjp->GetAmType();} + bool Stringify(void) override { return Sgfy; } // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; bool ParseJpath(PGLOBAL g); - virtual PSZ GetJpath(PGLOBAL g, bool proj); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + PSZ GetJpath(PGLOBAL g, bool proj) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: bool CheckExpand(PGLOBAL g, int i, PSZ nm, bool b); @@ -269,30 +269,30 @@ class DllExport TDBJSON : public TDBJSN { TDBJSON(PJTDB tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_JSON;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSON(this);} + AMT GetAmType(void) override {return TYPE_AM_JSON;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBJSON(this);} PJAR GetDoc(void) {return Doc;} // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; // Database routines - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual void ResetSize(void); - virtual int GetProgCur(void) {return N;} - virtual int GetRecpos(void); - virtual bool SetRecpos(PGLOBAL g, int recpos); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual bool PrepareWriting(PGLOBAL g) {return false;} - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + void ResetSize(void) override; + int GetProgCur(void) override {return N;} + int GetRecpos(void) override; + bool SetRecpos(PGLOBAL g, int recpos) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + bool PrepareWriting(PGLOBAL g) override {return false;} + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; int MakeDocument(PGLOBAL g); // Optimization routines - virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add); + int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) override; protected: int MakeNewDoc(PGLOBAL g); @@ -314,7 +314,7 @@ class DllExport TDBJCL : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabmac.h b/storage/connect/tabmac.h index 68135edb95f..8ff8fad47bb 100644 --- a/storage/connect/tabmac.h +++ b/storage/connect/tabmac.h @@ -48,23 +48,23 @@ class TDBMAC : public TDBASE { //TDBMAC(PGLOBAL g, PTDBMAC tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_MAC;} -//virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMAC(g, this);} + AMT GetAmType(void) override {return TYPE_AM_MAC;} +// PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBMAC(g, this);} // Methods -//virtual PTDB Clone(PTABS t); +//PTDB Clone(PTABS t) override; virtual int GetRecpos(void) {return N;} - virtual int RowNumber(PGLOBAL g, bool b = false) {return N;} + int RowNumber(PGLOBAL g, bool b = false) override {return N;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g) {return GetMaxSize(g);} - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g) {} + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override {return GetMaxSize(g);} + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override {} protected: // Specific routines @@ -94,10 +94,10 @@ class MACCOL : public COLBLK { //MACCOL(MACCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_MAC;} + int GetAmType(void) override {return TYPE_AM_MAC;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: MACCOL(void) {} // Default constructor not to be used diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h index a01e4e7fdf2..e1c42b46658 100644 --- a/storage/connect/tabmul.h +++ b/storage/connect/tabmul.h @@ -32,31 +32,31 @@ class DllExport TDBMUL : public TDBASE { TDBMUL(PTDBMUL tdbp); // Implementation - virtual AMT GetAmType(void) {return Tdbp->GetAmType();} - virtual PTDB Duplicate(PGLOBAL g); + AMT GetAmType(void) override {return Tdbp->GetAmType();} + PTDB Duplicate(PGLOBAL g) override; // Methods - virtual void ResetDB(void); - virtual PTDB Clone(PTABS t); - virtual bool IsSame(PTDB tp) {return tp == (PTDB)Tdbp;} - virtual PCSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);} - virtual int GetRecpos(void) {return 0;} - virtual PCOL ColDB(PGLOBAL g, PSZ name, int num); + void ResetDB(void) override; + PTDB Clone(PTABS t) override; + bool IsSame(PTDB tp) override {return tp == (PTDB)Tdbp;} + PCSZ GetFile(PGLOBAL g) override {return Tdbp->GetFile(g);} + int GetRecpos(void) override {return 0;} + PCOL ColDB(PGLOBAL g, PSZ name, int num) override; bool InitFileNames(PGLOBAL g); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override {strcpy(g->Message, MSG(MUL_MAKECOL_ERR)); return NULL;} - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual int GetProgMax(PGLOBAL g); - virtual int GetProgCur(void); - virtual int RowNumber(PGLOBAL g, bool b = false); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + int GetProgMax(PGLOBAL g) override; + int GetProgCur(void) override; + int RowNumber(PGLOBAL g, bool b = false) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: @@ -83,10 +83,10 @@ public: TDBMSD(PTDBMSD tdbp) : TDBMUL(tdbp) {} // Implementation - virtual PTDB Duplicate(PGLOBAL g); + PTDB Duplicate(PGLOBAL g); // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; bool InitFileNames(PGLOBAL g); // Database routines @@ -108,11 +108,11 @@ class DllExport DIRDEF : public TABDEF { /* Directory listing table */ DIRDEF(void) {Fn = NULL; Incl = false; Huge = false;} // Implementation - virtual const char *GetType(void) {return "DIR";} + const char *GetType(void) override {return "DIR";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -137,21 +137,21 @@ public: TDBDIR(PSZ fpat); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_DIR;} + AMT GetAmType(void) override {return TYPE_AM_DIR;} // Methods - virtual int GetRecpos(void) {return iFile;} + int GetRecpos(void) override {return iFile;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int GetMaxSize(PGLOBAL g); - virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);} - virtual int GetProgCur(void) {return iFile;} - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int GetMaxSize(PGLOBAL g) override; + int GetProgMax(PGLOBAL g) override {return GetMaxSize(g);} + int GetProgCur(void) override {return iFile;} + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: void Init(void); @@ -195,11 +195,11 @@ class TDBSDR : public TDBDIR { TDBSDR(PSZ fpat) : TDBDIR(fpat) {Sub = NULL;} // Database routines - virtual int GetMaxSize(PGLOBAL g); - virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);} - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); -//virtual void CloseDB(PGLOBAL g); + int GetMaxSize(PGLOBAL g) override; + int GetProgMax(PGLOBAL g) override {return GetMaxSize(g);} + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; +//void CloseDB(PGLOBAL g) override; protected: int FindInDir(PGLOBAL g); @@ -230,10 +230,10 @@ class DIRCOL : public COLBLK { DIRCOL(DIRCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_DIR;} + int GetAmType(void) override {return TYPE_AM_DIR;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index b5af77de50b..7f77eeabcbb 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -28,7 +28,7 @@ class MYSQLDEF : public EXTDEF {/* Logical table description */ MYSQLDEF(void); // Implementation - virtual const char *GetType(void) {return "MYSQL";} + const char *GetType(void) override {return "MYSQL";} inline PSZ GetHostname(void) {return Hostname;}; //inline PSZ GetDatabase(void) {return Tabschema;}; //inline PSZ GetTabname(void) {return Tabname;} @@ -39,8 +39,8 @@ class MYSQLDEF : public EXTDEF {/* Logical table description */ // Methods //virtual int Indexable(void) {return 2;} - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; bool ParseURL(PGLOBAL g, char *url, bool b = true); bool GetServerInfo(PGLOBAL g, const char *server_name); @@ -77,30 +77,30 @@ class TDBMYSQL : public TDBEXT { TDBMYSQL(PTDBMY tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_MYSQL;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(this);} + AMT GetAmType(void) override {return TYPE_AM_MYSQL;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBMYSQL(this);} // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; //virtual int GetAffectedRows(void) {return AftRows;} - virtual int GetRecpos(void) {return N;} - virtual int GetProgMax(PGLOBAL g); - virtual void ResetDB(void) {N = 0;} - virtual int RowNumber(PGLOBAL g, bool b = false); - virtual bool IsView(void) {return Isview;} - virtual PCSZ GetServer(void) {return Server;} + int GetRecpos(void) override {return N;} + int GetProgMax(PGLOBAL g) override; + void ResetDB(void) override {N = 0;} + int RowNumber(PGLOBAL g, bool b = false) override; + bool IsView(void) override {return Isview;} + PCSZ GetServer(void) override {return Server;} void SetDatabase(LPCSTR db) {Schema = (char*)db;} // Schema routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); -//virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; +//int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) override; // Specific routines bool SetColumnRanks(PGLOBAL g); @@ -112,7 +112,7 @@ class TDBMYSQL : public TDBEXT { bool MakeSelect(PGLOBAL g, bool mx); bool MakeInsert(PGLOBAL g); int BindColumns(PGLOBAL g __attribute__((unused))); - virtual bool MakeCommand(PGLOBAL g); + bool MakeCommand(PGLOBAL g) override; //int MakeUpdate(PGLOBAL g); //int MakeDelete(PGLOBAL g); int SendCommand(PGLOBAL g); @@ -154,13 +154,13 @@ class MYSQLCOL : public COLBLK { MYSQLCOL(MYSQLCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_MYSQL;} + int GetAmType(void) override {return TYPE_AM_MYSQL;} void InitBind(PGLOBAL g); // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; bool FindRank(PGLOBAL g); protected: @@ -182,19 +182,19 @@ class TDBMYEXC : public TDBMYSQL { TDBMYEXC(PTDBMYX tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_MYX;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(this);} + AMT GetAmType(void) override {return TYPE_AM_MYX;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBMYEXC(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual bool IsView(void) {return Isview;} + PTDB Clone(PTABS t) override; + bool IsView(void) override {return Isview;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; protected: // Internal functions @@ -223,8 +223,8 @@ class MYXCOL : public MYSQLCOL { MYXCOL(MYXCOL *colp, PTDB tdbp); // Constructor used in copy process // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Members @@ -242,7 +242,7 @@ class TDBMCL : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PCSZ Host; // Host machine to use diff --git a/storage/connect/taboccur.h b/storage/connect/taboccur.h index 8cd507acb7d..6f3a809174e 100644 --- a/storage/connect/taboccur.h +++ b/storage/connect/taboccur.h @@ -26,11 +26,11 @@ class OCCURDEF : public PRXDEF { /* Logical table description */ OCCURDEF(void) {Pseudo = 3; Colist = Xcol = NULL;} // Implementation - virtual const char *GetType(void) {return "OCCUR";} + const char *GetType(void) override {return "OCCUR";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -50,21 +50,21 @@ class TDBOCCUR : public TDBPRX { TDBOCCUR(POCCURDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_OCCUR;} + AMT GetAmType(void) override {return TYPE_AM_OCCUR;} void SetTdbp(PTDBASE tdbp) {Tdbp = tdbp;} // Methods - virtual void ResetDB(void) {N = 0; Tdbp->ResetDB();} - virtual int RowNumber(PGLOBAL g, bool b = FALSE); + void ResetDB(void) override {N = 0; Tdbp->ResetDB();} + int RowNumber(PGLOBAL g, bool b = FALSE) override; bool MakeColumnList(PGLOBAL g); bool ViewColumnList(PGLOBAL g); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual bool InitTable(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + bool InitTable(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; protected: // Members @@ -89,12 +89,12 @@ class OCCURCOL : public COLBLK { OCCURCOL(PCOLDEF cdp, PTDBOCCUR tdbp, int n); // Implementation - virtual int GetAmType(void) {return TYPE_AM_OCCUR;} + int GetAmType(void) override {return TYPE_AM_OCCUR;} int GetI(void) {return I;} // Methods - virtual void Reset(void) {} // Evaluated only by TDBOCCUR - virtual void ReadColumn(PGLOBAL g); + void Reset(void) override {} // Evaluated only by TDBOCCUR + void ReadColumn(PGLOBAL g) override; void Xreset(void) {I = 0;}; protected: @@ -114,10 +114,10 @@ class RANKCOL : public COLBLK { RANKCOL(PCOLDEF cdp, PTDBOCCUR tdbp, int n) : COLBLK(cdp, tdbp, n) {} // Implementation - virtual int GetAmType(void) {return TYPE_AM_OCCUR;} + int GetAmType(void) override {return TYPE_AM_OCCUR;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h index cedcf0f5f77..e196de8b4df 100644 --- a/storage/connect/tabodbc.h +++ b/storage/connect/tabodbc.h @@ -31,14 +31,14 @@ public: ODBCDEF(void); // Implementation - virtual const char *GetType(void) {return "ODBC";} + const char *GetType(void) override {return "ODBC";} PSZ GetConnect(void) {return Connect;} int GetCatver(void) {return Catver;} // Methods - virtual int Indexable(void) {return 2;} - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + int Indexable(void) override {return 2;} + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -63,28 +63,28 @@ class TDBODBC : public TDBEXT { TDBODBC(PTDBODBC tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ODBC;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_ODBC;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBODBC(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual bool SetRecpos(PGLOBAL g, int recpos); - virtual PCSZ GetFile(PGLOBAL g); - virtual void SetFile(PGLOBAL g, PCSZ fn); - virtual void ResetSize(void); - virtual PCSZ GetServer(void) {return "ODBC";} + PTDB Clone(PTABS t) override; + bool SetRecpos(PGLOBAL g, int recpos) override; + PCSZ GetFile(PGLOBAL g) override; + void SetFile(PGLOBAL g, PCSZ fn) override; + void ResetSize(void) override; + PCSZ GetServer(void) override {return "ODBC";} virtual int Indexable(void) {return 2;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + bool ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) override; protected: // Internal functions @@ -109,16 +109,16 @@ class ODBCCOL : public EXTCOL { public: // Constructors ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "ODBC"); - ODBCCOL(ODBCCOL *colp, PTDB tdbp); // Constructor used in copy process + ODBCCOL(ODBCCOL *colp, PTDB tdbp); // Constructor used in opy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_ODBC;} - SQLLEN *GetStrLen(void) {return StrLen;} + int GetAmType(void) override {return TYPE_AM_ODBC;} + SQLLEN *GetStrLen(void) {return StrLen;} // Methods //virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; void AllocateBuffers(PGLOBAL g, int rows); void *GetBuffer(DWORD rows); SWORD GetBuflen(void); @@ -146,20 +146,20 @@ class TDBXDBC : public TDBODBC { TDBXDBC(PTDBXDBC tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_XDBC;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_XDBC;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBXDBC(this);} // Methods - virtual PTDB Clone(PTABS t); + PTDB Clone(PTABS t) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; protected: // Internal functions @@ -185,8 +185,8 @@ class XSRCCOL : public ODBCCOL { // Implementation // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Members @@ -203,8 +203,8 @@ class TDBDRV : public TDBCAT { TDBDRV(PODEF tdp) : TDBCAT(tdp) {Maxres = tdp->Maxres;} protected: - // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + // Specific routines + PQRYRES GetResult(PGLOBAL g) override; // Members int Maxres; // Returned lines limit @@ -219,8 +219,8 @@ class TDBSRC : public TDBDRV { TDBSRC(PODEF tdp) : TDBDRV(tdp) {} protected: - // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + // Specific routines + PQRYRES GetResult(PGLOBAL g) override; // No additional Members }; // end of class TDBSRC @@ -234,8 +234,8 @@ class TDBOTB : public TDBDRV { TDBOTB(PODEF tdp); protected: - // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + // Specific routines + PQRYRES GetResult(PGLOBAL g) override; // Members PCSZ Dsn; // Points to connection string @@ -254,8 +254,8 @@ class TDBOCL : public TDBOTB { TDBOCL(PODEF tdp); protected: - // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + // Specific routines + PQRYRES GetResult(PGLOBAL g) override; // Members char *Colpat; // Points to column pattern diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h index 0a37804ff87..71964d74972 100644 --- a/storage/connect/tabpivot.h +++ b/storage/connect/tabpivot.h @@ -27,7 +27,7 @@ class PIVAID : public CSORT { bool SkipColumn(PCOLRES crp, char *skc); // The sorting function - virtual int Qcompare(int *, int *); + int Qcompare(int *, int *) override; protected: // Members @@ -64,11 +64,11 @@ class PIVOTDEF : public PRXDEF { /* Logical table description */ PIVOTDEF(void); // Implementation - virtual const char *GetType(void) {return "PIVOT";} + const char *GetType(void) override {return "PIVOT";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -96,22 +96,22 @@ class TDBPIVOT : public TDBPRX { TDBPIVOT(PPIVOTDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_PIVOT;} + AMT GetAmType(void) override {return TYPE_AM_PIVOT;} // Methods - virtual int GetRecpos(void) {return N;} - virtual void ResetDB(void) {N = 0;} - virtual int RowNumber(PGLOBAL g, bool b = FALSE); + int GetRecpos(void) override {return N;} + void ResetDB(void) override {N = 0;} + int RowNumber(PGLOBAL g, bool b = FALSE) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g) {return (g) ? 10 : 0;} - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override {return (g) ? 10 : 0;} + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: // Internal routines @@ -154,10 +154,10 @@ class FNCCOL : public COLBLK { FNCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); // Implementation - virtual int GetAmType(void) {return TYPE_AM_FNC;} + int GetAmType(void) override {return TYPE_AM_FNC;} // Methods - virtual void Reset(void) {} + void Reset(void) override {} bool InitColumn(PGLOBAL g); bool CompareColumn(void); @@ -177,13 +177,13 @@ class SRCCOL : public PRXCOL { SRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int n); // Implementation - virtual int GetAmType(void) {return TYPE_AM_SRC;} + int GetAmType(void) override {return TYPE_AM_SRC;} // Methods using PRXCOL::Init; - virtual void Reset(void) {} + void Reset(void) override {} void SetColumn(void); - virtual bool Init(PGLOBAL g, PTDB tp); + bool Init(PGLOBAL g, PTDB tp) override; bool CompareLast(void); protected: diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h index 901d9102e95..a04117ca82d 100644 --- a/storage/connect/tabrest.h +++ b/storage/connect/tabrest.h @@ -33,11 +33,11 @@ public: RESTDEF(void) { Tdp = NULL; Http = Uri = Fn = NULL; } // Implementation - virtual const char *GetType(void) { return "REST"; } + const char *GetType(void) override { return "REST"; } // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h index 0a427b12dae..58f0b5677ec 100644 --- a/storage/connect/tabsys.h +++ b/storage/connect/tabsys.h @@ -27,11 +27,11 @@ class DllExport INIDEF : public TABDEF { /* INI table description */ INIDEF(void); // Implementation - virtual const char *GetType(void) {return "INI";} + const char *GetType(void) override {return "INI";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -53,30 +53,30 @@ class TDBINI : public TDBASE { TDBINI(PTDBINI tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_INI;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);} + AMT GetAmType(void) override {return TYPE_AM_INI;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBINI(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual int GetRecpos(void) {return N;} - virtual int GetProgCur(void) {return N;} + PTDB Clone(PTABS t) override; + int GetRecpos(void) override {return N;} + int GetProgCur(void) override {return N;} //virtual int GetAffectedRows(void) {return 0;} - virtual PCSZ GetFile(PGLOBAL g) {return Ifile;} - virtual void SetFile(PGLOBAL g, PCSZ fn) {Ifile = fn;} - virtual void ResetDB(void) {Seclist = Section = NULL; N = 0;} - virtual void ResetSize(void) {MaxSize = -1; Seclist = NULL;} - virtual int RowNumber(PGLOBAL g, bool b = false) {return N;} + PCSZ GetFile(PGLOBAL g) override {return Ifile;} + void SetFile(PGLOBAL g, PCSZ fn) override {Ifile = fn;} + void ResetDB(void) override {Seclist = Section = NULL; N = 0;} + void ResetSize(void) override {MaxSize = -1; Seclist = NULL;} + int RowNumber(PGLOBAL g, bool b = false) override {return N;} char *GetSeclist(PGLOBAL g); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: // Members @@ -97,13 +97,13 @@ class INICOL : public COLBLK { INICOL(INICOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_INI;} - virtual void SetTo_Val(PVAL valp) {To_Val = valp;} + int GetAmType(void) override {return TYPE_AM_INI;} + void SetTo_Val(PVAL valp) override {To_Val = valp;} // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; virtual void AllocBuf(PGLOBAL g); protected: @@ -132,24 +132,24 @@ class TDBXIN : public TDBINI { TDBXIN(PTDBXIN tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_INI;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);} + AMT GetAmType(void) override {return TYPE_AM_INI;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBXIN(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual int GetRecpos(void); - virtual bool SetRecpos(PGLOBAL g, int recpos); - virtual void ResetDB(void) + PTDB Clone(PTABS t) override; + int GetRecpos(void) override; + bool SetRecpos(PGLOBAL g, int recpos) override; + void ResetDB(void) override {Seclist = Section = Keycur = NULL; N = 0; Oldsec = -1;} char *GetKeylist(PGLOBAL g, char *sec); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; protected: // Members @@ -171,8 +171,8 @@ class XINCOL : public INICOL { // Implementation // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; protected: // Default constructor not to be used diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h index e7a84395787..6e6c8cb438e 100644 --- a/storage/connect/tabtbl.h +++ b/storage/connect/tabtbl.h @@ -24,11 +24,11 @@ class DllExport TBLDEF : public PRXDEF { /* Logical table description */ TBLDEF(void); // Implementation - virtual const char *GetType(void) {return "TBL";} + const char *GetType(void) override {return "TBL";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -48,21 +48,21 @@ class DllExport TDBTBL : public TDBPRX { TDBTBL(PTBLDEF tdp = NULL); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_TBL;} + AMT GetAmType(void) override {return TYPE_AM_TBL;} // Methods - virtual void ResetDB(void); - virtual int GetRecpos(void) {return Rows;} - virtual int GetBadLines(void) {return (int)Nbc;} + void ResetDB(void) override; + int GetRecpos(void) override {return Rows;} + int GetBadLines(void) override {return (int)Nbc;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual int RowNumber(PGLOBAL g, bool b = FALSE); - virtual PCOL InsertSpecialColumn(PCOL scp); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + int RowNumber(PGLOBAL g, bool b = FALSE) override; + PCOL InsertSpecialColumn(PCOL scp) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; protected: // Internal functions @@ -89,7 +89,7 @@ class TBTBLK : public TIDBLK { TBTBLK(PVAL valp) {Value = valp;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; // Fake operator new used to change TIDBLK into SDTBLK void * operator new(size_t size, TIDBLK *sp) {return sp;} @@ -143,11 +143,11 @@ class DllExport TDBTBM : public TDBTBL { virtual void ResetDB(void); // Database routines - virtual int Cardinality(PGLOBAL g) { return 10; } - virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary - virtual int RowNumber(PGLOBAL g, bool b = FALSE); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); + int Cardinality(PGLOBAL g) override { return 10; } + int GetMaxSize(PGLOBAL g) override { return 10; } // Temporary + int RowNumber(PGLOBAL g, bool b = FALSE) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; protected: // Internal functions diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index 6cf2b11632b..fc0cef8d6e1 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -40,11 +40,11 @@ class DllExport PRXDEF : public TABDEF { /* Logical table description */ PRXDEF(void); // Implementation - virtual const char *GetType(void) {return "PRX";} + const char *GetType(void) override {return "PRX";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; protected: // Members @@ -63,27 +63,27 @@ class DllExport TDBPRX : public TDBASE { TDBPRX(PTDBPRX tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_PRX;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_PRX;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBPRX(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual int GetRecpos(void) {return Tdbp->GetRecpos();} - virtual void ResetDB(void) {Tdbp->ResetDB();} - virtual int RowNumber(PGLOBAL g, bool b = FALSE); - virtual PCSZ GetServer(void) {return (Tdbp) ? Tdbp->GetServer() : (PSZ)"?";} + PTDB Clone(PTABS t) override; + int GetRecpos(void) override {return Tdbp->GetRecpos();} + void ResetDB(void) override {Tdbp->ResetDB();} + int RowNumber(PGLOBAL g, bool b = FALSE) override; + PCSZ GetServer(void) override {return (Tdbp) ? Tdbp->GetServer() : (PSZ)"?";} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; virtual bool InitTable(PGLOBAL g); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g) {if (Tdbp) Tdbp->CloseDB(g);} + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override {if (Tdbp) Tdbp->CloseDB(g);} PTDB GetSubTable(PGLOBAL g, PTABLE tabp, bool b = false); void RemoveNext(PTABLE tp); @@ -106,16 +106,16 @@ class DllExport PRXCOL : public COLBLK { PRXCOL(PRXCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_PRX;} + int GetAmType(void) override {return TYPE_AM_PRX;} // Methods using COLBLK::Init; - virtual void Reset(void); - virtual bool IsSpecial(void) {return Pseudo;} - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) + void Reset(void) override; + bool IsSpecial(void) override {return Pseudo;} + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override {return false;} - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; virtual bool Init(PGLOBAL g, PTDB tp); protected: @@ -141,7 +141,7 @@ class TDBTBC : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PSZ Db; // Database of the table diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h index 06ccde71bcb..cd16c16d5e5 100644 --- a/storage/connect/tabvct.h +++ b/storage/connect/tabvct.h @@ -29,12 +29,12 @@ class DllExport VCTDEF : public DOSDEF { /* Logical table description */ VCTDEF(void) {Split = false; Estimate = Header = 0;} // Implementation - virtual const char *GetType(void) {return "VCT";} + const char *GetType(void) override {return "VCT";} int GetEstimate(void) {return Estimate;} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; protected: int MakeFnPattern(char *fpat); @@ -62,20 +62,20 @@ class DllExport TDBVCT : public TDBFIX { TDBVCT(PGLOBAL g, PTDBVCT tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_VCT;} - virtual PTDB Duplicate(PGLOBAL g) + AMT GetAmType(void) override {return TYPE_AM_VCT;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBVCT(g, this);} bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;} // Methods - virtual PTDB Clone(PTABS t); - virtual bool IsUsingTemp(PGLOBAL g); + PTDB Clone(PTABS t) override; + bool IsUsingTemp(PGLOBAL g) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + void CloseDB(PGLOBAL g) override; protected: // Members @@ -98,13 +98,13 @@ class DllExport VCTCOL : public DOSCOL { VCTCOL(VCTCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_VCT;} + int GetAmType(void) override {return TYPE_AM_VCT;} // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void SetOk(void); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void SetOk(void) override; protected: virtual void ReadBlock(PGLOBAL g); diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h index b92ca0c50f8..31bbed27c63 100644 --- a/storage/connect/tabvir.h +++ b/storage/connect/tabvir.h @@ -24,12 +24,12 @@ class DllExport VIRDEF : public TABDEF { /* Logical table description */ VIRDEF(void) = default; // Implementation - virtual const char *GetType(void) {return "VIRTUAL";} + const char *GetType(void) override {return "VIRTUAL";} // Methods - virtual bool DefineAM(PGLOBAL, LPCSTR, int) {Pseudo = 3; return false;} - virtual int Indexable(void) {return 3;} - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL, LPCSTR, int) override {Pseudo = 3; return false;} + int Indexable(void) override {return 3;} + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -44,24 +44,24 @@ class DllExport TDBVIR : public TDBASE { TDBVIR(PVIRDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_VIR;} + AMT GetAmType(void) override {return TYPE_AM_VIR;} // Methods - virtual int GetRecpos(void) {return N;} - virtual bool SetRecpos(PGLOBAL g, int recpos) + int GetRecpos(void) override {return N;} + bool SetRecpos(PGLOBAL g, int recpos) override {N = recpos - 2; return false;} - virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;} + int RowNumber(PGLOBAL g, bool b = false) override {return N + 1;} int TestFilter(PFIL filp, bool nop); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g) {return (g) ? Size : 1;} - virtual int GetMaxSize(PGLOBAL g) {return Size;} - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g) {} + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override {return (g) ? Size : 1;} + int GetMaxSize(PGLOBAL g) override {return Size;} + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override {} protected: // Members @@ -79,10 +79,10 @@ class VIRCOL : public COLBLK { VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "VIRTUAL"); // Implementation - virtual int GetAmType(void) {return TYPE_AM_VIR;} + int GetAmType(void) override {return TYPE_AM_VIR;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used @@ -100,11 +100,11 @@ class TDBVICL : public TDBCAT { TDBVICL(PVIRDEF tdp) : TDBCAT(tdp) {} // Methods - virtual int Cardinality(PGLOBAL g) {return 2;} // Avoid DBUG_ASSERT + int Cardinality(PGLOBAL g) override {return 2;} // Avoid DBUG_ASSERT protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members }; // end of class TDBVICL diff --git a/storage/connect/tabwmi.h b/storage/connect/tabwmi.h index 7a18453374e..a43e5c9ff52 100644 --- a/storage/connect/tabwmi.h +++ b/storage/connect/tabwmi.h @@ -66,22 +66,22 @@ class TDBWMI : public TDBASE { TDBWMI(PWMIDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_WMI;} + AMT GetAmType(void) override {return TYPE_AM_WMI;} // Methods virtual int GetRecpos(void); virtual int GetProgCur(void) {return N;} - virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;} + int RowNumber(PGLOBAL g, bool b = false) override {return N + 1;} // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g) {return GetMaxSize(g);} - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override {return GetMaxSize(g);} + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: // Specific routines @@ -118,10 +118,10 @@ class WMICOL : public COLBLK { WMICOL(PCOLDEF cdp, PTDB tdbp, int n); // Implementation - virtual int GetAmType(void) {return TYPE_AM_WMI;} + int GetAmType(void) override {return TYPE_AM_WMI;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: WMICOL(void) {} // Default constructor not to be used @@ -143,7 +143,7 @@ class TDBWCL : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + virtual PQRYRES GetResult(PGLOBAL g) override; // Members char *Nsp; // Name space diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 08beb5fe6ac..b2b7eb795a0 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -29,11 +29,11 @@ class XCLDEF : public PRXDEF { /* Logical table description */ XCLDEF(void); // Implementation - virtual const char *GetType(void) {return "XCL";} + const char *GetType(void) override {return "XCL";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE mode); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE mode) override; protected: // Members @@ -54,17 +54,17 @@ class TDBXCL : public TDBPRX { TDBXCL(PXCLDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_XCOL;} + AMT GetAmType(void) override {return TYPE_AM_XCOL;} // Methods - virtual void ResetDB(void) {N = 0; Tdbp->ResetDB();} - virtual int RowNumber(PGLOBAL g, bool b = FALSE); + void ResetDB(void) override {N = 0; Tdbp->ResetDB();} + int RowNumber(PGLOBAL g, bool b = FALSE) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; protected: // Members @@ -89,9 +89,9 @@ class XCLCOL : public PRXCOL { // Methods using PRXCOL::Init; - virtual void Reset(void) {} // Evaluated only by TDBXCL - virtual void ReadColumn(PGLOBAL g); - virtual bool Init(PGLOBAL g, PTDB tp = NULL); + void Reset(void) override {} // Evaluated only by TDBXCL + void ReadColumn(PGLOBAL g) override; + bool Init(PGLOBAL g, PTDB tp = NULL) override; protected: // Default constructor not to be used diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h index 42dbb038b47..252d2f74d85 100644 --- a/storage/connect/tabxml.h +++ b/storage/connect/tabxml.h @@ -25,11 +25,11 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */ XMLDEF(void); // Implementation - virtual const char *GetType(void) {return "XML";} + const char *GetType(void) override {return "XML";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -72,18 +72,18 @@ class DllExport TDBXML : public TDBASE { TDBXML(PTDBXML tdbp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_XML;} - virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXML(this);} + AMT GetAmType(void) override {return TYPE_AM_XML;} + PTDB Duplicate(PGLOBAL g) override {return (PTDB)new(g) TDBXML(this);} // Methods - virtual PTDB Clone(PTABS t); - virtual int GetRecpos(void); - virtual int GetProgCur(void) {return N;} - virtual PCSZ GetFile(PGLOBAL g) {return Xfile;} - virtual void SetFile(PGLOBAL g, PCSZ fn) {Xfile = fn;} - virtual void ResetDB(void) {N = 0;} - virtual void ResetSize(void) {MaxSize = -1;} - virtual int RowNumber(PGLOBAL g, bool b = false); + PTDB Clone(PTABS t) override; + int GetRecpos(void) override; + int GetProgCur(void) override {return N;} + PCSZ GetFile(PGLOBAL g) override {return Xfile;} + void SetFile(PGLOBAL g, PCSZ fn) override {Xfile = fn;} + void ResetDB(void) override {N = 0;} + void ResetSize(void) override {MaxSize = -1;} + int RowNumber(PGLOBAL g, bool b = false) override; int LoadTableFile(PGLOBAL g, char *filename); bool Initialize(PGLOBAL g); bool SetTabNode(PGLOBAL g); @@ -91,19 +91,19 @@ class DllExport TDBXML : public TDBASE { bool CheckRow(PGLOBAL g, bool b); // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual PCOL InsertSpecialColumn(PCOL colp); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + PCOL InsertSpecialColumn(PCOL colp) override; //virtual int GetMaxSame(PGLOBAL g) {return (Xpand) ? Limit : 1;} - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; //virtual bool NeedIndexing(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - virtual int CheckWrite(PGLOBAL g) {Checked = true; return 0;} - virtual const CHARSET_INFO *data_charset(); + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; + int CheckWrite(PGLOBAL g) override {Checked = true; return 0;} + const CHARSET_INFO *data_charset() override; protected: // Members @@ -164,14 +164,14 @@ class XMLCOL : public COLBLK { XMLCOL(XMLCOL *colp, PTDB tdbp); // Constructor used in copy process // Implementation - virtual int GetAmType(void) {return TYPE_AM_XML;} - virtual void SetTo_Val(PVAL valp) {To_Val = valp;} + int GetAmType(void) override {return TYPE_AM_XML;} + void SetTo_Val(PVAL valp) override {To_Val = valp;} bool ParseXpath(PGLOBAL g, bool mode); // Methods - virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) override; + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; bool AllocBuf(PGLOBAL g, bool mode); void AllocNodes(PGLOBAL g, PXDOC dp); @@ -234,8 +234,8 @@ class XMULCOL : public XMLCOLX { XMULCOL(PVAL valp) {Value = valp; Mul = true;} // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; }; // end of class XMULCOL /***********************************************************************/ @@ -248,8 +248,8 @@ class XPOSCOL : public XMLCOLX { XPOSCOL(PVAL valp) {Value = valp;} // Methods - virtual void ReadColumn(PGLOBAL g); - virtual void WriteColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; + void WriteColumn(PGLOBAL g) override; }; // end of class XPOSCOL /***********************************************************************/ @@ -262,7 +262,7 @@ class TDBXCT : public TDBCAT { protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); + PQRYRES GetResult(PGLOBAL g) override; // Members PTOS Topt; diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h index 3c16fae99bc..16ad9db7c4a 100644 --- a/storage/connect/tabzip.h +++ b/storage/connect/tabzip.h @@ -26,11 +26,11 @@ public: ZIPDEF(void) = default; // Implementation - virtual const char *GetType(void) {return "ZIP";} + const char *GetType(void) override {return "ZIP";} // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); + bool DefineAM(PGLOBAL g, LPCSTR am, int poff) override; + PTDB GetTable(PGLOBAL g, MODE m) override; protected: // Members @@ -47,22 +47,22 @@ public: TDBZIP(PZIPDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} - virtual PCSZ GetFile(PGLOBAL) {return zfn;} - virtual void SetFile(PGLOBAL, PCSZ fn) {zfn = fn;} + AMT GetAmType(void) override {return TYPE_AM_ZIP;} + PCSZ GetFile(PGLOBAL) override {return zfn;} + void SetFile(PGLOBAL, PCSZ fn) override {zfn = fn;} // Methods - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL g); - virtual int GetMaxSize(PGLOBAL g); - virtual int GetRecpos(void) {return 0;} + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL g) override; + int GetMaxSize(PGLOBAL g) override; + int GetRecpos(void) override {return 0;} // Database routines - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: bool open(PGLOBAL g, const char *filename); @@ -87,10 +87,10 @@ public: ZIPCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "ZIP"); // Implementation - virtual int GetAmType(void) { return TYPE_AM_ZIP; } + int GetAmType(void) override { return TYPE_AM_ZIP; } // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: // Default constructor not to be used diff --git a/storage/connect/valblk.h b/storage/connect/valblk.h index 537e838c99f..6ac293b734a 100644 --- a/storage/connect/valblk.h +++ b/storage/connect/valblk.h @@ -149,54 +149,54 @@ class TYPBLK : public VALBLK { TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false); // Implementation - virtual bool Init(PGLOBAL g, bool check); - virtual int GetVlen(void) {return sizeof(TYPE);} + bool Init(PGLOBAL g, bool check) override; + int GetVlen(void) override {return sizeof(TYPE);} - virtual char GetTinyValue(int n) {return (char)UnalignedRead(n);} - virtual uchar GetUTinyValue(int n) {return (uchar)UnalignedRead(n);} - virtual short GetShortValue(int n) {return (short)UnalignedRead(n);} - virtual ushort GetUShortValue(int n) {return (ushort)UnalignedRead(n);} - virtual int GetIntValue(int n) {return (int)UnalignedRead(n);} - virtual uint GetUIntValue(int n) {return (uint)UnalignedRead(n);} - virtual longlong GetBigintValue(int n) {return (longlong)UnalignedRead(n);} - virtual ulonglong GetUBigintValue(int n) {return (ulonglong)UnalignedRead(n);} - virtual double GetFloatValue(int n) {return (double)UnalignedRead(n);} - virtual char *GetCharString(char *p, int n); - virtual void Reset(int n) {UnalignedWrite(n, 0);} + char GetTinyValue(int n) override {return (char)UnalignedRead(n);} + uchar GetUTinyValue(int n) override {return (uchar)UnalignedRead(n);} + short GetShortValue(int n) override {return (short)UnalignedRead(n);} + ushort GetUShortValue(int n) override {return (ushort)UnalignedRead(n);} + int GetIntValue(int n) override {return (int)UnalignedRead(n);} + uint GetUIntValue(int n) override {return (uint)UnalignedRead(n);} + longlong GetBigintValue(int n) override {return (longlong)UnalignedRead(n);} + ulonglong GetUBigintValue(int n) override {return (ulonglong)UnalignedRead(n);} + double GetFloatValue(int n) override {return (double)UnalignedRead(n);} + char *GetCharString(char *p, int n) override; + void Reset(int n) override {UnalignedWrite(n, 0);} // Methods using VALBLK::SetValue; - virtual void SetValue(PCSZ sp, int n); - virtual void SetValue(const char *sp, uint len, int n); - virtual void SetValue(short sval, int n) + void SetValue(PCSZ sp, int n) override; + void SetValue(const char *sp, uint len, int n) override; + void SetValue(short sval, int n) override {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);} - virtual void SetValue(ushort sval, int n) + void SetValue(ushort sval, int n) override {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);} - virtual void SetValue(int lval, int n) + void SetValue(int lval, int n) override {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} - virtual void SetValue(uint lval, int n) + void SetValue(uint lval, int n) override {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} - virtual void SetValue(longlong lval, int n) + void SetValue(longlong lval, int n) override {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} - virtual void SetValue(ulonglong lval, int n) + void SetValue(ulonglong lval, int n) override {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} - virtual void SetValue(double fval, int n) + void SetValue(double fval, int n) override {UnalignedWrite(n, (TYPE)fval); SetNull(n, false);} - virtual void SetValue(char cval, int n) + void SetValue(char cval, int n) override {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);} - virtual void SetValue(uchar cval, int n) + void SetValue(uchar cval, int n) override {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);} - virtual void SetValue(PVAL valp, int n); - virtual void SetValue(PVBLK pv, int n1, int n2); - virtual void SetMin(PVAL valp, int n); - virtual void SetMax(PVAL valp, int n); - virtual void Move(int i, int j); - virtual int CompVal(PVAL vp, int n); - virtual int CompVal(int i1, int i2); - virtual void *GetValPtr(int n); - virtual void *GetValPtrEx(int n); - virtual int Find(PVAL vp); - virtual int GetMaxLength(void); + void SetValue(PVAL valp, int n) override; + void SetValue(PVBLK pv, int n1, int n2) override; + void SetMin(PVAL valp, int n) override; + void SetMax(PVAL valp, int n) override; + void Move(int i, int j) override; + int CompVal(PVAL vp, int n) override; + int CompVal(int i1, int i2) override; + void *GetValPtr(int n) override; + void *GetValPtrEx(int n) override; + int Find(PVAL vp) override; + int GetMaxLength(void) override; protected: // Specialized functions @@ -229,38 +229,38 @@ class CHRBLK : public VALBLK { CHRBLK(void *mp, int size, int type, int len, int prec, bool b); // Implementation - virtual bool Init(PGLOBAL g, bool check); - virtual int GetVlen(void) {return Long;} - virtual PSZ GetCharValue(int n); - virtual char GetTinyValue(int n); - virtual uchar GetUTinyValue(int n); - virtual short GetShortValue(int n); - virtual ushort GetUShortValue(int n); - virtual int GetIntValue(int n); - virtual uint GetUIntValue(int n); - virtual longlong GetBigintValue(int n); - virtual ulonglong GetUBigintValue(int n); - virtual double GetFloatValue(int n); - virtual char *GetCharString(char *p, int n); - virtual void Reset(int n); - virtual void SetPrec(int p) {Ci = (p != 0);} - virtual bool IsCi(void) {return Ci;} + bool Init(PGLOBAL g, bool check) override; + int GetVlen(void) override {return Long;} + PSZ GetCharValue(int n) override; + char GetTinyValue(int n) override; + uchar GetUTinyValue(int n) override; + short GetShortValue(int n) override; + ushort GetUShortValue(int n) override; + int GetIntValue(int n) override; + uint GetUIntValue(int n) override; + longlong GetBigintValue(int n) override; + ulonglong GetUBigintValue(int n) override; + double GetFloatValue(int n) override; + char *GetCharString(char *p, int n) override; + void Reset(int n) override; + void SetPrec(int p) override {Ci = (p != 0);} + bool IsCi(void) override {return Ci;} // Methods using VALBLK::SetValue; - virtual void SetValue(PCSZ sp, int n); - virtual void SetValue(const char *sp, uint len, int n); - virtual void SetValue(PVAL valp, int n); - virtual void SetValue(PVBLK pv, int n1, int n2); - virtual void SetMin(PVAL valp, int n); - virtual void SetMax(PVAL valp, int n); - virtual void Move(int i, int j); - virtual int CompVal(PVAL vp, int n); - virtual int CompVal(int i1, int i2); - virtual void *GetValPtr(int n); - virtual void *GetValPtrEx(int n); - virtual int Find(PVAL vp); - virtual int GetMaxLength(void); + void SetValue(PCSZ sp, int n) override; + void SetValue(const char *sp, uint len, int n) override; + void SetValue(PVAL valp, int n) override; + void SetValue(PVBLK pv, int n1, int n2) override; + void SetMin(PVAL valp, int n) override; + void SetMax(PVAL valp, int n) override; + void Move(int i, int j) override; + int CompVal(PVAL vp, int n) override; + int CompVal(int i1, int i2) override; + void *GetValPtr(int n) override; + void *GetValPtrEx(int n) override; + int Find(PVAL vp) override; + int GetMaxLength(void) override; protected: // Members @@ -282,39 +282,39 @@ class STRBLK : public VALBLK { STRBLK(PGLOBAL g, void *mp, int size, int type); // Implementation - virtual void SetNull(int n, bool b) {if (b) {Strp[n] = NULL;}} - virtual bool IsNull(int n) {return Strp[n] == NULL;} - virtual void SetNullable(bool) {} // Always nullable - virtual bool Init(PGLOBAL g, bool check); - virtual int GetVlen(void) {return sizeof(PSZ);} - virtual PSZ GetCharValue(int n) {return Strp[n];} - virtual char GetTinyValue(int n); - virtual uchar GetUTinyValue(int n); - virtual short GetShortValue(int n); - virtual ushort GetUShortValue(int n); - virtual int GetIntValue(int n); - virtual uint GetUIntValue(int n); - virtual longlong GetBigintValue(int n); - virtual ulonglong GetUBigintValue(int n); - virtual double GetFloatValue(int n) {return atof(Strp[n]);} - virtual char *GetCharString(char *, int n) {return Strp[n];} - virtual void Reset(int n) {Strp[n] = NULL;} + void SetNull(int n, bool b) override {if (b) {Strp[n] = NULL;}} + bool IsNull(int n) override {return Strp[n] == NULL;} + void SetNullable(bool) override {} // Always nullable + bool Init(PGLOBAL g, bool check) override; + int GetVlen(void) override {return sizeof(PSZ);} + PSZ GetCharValue(int n) override {return Strp[n];} + char GetTinyValue(int n) override; + uchar GetUTinyValue(int n) override; + short GetShortValue(int n) override; + ushort GetUShortValue(int n) override; + int GetIntValue(int n) override; + uint GetUIntValue(int n) override; + longlong GetBigintValue(int n) override; + ulonglong GetUBigintValue(int n) override; + double GetFloatValue(int n) override {return atof(Strp[n]);} + char *GetCharString(char *, int n) override {return Strp[n];} + void Reset(int n) override {Strp[n] = NULL;} // Methods using VALBLK::SetValue; - virtual void SetValue(PCSZ sp, int n); - virtual void SetValue(const char *sp, uint len, int n); - virtual void SetValue(PVAL valp, int n); - virtual void SetValue(PVBLK pv, int n1, int n2); - virtual void SetMin(PVAL valp, int n); - virtual void SetMax(PVAL valp, int n); - virtual void Move(int i, int j); - virtual int CompVal(PVAL vp, int n); - virtual int CompVal(int i1, int i2); - virtual void *GetValPtr(int n); - virtual void *GetValPtrEx(int n); - virtual int Find(PVAL vp); - virtual int GetMaxLength(void); + void SetValue(PCSZ sp, int n) override; + void SetValue(const char *sp, uint len, int n) override; + void SetValue(PVAL valp, int n) override; + void SetValue(PVBLK pv, int n1, int n2) override; + void SetMin(PVAL valp, int n) override; + void SetMax(PVAL valp, int n) override; + void Move(int i, int j) override; + int CompVal(PVAL vp, int n) override; + int CompVal(int i1, int i2) override; + void *GetValPtr(int n) override; + void *GetValPtrEx(int n) override; + int Find(PVAL vp) override; + int GetMaxLength(void) override; // Specific void SetSorted(bool b) {Sorted = b;} @@ -334,12 +334,12 @@ class DATBLK : public TYPBLK { DATBLK(void *mp, int size); // Implementation - virtual bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0); - virtual char *GetCharString(char *p, int n); + bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0) override; + char *GetCharString(char *p, int n) override; // Methods using TYPBLK::SetValue; - virtual void SetValue(PCSZ sp, int n); + void SetValue(PCSZ sp, int n) override; protected: // Members @@ -364,8 +364,8 @@ class PTRBLK : public STRBLK { // Methods using STRBLK::SetValue; using STRBLK::CompVal; - virtual void SetValue(PCSZ p, int n) {Strp[n] = (char*)p;} - virtual int CompVal(int i1, int i2); + void SetValue(PCSZ p, int n) override {Strp[n] = (char*)p;} + int CompVal(int i1, int i2) override; protected: // Members diff --git a/storage/connect/value.h b/storage/connect/value.h index 7eb0dec29f2..8145559f2cb 100644 --- a/storage/connect/value.h +++ b/storage/connect/value.h @@ -123,8 +123,8 @@ public: virtual bool IsEqual(PVAL vp, bool chktype) = 0; virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); virtual bool FormatValue(PVAL vp, PCSZ fmt) = 0; - virtual void Printf(PGLOBAL g, FILE *, uint); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *, uint) override; + void Prints(PGLOBAL g, char *ps, uint z) override; /** Set value from a non-aligned in-memory value in the machine byte order. @@ -194,48 +194,48 @@ class DllExport TYPVAL : public VALUE { TYPVAL(TYPE n, int type, int prec = 0, bool un = false); // Implementation - virtual bool IsTypeNum(void) {return true;} - virtual bool IsZero(void) {return Tval == 0;} - virtual void Reset(void) {Tval = 0;} - virtual int GetValLen(void); - virtual int GetValPrec() {return Prec;} - virtual int GetSize(void) {return sizeof(TYPE);} + bool IsTypeNum(void) override {return true;} + bool IsZero(void) override {return Tval == 0;} + void Reset(void) override {Tval = 0;} + int GetValLen(void) override; + int GetValPrec() override {return Prec;} + int GetSize(void) override {return sizeof(TYPE);} //virtual PSZ GetCharValue(void) {return VALUE::GetCharValue();} - virtual char GetTinyValue(void) {return (char)Tval;} - virtual uchar GetUTinyValue(void) {return (uchar)Tval;} - virtual short GetShortValue(void) {return (short)Tval;} - virtual ushort GetUShortValue(void) {return (ushort)Tval;} - virtual int GetIntValue(void) {return (int)Tval;} - virtual uint GetUIntValue(void) {return (uint)Tval;} - virtual longlong GetBigintValue(void) {return (longlong)Tval;} - virtual ulonglong GetUBigintValue(void) {return (ulonglong)Tval;} - virtual double GetFloatValue(void) {return (double)Tval;} - virtual void *GetTo_Val(void) {return &Tval;} + char GetTinyValue(void) override {return (char)Tval;} + uchar GetUTinyValue(void) override {return (uchar)Tval;} + short GetShortValue(void) override {return (short)Tval;} + ushort GetUShortValue(void) override {return (ushort)Tval;} + int GetIntValue(void) override {return (int)Tval;} + uint GetUIntValue(void) override {return (uint)Tval;} + longlong GetBigintValue(void) override {return (longlong)Tval;} + ulonglong GetUBigintValue(void) override {return (ulonglong)Tval;} + double GetFloatValue(void) override {return (double)Tval;} + void *GetTo_Val(void) override {return &Tval;} // Methods - virtual bool SetValue_pval(PVAL valp, bool chktype); - virtual bool SetValue_char(const char *p, int n); - virtual void SetValue_psz(PCSZ s); - virtual void SetValue_bool(bool b) {Tval = (b) ? 1 : 0;} - virtual int CompareValue(PVAL vp); - virtual void SetValue(char c) {Tval = (TYPE)c; Null = false;} - virtual void SetValue(uchar c) {Tval = (TYPE)c; Null = false;} - virtual void SetValue(short i) {Tval = (TYPE)i; Null = false;} - virtual void SetValue(ushort i) {Tval = (TYPE)i; Null = false;} - virtual void SetValue(int n) {Tval = (TYPE)n; Null = false;} - virtual void SetValue(uint n) {Tval = (TYPE)n; Null = false;} - virtual void SetValue(longlong n) {Tval = (TYPE)n; Null = false;} - virtual void SetValue(ulonglong n) {Tval = (TYPE)n; Null = false;} - virtual void SetValue(double f) {Tval = (TYPE)f; Null = false;} - virtual void SetValue_pvblk(PVBLK blk, int n); - virtual void SetBinValue(void *p); - virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual int ShowValue(char *buf, int len); - virtual char *GetCharString(char *p); - virtual bool IsEqual(PVAL vp, bool chktype); - virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); - virtual bool SetConstFormat(PGLOBAL, FORMAT&); - virtual bool FormatValue(PVAL vp, PCSZ fmt); + bool SetValue_pval(PVAL valp, bool chktype) override; + bool SetValue_char(const char *p, int n) override; + void SetValue_psz(PCSZ s) override; + void SetValue_bool(bool b) override {Tval = (b) ? 1 : 0;} + int CompareValue(PVAL vp) override; + void SetValue(char c) override {Tval = (TYPE)c; Null = false;} + void SetValue(uchar c) override {Tval = (TYPE)c; Null = false;} + void SetValue(short i) override {Tval = (TYPE)i; Null = false;} + void SetValue(ushort i) override {Tval = (TYPE)i; Null = false;} + void SetValue(int n) override {Tval = (TYPE)n; Null = false;} + void SetValue(uint n) override {Tval = (TYPE)n; Null = false;} + void SetValue(longlong n) override {Tval = (TYPE)n; Null = false;} + void SetValue(ulonglong n) override {Tval = (TYPE)n; Null = false;} + void SetValue(double f) override {Tval = (TYPE)f; Null = false;} + void SetValue_pvblk(PVBLK blk, int n) override; + void SetBinValue(void *p) override; + bool GetBinValue(void *buf, int buflen, bool go) override; + int ShowValue(char *buf, int len) override; + char *GetCharString(char *p) override; + bool IsEqual(PVAL vp, bool chktype) override; + bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) override; + bool SetConstFormat(PGLOBAL, FORMAT&) override; + bool FormatValue(PVAL vp, PCSZ fmt) override; protected: static TYPE MinMaxVal(bool b); @@ -268,49 +268,49 @@ public: TYPVAL(PGLOBAL g, PSZ s, int n, int c); // Implementation - virtual bool IsTypeNum(void) {return false;} - virtual bool IsZero(void) {return *Strp == 0;} - virtual void Reset(void) {*Strp = 0;} - virtual int GetValLen(void) {return Len;}; - virtual int GetValPrec() {return (Ci) ? 1 : 0;} - virtual int GetSize(void) {return (Strp) ? (int)strlen(Strp) : 0;} - virtual PSZ GetCharValue(void) {return Strp;} - virtual char GetTinyValue(void); - virtual uchar GetUTinyValue(void); - virtual short GetShortValue(void); - virtual ushort GetUShortValue(void); - virtual int GetIntValue(void); - virtual uint GetUIntValue(void); - virtual longlong GetBigintValue(void); - virtual ulonglong GetUBigintValue(void); - virtual double GetFloatValue(void) {return atof(Strp);} - virtual void *GetTo_Val(void) {return Strp;} - virtual void SetPrec(int prec) {Ci = prec != 0;} + bool IsTypeNum(void) override {return false;} + bool IsZero(void) override {return *Strp == 0;} + void Reset(void) override {*Strp = 0;} + int GetValLen(void) override {return Len;}; + int GetValPrec() override {return (Ci) ? 1 : 0;} + int GetSize(void) override {return (Strp) ? (int)strlen(Strp) : 0;} + PSZ GetCharValue(void) override {return Strp;} + char GetTinyValue(void) override; + uchar GetUTinyValue(void) override; + short GetShortValue(void) override; + ushort GetUShortValue(void) override; + int GetIntValue(void) override; + uint GetUIntValue(void) override; + longlong GetBigintValue(void) override; + ulonglong GetUBigintValue(void) override; + double GetFloatValue(void) override {return atof(Strp);} + void *GetTo_Val(void) override {return Strp;} + void SetPrec(int prec) override {Ci = prec != 0;} // Methods - virtual bool SetValue_pval(PVAL valp, bool chktype); - virtual bool SetValue_char(const char *p, int n); - virtual void SetValue_psz(PCSZ s); - virtual void SetValue_pvblk(PVBLK blk, int n); - virtual void SetValue(char c); - virtual void SetValue(uchar c); - virtual void SetValue(short i); - virtual void SetValue(ushort i); - virtual void SetValue(int n); - virtual void SetValue(uint n); - virtual void SetValue(longlong n); - virtual void SetValue(ulonglong n); - virtual void SetValue(double f); - virtual void SetBinValue(void *p); - virtual int CompareValue(PVAL vp); - virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual int ShowValue(char *buf, int len); - virtual char *GetCharString(char *p); - virtual bool IsEqual(PVAL vp, bool chktype); - virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); - virtual bool FormatValue(PVAL vp, PCSZ fmt); - virtual bool SetConstFormat(PGLOBAL, FORMAT&); - virtual void Prints(PGLOBAL g, char *ps, uint z); + bool SetValue_pval(PVAL valp, bool chktype) override; + bool SetValue_char(const char *p, int n) override; + void SetValue_psz(PCSZ s) override; + void SetValue_pvblk(PVBLK blk, int n) override; + void SetValue(char c) override; + void SetValue(uchar c) override; + void SetValue(short i) override; + void SetValue(ushort i) override; + void SetValue(int n) override; + void SetValue(uint n) override; + void SetValue(longlong n) override; + void SetValue(ulonglong n) override; + void SetValue(double f) override; + void SetBinValue(void *p) override; + int CompareValue(PVAL vp) override; + bool GetBinValue(void *buf, int buflen, bool go) override; + int ShowValue(char *buf, int len) override; + char *GetCharString(char *p) override; + bool IsEqual(PVAL vp, bool chktype) override; + bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) override; + bool FormatValue(PVAL vp, PCSZ fmt) override; + bool SetConstFormat(PGLOBAL, FORMAT&) override; + void Prints(PGLOBAL g, char *ps, uint z) override; protected: // Members @@ -329,16 +329,16 @@ class DllExport DECVAL: public TYPVAL { DECVAL(PGLOBAL g, PSZ s, int n, int prec, bool uns); // Implementation - virtual bool IsTypeNum(void) {return true;} - virtual bool IsZero(void); - virtual void Reset(void); - virtual int GetValPrec() {return Prec;} + bool IsTypeNum(void) override {return true;} + bool IsZero(void) override; + void Reset(void) override; + int GetValPrec() override {return Prec;} // Methods - virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual int ShowValue(char *buf, int len); - virtual bool IsEqual(PVAL vp, bool chktype); - virtual int CompareValue(PVAL vp); + bool GetBinValue(void *buf, int buflen, bool go) override; + int ShowValue(char *buf, int len) override; + bool IsEqual(PVAL vp, bool chktype) override; + int CompareValue(PVAL vp) override; protected: // Members @@ -355,47 +355,47 @@ public: BINVAL(PGLOBAL g, void *p, int cl, int n); // Implementation - virtual bool IsTypeNum(void) {return false;} - virtual bool IsZero(void); - virtual void Reset(void); - virtual int GetValLen(void) {return Clen;}; - virtual int GetValPrec() {return 0;} - virtual int GetSize(void) {return Len;} - virtual PSZ GetCharValue(void) {return (PSZ)Binp;} - virtual char GetTinyValue(void); - virtual uchar GetUTinyValue(void); - virtual short GetShortValue(void); - virtual ushort GetUShortValue(void); - virtual int GetIntValue(void); - virtual uint GetUIntValue(void); - virtual longlong GetBigintValue(void); - virtual ulonglong GetUBigintValue(void); - virtual double GetFloatValue(void); - virtual void *GetTo_Val(void) {return Binp;} + bool IsTypeNum(void) override {return false;} + bool IsZero(void) override; + void Reset(void) override; + int GetValLen(void) override {return Clen;}; + int GetValPrec() override {return 0;} + int GetSize(void) override {return Len;} + PSZ GetCharValue(void) override {return (PSZ)Binp;} + char GetTinyValue(void) override; + uchar GetUTinyValue(void) override; + short GetShortValue(void) override; + ushort GetUShortValue(void) override; + int GetIntValue(void) override; + uint GetUIntValue(void) override; + longlong GetBigintValue(void) override; + ulonglong GetUBigintValue(void) override; + double GetFloatValue(void) override; + void *GetTo_Val(void) override {return Binp;} // Methods - virtual bool SetValue_pval(PVAL valp, bool chktype); - virtual bool SetValue_char(const char *p, int n); - virtual void SetValue_psz(PCSZ s); - virtual void SetValue_pvblk(PVBLK blk, int n); - virtual void SetValue(char c); - virtual void SetValue(uchar c); - virtual void SetValue(short i); - virtual void SetValue(ushort i); - virtual void SetValue(int n); - virtual void SetValue(uint n); - virtual void SetValue(longlong n); - virtual void SetValue(ulonglong n); - virtual void SetValue(double f); - virtual void SetBinValue(void *p); + bool SetValue_pval(PVAL valp, bool chktype) override; + bool SetValue_char(const char *p, int n) override; + void SetValue_psz(PCSZ s) override; + void SetValue_pvblk(PVBLK blk, int n) override; + void SetValue(char c) override; + void SetValue(uchar c) override; + void SetValue(short i) override; + void SetValue(ushort i) override; + void SetValue(int n) override; + void SetValue(uint n) override; + void SetValue(longlong n) override; + void SetValue(ulonglong n) override; + void SetValue(double f) override; + void SetBinValue(void *p) override; virtual void SetBinValue(void* p, ulong len); - virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual int CompareValue(PVAL) {assert(false); return 0;} - virtual int ShowValue(char *buf, int len); - virtual char *GetCharString(char *p); - virtual bool IsEqual(PVAL vp, bool chktype); - virtual bool FormatValue(PVAL vp, PCSZ fmt); - virtual bool SetConstFormat(PGLOBAL, FORMAT&); + bool GetBinValue(void *buf, int buflen, bool go) override; + int CompareValue(PVAL) override {assert(false); return 0;} + int ShowValue(char *buf, int len) override; + char *GetCharString(char *p) override; + bool IsEqual(PVAL vp, bool chktype) override; + bool FormatValue(PVAL vp, PCSZ fmt) override; + bool SetConstFormat(PGLOBAL, FORMAT&) override; protected: // Members @@ -415,15 +415,15 @@ class DllExport DTVAL : public TYPVAL { using TYPVAL::SetValue; // Implementation - virtual bool SetValue_pval(PVAL valp, bool chktype); - virtual bool SetValue_char(const char *p, int n); - virtual void SetValue_psz(PCSZ s); - virtual void SetValue_pvblk(PVBLK blk, int n); - virtual void SetValue(int n); - virtual PSZ GetCharValue(void) { return Sdate; } - virtual char *GetCharString(char *p); - virtual int ShowValue(char *buf, int len); - virtual bool FormatValue(PVAL vp, PCSZ fmt); + bool SetValue_pval(PVAL valp, bool chktype) override; + bool SetValue_char(const char *p, int n) override; + void SetValue_psz(PCSZ s) override; + void SetValue_pvblk(PVBLK blk, int n) override; + void SetValue(int n) override; + PSZ GetCharValue(void) override { return Sdate; } + char *GetCharString(char *p) override; + int ShowValue(char *buf, int len) override; + bool FormatValue(PVAL vp, PCSZ fmt) override; bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0); bool SetFormat(PGLOBAL g, PVAL valp); bool IsFormatted(void) {return Pdtp != NULL;} diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h index ce62f0591c1..dcd98582e2d 100644 --- a/storage/connect/xindex.h +++ b/storage/connect/xindex.h @@ -200,8 +200,8 @@ class DllExport XXBASE : public CSORT, public BLOCK { void FreeIndex(void) {PlgDBfree(Index);} // Methods - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; virtual bool Init(PGLOBAL g) = 0; virtual bool Make(PGLOBAL g, PIXDEF sxp) = 0; #if defined(XMAP) @@ -214,7 +214,7 @@ class DllExport XXBASE : public CSORT, public BLOCK { virtual int FastFind(void) = 0; virtual bool Reorder(PGLOBAL) {return true;} virtual int Range(PGLOBAL, int = 0, bool = true) {return -1;} // Means error - virtual int Qcompare(int *, int *) = 0; + int Qcompare(int *, int *) override = 0; virtual int GroupSize(void) {return 1;} virtual void Close(void) = 0; @@ -254,32 +254,32 @@ class DllExport XINDEX : public XXBASE { PCOL *cp, PXOB *xp = NULL, int k = 0); // Implementation - virtual IDT GetType(void) {return TYPE_IDX_INDX;} - virtual bool IsMul(void) {return (Nval < Nk) ? true : Mul;} + IDT GetType(void) override {return TYPE_IDX_INDX;} + bool IsMul(void) override {return (Nval < Nk) ? true : Mul;} //virtual bool HaveSame(void) {return Op == OP_SAME;} - virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;} - virtual void SetNval(int n) {Nval = n;} + int GetCurPos(void) override {return (Pex) ? Pex[Cur_K] : Cur_K;} + void SetNval(int n) override {Nval = n;} int GetMaxSame(void) {return MaxSame;} // Methods - virtual void Reset(void); - virtual bool Init(PGLOBAL g); + void Reset(void) override; + bool Init(PGLOBAL g) override; #if defined(XMAP) - virtual bool MapInit(PGLOBAL g); + bool MapInit(PGLOBAL g) override; #endif // XMAP - virtual int Qcompare(int *, int *); - virtual int Fetch(PGLOBAL g); - virtual int FastFind(void); - virtual int GroupSize(void); - virtual int Range(PGLOBAL g, int limit = 0, bool incl = true); - virtual int MaxRange(void) {return MaxSame;} + int Qcompare(int *, int *) override; + int Fetch(PGLOBAL g) override; + int FastFind(void) override; + int GroupSize(void) override; + int Range(PGLOBAL g, int limit = 0, bool incl = true) override; + int MaxRange(void) override {return MaxSame;} virtual int ColMaxSame(PXCOL kp); - virtual void Close(void); - virtual bool NextVal(bool eq); - virtual bool PrevVal(void); - virtual bool Make(PGLOBAL g, PIXDEF sxp); + void Close(void) override; + bool NextVal(bool eq) override; + bool PrevVal(void) override; + bool Make(PGLOBAL g, PIXDEF sxp) override; virtual bool SaveIndex(PGLOBAL g, PIXDEF sxp); - virtual bool Reorder(PGLOBAL g); + bool Reorder(PGLOBAL g) override; bool GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk); protected: @@ -310,16 +310,16 @@ class DllExport XINDXS : public XINDEX { XINDXS(PTDBDOS tdbp, PIXDEF xdp, PXLOAD pxp, PCOL *cp, PXOB *xp = NULL); // Implementation - virtual void SetNval(int n) {assert(n == 1);} + void SetNval(int n) override {assert(n == 1);} // Methods - virtual int Qcompare(int *, int *); - virtual int Fetch(PGLOBAL g); - virtual int FastFind(void); - virtual bool NextVal(bool eq); - virtual bool PrevVal(void); - virtual int Range(PGLOBAL g, int limit = 0, bool incl = true); - virtual int GroupSize(void); + int Qcompare(int *, int *) override; + int Fetch(PGLOBAL g) override; + int FastFind(void) override; + bool NextVal(bool eq) override; + bool PrevVal(void) override; + int Range(PGLOBAL g, int limit = 0, bool incl = true) override; + int GroupSize(void) override; protected: // Members @@ -367,14 +367,14 @@ class DllExport XFILE : public XLOAD { XFILE(void); // Methods - virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode); - virtual bool Seek(PGLOBAL g, int low, int high, int origin); - virtual bool Read(PGLOBAL g, void *buf, int n, int size); - virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc); - virtual void Close(char *fn, int id); - virtual void Close(void); + bool Open(PGLOBAL g, char *filename, int id, MODE mode) override; + bool Seek(PGLOBAL g, int low, int high, int origin) override; + bool Read(PGLOBAL g, void *buf, int n, int size) override; + int Write(PGLOBAL g, void *buf, int n, int size, bool& rc) override; + void Close(char *fn, int id) override; + void Close(void) override; #if defined(XMAP) - virtual void *FileView(PGLOBAL g, char *fn); + void *FileView(PGLOBAL g, char *fn) override; #endif // XMAP protected: @@ -395,13 +395,13 @@ class DllExport XHUGE : public XLOAD { // Methods using XLOAD::Close; - virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode); - virtual bool Seek(PGLOBAL g, int low, int high, int origin); - virtual bool Read(PGLOBAL g, void *buf, int n, int size); - virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc); - virtual void Close(char *fn, int id); + bool Open(PGLOBAL g, char *filename, int id, MODE mode) override; + bool Seek(PGLOBAL g, int low, int high, int origin) override; + bool Read(PGLOBAL g, void *buf, int n, int size) override; + int Write(PGLOBAL g, void *buf, int n, int size, bool& rc) override; + void Close(char *fn, int id) override; #if defined(XMAP) - virtual void *FileView(PGLOBAL g, char *fn); + void *FileView(PGLOBAL g, char *fn) override; #endif // XMAP protected: @@ -418,21 +418,21 @@ class DllExport XXROW : public XXBASE { XXROW(PTDBDOS tbxp); // Implementation - virtual IDT GetType(void) {return TYPE_IDX_XROW;} - virtual void Reset(void); + IDT GetType(void) override {return TYPE_IDX_XROW;} + void Reset(void) override; // Methods - virtual bool Init(PGLOBAL g); + bool Init(PGLOBAL g) override; #if defined(XMAP) - virtual bool MapInit(PGLOBAL) {return true;} + bool MapInit(PGLOBAL) override {return true;} #endif // XMAP - virtual int Fetch(PGLOBAL g); - virtual int FastFind(void); - virtual int MaxRange(void) {return 1;} - virtual int Range(PGLOBAL g, int limit = 0, bool incl = true); - virtual int Qcompare(int *, int *) {assert(false); return 0;} - virtual bool Make(PGLOBAL, PIXDEF) {return false;} - virtual void Close(void) {} + int Fetch(PGLOBAL g) override; + int FastFind(void) override; + int MaxRange(void) override {return 1;} + int Range(PGLOBAL g, int limit = 0, bool incl = true) override; + int Qcompare(int *, int *) override {assert(false); return 0;} + bool Make(PGLOBAL, PIXDEF) override {return false;} + void Close(void) override {} protected: // Members diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h index 5b50e9320f5..9d8651a3b87 100644 --- a/storage/connect/xobject.h +++ b/storage/connect/xobject.h @@ -75,17 +75,17 @@ class DllExport XVOID : public XOBJECT { XVOID(void) {Constant = true;} // Implementation - virtual int GetType(void) {return TYPE_VOID;} - virtual int GetLength(void) {return 0;} - virtual int GetLengthEx(void) {return 0;} - virtual PSZ GetCharValue(void) {return NULL;} - virtual int GetIntValue(void) {return 0;} - virtual double GetFloatValue(void) {return 0.0;} - virtual int GetScale() {return 0;} + int GetType(void) override {return TYPE_VOID;} + int GetLength(void) override {return 0;} + int GetLengthEx(void) override {return 0;} + PSZ GetCharValue(void) override {return NULL;} + int GetIntValue(void) override {return 0;} + double GetFloatValue(void) override {return 0.0;} + int GetScale() override {return 0;} // Methods - virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;} - virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;} + bool Compare(PXOB xp) override {return xp->GetType() == TYPE_VOID;} + bool SetFormat(PGLOBAL, FORMAT&) override {return true;} }; // end of class XVOID @@ -100,20 +100,20 @@ class DllExport CONSTANT : public XOBJECT { CONSTANT(PVAL valp) {Value = valp; Constant = true;} // Implementation - virtual int GetType(void) {return TYPE_CONST;} - virtual int GetResultType(void) {return Value->Type;} - virtual int GetLength(void) {return Value->GetValLen();} - virtual int GetScale() {return Value->GetValPrec();} - virtual int GetLengthEx(void); + int GetType(void) override {return TYPE_CONST;} + int GetResultType(void) override {return Value->Type;} + int GetLength(void) override {return Value->GetValLen();} + int GetScale() override {return Value->GetValPrec();} + int GetLengthEx(void) override; // Methods - virtual bool Compare(PXOB xp); - virtual bool SetFormat(PGLOBAL g, FORMAT& fmt) + bool Compare(PXOB xp) override; + bool SetFormat(PGLOBAL g, FORMAT& fmt) override {return Value->SetConstFormat(g, fmt);} void Convert(PGLOBAL g, int newtype); void SetValue(PVAL vp) {Value = vp;} - virtual void Printf(PGLOBAL g, FILE *, uint); - virtual void Prints(PGLOBAL g, char *, uint); + void Printf(PGLOBAL g, FILE *, uint) override; + void Prints(PGLOBAL g, char *, uint) override; }; // end of class CONSTANT /***********************************************************************/ diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index 58acf550a0b..a96b5c6b3c6 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -109,8 +109,8 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block. virtual PTDB Copy(PTABS t); virtual void PrintAM(FILE *f, char *m) {fprintf(f, "%s AM(%d)\n", m, GetAmType());} - virtual void Printf(PGLOBAL g, FILE *f, uint n); - virtual void Prints(PGLOBAL g, char *ps, uint z); + void Printf(PGLOBAL g, FILE *f, uint n) override; + void Prints(PGLOBAL g, char *ps, uint z) override; virtual PCSZ GetServer(void) = 0; virtual int GetBadLines(void) {return 0;} virtual CHARSET_INFO *data_charset(void); @@ -173,7 +173,7 @@ class DllExport TDBASE : public TDB { inline void SetKindex(PKXBASE kxp) {To_Kindex = kxp;} // Properties - PKXBASE GetKindex(void) {return To_Kindex;} + PKXBASE GetKindex(void) override {return To_Kindex;} PXOB *GetLink(void) {return To_Link;} PIXDEF GetXdp(void) {return To_Xdp;} void ResetKindex(PGLOBAL g, PKXBASE kxp); @@ -182,17 +182,17 @@ class DllExport TDBASE : public TDB { // Methods virtual bool IsUsingTemp(PGLOBAL) {return false;} - virtual PCATLG GetCat(void); - virtual void PrintAM(FILE *f, char *m); - virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);} + PCATLG GetCat(void) override; + void PrintAM(FILE *f, char *m) override; + int GetProgMax(PGLOBAL g) override {return GetMaxSize(g);} virtual void RestoreNrec(void) {} virtual int ResetTableOpt(PGLOBAL g, bool dop, bool dox); - virtual PCSZ GetServer(void) {return "Current";} + PCSZ GetServer(void) override {return "Current";} // Database routines virtual int MakeIndex(PGLOBAL g, PIXDEF, bool) {strcpy(g->Message, "Remote index"); return RC_INFO;} - virtual bool ReadKey(PGLOBAL, OPVAL, const key_range *) + bool ReadKey(PGLOBAL, OPVAL, const key_range *) override {assert(false); return true;} protected: @@ -218,23 +218,23 @@ class DllExport TDBCAT : public TDBASE { TDBCAT(PTABDEF tdp); // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_CAT;} + AMT GetAmType(void) override {return TYPE_AM_CAT;} // Methods - virtual int GetRecpos(void) {return N;} - virtual int GetProgCur(void) {return N;} - virtual int RowNumber(PGLOBAL, bool = false) {return N + 1;} - virtual bool SetRecpos(PGLOBAL g, int recpos); + int GetRecpos(void) override {return N;} + int GetProgCur(void) override {return N;} + int RowNumber(PGLOBAL, bool = false) override {return N + 1;} + bool SetRecpos(PGLOBAL g, int recpos) override; // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); - virtual int Cardinality(PGLOBAL) {return 10;} // To avoid assert - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); + PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override; + int Cardinality(PGLOBAL) override {return 10;} // To avoid assert + int GetMaxSize(PGLOBAL g) override; + bool OpenDB(PGLOBAL g) override; + int ReadDB(PGLOBAL g) override; + int WriteDB(PGLOBAL g) override; + int DeleteDB(PGLOBAL g, int irc) override; + void CloseDB(PGLOBAL g) override; protected: // Specific routines @@ -258,10 +258,10 @@ class DllExport CATCOL : public COLBLK { CATCOL(PCOLDEF cdp, PTDB tdbp, int n); // Implementation - virtual int GetAmType(void) {return TYPE_AM_ODBC;} + int GetAmType(void) override {return TYPE_AM_ODBC;} // Methods - virtual void ReadColumn(PGLOBAL g); + void ReadColumn(PGLOBAL g) override; protected: CATCOL(void) = default; // Default constructor not to be used diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 043183444da..68dd7b29d99 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -102,14 +102,14 @@ public: delete file_buff; free_root(&blobroot, MYF(0)); } - const char *index_type(uint inx) { return "NONE"; } - ulonglong table_flags() const + const char *index_type(uint inx) override { return "NONE"; } + ulonglong table_flags() const override { return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_CAN_EXPORT | HA_CAN_REPAIR | HA_SLOW_RND_POS); } - ulong index_flags(uint idx, uint part, bool all_parts) const + ulong index_flags(uint idx, uint part, bool all_parts) const override { /* We will never have indexes so this will never be called(AKA we return @@ -124,7 +124,7 @@ public: /* Called in test_quick_select to determine if indexes should be used. */ - virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; } + double scan_time() override { return (double) (stats.records+stats.deleted) / 20.0+10; } /* The next method will never be called */ virtual bool fast_key_read() { return 1;} /* @@ -132,38 +132,38 @@ public: (e.g. save number of records seen on full table scan and/or use file size as upper bound) */ - ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; } + ha_rows estimate_rows_upper_bound() override { return HA_POS_ERROR; } - int open(const char *name, int mode, uint open_options); - int close(void); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); - int rnd_init(bool scan=1); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); - bool check_and_repair(THD *thd); - int check(THD* thd, HA_CHECK_OPT* check_opt); - bool is_crashed() const; - int rnd_end(); - int repair(THD* thd, HA_CHECK_OPT* check_opt); + int open(const char *name, int mode, uint open_options) override; + int close(void) override; + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; + int rnd_init(bool scan=1) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; + bool check_and_repair(THD *thd) override; + int check(THD* thd, HA_CHECK_OPT* check_opt) override; + bool is_crashed() const override; + int rnd_end() override; + int repair(THD* thd, HA_CHECK_OPT* check_opt) override; /* This is required for SQL layer to know that we support autorepair */ - bool auto_repair(int error) const + bool auto_repair(int error) const override { return error == HA_ERR_CRASHED_ON_USAGE; } bool auto_repair() const { return 1; } - void position(const uchar *record); - int info(uint); - int reset(); - int extra(enum ha_extra_function operation); - int delete_all_rows(void); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + void position(const uchar *record) override; + int info(uint) override; + int reset() override; + int extra(enum ha_extra_function operation) override; + int delete_all_rows(void) override; + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; bool check_if_incompatible_data(HA_CREATE_INFO *info, - uint table_changes); + uint table_changes) override; - int external_lock(THD *thd, int lock_type); + int external_lock(THD *thd, int lock_type) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); + enum thr_lock_type lock_type) override; /* These functions used to get/update status of the handler. diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 5d067f7cda9..aa38b58d24b 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -74,13 +74,13 @@ public: The name of the index type that will be used for display. Don't implement this method unless you really have indexes. */ - const char *index_type(uint inx) { return "HASH"; } + const char *index_type(uint inx) override { return "HASH"; } /** @brief This is a list of flags that indicate what functionality the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const + ulonglong table_flags() const override { /* We are saying that this engine is just statement capable to have @@ -100,7 +100,7 @@ public: If all_parts is set, MySQL wants to know the flags for the combined index, up to and including 'part'. */ - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return 0; } @@ -112,7 +112,7 @@ public: send. Return *real* limits of your storage engine here; MySQL will do min(your_limits, MySQL_limits) automatically. */ - uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } + uint max_supported_record_length() const override { return HA_MAX_REC_LENGTH; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -123,7 +123,7 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_keys() const { return 0; } + uint max_supported_keys() const override { return 0; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -134,7 +134,7 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_key_parts() const { return 0; } + uint max_supported_key_parts() const override { return 0; } /** @brief unireg.cc will call this to make sure that the storage engine can handle @@ -145,17 +145,17 @@ public: There is no need to implement ..._key_... methods if your engine doesn't support indexes. */ - uint max_supported_key_length() const { return 0; } + uint max_supported_key_length() const override { return 0; } /** @brief Called in test_quick_select to determine if indexes should be used. */ - virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; } + double scan_time() override { return (double) (stats.records+stats.deleted) / 20.0+10; } /** @brief This method will never be called if you do not implement indexes. */ - virtual double read_time(uint, uint, ha_rows rows) + double read_time(uint, uint, ha_rows rows) override { return (double) rows / 20.0+1; } /* @@ -167,61 +167,61 @@ public: /** @brief We implement this in ha_example.cc; it's a required method. */ - int open(const char *name, int mode, uint test_if_locked); // required + int open(const char *name, int mode, uint test_if_locked) override; // required /** @brief We implement this in ha_example.cc; it's a required method. */ - int close(void); // required + int close(void) override; // required /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int write_row(const uchar *buf); + int write_row(const uchar *buf) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int update_row(const uchar *old_data, const uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int delete_row(const uchar *buf); + int delete_row(const uchar *buf) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ int index_read_map(uchar *buf, const uchar *key, - key_part_map keypart_map, enum ha_rkey_function find_flag); + key_part_map keypart_map, enum ha_rkey_function find_flag) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_next(uchar *buf); + int index_next(uchar *buf) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_prev(uchar *buf); + int index_prev(uchar *buf) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_first(uchar *buf); + int index_first(uchar *buf) override; /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_last(uchar *buf); + int index_last(uchar *buf) override; /** @brief Unlike index_init(), rnd_init() can be called two consecutive times @@ -231,24 +231,24 @@ public: cursor to the start of the table; no need to deallocate and allocate it again. This is a required method. */ - int rnd_init(bool scan); //required - int rnd_end(); - int rnd_next(uchar *buf); ///< required - int rnd_pos(uchar *buf, uchar *pos); ///< required - void position(const uchar *record); ///< required - int info(uint); ///< required - int extra(enum ha_extra_function operation); - int external_lock(THD *thd, int lock_type); ///< required - int delete_all_rows(void); + int rnd_init(bool scan) override; //required + int rnd_end() override; + int rnd_next(uchar *buf) override; ///< required + int rnd_pos(uchar *buf, uchar *pos) override; ///< required + void position(const uchar *record) override; ///< required + int info(uint) override; ///< required + int extra(enum ha_extra_function operation) override; + int external_lock(THD *thd, int lock_type) override; ///< required + int delete_all_rows(void) override; ha_rows records_in_range(uint inx, const key_range *min_key, - const key_range *max_key, page_range *pages); - int delete_table(const char *from); + const key_range *max_key, page_range *pages) override; + int delete_table(const char *from) override; int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); ///< required + HA_CREATE_INFO *create_info) override; ///< required enum_alter_inplace_result check_if_supported_inplace_alter(TABLE* altered_table, - Alter_inplace_info* ha_alter_info); + Alter_inplace_info* ha_alter_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); ///< required + enum thr_lock_type lock_type) override; ///< required }; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 11d4af6dd51..37d518eaaf1 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1658,7 +1658,7 @@ public: public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, - const char* msg, Sql_condition ** cond_hdl) + const char* msg, Sql_condition ** cond_hdl) override { return sql_errno >= ER_ABORTING_CONNECTION && sql_errno <= ER_NET_WRITE_INTERRUPTED; diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index fe729f08413..a08eebf30f5 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -131,13 +131,13 @@ public: don't implement this method unless you really have indexes */ // perhaps get index type - const char *index_type(uint inx) { return "REMOTE"; } + const char *index_type(uint inx) override { return "REMOTE"; } /* This is a list of flags that says what the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const + ulonglong table_flags() const override { /* fix server to be able to get remote server table flags */ return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED @@ -160,15 +160,15 @@ public: index up to and including 'part'. */ /* fix server to be able to get remote server index flags */ - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return (HA_READ_NEXT | HA_READ_RANGE | HA_READ_AFTER_KEY); } - uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } - uint max_supported_keys() const { return MAX_KEY; } - uint max_supported_key_parts() const { return MAX_REF_PARTS; } - uint max_supported_key_length() const { return FEDERATED_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return FEDERATED_MAX_KEY_LENGTH; } + uint max_supported_record_length() const override { return HA_MAX_REC_LENGTH; } + uint max_supported_keys() const override { return MAX_KEY; } + uint max_supported_key_parts() const override { return MAX_REF_PARTS; } + uint max_supported_key_length() const override { return FEDERATED_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const override { return FEDERATED_MAX_KEY_LENGTH; } /* Called in test_quick_select to determine if indexes should be used. Normally, we need to know number of blocks . For federated we need to @@ -180,7 +180,7 @@ public: The reason for "records * 1000" is that such a large number forces this to use indexes " */ - double scan_time() + double scan_time() override { DBUG_PRINT("info", ("records %lu", (ulong) stats.records)); return (double)(stats.records*1000); @@ -188,7 +188,7 @@ public: /* The next method will never be called if you do not implement indexes. */ - double read_time(uint index, uint ranges, ha_rows rows) + double read_time(uint index, uint ranges, ha_rows rows) override { /* Per Brian, this number is bugus, but this method must be implemented, @@ -197,33 +197,33 @@ public: return (double) rows / 20.0+1; } - const key_map *keys_to_use_for_scanning() { return &key_map_full; } + const key_map *keys_to_use_for_scanning() override { return &key_map_full; } /* Everything below are methods that we implment in ha_federated.cc. Most of these methods are not obligatory, skip them and MySQL will treat them as not implemented */ - int open(const char *name, int mode, uint test_if_locked); // required - int close(void); // required + int open(const char *name, int mode, uint test_if_locked) override; // required + int close(void) override; // required - void start_bulk_insert(ha_rows rows, uint flags); - int end_bulk_insert(); - int write_row(const uchar *buf); - int update_row(const uchar *old_data, const uchar *new_data); - int delete_row(const uchar *buf); - int index_init(uint keynr, bool sorted); - ha_rows estimate_rows_upper_bound(); + void start_bulk_insert(ha_rows rows, uint flags) override; + int end_bulk_insert() override; + int write_row(const uchar *buf) override; + int update_row(const uchar *old_data, const uchar *new_data) override; + int delete_row(const uchar *buf) override; + int index_init(uint keynr, bool sorted) override; + ha_rows estimate_rows_upper_bound() override; int index_read(uchar *buf, const uchar *key, - uint key_len, enum ha_rkey_function find_flag); + uint key_len, enum ha_rkey_function find_flag) override; int index_read_idx(uchar *buf, uint idx, const uchar *key, uint key_len, enum ha_rkey_function find_flag); - int index_next(uchar *buf); - int index_end(); + int index_next(uchar *buf) override; + int index_end() override; int read_range_first(const key_range *start_key, const key_range *end_key, - bool eq_range, bool sorted); - int read_range_next(); + bool eq_range, bool sorted) override; + int read_range_next() override; /* unlike index_init(), rnd_init() can be called two times without rnd_end() in between (it only makes sense if scan=1). @@ -232,17 +232,17 @@ public: position it to the start of the table, no need to deallocate and allocate it again */ - int rnd_init(bool scan); //required - int rnd_end(); - int rnd_next(uchar *buf); //required + int rnd_init(bool scan) override; //required + int rnd_end() override; + int rnd_next(uchar *buf) override; //required int rnd_next_int(uchar *buf); - int rnd_pos(uchar *buf, uchar *pos); //required - void position(const uchar *record); //required + int rnd_pos(uchar *buf, uchar *pos) override; //required + void position(const uchar *record) override; //required /* A ref is a pointer inside a local buffer. It is not comparable to other ref's. This is never called as HA_NON_COMPARABLE_ROWID is set. */ - int cmp_ref(const uchar *ref1, const uchar *ref2) + int cmp_ref(const uchar *ref1, const uchar *ref2) override { #ifdef NOT_YET DBUG_ASSERT(0); @@ -251,38 +251,38 @@ public: return handler::cmp_ref(ref1,ref2); /* Works if table scan is used */ #endif } - int info(uint); //required - int extra(ha_extra_function operation); + int info(uint) override; //required + int extra(ha_extra_function operation) override; void update_auto_increment(void); - int repair(THD* thd, HA_CHECK_OPT* check_opt); - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - int delete_table(const char *name) + int repair(THD* thd, HA_CHECK_OPT* check_opt) override; + int optimize(THD* thd, HA_CHECK_OPT* check_opt) override; + int delete_table(const char *name) override { return 0; } - int delete_all_rows(void); - int truncate(); + int delete_all_rows(void) override; + int truncate() override; int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); //required + HA_CREATE_INFO *create_info) override; //required ha_rows records_in_range(uint inx, const key_range *start_key, const key_range *end_key, - page_range *pages); - uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; } + page_range *pages) override; + uint8 table_cache_type() override { return HA_CACHE_TBL_NOCACHE; } THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); //required - bool get_error_message(int error, String *buf); + enum thr_lock_type lock_type) override; //required + bool get_error_message(int error, String *buf) override; MYSQL_RES *store_result(MYSQL *mysql); void free_result(); - int external_lock(THD *thd, int lock_type); + int external_lock(THD *thd, int lock_type) override; int connection_commit(); int connection_rollback(); int connection_autocommit(bool state); int execute_simple_query(const char *query, int len); - int reset(void); + int reset(void) override; }; diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc index 5649b903060..6cb520c9175 100644 --- a/storage/federatedx/federatedx_io_mysql.cc +++ b/storage/federatedx/federatedx_io_mysql.cc @@ -73,55 +73,55 @@ class federatedx_io_mysql :public federatedx_io bool test_all_restrict() const; public: federatedx_io_mysql(FEDERATEDX_SERVER *); - ~federatedx_io_mysql(); + ~federatedx_io_mysql() override; int simple_query(const char *fmt, ...); - int query(const char *buffer, size_t length); - virtual FEDERATEDX_IO_RESULT *store_result(); + int query(const char *buffer, size_t length) override; + FEDERATEDX_IO_RESULT *store_result() override; - virtual size_t max_query_size() const; + size_t max_query_size() const override; - virtual my_ulonglong affected_rows() const; - virtual my_ulonglong last_insert_id() const; + my_ulonglong affected_rows() const override; + my_ulonglong last_insert_id() const override; - virtual int error_code(); - virtual const char *error_str(); + int error_code() override; + const char *error_str() override; - void reset(); - int commit(); - int rollback(); + void reset() override; + int commit() override; + int rollback() override; - int savepoint_set(ulong sp); - ulong savepoint_release(ulong sp); - ulong savepoint_rollback(ulong sp); - void savepoint_restrict(ulong sp); + int savepoint_set(ulong sp) override; + ulong savepoint_release(ulong sp) override; + ulong savepoint_rollback(ulong sp) override; + void savepoint_restrict(ulong sp) override; - ulong last_savepoint() const; - ulong actual_savepoint() const; - bool is_autocommit() const; + ulong last_savepoint() const override; + ulong actual_savepoint() const override; + bool is_autocommit() const override; bool table_metadata(ha_statistics *stats, const char *table_name, - uint table_name_length, uint flag); + uint table_name_length, uint flag) override; /* resultset operations */ - virtual void free_result(FEDERATEDX_IO_RESULT *io_result); - virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result); - virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result); - virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result, - FEDERATEDX_IO_ROWS **current= NULL); - virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result); - virtual const char *get_column_data(FEDERATEDX_IO_ROW *row, - unsigned int column); - virtual bool is_column_null(const FEDERATEDX_IO_ROW *row, - unsigned int column) const; + void free_result(FEDERATEDX_IO_RESULT *io_result) override; + unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result) override; + my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result) override; + FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result, + FEDERATEDX_IO_ROWS **current= NULL) override; + ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result) override; + const char *get_column_data(FEDERATEDX_IO_ROW *row, + unsigned int column) override; + bool is_column_null(const FEDERATEDX_IO_ROW *row, + unsigned int column) const override; - virtual size_t get_ref_length() const; - virtual void mark_position(FEDERATEDX_IO_RESULT *io_result, - void *ref, FEDERATEDX_IO_ROWS *current); - virtual int seek_position(FEDERATEDX_IO_RESULT **io_result, - const void *ref); - virtual void set_thd(void *thd); + size_t get_ref_length() const override; + void mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref, FEDERATEDX_IO_ROWS *current) override; + int seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref) override; + void set_thd(void *thd) override; }; diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc index 8a2394f2150..24e499e4ba4 100644 --- a/storage/federatedx/federatedx_io_null.cc +++ b/storage/federatedx/federatedx_io_null.cc @@ -56,52 +56,52 @@ class federatedx_io_null :public federatedx_io { public: federatedx_io_null(FEDERATEDX_SERVER *); - ~federatedx_io_null(); + ~federatedx_io_null() override; - int query(const char *buffer, size_t length); - virtual FEDERATEDX_IO_RESULT *store_result(); + int query(const char *buffer, size_t length) override; + FEDERATEDX_IO_RESULT *store_result() override; - virtual size_t max_query_size() const; + size_t max_query_size() const override; - virtual my_ulonglong affected_rows() const; - virtual my_ulonglong last_insert_id() const; + my_ulonglong affected_rows() const override; + my_ulonglong last_insert_id() const override; - virtual int error_code(); - virtual const char *error_str(); + int error_code() override; + const char *error_str() override; - void reset(); - int commit(); - int rollback(); + void reset() override; + int commit() override; + int rollback() override; - int savepoint_set(ulong sp); - ulong savepoint_release(ulong sp); - ulong savepoint_rollback(ulong sp); - void savepoint_restrict(ulong sp); + int savepoint_set(ulong sp) override; + ulong savepoint_release(ulong sp) override; + ulong savepoint_rollback(ulong sp) override; + void savepoint_restrict(ulong sp) override; - ulong last_savepoint() const; - ulong actual_savepoint() const; - bool is_autocommit() const; + ulong last_savepoint() const override; + ulong actual_savepoint() const override; + bool is_autocommit() const override; bool table_metadata(ha_statistics *stats, const char *table_name, - uint table_name_length, uint flag); + uint table_name_length, uint flag) override; /* resultset operations */ - virtual void free_result(FEDERATEDX_IO_RESULT *io_result); - virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result); - virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result); - virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result, - FEDERATEDX_IO_ROWS **current= NULL); - virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result); - virtual const char *get_column_data(FEDERATEDX_IO_ROW *row, - unsigned int column); - virtual bool is_column_null(const FEDERATEDX_IO_ROW *row, - unsigned int column) const; - virtual size_t get_ref_length() const; - virtual void mark_position(FEDERATEDX_IO_RESULT *io_result, - void *ref, FEDERATEDX_IO_ROWS *current); - virtual int seek_position(FEDERATEDX_IO_RESULT **io_result, - const void *ref); + void free_result(FEDERATEDX_IO_RESULT *io_result) override; + unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result) override; + my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result) override; + FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result, + FEDERATEDX_IO_ROWS **current= NULL) override; + ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result) override; + const char *get_column_data(FEDERATEDX_IO_ROW *row, + unsigned int column) override; + bool is_column_null(const FEDERATEDX_IO_ROW *row, + unsigned int column) const override; + size_t get_ref_length() const override; + void mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref, FEDERATEDX_IO_ROWS *current) override; + int seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref) override; }; diff --git a/storage/federatedx/federatedx_pushdown.h b/storage/federatedx/federatedx_pushdown.h index 673abcfc68d..a40594a988c 100644 --- a/storage/federatedx/federatedx_pushdown.h +++ b/storage/federatedx/federatedx_pushdown.h @@ -33,10 +33,10 @@ private: public: ha_federatedx_derived_handler(THD* thd_arg, TABLE_LIST *tbl); ~ha_federatedx_derived_handler(); - int init_scan(); - int next_row(); - int end_scan(); - void print_error(int, unsigned long); + int init_scan() override; + int next_row() override; + int end_scan() override; + void print_error(int, unsigned long) override; }; @@ -56,8 +56,8 @@ private: public: ha_federatedx_select_handler(THD* thd_arg, SELECT_LEX *sel); ~ha_federatedx_select_handler(); - int init_scan(); - int next_row(); - int end_scan(); - void print_error(int, unsigned long); + int init_scan() override; + int next_row() override; + int end_scan() override; + void print_error(int, unsigned long) override; }; diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 13392d6234c..6c476661c1d 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1820,7 +1820,7 @@ public: public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, Sql_condition::enum_warning_level *level, - const char* msg, Sql_condition ** cond_hdl) + const char* msg, Sql_condition ** cond_hdl) override { return sql_errno >= ER_ABORTING_CONNECTION && sql_errno <= ER_NET_WRITE_INTERRUPTED; diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index e8ed9713f3e..d270e52d247 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -325,13 +325,13 @@ public: don't implement this method unless you really have indexes */ // perhaps get index type - const char *index_type(uint inx) { return "REMOTE"; } + const char *index_type(uint inx) override { return "REMOTE"; } /* This is a list of flags that says what the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const + ulonglong table_flags() const override { /* fix server to be able to get remote server table flags */ return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED @@ -351,15 +351,15 @@ public: index up to and including 'part'. */ /* fix server to be able to get remote server index flags */ - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return (HA_READ_NEXT | HA_READ_RANGE); } - uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } - uint max_supported_keys() const { return MAX_KEY; } - uint max_supported_key_parts() const { return MAX_REF_PARTS; } - uint max_supported_key_length() const { return FEDERATEDX_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return FEDERATEDX_MAX_KEY_LENGTH; } + uint max_supported_record_length() const override { return HA_MAX_REC_LENGTH; } + uint max_supported_keys() const override { return MAX_KEY; } + uint max_supported_key_parts() const override { return MAX_REF_PARTS; } + uint max_supported_key_length() const override { return FEDERATEDX_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const override { return FEDERATEDX_MAX_KEY_LENGTH; } /* Called in test_quick_select to determine if indexes should be used. Normally, we need to know number of blocks . For federatedx we need to @@ -371,7 +371,7 @@ public: The reason for "records * 1000" is that such a large number forces this to use indexes " */ - double scan_time() + double scan_time() override { DBUG_PRINT("info", ("records %lu", (ulong) stats.records)); return (double)(stats.records*1000); @@ -379,7 +379,7 @@ public: /* The next method will never be called if you do not implement indexes. */ - double read_time(uint index, uint ranges, ha_rows rows) + double read_time(uint index, uint ranges, ha_rows rows) override { /* Per Brian, this number is bugus, but this method must be implemented, @@ -388,33 +388,33 @@ public: return (double) rows / 20.0+1; } - const key_map *keys_to_use_for_scanning() { return &key_map_full; } + const key_map *keys_to_use_for_scanning() override { return &key_map_full; } /* Everything below are methods that we implment in ha_federatedx.cc. Most of these methods are not obligatory, skip them and MySQL will treat them as not implemented */ - int open(const char *name, int mode, uint test_if_locked); // required - int close(void); // required + int open(const char *name, int mode, uint test_if_locked) override; // required + int close(void) override; // required - void start_bulk_insert(ha_rows rows, uint flags); - int end_bulk_insert(); - int write_row(const uchar *buf); - int update_row(const uchar *old_data, const uchar *new_data); - int delete_row(const uchar *buf); - int index_init(uint keynr, bool sorted); - ha_rows estimate_rows_upper_bound(); + void start_bulk_insert(ha_rows rows, uint flags) override; + int end_bulk_insert() override; + int write_row(const uchar *buf) override; + int update_row(const uchar *old_data, const uchar *new_data) override; + int delete_row(const uchar *buf) override; + int index_init(uint keynr, bool sorted) override; + ha_rows estimate_rows_upper_bound() override; int index_read(uchar *buf, const uchar *key, - uint key_len, enum ha_rkey_function find_flag); + uint key_len, enum ha_rkey_function find_flag) override; int index_read_idx(uchar *buf, uint idx, const uchar *key, uint key_len, enum ha_rkey_function find_flag); - int index_next(uchar *buf); - int index_end(); + int index_next(uchar *buf) override; + int index_end() override; int read_range_first(const key_range *start_key, const key_range *end_key, - bool eq_range, bool sorted); - int read_range_next(); + bool eq_range, bool sorted) override; + int read_range_next() override; /* unlike index_init(), rnd_init() can be called two times without rnd_end() in between (it only makes sense if scan=1). @@ -423,16 +423,16 @@ public: position it to the start of the table, no need to deallocate and allocate it again */ - int rnd_init(bool scan); //required - int rnd_end(); - int rnd_next(uchar *buf); //required - int rnd_pos(uchar *buf, uchar *pos); //required - void position(const uchar *record); //required + int rnd_init(bool scan) override; //required + int rnd_end() override; + int rnd_next(uchar *buf) override; //required + int rnd_pos(uchar *buf, uchar *pos) override; //required + void position(const uchar *record) override; //required /* A ref is a pointer inside a local buffer. It is not comparable to other ref's. This is never called as HA_NON_COMPARABLE_ROWID is set. */ - int cmp_ref(const uchar *ref1, const uchar *ref2) + int cmp_ref(const uchar *ref1, const uchar *ref2) override { #ifdef NOT_YET DBUG_ASSERT(0); @@ -441,29 +441,29 @@ public: return handler::cmp_ref(ref1,ref2); /* Works if table scan is used */ #endif } - int info(uint); //required - int extra(ha_extra_function operation); + int info(uint) override; //required + int extra(ha_extra_function operation) override; void update_auto_increment(void); - int repair(THD* thd, HA_CHECK_OPT* check_opt); - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - int delete_table(const char *name) + int repair(THD* thd, HA_CHECK_OPT* check_opt) override; + int optimize(THD* thd, HA_CHECK_OPT* check_opt) override; + int delete_table(const char *name) override { return 0; } - int delete_all_rows(void); + int delete_all_rows(void) override; int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); //required + HA_CREATE_INFO *create_info) override; //required ha_rows records_in_range(uint inx, const key_range *start_key, - const key_range *end_key, page_range *pages); - uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; } + const key_range *end_key, page_range *pages) override; + uint8 table_cache_type() override { return HA_CACHE_TBL_NOCACHE; } THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); //required - bool get_error_message(int error, String *buf); - int start_stmt(THD *thd, thr_lock_type lock_type); - int external_lock(THD *thd, int lock_type); - int reset(void); + enum thr_lock_type lock_type) override; //required + bool get_error_message(int error, String *buf) override; + int start_stmt(THD *thd, thr_lock_type lock_type) override; + int external_lock(THD *thd, int lock_type) override; + int reset(void) override; int free_result(void); const FEDERATEDX_SHARE *get_federatedx_share() const { return share; } diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index d8636f7fc7e..c38ec325740 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -37,15 +37,15 @@ class ha_heap final : public handler public: ha_heap(handlerton *hton, TABLE_SHARE *table); ~ha_heap() = default; - handler *clone(const char *name, MEM_ROOT *mem_root); - const char *index_type(uint inx) + handler *clone(const char *name, MEM_ROOT *mem_root) override; + const char *index_type(uint inx) override { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? "BTREE" : "HASH"); } /* Rows also use a fixed-size format */ - enum row_type get_row_type() const { return ROW_TYPE_FIXED; } - ulonglong table_flags() const + enum row_type get_row_type() const override { return ROW_TYPE_FIXED; } + ulonglong table_flags() const override { return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | @@ -53,73 +53,73 @@ public: HA_REC_NOT_IN_SEQ | HA_CAN_INSERT_DELAYED | HA_NO_TRANSACTIONS | HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT | HA_CAN_HASH_KEYS); } - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE : HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); } - const key_map *keys_to_use_for_scanning() { return &btree_keys; } - uint max_supported_keys() const { return MAX_KEY; } - uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; } - double scan_time() + const key_map *keys_to_use_for_scanning() override { return &btree_keys; } + uint max_supported_keys() const override { return MAX_KEY; } + uint max_supported_key_part_length() const override { return MAX_KEY_LENGTH; } + double scan_time() override { return (double) (stats.records+stats.deleted) / 20.0+10; } - double read_time(uint index, uint ranges, ha_rows rows) + double read_time(uint index, uint ranges, ha_rows rows) override { return (double) (rows +1)/ 20.0; } - double keyread_time(uint index, uint ranges, ha_rows rows) + double keyread_time(uint index, uint ranges, ha_rows rows) override { return (double) (rows + ranges) / 20.0 ; } - double avg_io_cost() + double avg_io_cost() override { return 0.05; } /* 1/20 */ - int open(const char *name, int mode, uint test_if_locked); - int close(void); + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; void set_keys_for_scanning(void); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); - virtual void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values); + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; + void get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) override; int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map); + enum ha_rkey_function find_flag) override; + int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map) override; int index_read_idx_map(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - int rnd_init(bool scan); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); - void position(const uchar *record); - int can_continue_handler_scan(); - int info(uint); - int extra(enum ha_extra_function operation); - int reset(); - int external_lock(THD *thd, int lock_type); - int delete_all_rows(void); - int reset_auto_increment(ulonglong value); - int disable_indexes(key_map map, bool persist); - int enable_indexes(key_map map, bool persist); - int indexes_are_disabled(void); + enum ha_rkey_function find_flag) override; + int index_next(uchar * buf) override; + int index_prev(uchar * buf) override; + int index_first(uchar * buf) override; + int index_last(uchar * buf) override; + int rnd_init(bool scan) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; + void position(const uchar *record) override; + int can_continue_handler_scan() override; + int info(uint) override; + int extra(enum ha_extra_function operation) override; + int reset() override; + int external_lock(THD *thd, int lock_type) override; + int delete_all_rows(void) override; + int reset_auto_increment(ulonglong value) override; + int disable_indexes(key_map map, bool persist) override; + int enable_indexes(key_map map, bool persist) override; + int indexes_are_disabled(void) override; ha_rows records_in_range(uint inx, const key_range *start_key, - const key_range *end_key, page_range *pages); - int delete_table(const char *from); - void drop_table(const char *name); - int rename_table(const char * from, const char * to); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); - void update_create_info(HA_CREATE_INFO *create_info); + const key_range *end_key, page_range *pages) override; + int delete_table(const char *from) override; + void drop_table(const char *name) override; + int rename_table(const char * from, const char * to) override; + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; + void update_create_info(HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - int cmp_ref(const uchar *ref1, const uchar *ref2) + enum thr_lock_type lock_type) override; + int cmp_ref(const uchar *ref1, const uchar *ref2) override { return memcmp(ref1, ref2, sizeof(HEAP_PTR)); } - bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); - int find_unique_row(uchar *record, uint unique_idx); + bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) override; + int find_unique_row(uchar *record, uint unique_idx) override; private: void update_key_stats(); }; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index ec34b7d1b67..79024177125 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1013,7 +1013,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx prebuilt); } - ~ha_innobase_inplace_ctx() + ~ha_innobase_inplace_ctx() override { UT_DELETE(m_stage); if (instant_table) { @@ -1122,7 +1122,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx /** Share context between partitions. @param[in] ctx context from another partition of the table */ - void set_shared_data(const inplace_alter_handler_ctx& ctx) + void set_shared_data(const inplace_alter_handler_ctx& ctx) override { if (add_autoinc != ULINT_UNDEFINED) { const ha_innobase_inplace_ctx& ha_ctx = diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 26385bb4494..662b2e94853 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -378,14 +378,14 @@ public: file_os_io &operator=(file_os_io &&rhs); ~file_os_io() noexcept; - dberr_t open(const char *path, bool read_only) noexcept final; + dberr_t open(const char *path, bool read_only) noexcept override final; bool is_opened() const noexcept { return m_fd != OS_FILE_CLOSED; } - dberr_t rename(const char *old_path, const char *new_path) noexcept final; - dberr_t close() noexcept final; - dberr_t read(os_offset_t offset, span buf) noexcept final; + dberr_t rename(const char *old_path, const char *new_path) noexcept override final; + dberr_t close() noexcept override final; + dberr_t read(os_offset_t offset, span buf) noexcept override final; dberr_t write(const char *path, os_offset_t offset, - span buf) noexcept final; - dberr_t flush() noexcept final; + span buf) noexcept override final; + dberr_t flush() noexcept override final; private: pfs_os_file_t m_fd{OS_FILE_CLOSED}; diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h index 68397827891..2f7f04e6632 100644 --- a/storage/innobase/include/sync0policy.h +++ b/storage/innobase/include/sync0policy.h @@ -177,7 +177,7 @@ public: Print information about the latch @return the string representation */ - virtual std::string to_string() const + std::string to_string() const override { std::ostringstream msg; const MutexDebug ctx= get(); diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 41f644364bd..353ffd88d49 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -77,7 +77,7 @@ public: { return max_supported_key_length(); } enum row_type get_row_type() const override final; void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override final; - virtual double scan_time() override final; + double scan_time() override final; int open(const char *name, int mode, uint test_if_locked) override; int close(void) override final; diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 6bf971aa347..2bc5c2b30f3 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -35,11 +35,8 @@ extern "C" { #include #include -#if __cplusplus >= 201402 -# define mrn_override override -#else -# define mrn_override -#endif +#define mrn_override override + #if (MYSQL_VERSION_ID >= 50514 && MYSQL_VERSION_ID < 50600) # define MRN_HANDLER_HAVE_FINAL_ADD_INDEX 1 @@ -455,10 +452,10 @@ public: int update_row(const uchar *old_data, const uchar *new_data) mrn_override; int delete_row(const uchar *buf) mrn_override; - uint max_supported_record_length() const mrn_override; - uint max_supported_keys() const mrn_override; - uint max_supported_key_parts() const mrn_override; - uint max_supported_key_length() const mrn_override; + uint max_supported_record_length() const mrn_override; + uint max_supported_keys() const mrn_override; + uint max_supported_key_parts() const mrn_override; + uint max_supported_key_length() const mrn_override; uint max_supported_key_part_length() const mrn_override; ha_rows records_in_range(uint inx, const key_range *min_key, diff --git a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp index b6e2893ad07..b1ae507542d 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp @@ -185,7 +185,7 @@ class Exception : public std::exception { virtual int line() const throw() { return line_; } - virtual const char *what() const throw() { + const char *what() const throw() override { return what_; } @@ -206,7 +206,7 @@ class Error : public Exception { : Exception(ex) {} virtual ~Error() throw() = default; - virtual ErrorCode code() const throw() { + ErrorCode code() const throw() override { return T; } }; diff --git a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.hpp index 60953faeb2f..63741e6bf20 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.hpp @@ -44,17 +44,17 @@ class GRN_DAT_API IdCursor : public Cursor { UInt32 limit = MAX_UINT32, UInt32 flags = 0); - void close(); + void close() override; - const Key &next(); + const Key &next() override; - UInt32 offset() const { + UInt32 offset() const override { return offset_; } - UInt32 limit() const { + UInt32 limit() const override { return limit_; } - UInt32 flags() const { + UInt32 flags() const override { return flags_; } diff --git a/storage/mroonga/vendor/groonga/lib/dat/key-cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/key-cursor.hpp index 56392b63c23..978724fce80 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/key-cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/key-cursor.hpp @@ -38,17 +38,17 @@ class GRN_DAT_API KeyCursor : public Cursor { UInt32 limit = MAX_UINT32, UInt32 flags = 0); - void close(); + void close() override; - const Key &next(); + const Key &next() override; - UInt32 offset() const { + UInt32 offset() const override { return offset_; } - UInt32 limit() const { + UInt32 limit() const override { return limit_; } - UInt32 flags() const { + UInt32 flags() const override { return flags_; } diff --git a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.hpp index 88a950b8bba..93c151242f0 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.hpp @@ -37,17 +37,17 @@ class GRN_DAT_API PredictiveCursor : public Cursor { UInt32 limit = MAX_UINT32, UInt32 flags = 0); - void close(); + void close() override; - const Key &next(); + const Key &next() override; - UInt32 offset() const { + UInt32 offset() const override { return offset_; } - UInt32 limit() const { + UInt32 limit() const override { return limit_; } - UInt32 flags() const { + UInt32 flags() const override { return flags_; } diff --git a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.hpp index 07a59186b37..8f6e04bd94b 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.hpp @@ -38,17 +38,17 @@ class GRN_DAT_API PrefixCursor : public Cursor { UInt32 limit = MAX_UINT32, UInt32 flags = 0); - void close(); + void close() override; - const Key &next(); + const Key &next() override; - UInt32 offset() const { + UInt32 offset() const override { return offset_; } - UInt32 limit() const { + UInt32 limit() const override { return limit_; } - UInt32 flags() const { + UInt32 flags() const override { return flags_; } diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index e0121dbeb51..46202468475 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -54,101 +54,101 @@ class ha_myisam final : public handler public: ha_myisam(handlerton *hton, TABLE_SHARE *table_arg); ~ha_myisam() = default; - handler *clone(const char *name, MEM_ROOT *mem_root); - const char *index_type(uint key_number); - ulonglong table_flags() const { return int_table_flags; } - int index_init(uint idx, bool sorted); - int index_end(); - int rnd_end(); + handler *clone(const char *name, MEM_ROOT *mem_root) override; + const char *index_type(uint key_number) override; + ulonglong table_flags() const override { return int_table_flags; } + int index_init(uint idx, bool sorted) override; + int index_end() override; + int rnd_end() override; - ulong index_flags(uint inx, uint part, bool all_parts) const; - uint max_supported_keys() const { return MI_MAX_KEY; } - uint max_supported_key_parts() const { return HA_MAX_KEY_SEG; } - uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return HA_MAX_KEY_LENGTH; } - void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); + ulong index_flags(uint inx, uint part, bool all_parts) const override; + uint max_supported_keys() const override { return MI_MAX_KEY; } + uint max_supported_key_parts() const override { return HA_MAX_KEY_SEG; } + uint max_supported_key_length() const override { return HA_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const override { return HA_MAX_KEY_LENGTH; } + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override; + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag); + enum ha_rkey_function find_flag) override; int index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - int index_next_same(uchar *buf, const uchar *key, uint keylen); - int ft_init() + enum ha_rkey_function find_flag) override; + int index_next(uchar * buf) override; + int index_prev(uchar * buf) override; + int index_first(uchar * buf) override; + int index_last(uchar * buf) override; + int index_next_same(uchar *buf, const uchar *key, uint keylen) override; + int ft_init() override { if (!ft_handler) return 1; ft_handler->please->reinit_search(ft_handler); return 0; } - FT_INFO *ft_init_ext(uint flags, uint inx,String *key) + FT_INFO *ft_init_ext(uint flags, uint inx,String *key) override { return ft_init_search(flags,file,inx, (uchar *)key->ptr(), key->length(), key->charset(), table->record[0]); } - int ft_read(uchar *buf); - int rnd_init(bool scan); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); - int remember_rnd_pos(); - int restart_rnd_next(uchar *buf); - void position(const uchar *record); - int info(uint); - int extra(enum ha_extra_function operation); - int extra_opt(enum ha_extra_function operation, ulong cache_size); - int reset(void); - int external_lock(THD *thd, int lock_type); - int delete_all_rows(void); - int reset_auto_increment(ulonglong value); - int disable_indexes(key_map map, bool persist); - int enable_indexes(key_map map, bool persist); - int indexes_are_disabled(void); - void start_bulk_insert(ha_rows rows, uint flags); - int end_bulk_insert(); + int ft_read(uchar *buf) override; + int rnd_init(bool scan) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; + int remember_rnd_pos() override; + int restart_rnd_next(uchar *buf) override; + void position(const uchar *record) override; + int info(uint) override; + int extra(enum ha_extra_function operation) override; + int extra_opt(enum ha_extra_function operation, ulong cache_size) override; + int reset(void) override; + int external_lock(THD *thd, int lock_type) override; + int delete_all_rows(void) override; + int reset_auto_increment(ulonglong value) override; + int disable_indexes(key_map map, bool persist) override; + int enable_indexes(key_map map, bool persist) override; + int indexes_are_disabled(void) override; + void start_bulk_insert(ha_rows rows, uint flags) override; + int end_bulk_insert() override; ha_rows records_in_range(uint inx, const key_range *min_key, - const key_range *max_key, page_range *pages); - void update_create_info(HA_CREATE_INFO *create_info); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + const key_range *max_key, page_range *pages) override; + void update_create_info(HA_CREATE_INFO *create_info) override; + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - virtual void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values); - int rename_table(const char * from, const char * to); - int delete_table(const char *name); - int check_for_upgrade(HA_CHECK_OPT *check_opt); - int check(THD* thd, HA_CHECK_OPT* check_opt); - int analyze(THD* thd,HA_CHECK_OPT* check_opt); - int repair(THD* thd, HA_CHECK_OPT* check_opt); - bool check_and_repair(THD *thd); - bool is_crashed() const; - bool auto_repair(int error) const + enum thr_lock_type lock_type) override; + void get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) override; + int rename_table(const char * from, const char * to) override; + int delete_table(const char *name) override; + int check_for_upgrade(HA_CHECK_OPT *check_opt) override; + int check(THD* thd, HA_CHECK_OPT* check_opt) override; + int analyze(THD* thd,HA_CHECK_OPT* check_opt) override; + int repair(THD* thd, HA_CHECK_OPT* check_opt) override; + bool check_and_repair(THD *thd) override; + bool is_crashed() const override; + bool auto_repair(int error) const override { return (myisam_recover_options != HA_RECOVER_OFF && error == HA_ERR_CRASHED_ON_USAGE); } - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt); - int preload_keys(THD* thd, HA_CHECK_OPT* check_opt); + int optimize(THD* thd, HA_CHECK_OPT* check_opt) override; + int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt) override; + int preload_keys(THD* thd, HA_CHECK_OPT* check_opt) override; enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *new_table, - Alter_inplace_info *alter_info); - bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); + Alter_inplace_info *alter_info) override; + bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) override; #ifdef HAVE_QUERY_CACHE my_bool register_query_cache_table(THD *thd, const char *table_key, uint key_length, qc_engine_callback *engine_callback, - ulonglong *engine_data); + ulonglong *engine_data) override; #endif MI_INFO *file_ptr(void) { @@ -159,20 +159,20 @@ public: * Multi Range Read interface */ int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, - uint n_ranges, uint mode, HANDLER_BUFFER *buf); - int multi_range_read_next(range_id_t *range_info); + uint n_ranges, uint mode, HANDLER_BUFFER *buf) override; + int multi_range_read_next(range_id_t *range_info) override; ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, - uint *flags, Cost_estimate *cost); + uint *flags, Cost_estimate *cost) override; ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint *bufsz, - uint *flags, Cost_estimate *cost); - int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); + uint *flags, Cost_estimate *cost) override; + int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) override; /* Index condition pushdown implementation */ - Item *idx_cond_push(uint keyno, Item* idx_cond); - bool rowid_filter_push(Rowid_filter* rowid_filter); + Item *idx_cond_push(uint keyno, Item* idx_cond) override; + bool rowid_filter_push(Rowid_filter* rowid_filter) override; private: DsMrr_impl ds_mrr; diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h index 6da327ec84b..78490335c64 100644 --- a/storage/myisammrg/ha_myisammrg.h +++ b/storage/myisammrg/ha_myisammrg.h @@ -82,8 +82,8 @@ public: ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg); ~ha_myisammrg(); - const char *index_type(uint key_number); - ulonglong table_flags() const + const char *index_type(uint key_number) override; + ulonglong table_flags() const override { return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_NO_TRANSACTIONS | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | @@ -93,70 +93,70 @@ public: HA_NO_COPY_ON_ALTER | HA_DUPLICATE_POS | HA_CAN_MULTISTEP_MERGE); } - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY); } - uint max_supported_keys() const { return MI_MAX_KEY; } - uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return HA_MAX_KEY_LENGTH; } - double scan_time() + uint max_supported_keys() const override { return MI_MAX_KEY; } + uint max_supported_key_length() const override{ return HA_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const override { return HA_MAX_KEY_LENGTH; } + double scan_time() override { return ulonglong2double(stats.data_file_length) / IO_SIZE + file->tables; } - int open(const char *name, int mode, uint test_if_locked); + int open(const char *name, int mode, uint test_if_locked) override; int add_children_list(void); int attach_children(void); int detach_children(void); - virtual handler *clone(const char *name, MEM_ROOT *mem_root); - int close(void); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); + handler *clone(const char *name, MEM_ROOT *mem_root) override; + int close(void) override; + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag); + enum ha_rkey_function find_flag) override; int index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - int index_next_same(uchar *buf, const uchar *key, uint keylen); - int rnd_init(bool scan); - int rnd_next(uchar *buf); - int rnd_pos(uchar * buf, uchar *pos); - void position(const uchar *record); + enum ha_rkey_function find_flag) override; + int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map) override; + int index_next(uchar * buf) override; + int index_prev(uchar * buf) override; + int index_first(uchar * buf) override; + int index_last(uchar * buf) override; + int index_next_same(uchar *buf, const uchar *key, uint keylen) override; + int rnd_init(bool scan) override; + int rnd_next(uchar *buf) override; + int rnd_pos(uchar * buf, uchar *pos) override; + void position(const uchar *record) override; ha_rows records_in_range(uint inx, const key_range *start_key, - const key_range *end_key, page_range *pages); - int delete_all_rows(); - int info(uint); - int reset(void); - int extra(enum ha_extra_function operation); - int extra_opt(enum ha_extra_function operation, ulong cache_size); - int external_lock(THD *thd, int lock_type); - uint lock_count(void) const; + const key_range *end_key, page_range *pages) override; + int delete_all_rows() override; + int info(uint) override; + int reset(void) override; + int extra(enum ha_extra_function operation) override; + int extra_opt(enum ha_extra_function operation, ulong cache_size) override; + int external_lock(THD *thd, int lock_type) override; + uint lock_count(void) const override; int create_mrg(const char *name, HA_CREATE_INFO *create_info); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - void update_create_info(HA_CREATE_INFO *create_info); - void append_create_info(String *packet); + enum thr_lock_type lock_type) override; + void update_create_info(HA_CREATE_INFO *create_info) override; + void append_create_info(String *packet) override; MYRG_INFO *myrg_info() { return file; } TABLE *table_ptr() { return table; } enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *, - Alter_inplace_info *); + Alter_inplace_info *) override; bool inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info); - int check(THD* thd, HA_CHECK_OPT* check_opt); - ha_rows records(); - virtual uint count_query_cache_dependant_tables(uint8 *tables_type); - virtual my_bool + Alter_inplace_info *ha_alter_info) override; + int check(THD* thd, HA_CHECK_OPT* check_opt) override; + ha_rows records() override; + uint count_query_cache_dependant_tables(uint8 *tables_type) override; + my_bool register_query_cache_dependant_tables(THD *thd, Query_cache *cache, Query_cache_block_table **block, - uint *n); - virtual void set_lock_type(enum thr_lock_type lock); + uint *n) override; + void set_lock_type(enum thr_lock_type lock) override; }; diff --git a/storage/perfschema/cursor_by_account.h b/storage/perfschema/cursor_by_account.h index 44175ceb3a2..61e9f9afd31 100644 --- a/storage/perfschema/cursor_by_account.h +++ b/storage/perfschema/cursor_by_account.h @@ -43,9 +43,9 @@ class cursor_by_account : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: cursor_by_account(const PFS_engine_table_share *share); diff --git a/storage/perfschema/cursor_by_host.h b/storage/perfschema/cursor_by_host.h index c8a83a47ec6..a9e2005148f 100644 --- a/storage/perfschema/cursor_by_host.h +++ b/storage/perfschema/cursor_by_host.h @@ -43,9 +43,9 @@ class cursor_by_host : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: cursor_by_host(const PFS_engine_table_share *share); diff --git a/storage/perfschema/cursor_by_thread.h b/storage/perfschema/cursor_by_thread.h index 50e162294cf..c1e647fba8c 100644 --- a/storage/perfschema/cursor_by_thread.h +++ b/storage/perfschema/cursor_by_thread.h @@ -43,9 +43,9 @@ class cursor_by_thread : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: cursor_by_thread(const PFS_engine_table_share *share); diff --git a/storage/perfschema/cursor_by_thread_connect_attr.h b/storage/perfschema/cursor_by_thread_connect_attr.h index 4f48b40c870..fffa89c7e81 100644 --- a/storage/perfschema/cursor_by_thread_connect_attr.h +++ b/storage/perfschema/cursor_by_thread_connect_attr.h @@ -62,9 +62,9 @@ class cursor_by_thread_connect_attr : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: cursor_by_thread_connect_attr(const PFS_engine_table_share *share); diff --git a/storage/perfschema/cursor_by_user.h b/storage/perfschema/cursor_by_user.h index 6438515cf1e..d45507a2b50 100644 --- a/storage/perfschema/cursor_by_user.h +++ b/storage/perfschema/cursor_by_user.h @@ -43,9 +43,9 @@ class cursor_by_user : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: cursor_by_user(const PFS_engine_table_share *share); diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index d8ef9e0085d..a78802c546e 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -53,10 +53,10 @@ public: ~ha_perfschema(); - const char *index_type(uint) { return ""; } + const char *index_type(uint) override { return ""; } /** Capabilities of the performance schema tables. */ - ulonglong table_flags(void) const + ulonglong table_flags(void) const override { /* About HA_FAST_KEY_READ: @@ -86,25 +86,25 @@ public: Operations supported by indexes. None, there are no indexes. */ - ulong index_flags(uint , uint , bool ) const + ulong index_flags(uint , uint , bool ) const override { return 0; } - uint max_supported_record_length(void) const + uint max_supported_record_length(void) const override { return HA_MAX_REC_LENGTH; } - uint max_supported_keys(void) const + uint max_supported_keys(void) const override { return 0; } - uint max_supported_key_parts(void) const + uint max_supported_key_parts(void) const override { return 0; } - uint max_supported_key_length(void) const + uint max_supported_key_length(void) const override { return 0; } - ha_rows estimate_rows_upper_bound(void) + ha_rows estimate_rows_upper_bound(void) override { return HA_POS_ERROR; } - double scan_time(void) + double scan_time(void) override { return 1.0; } /** @@ -114,22 +114,22 @@ public: @param test_if_locked unused @return 0 on success */ - int open(const char *name, int mode, uint test_if_locked); + int open(const char *name, int mode, uint test_if_locked) override; /** Close a table handle. @sa open. */ - int close(void); + int close(void) override; /** Write a row. @param buf the row to write @return 0 on success */ - int write_row(const uchar *buf); + int write_row(const uchar *buf) override; - void use_hidden_primary_key(); + void use_hidden_primary_key() override; /** Update a row. @@ -137,29 +137,29 @@ public: @param new_data the row new values @return 0 on success */ - int update_row(const uchar *old_data, const uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data) override; /** Delete a row. @param buf the row to delete @return 0 on success */ - int delete_row(const uchar *buf); + int delete_row(const uchar *buf) override; - int rnd_init(bool scan); + int rnd_init(bool scan) override; /** Scan end. @sa rnd_init. */ - int rnd_end(void); + int rnd_end(void) override; /** Iterator, fetch the next row. @param[out] buf the row fetched. @return 0 on success */ - int rnd_next(uchar *buf); + int rnd_next(uchar *buf) override; /** Iterator, fetch the row at a given position. @@ -167,42 +167,42 @@ public: @param pos the row position @return 0 on success */ - int rnd_pos(uchar *buf, uchar *pos); + int rnd_pos(uchar *buf, uchar *pos) override; /** Read the row current position. @param record the current row */ - void position(const uchar *record); + void position(const uchar *record) override; - int info(uint); + int info(uint) override; - int delete_all_rows(void); + int delete_all_rows(void) override; - int truncate(); + int truncate() override; - int delete_table(const char *from); + int delete_table(const char *from) override; - int rename_table(const char * from, const char * to); + int rename_table(const char * from, const char * to) override; int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); + HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); + enum thr_lock_type lock_type) override; - virtual uint8 table_cache_type(void) + uint8 table_cache_type(void) override { return HA_CACHE_TBL_NOCACHE; } - virtual my_bool register_query_cache_table + my_bool register_query_cache_table (THD *, const char *, uint , qc_engine_callback *engine_callback, - ulonglong *) + ulonglong *) override { *engine_callback= 0; return FALSE; } - virtual void print_error(int error, myf errflags); + void print_error(int error, myf errflags) override; private: /** diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc index ecf26cd77ea..84257d9dc38 100644 --- a/storage/perfschema/pfs_account.cc +++ b/storage/perfschema/pfs_account.cc @@ -666,7 +666,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_account *pfs) + void operator()(PFS_account *pfs) override { PFS_user *user= sanitize_user(pfs->m_user); PFS_host *host= sanitize_host(pfs->m_host); @@ -699,7 +699,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_account *pfs) + void operator()(PFS_account *pfs) override { if (pfs->m_username_length > 0 && pfs->m_hostname_length > 0) { diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 4895dbdbd1b..b28e4258069 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -343,13 +343,13 @@ static PFS_engine_table_share *all_shares[]= class PFS_silent_check_intact : public Table_check_intact { protected: - virtual void report_error(uint code, const char *fmt, ...) {} + void report_error(uint code, const char *fmt, ...) override {} public: PFS_silent_check_intact() {} - ~PFS_silent_check_intact() + ~PFS_silent_check_intact() override {} }; @@ -672,12 +672,12 @@ class PFS_internal_schema_access : public ACL_internal_schema_access public: PFS_internal_schema_access() = default; - ~PFS_internal_schema_access() = default; + ~PFS_internal_schema_access() override = default; ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + privilege_t *save_priv) const override; - const ACL_internal_table_access *lookup(const char *name) const; + const ACL_internal_table_access *lookup(const char *name) const override; }; ACL_internal_access_result diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index 02ef9b07010..0bf8e58c081 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -340,8 +340,8 @@ public: ~PFS_readonly_acl() = default; - virtual ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + ACL_internal_access_result check(privilege_t want_access, + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_readonly_acl. */ @@ -358,8 +358,8 @@ public: ~PFS_truncatable_acl() = default; - virtual ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + ACL_internal_access_result check(privilege_t want_access, + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_truncatable_acl. */ @@ -377,7 +377,7 @@ public: ~PFS_updatable_acl() = default; ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_updatable_acl. */ @@ -395,7 +395,7 @@ public: ~PFS_editable_acl() = default; ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_editable_acl. */ @@ -412,7 +412,7 @@ public: ~PFS_unknown_acl() = default; ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_unknown_acl. */ @@ -430,7 +430,7 @@ public: ~PFS_readonly_world_acl() {} - virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; + ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const override; }; @@ -449,7 +449,7 @@ public: ~PFS_truncatable_world_acl() {} - virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; + ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const override; }; @@ -468,8 +468,8 @@ class PFS_readonly_processlist_acl : public PFS_readonly_acl { ~PFS_readonly_processlist_acl() {} - virtual ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const; + ACL_internal_access_result check(privilege_t want_access, + privilege_t *save_priv) const override; }; /** Singleton instance of PFS_readonly_processlist_acl */ diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc index 37d1bec49aa..9012d01004c 100644 --- a/storage/perfschema/pfs_host.cc +++ b/storage/perfschema/pfs_host.cc @@ -349,7 +349,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_host *pfs) + void operator()(PFS_host *pfs) override { pfs->aggregate(true); if (pfs->get_refcount() == 0) diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index fa85d8610bf..56573d3dffd 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -2022,7 +2022,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_table_share *pfs) + void operator()(PFS_table_share *pfs) override { pfs->refresh_setup_object_flags(m_thread); } @@ -2045,7 +2045,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_program *pfs) + void operator()(PFS_program *pfs) override { pfs->refresh_setup_object_flags(m_thread); } diff --git a/storage/perfschema/pfs_setup_actor.cc b/storage/perfschema/pfs_setup_actor.cc index efe19b3c8b3..c2b53bf2d1e 100644 --- a/storage/perfschema/pfs_setup_actor.cc +++ b/storage/perfschema/pfs_setup_actor.cc @@ -231,7 +231,7 @@ public: : m_pins(pins) {} - virtual void operator()(PFS_setup_actor *pfs) + void operator()(PFS_setup_actor *pfs) override { lf_hash_delete(&setup_actor_hash, m_pins, pfs->m_key.m_hash_key, pfs->m_key.m_key_length); diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc index 78617d1b2c6..b18bc2fd5ba 100644 --- a/storage/perfschema/pfs_setup_object.cc +++ b/storage/perfschema/pfs_setup_object.cc @@ -231,7 +231,7 @@ public: : m_pins(pins) {} - virtual void operator()(PFS_setup_object *pfs) + void operator()(PFS_setup_object *pfs) override { lf_hash_delete(&setup_object_hash, m_pins, pfs->m_key.m_hash_key, pfs->m_key.m_key_length); diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc index 1f299d9b9b6..fa39b330f75 100644 --- a/storage/perfschema/pfs_user.cc +++ b/storage/perfschema/pfs_user.cc @@ -314,7 +314,7 @@ public: : m_thread(thread) {} - virtual void operator()(PFS_user *pfs) + void operator()(PFS_user *pfs) override { pfs->aggregate(true); if (pfs->get_refcount() == 0) diff --git a/storage/perfschema/pfs_variable.h b/storage/perfschema/pfs_variable.h index d3ad4c7f900..4ae33139bdd 100644 --- a/storage/perfschema/pfs_variable.h +++ b/storage/perfschema/pfs_variable.h @@ -205,7 +205,7 @@ public: Find_THD_variable() : m_unsafe_thd(NULL) {} Find_THD_variable(THD *unsafe_thd) : m_unsafe_thd(unsafe_thd) {} - virtual bool operator()(THD *thd) + bool operator()(THD *thd) override { //TODO: filter bg threads? if (thd != m_unsafe_thd) @@ -608,18 +608,18 @@ public: private: /* Build SHOW_var array. */ bool init_show_var_array(enum_var_type scope, bool strict); - bool do_initialize_session(void); + bool do_initialize_session(void) override; /* Global */ - int do_materialize_global(void); + int do_materialize_global(void) override; /* Global and Session - THD */ - int do_materialize_all(THD* thd); + int do_materialize_all(THD* thd) override; /* Session - THD */ - int do_materialize_session(THD* thd); + int do_materialize_session(THD* thd) override; /* Session - PFS_thread */ - int do_materialize_session(PFS_thread *thread); + int do_materialize_session(PFS_thread *thread) override; /* Single variable - PFS_thread */ - int do_materialize_session(PFS_thread *pfs_thread, uint index); + int do_materialize_session(PFS_thread *pfs_thread, uint index) override; /* Temporary mem_root to use for materialization. */ MEM_ROOT m_mem_sysvar; @@ -660,14 +660,14 @@ protected: bool m_show_command; private: - bool do_initialize_session(void); + bool do_initialize_session(void) override; - int do_materialize_global(void); + int do_materialize_global(void) override; /* Global and Session - THD */ - int do_materialize_all(THD* thd); - int do_materialize_session(THD *thd); - int do_materialize_session(PFS_thread *thread); - int do_materialize_session(PFS_thread *thread, uint index) { return 0; } + int do_materialize_all(THD* thd) override; + int do_materialize_session(THD *thd) override; + int do_materialize_session(PFS_thread *thread) override; + int do_materialize_session(PFS_thread *thread, uint index) override { return 0; } int do_materialize_client(PFS_client *pfs_client); /* Callback to sum user, host or account status variables. */ diff --git a/storage/perfschema/pfs_visitor.cc b/storage/perfschema/pfs_visitor.cc index 92a5c99e13b..d3f37aae845 100644 --- a/storage/perfschema/pfs_visitor.cc +++ b/storage/perfschema/pfs_visitor.cc @@ -49,7 +49,7 @@ public: : m_visitor(visitor) {} - virtual void operator()(THD *thd) + void operator()(THD *thd) override { m_visitor->visit_THD(thd); } @@ -132,7 +132,7 @@ public: : m_visitor(visitor), m_host(host) {} - virtual void operator()(THD *thd) + void operator()(THD *thd) override { PSI_thread *psi= thd->get_psi(); PFS_thread *pfs= reinterpret_cast(psi); @@ -221,7 +221,7 @@ public: : m_visitor(visitor), m_user(user) {} - virtual void operator()(THD *thd) + void operator()(THD *thd) override { PSI_thread *psi= thd->get_psi(); PFS_thread *pfs= reinterpret_cast(psi); @@ -310,7 +310,7 @@ public: : m_visitor(visitor), m_account(account) {} - virtual void operator()(THD *thd) + void operator()(THD *thd) override { PSI_thread *psi= thd->get_psi(); PFS_thread *pfs= reinterpret_cast(psi); @@ -752,7 +752,7 @@ public: : m_visitor(visitor) {} - virtual void operator()(PFS_table_share *pfs) + void operator()(PFS_table_share *pfs) override { if (pfs->m_enabled) { @@ -772,7 +772,7 @@ public: : m_visitor(visitor) {} - virtual void operator()(PFS_table *pfs) + void operator()(PFS_table *pfs) override { PFS_table_share *safe_share= sanitize_table_share(pfs->m_share); if (safe_share != NULL) @@ -811,7 +811,7 @@ public: : m_visitor(visitor), m_share(share) {} - virtual void operator()(PFS_table *pfs) + void operator()(PFS_table *pfs) override { if (pfs->m_share == m_share) { @@ -852,7 +852,7 @@ public: : m_visitor(visitor), m_share(share), m_index(index) {} - virtual void operator()(PFS_table *pfs) + void operator()(PFS_table *pfs) override { if (pfs->m_share == m_share) { diff --git a/storage/perfschema/pfs_visitor.h b/storage/perfschema/pfs_visitor.h index 03684ba9ca6..9de6c4217c6 100644 --- a/storage/perfschema/pfs_visitor.h +++ b/storage/perfschema/pfs_visitor.h @@ -314,11 +314,11 @@ public: /** Constructor. */ PFS_connection_wait_visitor(PFS_instr_class *klass); virtual ~PFS_connection_wait_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** EVENT_NAME instrument index. */ uint m_index; @@ -336,11 +336,11 @@ public: /** Constructor. */ PFS_connection_all_wait_visitor(); virtual ~PFS_connection_all_wait_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** Wait statistic collected. */ PFS_single_stat m_stat; @@ -359,11 +359,11 @@ public: /** Constructor. */ PFS_connection_stage_visitor(PFS_stage_class *klass); virtual ~PFS_connection_stage_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** EVENT_NAME instrument index. */ uint m_index; @@ -381,11 +381,11 @@ public: /** Constructor. */ PFS_connection_statement_visitor(PFS_statement_class *klass); virtual ~PFS_connection_statement_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** EVENT_NAME instrument index. */ uint m_index; @@ -403,11 +403,11 @@ public: /** Constructor. */ PFS_connection_all_statement_visitor(); virtual ~PFS_connection_all_statement_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** Statement statistic collected. */ PFS_statement_stat m_stat; @@ -426,11 +426,11 @@ public: /** Constructor. */ PFS_connection_transaction_visitor(PFS_transaction_class *klass); virtual ~PFS_connection_transaction_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** EVENT_NAME instrument index. */ uint m_index; @@ -450,11 +450,11 @@ public: /** Constructor. */ PFS_connection_all_transaction_visitor(); virtual ~PFS_connection_all_transaction_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** Statement statistic collected. */ PFS_transaction_stat m_stat; @@ -474,11 +474,11 @@ public: /** Constructor. */ PFS_connection_stat_visitor(); virtual ~PFS_connection_stat_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** Connection statistic collected. */ PFS_connection_stat m_stat; @@ -494,11 +494,11 @@ public: /** Constructor. */ PFS_connection_memory_visitor(PFS_memory_class *klass); virtual ~PFS_connection_memory_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; /** EVENT_NAME instrument index. */ uint m_index; @@ -516,12 +516,12 @@ public: /** Constructor. */ PFS_connection_status_visitor(STATUS_VAR *status_vars); virtual ~PFS_connection_status_visitor(); - virtual void visit_global(); - virtual void visit_host(PFS_host *pfs); - virtual void visit_account(PFS_account *pfs); - virtual void visit_user(PFS_user *pfs); - virtual void visit_thread(PFS_thread *pfs); - virtual void visit_THD(THD *thd); + void visit_global() override; + void visit_host(PFS_host *pfs) override; + void visit_account(PFS_account *pfs) override; + void visit_user(PFS_user *pfs) override; + void visit_thread(PFS_thread *pfs) override; + void visit_THD(THD *thd) override; private: STATUS_VAR *m_status_vars; @@ -536,16 +536,16 @@ class PFS_instance_wait_visitor : public PFS_instance_visitor public: PFS_instance_wait_visitor(); virtual ~PFS_instance_wait_visitor(); - virtual void visit_mutex_class(PFS_mutex_class *pfs); - virtual void visit_rwlock_class(PFS_rwlock_class *pfs); - virtual void visit_cond_class(PFS_cond_class *pfs); - virtual void visit_file_class(PFS_file_class *pfs); - virtual void visit_socket_class(PFS_socket_class *pfs); - virtual void visit_mutex(PFS_mutex *pfs); - virtual void visit_rwlock(PFS_rwlock *pfs); - virtual void visit_cond(PFS_cond *pfs); - virtual void visit_file(PFS_file *pfs); - virtual void visit_socket(PFS_socket *pfs); + void visit_mutex_class(PFS_mutex_class *pfs) override; + void visit_rwlock_class(PFS_rwlock_class *pfs) override; + void visit_cond_class(PFS_cond_class *pfs) override; + void visit_file_class(PFS_file_class *pfs) override; + void visit_socket_class(PFS_socket_class *pfs) override; + void visit_mutex(PFS_mutex *pfs) override; + void visit_rwlock(PFS_rwlock *pfs) override; + void visit_cond(PFS_cond *pfs) override; + void visit_file(PFS_file *pfs) override; + void visit_socket(PFS_socket *pfs) override; /** Wait statistic collected. */ PFS_single_stat m_stat; @@ -560,9 +560,9 @@ class PFS_object_wait_visitor : public PFS_object_visitor public: PFS_object_wait_visitor(); virtual ~PFS_object_wait_visitor(); - virtual void visit_global(); - virtual void visit_table_share(PFS_table_share *pfs); - virtual void visit_table(PFS_table *pfs); + void visit_global() override; + void visit_table_share(PFS_table_share *pfs) override; + void visit_table(PFS_table *pfs) override; /** Object wait statistic collected. */ PFS_single_stat m_stat; @@ -577,9 +577,9 @@ class PFS_table_io_wait_visitor : public PFS_object_visitor public: PFS_table_io_wait_visitor(); virtual ~PFS_table_io_wait_visitor(); - virtual void visit_global(); - virtual void visit_table_share(PFS_table_share *pfs); - virtual void visit_table(PFS_table *pfs); + void visit_global() override; + void visit_table_share(PFS_table_share *pfs) override; + void visit_table(PFS_table *pfs) override; /** Table io wait statistic collected. */ PFS_single_stat m_stat; @@ -594,8 +594,8 @@ class PFS_table_io_stat_visitor : public PFS_object_visitor public: PFS_table_io_stat_visitor(); virtual ~PFS_table_io_stat_visitor(); - virtual void visit_table_share(PFS_table_share *pfs); - virtual void visit_table(PFS_table *pfs); + void visit_table_share(PFS_table_share *pfs) override; + void visit_table(PFS_table *pfs) override; /** Table io statistic collected. */ PFS_table_io_stat m_stat; @@ -610,8 +610,8 @@ class PFS_index_io_stat_visitor : public PFS_object_visitor public: PFS_index_io_stat_visitor(); virtual ~PFS_index_io_stat_visitor(); - virtual void visit_table_share_index(PFS_table_share *pfs, uint index); - virtual void visit_table_index(PFS_table *pfs, uint index); + void visit_table_share_index(PFS_table_share *pfs, uint index) override; + void visit_table_index(PFS_table *pfs, uint index) override; /** Index io statistic collected. */ PFS_table_io_stat m_stat; @@ -626,9 +626,9 @@ class PFS_table_lock_wait_visitor : public PFS_object_visitor public: PFS_table_lock_wait_visitor(); virtual ~PFS_table_lock_wait_visitor(); - virtual void visit_global(); - virtual void visit_table_share(PFS_table_share *pfs); - virtual void visit_table(PFS_table *pfs); + void visit_global() override; + void visit_table_share(PFS_table_share *pfs) override; + void visit_table(PFS_table *pfs) override; /** Table lock wait statistic collected. */ PFS_single_stat m_stat; @@ -643,8 +643,8 @@ class PFS_table_lock_stat_visitor : public PFS_object_visitor public: PFS_table_lock_stat_visitor(); virtual ~PFS_table_lock_stat_visitor(); - virtual void visit_table_share(PFS_table_share *pfs); - virtual void visit_table(PFS_table *pfs); + void visit_table_share(PFS_table_share *pfs) override; + void visit_table(PFS_table *pfs) override; /** Table lock statistic collected. */ PFS_table_lock_stat m_stat; @@ -659,8 +659,8 @@ class PFS_instance_socket_io_stat_visitor : public PFS_instance_visitor public: PFS_instance_socket_io_stat_visitor(); virtual ~PFS_instance_socket_io_stat_visitor(); - virtual void visit_socket_class(PFS_socket_class *pfs); - virtual void visit_socket(PFS_socket *pfs); + void visit_socket_class(PFS_socket_class *pfs) override; + void visit_socket(PFS_socket *pfs) override; /** Wait and byte count statistics collected. */ PFS_socket_io_stat m_socket_io_stat; @@ -675,8 +675,8 @@ class PFS_instance_file_io_stat_visitor : public PFS_instance_visitor public: PFS_instance_file_io_stat_visitor(); virtual ~PFS_instance_file_io_stat_visitor(); - virtual void visit_file_class(PFS_file_class *pfs); - virtual void visit_file(PFS_file *pfs); + void visit_file_class(PFS_file_class *pfs) override; + void visit_file(PFS_file *pfs) override; /** Wait and byte count statistics collected. */ PFS_file_io_stat m_file_io_stat; diff --git a/storage/perfschema/table_accounts.h b/storage/perfschema/table_accounts.h index 28348190e69..77d2940a411 100644 --- a/storage/perfschema/table_accounts.h +++ b/storage/perfschema/table_accounts.h @@ -57,10 +57,10 @@ public: static int delete_all_rows(); protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; protected: @@ -70,7 +70,7 @@ public: ~table_accounts() = default; private: - virtual void make_row(PFS_account *pfs); + void make_row(PFS_account *pfs) override; /** Table share lock. */ static THR_LOCK m_table_lock; diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index d7f3fe6aa1a..803cb9b5005 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -76,9 +76,9 @@ class table_all_instr : public PFS_engine_table public: static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_all_instr(const PFS_engine_table_share *share); diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.h b/storage/perfschema/table_esgs_by_account_by_event_name.h index fa0c7d8ec2d..3c0e2f29413 100644 --- a/storage/perfschema/table_esgs_by_account_by_event_name.h +++ b/storage/perfschema/table_esgs_by_account_by_event_name.h @@ -91,16 +91,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esgs_by_account_by_event_name(); diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.h b/storage/perfschema/table_esgs_by_host_by_event_name.h index f71a479c8fa..0f5892fe288 100644 --- a/storage/perfschema/table_esgs_by_host_by_event_name.h +++ b/storage/perfschema/table_esgs_by_host_by_event_name.h @@ -91,16 +91,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esgs_by_host_by_event_name(); diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.h b/storage/perfschema/table_esgs_by_thread_by_event_name.h index f9a52ebe189..848ace7609f 100644 --- a/storage/perfschema/table_esgs_by_thread_by_event_name.h +++ b/storage/perfschema/table_esgs_by_thread_by_event_name.h @@ -95,16 +95,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esgs_by_thread_by_event_name(); diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.h b/storage/perfschema/table_esgs_by_user_by_event_name.h index e8b421089c8..df96dd48e8a 100644 --- a/storage/perfschema/table_esgs_by_user_by_event_name.h +++ b/storage/perfschema/table_esgs_by_user_by_event_name.h @@ -96,16 +96,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esgs_by_user_by_event_name(); diff --git a/storage/perfschema/table_esgs_global_by_event_name.h b/storage/perfschema/table_esgs_global_by_event_name.h index bfcd70174ec..d5fe9b676e0 100644 --- a/storage/perfschema/table_esgs_global_by_event_name.h +++ b/storage/perfschema/table_esgs_global_by_event_name.h @@ -62,16 +62,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esgs_global_by_event_name(); diff --git a/storage/perfschema/table_esms_by_account_by_event_name.h b/storage/perfschema/table_esms_by_account_by_event_name.h index 638cc28ed7b..e87e27d7688 100644 --- a/storage/perfschema/table_esms_by_account_by_event_name.h +++ b/storage/perfschema/table_esms_by_account_by_event_name.h @@ -91,16 +91,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_account_by_event_name(); diff --git a/storage/perfschema/table_esms_by_digest.h b/storage/perfschema/table_esms_by_digest.h index 4711ffc56bf..ab4c7341bcb 100644 --- a/storage/perfschema/table_esms_by_digest.h +++ b/storage/perfschema/table_esms_by_digest.h @@ -65,15 +65,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_digest(); diff --git a/storage/perfschema/table_esms_by_host_by_event_name.h b/storage/perfschema/table_esms_by_host_by_event_name.h index 65a7256b9cb..cb29690805d 100644 --- a/storage/perfschema/table_esms_by_host_by_event_name.h +++ b/storage/perfschema/table_esms_by_host_by_event_name.h @@ -91,16 +91,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_host_by_event_name(); diff --git a/storage/perfschema/table_esms_by_program.h b/storage/perfschema/table_esms_by_program.h index f9e686efc6f..a27f2ab5432 100644 --- a/storage/perfschema/table_esms_by_program.h +++ b/storage/perfschema/table_esms_by_program.h @@ -75,15 +75,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_program(); diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.h b/storage/perfschema/table_esms_by_thread_by_event_name.h index 87a4e3c3ed4..f629e229403 100644 --- a/storage/perfschema/table_esms_by_thread_by_event_name.h +++ b/storage/perfschema/table_esms_by_thread_by_event_name.h @@ -95,16 +95,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_thread_by_event_name(); diff --git a/storage/perfschema/table_esms_by_user_by_event_name.h b/storage/perfschema/table_esms_by_user_by_event_name.h index cbd388ef606..4d2d4a3fdff 100644 --- a/storage/perfschema/table_esms_by_user_by_event_name.h +++ b/storage/perfschema/table_esms_by_user_by_event_name.h @@ -91,16 +91,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_by_user_by_event_name(); diff --git a/storage/perfschema/table_esms_global_by_event_name.h b/storage/perfschema/table_esms_global_by_event_name.h index 21a6b1a18b9..e63f341e759 100644 --- a/storage/perfschema/table_esms_global_by_event_name.h +++ b/storage/perfschema/table_esms_global_by_event_name.h @@ -62,16 +62,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_esms_global_by_event_name(); diff --git a/storage/perfschema/table_ets_by_account_by_event_name.h b/storage/perfschema/table_ets_by_account_by_event_name.h index a5202b299e0..46734d04753 100644 --- a/storage/perfschema/table_ets_by_account_by_event_name.h +++ b/storage/perfschema/table_ets_by_account_by_event_name.h @@ -95,16 +95,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ets_by_account_by_event_name(); diff --git a/storage/perfschema/table_ets_by_host_by_event_name.h b/storage/perfschema/table_ets_by_host_by_event_name.h index 00b4dbd02f8..e5e89a0f2a7 100644 --- a/storage/perfschema/table_ets_by_host_by_event_name.h +++ b/storage/perfschema/table_ets_by_host_by_event_name.h @@ -95,16 +95,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ets_by_host_by_event_name(); diff --git a/storage/perfschema/table_ets_by_thread_by_event_name.h b/storage/perfschema/table_ets_by_thread_by_event_name.h index 1fa62f84e51..e7837d7000c 100644 --- a/storage/perfschema/table_ets_by_thread_by_event_name.h +++ b/storage/perfschema/table_ets_by_thread_by_event_name.h @@ -99,16 +99,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ets_by_thread_by_event_name(); diff --git a/storage/perfschema/table_ets_by_user_by_event_name.h b/storage/perfschema/table_ets_by_user_by_event_name.h index 9bd5b859ef9..98e8d97c69c 100644 --- a/storage/perfschema/table_ets_by_user_by_event_name.h +++ b/storage/perfschema/table_ets_by_user_by_event_name.h @@ -95,16 +95,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ets_by_user_by_event_name(); diff --git a/storage/perfschema/table_ets_global_by_event_name.h b/storage/perfschema/table_ets_global_by_event_name.h index d5a67f43505..14994984a30 100644 --- a/storage/perfschema/table_ets_global_by_event_name.h +++ b/storage/perfschema/table_ets_global_by_event_name.h @@ -66,16 +66,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ets_global_by_event_name(); diff --git a/storage/perfschema/table_events_stages.h b/storage/perfschema/table_events_stages.h index d8b973acc8b..193fa4b40bc 100644 --- a/storage/perfschema/table_events_stages.h +++ b/storage/perfschema/table_events_stages.h @@ -100,10 +100,10 @@ struct pos_events_stages_history : public PFS_double_index class table_events_stages_common : public PFS_engine_table { protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_events_stages_common(const PFS_engine_table_share *share, void *pos); @@ -128,10 +128,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_stages_current(); @@ -163,10 +163,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_stages_history(); @@ -195,10 +195,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_stages_history_long(); diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h index 6acad7bb90d..61b5b28805d 100644 --- a/storage/perfschema/table_events_statements.h +++ b/storage/perfschema/table_events_statements.h @@ -183,10 +183,10 @@ struct pos_events_statements_history : public PFS_double_index class table_events_statements_common : public PFS_engine_table { protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_events_statements_common(const PFS_engine_table_share *share, void *pos); @@ -215,10 +215,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_statements_current(); @@ -252,10 +252,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_statements_history(); @@ -286,10 +286,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_statements_history_long(); diff --git a/storage/perfschema/table_events_transactions.h b/storage/perfschema/table_events_transactions.h index f6024c63766..0911fd63cb7 100644 --- a/storage/perfschema/table_events_transactions.h +++ b/storage/perfschema/table_events_transactions.h @@ -127,10 +127,10 @@ struct pos_events_transactions_history : public PFS_double_index class table_events_transactions_common : public PFS_engine_table { protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_events_transactions_common(const PFS_engine_table_share *share, void *pos); @@ -156,10 +156,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_transactions_current(); @@ -198,10 +198,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_transactions_history(); @@ -231,10 +231,10 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_transactions_history_long(); diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 62df9ae2521..85a9b146745 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -139,10 +139,10 @@ struct pos_events_waits_history : public PFS_double_index class table_events_waits_common : public PFS_engine_table { protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_events_waits_common(const PFS_engine_table_share *share, void *pos); @@ -173,9 +173,9 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_waits_current(); @@ -209,9 +209,9 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: table_events_waits_history(); @@ -242,9 +242,9 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override;; protected: table_events_waits_history_long(); diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index d84a79effc1..74f3a9ac959 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -67,16 +67,16 @@ protected: void make_instr_row(PFS_instr *pfs, PFS_instr_class *klass, const void *object_instance_begin, PFS_single_stat *pfs_stat); - virtual void make_mutex_row(PFS_mutex *pfs); - virtual void make_rwlock_row(PFS_rwlock *pfs); - virtual void make_cond_row(PFS_cond *pfs); - virtual void make_file_row(PFS_file *pfs); - virtual void make_socket_row(PFS_socket *pfs); + void make_mutex_row(PFS_mutex *pfs) override; + void make_rwlock_row(PFS_rwlock *pfs) override; + void make_cond_row(PFS_cond *pfs) override; + void make_file_row(PFS_file *pfs) override; + void make_socket_row(PFS_socket *pfs) override; - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_events_waits_summary_by_instance(); diff --git a/storage/perfschema/table_ews_by_account_by_event_name.h b/storage/perfschema/table_ews_by_account_by_event_name.h index df72f25809b..b4e2df513b2 100644 --- a/storage/perfschema/table_ews_by_account_by_event_name.h +++ b/storage/perfschema/table_ews_by_account_by_event_name.h @@ -103,15 +103,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ews_by_account_by_event_name(); diff --git a/storage/perfschema/table_ews_by_host_by_event_name.h b/storage/perfschema/table_ews_by_host_by_event_name.h index c88b3d77a3f..588244109be 100644 --- a/storage/perfschema/table_ews_by_host_by_event_name.h +++ b/storage/perfschema/table_ews_by_host_by_event_name.h @@ -103,15 +103,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ews_by_host_by_event_name(); diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.h b/storage/perfschema/table_ews_by_thread_by_event_name.h index 7ac6638a1cd..8dc51ddc579 100644 --- a/storage/perfschema/table_ews_by_thread_by_event_name.h +++ b/storage/perfschema/table_ews_by_thread_by_event_name.h @@ -102,15 +102,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ews_by_thread_by_event_name(); diff --git a/storage/perfschema/table_ews_by_user_by_event_name.h b/storage/perfschema/table_ews_by_user_by_event_name.h index 82c7319c19a..5422d493df4 100644 --- a/storage/perfschema/table_ews_by_user_by_event_name.h +++ b/storage/perfschema/table_ews_by_user_by_event_name.h @@ -103,15 +103,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ews_by_user_by_event_name(); diff --git a/storage/perfschema/table_ews_global_by_event_name.h b/storage/perfschema/table_ews_global_by_event_name.h index 84d8a742b3c..4e40923f2af 100644 --- a/storage/perfschema/table_ews_global_by_event_name.h +++ b/storage/perfschema/table_ews_global_by_event_name.h @@ -91,15 +91,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_ews_global_by_event_name(); diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index 5b1b9016f41..1adc4896b9b 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -61,15 +61,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_file_instances(); diff --git a/storage/perfschema/table_file_summary_by_event_name.h b/storage/perfschema/table_file_summary_by_event_name.h index 80b08773b55..0d660ffe216 100644 --- a/storage/perfschema/table_file_summary_by_event_name.h +++ b/storage/perfschema/table_file_summary_by_event_name.h @@ -62,15 +62,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_file_summary_by_event_name(); diff --git a/storage/perfschema/table_file_summary_by_instance.h b/storage/perfschema/table_file_summary_by_instance.h index 750ba904484..09f4383394d 100644 --- a/storage/perfschema/table_file_summary_by_instance.h +++ b/storage/perfschema/table_file_summary_by_instance.h @@ -70,15 +70,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_file_summary_by_instance(); diff --git a/storage/perfschema/table_global_status.h b/storage/perfschema/table_global_status.h index 5b5f6e60c37..16fc7c82877 100644 --- a/storage/perfschema/table_global_status.h +++ b/storage/perfschema/table_global_status.h @@ -75,16 +75,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_global_status(); public: diff --git a/storage/perfschema/table_global_variables.h b/storage/perfschema/table_global_variables.h index 49083e63292..5172f215f72 100644 --- a/storage/perfschema/table_global_variables.h +++ b/storage/perfschema/table_global_variables.h @@ -74,16 +74,16 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_global_variables(); public: diff --git a/storage/perfschema/table_host_cache.h b/storage/perfschema/table_host_cache.h index 59e3a973421..dc2d9916817 100644 --- a/storage/perfschema/table_host_cache.h +++ b/storage/perfschema/table_host_cache.h @@ -114,15 +114,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_host_cache(); diff --git a/storage/perfschema/table_hosts.h b/storage/perfschema/table_hosts.h index 1f82cc5c60b..3d4dddbfa07 100644 --- a/storage/perfschema/table_hosts.h +++ b/storage/perfschema/table_hosts.h @@ -57,11 +57,11 @@ public: static int delete_all_rows(); protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); - + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; + protected: table_hosts(); @@ -70,7 +70,7 @@ public: ~table_hosts() = default; private: - virtual void make_row(PFS_host *pfs); + void make_row(PFS_host *pfs) override; /** Table share lock. */ static THR_LOCK m_table_lock; diff --git a/storage/perfschema/table_md_locks.h b/storage/perfschema/table_md_locks.h index 5c9ad9b5638..62f681435f6 100644 --- a/storage/perfschema/table_md_locks.h +++ b/storage/perfschema/table_md_locks.h @@ -69,15 +69,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_metadata_locks(); diff --git a/storage/perfschema/table_mems_by_account_by_event_name.h b/storage/perfschema/table_mems_by_account_by_event_name.h index e242bc40ac6..e393ba9d2f9 100644 --- a/storage/perfschema/table_mems_by_account_by_event_name.h +++ b/storage/perfschema/table_mems_by_account_by_event_name.h @@ -92,15 +92,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mems_by_account_by_event_name(); diff --git a/storage/perfschema/table_mems_by_host_by_event_name.h b/storage/perfschema/table_mems_by_host_by_event_name.h index 7920b362b5e..cc1c4a0f2d9 100644 --- a/storage/perfschema/table_mems_by_host_by_event_name.h +++ b/storage/perfschema/table_mems_by_host_by_event_name.h @@ -92,15 +92,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mems_by_host_by_event_name(); diff --git a/storage/perfschema/table_mems_by_thread_by_event_name.h b/storage/perfschema/table_mems_by_thread_by_event_name.h index 0f698990b47..ba23d790c17 100644 --- a/storage/perfschema/table_mems_by_thread_by_event_name.h +++ b/storage/perfschema/table_mems_by_thread_by_event_name.h @@ -92,15 +92,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mems_by_thread_by_event_name(); diff --git a/storage/perfschema/table_mems_by_user_by_event_name.h b/storage/perfschema/table_mems_by_user_by_event_name.h index c17f5d3302b..4be0f659453 100644 --- a/storage/perfschema/table_mems_by_user_by_event_name.h +++ b/storage/perfschema/table_mems_by_user_by_event_name.h @@ -92,15 +92,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mems_by_user_by_event_name(); diff --git a/storage/perfschema/table_mems_global_by_event_name.h b/storage/perfschema/table_mems_global_by_event_name.h index ae3cd0435d6..0cc426523b0 100644 --- a/storage/perfschema/table_mems_global_by_event_name.h +++ b/storage/perfschema/table_mems_global_by_event_name.h @@ -94,15 +94,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mems_global_by_event_name(); diff --git a/storage/perfschema/table_os_global_by_type.h b/storage/perfschema/table_os_global_by_type.h index 7d0ed58ce5b..f8d407ae321 100644 --- a/storage/perfschema/table_os_global_by_type.h +++ b/storage/perfschema/table_os_global_by_type.h @@ -93,15 +93,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_os_global_by_type(); diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index a28b4d3f2c9..b16af7c22ec 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -59,15 +59,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; protected: table_performance_timers(); diff --git a/storage/perfschema/table_prepared_stmt_instances.h b/storage/perfschema/table_prepared_stmt_instances.h index 8bd9acafce5..838deec55a0 100644 --- a/storage/perfschema/table_prepared_stmt_instances.h +++ b/storage/perfschema/table_prepared_stmt_instances.h @@ -94,15 +94,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_prepared_stmt_instances(); diff --git a/storage/perfschema/table_replication_applier_configuration.h b/storage/perfschema/table_replication_applier_configuration.h index a825b46729e..825db963a89 100644 --- a/storage/perfschema/table_replication_applier_configuration.h +++ b/storage/perfschema/table_replication_applier_configuration.h @@ -83,10 +83,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_applier_configuration(); @@ -98,9 +98,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_applier_status.h b/storage/perfschema/table_replication_applier_status.h index 026edea5442..b276af0d456 100644 --- a/storage/perfschema/table_replication_applier_status.h +++ b/storage/perfschema/table_replication_applier_status.h @@ -94,10 +94,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_applier_status(); @@ -109,9 +109,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_applier_status_by_coordinator.h b/storage/perfschema/table_replication_applier_status_by_coordinator.h index 0d3f74f04ac..d4c38a4b21e 100644 --- a/storage/perfschema/table_replication_applier_status_by_coordinator.h +++ b/storage/perfschema/table_replication_applier_status_by_coordinator.h @@ -100,10 +100,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_applier_status_by_coordinator(); @@ -115,9 +115,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_applier_status_by_worker.h b/storage/perfschema/table_replication_applier_status_by_worker.h index db2a66f2045..5a1f4456052 100644 --- a/storage/perfschema/table_replication_applier_status_by_worker.h +++ b/storage/perfschema/table_replication_applier_status_by_worker.h @@ -158,10 +158,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_applier_status_by_worker(); @@ -173,9 +173,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_connection_configuration.h b/storage/perfschema/table_replication_connection_configuration.h index 315ad98afe7..f43946992d2 100644 --- a/storage/perfschema/table_replication_connection_configuration.h +++ b/storage/perfschema/table_replication_connection_configuration.h @@ -128,10 +128,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_connection_configuration(); @@ -143,9 +143,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_connection_status.h b/storage/perfschema/table_replication_connection_status.h index 57cc9a944df..d8c1a430037 100644 --- a/storage/perfschema/table_replication_connection_status.h +++ b/storage/perfschema/table_replication_connection_status.h @@ -126,10 +126,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_connection_status(); @@ -141,9 +141,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_group_member_stats.h b/storage/perfschema/table_replication_group_member_stats.h index d3d00a7a5f2..af78971fbb8 100644 --- a/storage/perfschema/table_replication_group_member_stats.h +++ b/storage/perfschema/table_replication_group_member_stats.h @@ -91,10 +91,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_group_member_stats(); @@ -106,9 +106,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_replication_group_members.h b/storage/perfschema/table_replication_group_members.h index 3ea5787877a..f8c205ef2e2 100644 --- a/storage/perfschema/table_replication_group_members.h +++ b/storage/perfschema/table_replication_group_members.h @@ -84,10 +84,10 @@ protected: @param read_all true if all columns are read. */ - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_replication_group_members(); @@ -99,9 +99,9 @@ public: static PFS_engine_table_share m_share; static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; }; diff --git a/storage/perfschema/table_session_account_connect_attrs.h b/storage/perfschema/table_session_account_connect_attrs.h index 6a405db6cef..9c2acd714a9 100644 --- a/storage/perfschema/table_session_account_connect_attrs.h +++ b/storage/perfschema/table_session_account_connect_attrs.h @@ -46,7 +46,7 @@ public: ~table_session_account_connect_attrs() = default; protected: - virtual bool thread_fits(PFS_thread *thread); + bool thread_fits(PFS_thread *thread) override; private: /** Table share lock. */ diff --git a/storage/perfschema/table_session_connect.h b/storage/perfschema/table_session_connect.h index bcc42beb574..9f077160780 100644 --- a/storage/perfschema/table_session_connect.h +++ b/storage/perfschema/table_session_connect.h @@ -69,10 +69,10 @@ public: ~table_session_connect(); protected: - virtual void make_row(PFS_thread *pfs, uint ordinal); + void make_row(PFS_thread *pfs, uint ordinal) override; virtual bool thread_fits(PFS_thread *thread); - virtual int read_row_values(TABLE *table, unsigned char *buf, - Field **fields, bool read_all); + int read_row_values(TABLE *table, unsigned char *buf, + Field **fields, bool read_all) override; protected: /** Current row. */ row_session_connect_attrs m_row; diff --git a/storage/perfschema/table_session_status.h b/storage/perfschema/table_session_status.h index 0b3e16c6011..f8b93dcc945 100644 --- a/storage/perfschema/table_session_status.h +++ b/storage/perfschema/table_session_status.h @@ -76,16 +76,16 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_session_status(); public: diff --git a/storage/perfschema/table_session_variables.h b/storage/perfschema/table_session_variables.h index f46d9967e5c..1f27b1796ce 100644 --- a/storage/perfschema/table_session_variables.h +++ b/storage/perfschema/table_session_variables.h @@ -74,16 +74,16 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_session_variables(); public: diff --git a/storage/perfschema/table_setup_actors.h b/storage/perfschema/table_setup_actors.h index 1909d41e24b..dcd7eabd808 100644 --- a/storage/perfschema/table_setup_actors.h +++ b/storage/perfschema/table_setup_actors.h @@ -71,24 +71,24 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; - virtual int delete_row_values(TABLE *table, - const unsigned char *buf, - Field **fields); + int delete_row_values(TABLE *table, + const unsigned char *buf, + Field **fields) override; table_setup_actors(); diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index c7386d7a050..2e5cc618609 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -59,20 +59,20 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; table_setup_consumers(); diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 9ea142857ce..40266900283 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -97,21 +97,21 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); - - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); - + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; + + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; + table_setup_instruments(); public: diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h index 32853b36497..5409e3d8813 100644 --- a/storage/perfschema/table_setup_objects.h +++ b/storage/perfschema/table_setup_objects.h @@ -70,24 +70,24 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); - - virtual int delete_row_values(TABLE *table, - const unsigned char *buf, - Field **fields); + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; + + int delete_row_values(TABLE *table, + const unsigned char *buf, + Field **fields) override; table_setup_objects(); diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index e606fcbfa8b..d66fa548584 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -55,20 +55,20 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; table_setup_timers(); diff --git a/storage/perfschema/table_socket_instances.h b/storage/perfschema/table_socket_instances.h index c8a4a5b6a5d..61cb121afd4 100644 --- a/storage/perfschema/table_socket_instances.h +++ b/storage/perfschema/table_socket_instances.h @@ -73,15 +73,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_socket_instances(); diff --git a/storage/perfschema/table_socket_summary_by_event_name.h b/storage/perfschema/table_socket_summary_by_event_name.h index 726d16abb0a..ab0f8bb8fae 100644 --- a/storage/perfschema/table_socket_summary_by_event_name.h +++ b/storage/perfschema/table_socket_summary_by_event_name.h @@ -63,15 +63,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_socket_summary_by_event_name(); diff --git a/storage/perfschema/table_socket_summary_by_instance.h b/storage/perfschema/table_socket_summary_by_instance.h index 21e811baabf..2f51d8b5e39 100644 --- a/storage/perfschema/table_socket_summary_by_instance.h +++ b/storage/perfschema/table_socket_summary_by_instance.h @@ -66,15 +66,15 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_socket_summary_by_instance(); diff --git a/storage/perfschema/table_status_by_account.h b/storage/perfschema/table_status_by_account.h index c8d270c5926..e06885bbfad 100644 --- a/storage/perfschema/table_status_by_account.h +++ b/storage/perfschema/table_status_by_account.h @@ -111,16 +111,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_status_by_account(); public: diff --git a/storage/perfschema/table_status_by_host.h b/storage/perfschema/table_status_by_host.h index 4e28966c016..41810ee3969 100644 --- a/storage/perfschema/table_status_by_host.h +++ b/storage/perfschema/table_status_by_host.h @@ -109,16 +109,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_status_by_host(); public: diff --git a/storage/perfschema/table_status_by_thread.h b/storage/perfschema/table_status_by_thread.h index 770490438f1..c8fb8c4f095 100644 --- a/storage/perfschema/table_status_by_thread.h +++ b/storage/perfschema/table_status_by_thread.h @@ -107,16 +107,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_status_by_thread(); public: diff --git a/storage/perfschema/table_status_by_user.h b/storage/perfschema/table_status_by_user.h index 1954b15d820..69cc3a6c14e 100644 --- a/storage/perfschema/table_status_by_user.h +++ b/storage/perfschema/table_status_by_user.h @@ -109,16 +109,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_status_by_user(); public: diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index 75424d56540..1a6cf81a173 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -65,15 +65,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_mutex_instances(); @@ -123,15 +123,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_rwlock_instances(); @@ -175,15 +175,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; private: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_cond_instances(); diff --git a/storage/perfschema/table_table_handles.h b/storage/perfschema/table_table_handles.h index 7e184deb9a0..d2330104e5d 100644 --- a/storage/perfschema/table_table_handles.h +++ b/storage/perfschema/table_table_handles.h @@ -69,16 +69,16 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_table_handles(); diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h index 1f981ded4d7..b71fb47e7b8 100644 --- a/storage/perfschema/table_threads.h +++ b/storage/perfschema/table_threads.h @@ -95,16 +95,16 @@ public: static PFS_engine_table* create(); protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; + - - virtual int update_row_values(TABLE *table, - const unsigned char *old_buf, - const unsigned char *new_buf, - Field **fields); + int update_row_values(TABLE *table, + const unsigned char *old_buf, + const unsigned char *new_buf, + Field **fields) override; protected: table_threads(); @@ -113,7 +113,7 @@ public: ~table_threads() = default; private: - virtual void make_row(PFS_thread *pfs); + void make_row(PFS_thread *pfs) override; /** Table share lock. */ static THR_LOCK m_table_lock; diff --git a/storage/perfschema/table_tiws_by_index_usage.h b/storage/perfschema/table_tiws_by_index_usage.h index 6bc009fcf20..70095921d3b 100644 --- a/storage/perfschema/table_tiws_by_index_usage.h +++ b/storage/perfschema/table_tiws_by_index_usage.h @@ -87,16 +87,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_tiws_by_index_usage(); diff --git a/storage/perfschema/table_tiws_by_table.h b/storage/perfschema/table_tiws_by_table.h index 2970ee64b06..e28704ec270 100644 --- a/storage/perfschema/table_tiws_by_table.h +++ b/storage/perfschema/table_tiws_by_table.h @@ -62,16 +62,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_tiws_by_table(); diff --git a/storage/perfschema/table_tlws_by_table.h b/storage/perfschema/table_tlws_by_table.h index 5755e33f7a7..6d2a77f0f3b 100644 --- a/storage/perfschema/table_tlws_by_table.h +++ b/storage/perfschema/table_tlws_by_table.h @@ -62,16 +62,16 @@ public: static int delete_all_rows(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_tlws_by_table(); diff --git a/storage/perfschema/table_users.h b/storage/perfschema/table_users.h index 9255ec9546a..7a16284c088 100644 --- a/storage/perfschema/table_users.h +++ b/storage/perfschema/table_users.h @@ -57,10 +57,10 @@ public: static int delete_all_rows(); protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; protected: @@ -70,7 +70,7 @@ public: ~table_users() = default; private: - virtual void make_row(PFS_user *pfs); + void make_row(PFS_user *pfs) override; /** Table share lock. */ static THR_LOCK m_table_lock; diff --git a/storage/perfschema/table_uvar_by_thread.cc b/storage/perfschema/table_uvar_by_thread.cc index 74b6165d039..ed4ed039481 100644 --- a/storage/perfschema/table_uvar_by_thread.cc +++ b/storage/perfschema/table_uvar_by_thread.cc @@ -46,7 +46,7 @@ public: : m_unsafe_thd(unsafe_thd) {} - virtual bool operator()(THD *thd) + bool operator()(THD *thd) override { if (thd != m_unsafe_thd) return false; diff --git a/storage/perfschema/table_uvar_by_thread.h b/storage/perfschema/table_uvar_by_thread.h index 61c521069c7..37427a0d201 100644 --- a/storage/perfschema/table_uvar_by_thread.h +++ b/storage/perfschema/table_uvar_by_thread.h @@ -154,15 +154,15 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_uvar_by_thread(); diff --git a/storage/perfschema/table_variables_by_thread.h b/storage/perfschema/table_variables_by_thread.h index 99adcda4e98..87f284429eb 100644 --- a/storage/perfschema/table_variables_by_thread.h +++ b/storage/perfschema/table_variables_by_thread.h @@ -107,16 +107,16 @@ public: static PFS_engine_table* create(); static ha_rows get_row_count(); - virtual int rnd_init(bool scan); - virtual int rnd_next(); - virtual int rnd_pos(const void *pos); - virtual void reset_position(void); + int rnd_init(bool scan) override; + int rnd_next() override; + int rnd_pos(const void *pos) override; + void reset_position(void) override; protected: - virtual int read_row_values(TABLE *table, - unsigned char *buf, - Field **fields, - bool read_all); + int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) override; table_variables_by_thread(); public: diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index d2d695fc7b9..fd4c7f7680c 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -3169,7 +3169,7 @@ class Rdb_transaction_impl : public Rdb_transaction { } } - virtual bool is_writebatch_trx() const override { return false; } + bool is_writebatch_trx() const override { return false; } bool is_prepared() override { return m_rocksdb_tx && rocksdb::Transaction::PREPARED == m_rocksdb_tx->GetState(); @@ -3514,7 +3514,7 @@ private: m_notifier = std::make_shared(this); } - virtual ~Rdb_transaction_impl() override { + ~Rdb_transaction_impl() override { rollback(); // Theoretically the notifier could outlive the Rdb_transaction_impl @@ -3720,7 +3720,7 @@ class Rdb_writebatch_impl : public Rdb_transaction { true); } - virtual ~Rdb_writebatch_impl() override { + ~Rdb_writebatch_impl() override { rollback(); delete m_batch; } diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index d8413fca725..70795c17d38 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -441,7 +441,7 @@ class ha_rocksdb : public my_core::handler { ha_rocksdb(my_core::handlerton *const hton, my_core::TABLE_SHARE *const table_arg); - virtual ~ha_rocksdb() override { + ~ha_rocksdb() override { int err MY_ATTRIBUTE((__unused__)); err = finalize_bulk_load(false); if (err != 0) { @@ -458,7 +458,7 @@ class ha_rocksdb : public my_core::handler { const char *table_type() const - is non-virtual in class handler, so there's no point to override it. + is non-in class handler, so there's no point to override it. */ /* The following is only used by SHOW KEYS: */ @@ -623,15 +623,15 @@ public: bool sorted) override MY_ATTRIBUTE((__warn_unused_result__)); - virtual double scan_time() override { + double scan_time() override { DBUG_ENTER_FUNC(); DBUG_RETURN( static_cast((stats.records + stats.deleted) / 20.0 + 10)); } - virtual double read_time(uint, uint, ha_rows rows) override; - virtual void print_error(int error, myf errflag) override; + double read_time(uint, uint, ha_rows rows) override; + void print_error(int error, myf errflag) override; int open(const char *const name, int mode, uint test_if_locked) override MY_ATTRIBUTE((__warn_unused_result__)); @@ -977,11 +977,11 @@ public: #ifdef MARIAROCKS_NOT_YET // MDEV-10976 public: - virtual void rpl_before_delete_rows() override; - virtual void rpl_after_delete_rows() override; - virtual void rpl_before_update_rows() override; - virtual void rpl_after_update_rows() override; - virtual bool use_read_free_rpl() const override; + void rpl_before_delete_rows() override; + void rpl_after_delete_rows() override; + void rpl_before_update_rows() override; + void rpl_after_update_rows() override; + bool use_read_free_rpl() const override; #endif // MARIAROCKS_NOT_YET private: diff --git a/storage/rocksdb/properties_collector.h b/storage/rocksdb/properties_collector.h index ce2773cd618..a924227d5b1 100644 --- a/storage/rocksdb/properties_collector.h +++ b/storage/rocksdb/properties_collector.h @@ -128,7 +128,7 @@ class Rdb_tbl_prop_coll : public rocksdb::TablePropertiesCollector { virtual rocksdb::Status Finish( rocksdb::UserCollectedProperties *properties) override; - virtual const char *Name() const override { return "Rdb_tbl_prop_coll"; } + const char *Name() const override { return "Rdb_tbl_prop_coll"; } rocksdb::UserCollectedProperties GetReadableProperties() const override; @@ -193,7 +193,7 @@ class Rdb_tbl_prop_coll_factory m_table_stats_sampling_pct); } - virtual const char *Name() const override { + const char *Name() const override { return "Rdb_tbl_prop_coll_factory"; } diff --git a/storage/rocksdb/rdb_compact_filter.h b/storage/rocksdb/rdb_compact_filter.h index 93767b23787..cadd55e8c2f 100644 --- a/storage/rocksdb/rdb_compact_filter.h +++ b/storage/rocksdb/rdb_compact_filter.h @@ -105,9 +105,9 @@ class Rdb_compact_filter : public rocksdb::CompactionFilter { return false; } - virtual bool IgnoreSnapshots() const override { return true; } + bool IgnoreSnapshots() const override { return true; } - virtual const char *Name() const override { return "Rdb_compact_filter"; } + const char *Name() const override { return "Rdb_compact_filter"; } void get_ttl_duration_and_offset(const GL_INDEX_ID &gl_index_id, uint64 *ttl_duration, diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h index c16bd00335d..67cc2bdaf58 100644 --- a/storage/rocksdb/rdb_datadic.h +++ b/storage/rocksdb/rdb_datadic.h @@ -1582,7 +1582,7 @@ class Rdb_system_merge_op : public rocksdb::AssociativeMergeOperator { return true; } - virtual const char *Name() const override { return "Rdb_system_merge_op"; } + const char *Name() const override { return "Rdb_system_merge_op"; } private: /* diff --git a/storage/rocksdb/rdb_mutex_wrapper.h b/storage/rocksdb/rdb_mutex_wrapper.h index fd0790aa8e6..bcc92533e73 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.h +++ b/storage/rocksdb/rdb_mutex_wrapper.h @@ -39,7 +39,7 @@ class Rdb_mutex : public rocksdb::TransactionDBMutex { public: Rdb_mutex(); - virtual ~Rdb_mutex() override; + ~Rdb_mutex() override; /* Override parent class's virtual methods of interrest. @@ -47,7 +47,7 @@ class Rdb_mutex : public rocksdb::TransactionDBMutex { // Attempt to acquire lock. Return OK on success, or other Status on failure. // If returned status is OK, TransactionDB will eventually call UnLock(). - virtual rocksdb::Status Lock() override; + rocksdb::Status Lock() override; // Attempt to acquire lock. If timeout is non-negative, operation should be // failed after this many microseconds. @@ -59,7 +59,7 @@ class Rdb_mutex : public rocksdb::TransactionDBMutex { int64_t timeout_time MY_ATTRIBUTE((__unused__))) override; // Unlock Mutex that was successfully locked by Lock() or TryLockUntil() - virtual void UnLock() override; + void UnLock() override; private: mysql_mutex_t m_mutex; @@ -77,7 +77,7 @@ class Rdb_cond_var : public rocksdb::TransactionDBCondVar { public: Rdb_cond_var(); - virtual ~Rdb_cond_var() override; + ~Rdb_cond_var() override; /* Override parent class's virtual methods of interrest. @@ -109,10 +109,10 @@ class Rdb_cond_var : public rocksdb::TransactionDBCondVar { // If any threads are waiting on *this, unblock at least one of the // waiting threads. - virtual void Notify() override; + void Notify() override; // Unblocks all threads waiting on *this. - virtual void NotifyAll() override; + void NotifyAll() override; private: mysql_cond_t m_cond; @@ -137,7 +137,7 @@ class Rdb_mutex_factory : public rocksdb::TransactionDBMutexFactory { return std::make_shared(); } - virtual ~Rdb_mutex_factory() override = default; + ~Rdb_mutex_factory() override = default; }; } // namespace myrocks diff --git a/storage/rocksdb/rdb_threads.h b/storage/rocksdb/rdb_threads.h index d23419df3b9..36ce4620343 100644 --- a/storage/rocksdb/rdb_threads.h +++ b/storage/rocksdb/rdb_threads.h @@ -148,7 +148,7 @@ class Rdb_background_thread : public Rdb_thread { } public: - virtual void run() override; + void run() override; void request_save_stats() { RDB_MUTEX_LOCK_CHECK(m_signal_mutex); @@ -175,7 +175,7 @@ class Rdb_manual_compaction_thread : public Rdb_thread { std::map m_requests; public: - virtual void run() override; + void run() override; int request_manual_compaction(rocksdb::ColumnFamilyHandle *cf, rocksdb::Slice *start, rocksdb::Slice *limit, int concurrency = 0); @@ -189,7 +189,7 @@ class Rdb_manual_compaction_thread : public Rdb_thread { */ struct Rdb_drop_index_thread : public Rdb_thread { - virtual void run() override; + void run() override; }; } // namespace myrocks diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc index b2bce9325ac..4db6a5144ef 100644 --- a/storage/sequence/sequence.cc +++ b/storage/sequence/sequence.cc @@ -47,7 +47,7 @@ public: { thr_lock_init(&lock); } - ~Sequence_share() + ~Sequence_share() override { thr_lock_delete(&lock); } @@ -64,45 +64,45 @@ public: Sequence_share *seqs; ha_seq(handlerton *hton, TABLE_SHARE *table_arg) : handler(hton, table_arg), seqs(0) { } - ulonglong table_flags() const + ulonglong table_flags() const override { return HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE; } /* open/close/locking */ int create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info) + HA_CREATE_INFO *create_info) override { return HA_ERR_WRONG_COMMAND; } - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int delete_table(const char *name) + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; + int delete_table(const char *name) override { return 0; } - THR_LOCK_DATA **store_lock(THD *, THR_LOCK_DATA **, enum thr_lock_type); + THR_LOCK_DATA **store_lock(THD *, THR_LOCK_DATA **, enum thr_lock_type) override; /* table scan */ - int rnd_init(bool scan); - int rnd_next(unsigned char *buf); - void position(const uchar *record); - int rnd_pos(uchar *buf, uchar *pos); - int info(uint flag); + int rnd_init(bool scan) override; + int rnd_next(unsigned char *buf) override; + void position(const uchar *record) override; + int rnd_pos(uchar *buf, uchar *pos) override; + int info(uint flag) override; /* indexes */ - ulong index_flags(uint inx, uint part, bool all_parts) const + ulong index_flags(uint inx, uint part, bool all_parts) const override { return HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE | HA_KEYREAD_ONLY; } - uint max_supported_keys() const { return 1; } + uint max_supported_keys() const override { return 1; } int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag); - int index_next(uchar *buf); - int index_prev(uchar *buf); - int index_first(uchar *buf); - int index_last(uchar *buf); + enum ha_rkey_function find_flag) override; + int index_next(uchar *buf) override; + int index_prev(uchar *buf) override; + int index_first(uchar *buf) override; + int index_last(uchar *buf) override; ha_rows records_in_range(uint inx, const key_range *start_key, - const key_range *end_key, page_range *pages); - double scan_time() { return (double)nvalues(); } - double read_time(uint index, uint ranges, ha_rows rows) { return (double)rows; } - double keyread_time(uint index, uint ranges, ha_rows rows) { return (double)rows; } + const key_range *end_key, page_range *pages) override; + double scan_time() override { return (double)nvalues(); } + double read_time(uint index, uint ranges, ha_rows rows) override { return (double)rows; } + double keyread_time(uint index, uint ranges, ha_rows rows) override { return (double)rows; } private: void set(uchar *buf); @@ -382,10 +382,10 @@ public: // Reset limit because we are handling it now orig_lim->set_unlimited(); } - ~ha_seq_group_by_handler() = default; - int init_scan() { first_row= 1 ; return 0; } - int next_row(); - int end_scan() { return 0; } + ~ha_seq_group_by_handler() override = default; + int init_scan() override { first_row= 1 ; return 0; } + int next_row() override; + int end_scan() override { return 0; } }; static group_by_handler * diff --git a/storage/sphinx/ha_sphinx.h b/storage/sphinx/ha_sphinx.h index 5a1541f1d2e..77685fb0ddf 100644 --- a/storage/sphinx/ha_sphinx.h +++ b/storage/sphinx/ha_sphinx.h @@ -56,84 +56,84 @@ public: ~ha_sphinx (); const char * table_type () const { return "SPHINX"; } ///< SE name for display purposes - const char * index_type ( uint ) { return "HASH"; } ///< index type name for display purposes + const char * index_type ( uint ) override { return "HASH"; } ///< index type name for display purposes #if MYSQL_VERSION_ID>50100 - ulonglong table_flags () const { return HA_CAN_INDEX_BLOBS | + ulonglong table_flags () const override { return HA_CAN_INDEX_BLOBS | HA_CAN_TABLE_CONDITION_PUSHDOWN; } ///< bitmap of implemented flags (see handler.h for more info) #else ulong table_flags () const { return HA_CAN_INDEX_BLOBS; } ///< bitmap of implemented flags (see handler.h for more info) #endif - ulong index_flags ( uint, uint, bool ) const { return 0; } ///< bitmap of flags that says how SE implements indexes - uint max_supported_record_length () const { return HA_MAX_REC_LENGTH; } - uint max_supported_keys () const { return 1; } - uint max_supported_key_parts () const { return 1; } - uint max_supported_key_length () const { return MAX_KEY_LENGTH; } - uint max_supported_key_part_length () const { return MAX_KEY_LENGTH; } + ulong index_flags ( uint, uint, bool ) const override { return 0; } ///< bitmap of flags that says how SE implements indexes + uint max_supported_record_length () const override { return HA_MAX_REC_LENGTH; } + uint max_supported_keys () const override { return 1; } + uint max_supported_key_parts () const override { return 1; } + uint max_supported_key_length () const override { return MAX_KEY_LENGTH; } + uint max_supported_key_part_length () const override { return MAX_KEY_LENGTH; } #if MYSQL_VERSION_ID>50100 - virtual double scan_time () { return (double)( stats.records+stats.deleted )/20.0 + 10; } ///< called in test_quick_select to determine if indexes should be used + double scan_time () override { return (double)( stats.records+stats.deleted )/20.0 + 10; } ///< called in test_quick_select to determine if indexes should be used #else virtual double scan_time () { return (double)( records+deleted )/20.0 + 10; } ///< called in test_quick_select to determine if indexes should be used #endif - virtual double read_time(uint index, uint ranges, ha_rows rows) + double read_time(uint index, uint ranges, ha_rows rows) override { return ranges + (double)rows/20.0 + 1; } ///< index read time estimate public: - int open ( const char * name, int mode, uint test_if_locked ); - int close (); + int open ( const char * name, int mode, uint test_if_locked ) override; + int close () override; - int write_row ( const byte * buf ); - int update_row ( const byte * old_data, const byte * new_data ); - int delete_row ( const byte * buf ); - int extra ( enum ha_extra_function op ); + int write_row ( const byte * buf ) override; + int update_row ( const byte * old_data, const byte * new_data ) override; + int delete_row ( const byte * buf ) override; + int extra ( enum ha_extra_function op ) override; - int index_init ( uint keynr, bool sorted ); // 5.1.x + int index_init ( uint keynr, bool sorted ) override; // 5.1.x int index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x - int index_end (); - int index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag ); + int index_end () override; + int index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag ) override; int index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag ); - int index_next ( byte * buf ); - int index_next_same ( byte * buf, const byte * key, uint keylen ); - int index_prev ( byte * buf ); - int index_first ( byte * buf ); - int index_last ( byte * buf ); + int index_next ( byte * buf ) override; + int index_next_same ( byte * buf, const byte * key, uint keylen ) override; + int index_prev ( byte * buf ) override; + int index_first ( byte * buf ) override; + int index_last ( byte * buf ) override; int get_rec ( byte * buf, const byte * key, uint keylen ); - int rnd_init ( bool scan ); - int rnd_end (); - int rnd_next ( byte * buf ); - int rnd_pos ( byte * buf, byte * pos ); - void position ( const byte * record ); + int rnd_init ( bool scan ) override; + int rnd_end () override; + int rnd_next ( byte * buf ) override; + int rnd_pos ( byte * buf, byte * pos ) override; + void position ( const byte * record ) override; #if MYSQL_VERSION_ID>=50030 - int info ( uint ); + int info ( uint ) override; #else void info ( uint ); #endif - int reset(); - int external_lock ( THD * thd, int lock_type ); - int delete_all_rows (); - ha_rows records_in_range ( uint inx, const key_range * min_key, const key_range * max_key, page_range *pages); + int reset() override; + int external_lock ( THD * thd, int lock_type ) override; + int delete_all_rows () override; + ha_rows records_in_range ( uint inx, const key_range * min_key, const key_range * max_key, page_range *pages) override; - 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 delete_table ( const char * from ) override; + int rename_table ( const char * from, const char * to ) override; + int create ( const char * name, TABLE * form, HA_CREATE_INFO * create_info ) override; - THR_LOCK_DATA ** store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type ); + THR_LOCK_DATA ** store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type ) override; public: #if MYSQL_VERSION_ID<50610 virtual const COND * cond_push ( const COND *cond ); #else - virtual const Item * cond_push ( const Item *cond ); + const Item * cond_push ( const Item *cond ) override; #endif - virtual void cond_pop (); + void cond_pop () override; private: uint32 m_iFields; diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 5ccf3d5c4f5..def8ee169ed 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -208,14 +208,14 @@ public: handler *clone( const char *name, MEM_ROOT *mem_root - ); + ) override; const char **bas_ext() const; int open( const char* name, int mode, uint test_if_locked - ); - int close(); + ) override; + int close() override; int check_access_kind_for_connection( THD *thd, bool write_request @@ -233,30 +233,30 @@ public: THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type - ); + ) override; int external_lock( THD *thd, int lock_type - ); + ) override; int start_stmt( THD *thd, thr_lock_type lock_type - ); - int reset(); + ) override; + int reset() override; int extra( enum ha_extra_function operation - ); + ) override; int index_init( uint idx, bool sorted - ); + ) override; #ifdef HA_CAN_BULK_ACCESS int pre_index_init( uint idx, bool sorted ); #endif - int index_end(); + int index_end() override; #ifdef HA_CAN_BULK_ACCESS int pre_index_end(); #endif @@ -265,36 +265,36 @@ public: const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag - ); + ) override; int index_read_last_map( uchar *buf, const uchar *key, key_part_map keypart_map - ); + ) override; int index_next( uchar *buf - ); + ) override; int index_prev( uchar *buf - ); + ) override; int index_first( uchar *buf - ); + ) override; int index_last( uchar *buf - ); + ) override; int index_next_same( uchar *buf, const uchar *key, uint keylen - ); + ) override; int read_range_first( const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted - ); - int read_range_next(); + ) override; + int read_range_next() override; void reset_no_where_cond(); bool check_no_where_cond(); #ifdef HA_MRR_USE_DEFAULT_IMPL @@ -306,7 +306,7 @@ public: uint *bufsz, uint *flags, Cost_estimate *cost - ); + ) override; ha_rows multi_range_read_info( uint keyno, uint n_ranges, @@ -315,17 +315,17 @@ public: uint *bufsz, uint *flags, Cost_estimate *cost - ); + ) override; int multi_range_read_init( RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf - ); + ) override; int multi_range_read_next( range_id_t *range_info - ); + ) override; int multi_range_read_next_first( range_id_t *range_info ); @@ -346,57 +346,57 @@ public: #endif int rnd_init( bool scan - ); + ) override; #ifdef HA_CAN_BULK_ACCESS int pre_rnd_init( bool scan ); #endif - int rnd_end(); + int rnd_end() override; #ifdef HA_CAN_BULK_ACCESS int pre_rnd_end(); #endif int rnd_next( uchar *buf - ); + ) override; void position( const uchar *record - ); + ) override; int rnd_pos( uchar *buf, uchar *pos - ); + ) override; int cmp_ref( const uchar *ref1, const uchar *ref2 - ); - int ft_init(); - void ft_end(); + ) override; + int ft_init() override; + void ft_end() override; FT_INFO *ft_init_ext( uint flags, uint inx, String *key - ); + ) override; int ft_read( uchar *buf - ); + ) override; int pre_index_read_map( const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag, bool use_parallel - ); - int pre_index_first(bool use_parallel); - int pre_index_last(bool use_parallel); + ) override; + int pre_index_first(bool use_parallel) override; + int pre_index_last(bool use_parallel) override; int pre_index_read_last_map( const uchar *key, key_part_map keypart_map, bool use_parallel - ); + ) override; #ifdef HA_MRR_USE_DEFAULT_IMPL int pre_multi_range_read_next( bool use_parallel - ); + ) override; #else int pre_read_multi_range_first( KEY_MULTI_RANGE **found_range_p, @@ -413,47 +413,47 @@ public: bool eq_range, bool sorted, bool use_parallel - ); - int pre_ft_read(bool use_parallel); - int pre_rnd_next(bool use_parallel); + ) override; + int pre_ft_read(bool use_parallel) override; + int pre_rnd_next(bool use_parallel) override; int info( uint flag - ); + ) override; ha_rows records_in_range( uint inx, const key_range *start_key, const key_range *end_key, page_range *pages - ); + ) override; int check_crd(); - int pre_records(); - ha_rows records(); + int pre_records() override; + ha_rows records() override; #ifdef HA_HAS_CHECKSUM_EXTENDED - int pre_calculate_checksum(); - int calculate_checksum(); + int pre_calculate_checksum() override; + int calculate_checksum() override; #endif const char *table_type() const; - ulonglong table_flags() const; + ulonglong table_flags() const override; ulong table_flags_for_partition(); const char *index_type( uint key_number - ); + ) override; ulong index_flags( uint idx, uint part, bool all_parts - ) const; - uint max_supported_record_length() const; - uint max_supported_keys() const; - uint max_supported_key_parts() const; - uint max_supported_key_length() const; - uint max_supported_key_part_length() const; - uint8 table_cache_type(); + ) const override; + uint max_supported_record_length() const override; + uint max_supported_keys() const override; + uint max_supported_key_parts() const override; + uint max_supported_key_length() const override; + uint max_supported_key_part_length() const override; + uint8 table_cache_type() override; #ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC - bool need_info_for_auto_inc(); + bool need_info_for_auto_inc() override; #endif #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT - bool can_use_for_auto_inc_init(); + bool can_use_for_auto_inc_init() override; #endif int update_auto_increment(); void get_auto_increment( @@ -462,25 +462,25 @@ public: ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values - ); + ) override; int reset_auto_increment( ulonglong value - ); - void release_auto_increment(); + ) override; + void release_auto_increment() override; #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS void start_bulk_insert( ha_rows rows, uint flags - ); + ) override; #else void start_bulk_insert( ha_rows rows ); #endif - int end_bulk_insert(); + int end_bulk_insert() override; int write_row( const uchar *buf - ); + ) override; #ifdef HA_CAN_BULK_ACCESS int pre_write_row( uchar *buf @@ -492,21 +492,21 @@ public: bool hs_request ); #endif - bool start_bulk_update(); + bool start_bulk_update() override; int exec_bulk_update( ha_rows *dup_key_found - ); - int end_bulk_update(); + ) override; + int end_bulk_update() override; #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int bulk_update_row( const uchar *old_data, const uchar *new_data, ha_rows *dup_key_found - ); + ) override; int update_row( const uchar *old_data, const uchar *new_data - ); + ) override; #else int bulk_update_row( const uchar *old_data, @@ -556,7 +556,7 @@ public: #ifdef SPIDER_MDEV_16246 int direct_update_rows_init( List *update_fields - ); + ) override; #else int direct_update_rows_init(); #endif @@ -617,7 +617,7 @@ public: int direct_update_rows( ha_rows *update_rows, ha_rows *found_row - ); + ) override; #endif #ifdef HA_CAN_BULK_ACCESS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS @@ -642,11 +642,11 @@ public: #endif #endif #endif - bool start_bulk_delete(); - int end_bulk_delete(); + bool start_bulk_delete() override; + int end_bulk_delete() override; int delete_row( const uchar *buf - ); + ) override; #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool check_direct_delete_sql_part( st_select_lex *select_lex, @@ -665,7 +665,7 @@ public: bool sorted ); #else - int direct_delete_rows_init(); + int direct_delete_rows_init() override; #endif #ifdef HA_CAN_BULK_ACCESS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS @@ -697,7 +697,7 @@ public: #else int direct_delete_rows( ha_rows *delete_rows - ); + ) override; #endif #ifdef HA_CAN_BULK_ACCESS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS @@ -718,90 +718,90 @@ public: #endif #endif #endif - int delete_all_rows(); - int truncate(); - double scan_time(); + int delete_all_rows() override; + int truncate() override; + double scan_time() override; double read_time( uint index, uint ranges, ha_rows rows - ); + ) override; #ifdef HA_CAN_BULK_ACCESS void bulk_req_exec(); #endif - const key_map *keys_to_use_for_scanning(); - ha_rows estimate_rows_upper_bound(); + const key_map *keys_to_use_for_scanning() override; + ha_rows estimate_rows_upper_bound() override; void print_error( int error, myf errflag - ); + ) override; bool get_error_message( int error, String *buf - ); + ) override; int create( const char *name, TABLE *form, HA_CREATE_INFO *info - ); + ) override; void update_create_info( HA_CREATE_INFO* create_info - ); + ) override; int rename_table( const char *from, const char *to - ); + ) override; int delete_table( const char *name - ); - bool is_crashed() const; + ) override; + bool is_crashed() const override; #ifdef SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR - bool auto_repair(int error) const; + bool auto_repair(int error) const override; #else bool auto_repair() const; #endif int disable_indexes( key_map map, bool persist - ); + ) override; int enable_indexes( key_map map, bool persist - ); + ) override; int check( THD* thd, HA_CHECK_OPT* check_opt - ); + ) override; int repair( THD* thd, HA_CHECK_OPT* check_opt - ); + ) override; bool check_and_repair( THD *thd - ); + ) override; int analyze( THD* thd, HA_CHECK_OPT* check_opt - ); + ) override; int optimize( THD* thd, HA_CHECK_OPT* check_opt - ); + ) override; bool is_fatal_error( int error_num, uint flags - ); + ) override; Field *field_exchange( Field *field ); const COND *cond_push( const COND* cond - ); - void cond_pop(); + ) override; + void cond_pop() override; int info_push( uint info_type, void *info - ); + ) override; #ifdef HANDLER_HAS_DIRECT_AGGREGATE - void return_record_by_parent(); + void return_record_by_parent() override; #endif TABLE *get_table(); void set_ft_discard_bitmap(); diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 231e7374b81..0a133267e0e 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -245,29 +245,29 @@ public: int store_to_field( Field *field, CHARSET_INFO *access_charset - ); + ) override; int append_to_str( spider_string *str - ); + ) override; int append_escaped_to_str( spider_string *str, uint dbton_id - ); - void first(); - void next(); - bool is_null(); - int val_int(); - double val_real(); + ) override; + void first() override; + void next() override; + bool is_null() override; + int val_int() override; + double val_real() override; my_decimal *val_decimal( my_decimal *decimal_value, CHARSET_INFO *access_charset - ); - SPIDER_DB_ROW *clone(); + ) override; + SPIDER_DB_ROW *clone() override; int store_to_tmp_table( TABLE *tmp_table, spider_string *str - ); - uint get_byte_size(); + ) override; + uint get_byte_size() override; }; class spider_db_mysql_row: public spider_db_mbase_row @@ -295,20 +295,20 @@ public: SPIDER_DB_CONN *in_db_conn ); virtual ~spider_db_mbase_result(); - bool has_result(); - void free_result(); - SPIDER_DB_ROW *current_row(); - SPIDER_DB_ROW *fetch_row(); + bool has_result() override; + void free_result() override; + SPIDER_DB_ROW *current_row() override; + SPIDER_DB_ROW *fetch_row() override; SPIDER_DB_ROW *fetch_row_from_result_buffer( spider_db_result_buffer *spider_res_buf - ); + ) override; SPIDER_DB_ROW *fetch_row_from_tmp_table( TABLE *tmp_table - ); + ) override; int fetch_table_status( int mode, ha_statistics &stat - ); + ) override; int fetch_simple_action( uint simple_action, uint position, @@ -317,11 +317,11 @@ public: int fetch_table_records( int mode, ha_rows &records - ); + ) override; #ifdef HA_HAS_CHECKSUM_EXTENDED int fetch_table_checksum( ha_spider *spider - ); + ) override; #endif int fetch_table_cardinality( int mode, @@ -329,10 +329,10 @@ public: longlong *cardinality, uchar *cardinality_upd, int bitmap_size - ); + ) override; int fetch_table_mon_status( int &status - ); + ) override; int fetch_show_master_status( const char **binlog_file_name, const char **binlog_pos @@ -340,26 +340,26 @@ public: int fetch_select_binlog_gtid_pos( const char **gtid_pos ); - longlong num_rows(); - uint num_fields(); + longlong num_rows() override; + uint num_fields() override; void move_to_pos( longlong pos - ); - int get_errno(); + ) override; + int get_errno() override; #ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE int fetch_columns_for_discover_table_structure( spider_string *str, CHARSET_INFO *access_charset - ); + ) override; int fetch_index_for_discover_table_structure( spider_string *str, CHARSET_INFO *access_charset - ); + ) override; int fetch_table_for_discover_table_structure( spider_string *str, SPIDER_SHARE *spider_share, CHARSET_INFO *access_charset - ); + ) override; #endif }; @@ -405,9 +405,9 @@ public: spider_db_mbase_util *spider_db_mbase_utility ); virtual ~spider_db_mbase(); - int init(); - bool is_connected(); - void bg_connect(); + int init() override; + bool is_connected() override; + void bg_connect() override; int connect( char *tgt_host, char *tgt_username, @@ -417,116 +417,116 @@ public: char *server_name, int connect_retry_count, longlong connect_retry_interval - ); - int ping(); - void bg_disconnect(); - void disconnect(); - int set_net_timeout(); + ) override; + int ping() override; + void bg_disconnect() override; + void disconnect() override; + int set_net_timeout() override; int exec_query( const char *query, uint length, int quick_mode - ); - int get_errno(); - const char *get_error(); + ) override; + int get_errno() override; + const char *get_error() override; bool is_server_gone_error( int error_num - ); + ) override; bool is_dup_entry_error( int error_num - ); + ) override; bool is_xa_nota_error( int error_num - ); + ) override; int fetch_and_print_warnings(struct tm *l_time); spider_db_result *store_result( spider_db_result_buffer **spider_res_buf, st_spider_db_request_key *request_key, int *error_num - ); + ) override; spider_db_result *use_result( ha_spider *spider, st_spider_db_request_key *request_key, int *error_num - ); - int next_result(); - uint affected_rows(); - uint matched_rows(); + ) override; + int next_result() override; + uint affected_rows() override; + uint matched_rows() override; bool inserted_info( spider_db_handler *handler, ha_copy_info *copy_info - ); - ulonglong last_insert_id(); + ) override; + ulonglong last_insert_id() override; int set_character_set( const char *csname - ); + ) override; int select_db( const char *dbname - ); + ) override; int consistent_snapshot( int *need_mon - ); - bool trx_start_in_bulk_sql(); + ) override; + bool trx_start_in_bulk_sql() override; int start_transaction( int *need_mon - ); + ) override; int commit( int *need_mon - ); + ) override; int rollback( int *need_mon - ); - bool xa_start_in_bulk_sql(); + ) override; + bool xa_start_in_bulk_sql() override; int xa_start( XID *xid, int *need_mon - ); + ) override; int xa_end( XID *xid, int *need_mon - ); + ) override; int xa_prepare( XID *xid, int *need_mon - ); + ) override; int xa_commit( XID *xid, int *need_mon - ); + ) override; int xa_rollback( XID *xid, int *need_mon - ); - bool set_trx_isolation_in_bulk_sql(); + ) override; + bool set_trx_isolation_in_bulk_sql() override; int set_trx_isolation( int trx_isolation, int *need_mon - ); - bool set_autocommit_in_bulk_sql(); + ) override; + bool set_autocommit_in_bulk_sql() override; int set_autocommit( bool autocommit, int *need_mon - ); - bool set_sql_log_off_in_bulk_sql(); + ) override; + bool set_sql_log_off_in_bulk_sql() override; int set_sql_log_off( bool sql_log_off, int *need_mon - ); - bool set_wait_timeout_in_bulk_sql(); + ) override; + bool set_wait_timeout_in_bulk_sql() override; int set_wait_timeout( int wait_timeout, int *need_mon - ); - bool set_sql_mode_in_bulk_sql(); + ) override; + bool set_sql_mode_in_bulk_sql() override; int set_sql_mode( sql_mode_t sql_mode, int *need_mon - ); - bool set_time_zone_in_bulk_sql(); + ) override; + bool set_time_zone_in_bulk_sql() override; int set_time_zone( Time_zone *time_zone, int *need_mon - ); + ) override; int exec_simple_sql_with_result( SPIDER_TRX *trx, SPIDER_SHARE *share, @@ -546,7 +546,7 @@ public: int mode, SPIDER_DB_RESULT **res1, SPIDER_DB_RESULT **res2 - ); + ) override; int select_binlog_gtid_pos( SPIDER_TRX *trx, SPIDER_SHARE *share, @@ -564,25 +564,25 @@ public: char *to, const char *from, size_t from_length - ); - bool have_lock_table_list(); + ) override; + bool have_lock_table_list() override; int append_lock_tables( spider_string *str - ); + ) override; int append_unlock_tables( spider_string *str - ); - uint get_lock_table_hash_count(); - void reset_lock_table_hash(); - uint get_opened_handler_count(); - void reset_opened_handler(); + ) override; + uint get_lock_table_hash_count() override; + void reset_lock_table_hash() override; + uint get_opened_handler_count() override; + void reset_opened_handler() override; void set_dup_key_idx( ha_spider *spider, int link_idx - ); + ) override; bool cmp_request_key_to_snd( st_spider_db_request_key *request_key - ); + ) override; }; class spider_db_mysql: public spider_db_mbase @@ -637,20 +637,20 @@ public: spider_db_mbase_util *spider_db_mbase_utility ); virtual ~spider_mbase_share(); - int init(); + int init() override; uint get_column_name_length( uint field_index - ); + ) override; int append_column_name( spider_string *str, uint field_index - ); + ) override; int append_column_name_with_alias( spider_string *str, uint field_index, const char *alias, uint alias_length - ); + ) override; int append_table_name( spider_string *str, int all_link_idx @@ -663,16 +663,16 @@ public: spider_string *str, int *table_name_pos ); - bool need_change_db_table_name(); + bool need_change_db_table_name() override; #ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE int discover_table_structure( SPIDER_TRX *trx, SPIDER_SHARE *spider_share, spider_string *str - ); + ) override; #endif #ifdef HA_HAS_CHECKSUM_EXTENDED - bool checksum_support(); + bool checksum_support() override; #endif protected: int create_table_names_str(); @@ -763,17 +763,17 @@ public: spider_db_mbase_util *spider_db_mbase_utility ); virtual ~spider_mbase_handler(); - int init(); + int init() override; int append_index_hint( spider_string *str, int link_idx, ulong sql_type - ); + ) override; int append_table_name_with_adjusting( spider_string *str, int link_idx, ulong sql_type - ); + ) override; int append_key_column_types( const key_range *start_key, spider_string *str @@ -786,8 +786,8 @@ public: ); int append_tmp_table_and_sql_for_bka( const key_range *start_key - ); - int reuse_tmp_table_and_sql_for_bka(); + ) override; + int reuse_tmp_table_and_sql_for_bka() override; void create_tmp_bka_table_name( char *tmp_table_name, int *tmp_table_name_length, @@ -818,62 +818,62 @@ public: ); int append_union_table_and_sql_for_bka( const key_range *start_key - ); - int reuse_union_table_and_sql_for_bka(); + ) override; + int reuse_union_table_and_sql_for_bka() override; int append_insert_for_recovery( ulong sql_type, int link_idx - ); + ) override; int append_update( const TABLE *table, my_ptrdiff_t ptr_diff - ); + ) override; int append_update( const TABLE *table, my_ptrdiff_t ptr_diff, int link_idx - ); + ) override; int append_delete( const TABLE *table, my_ptrdiff_t ptr_diff - ); + ) override; int append_delete( const TABLE *table, my_ptrdiff_t ptr_diff, int link_idx - ); - int append_insert_part(); + ) override; + int append_insert_part() override; int append_insert( spider_string *str, int link_idx ); - int append_update_part(); + int append_update_part() override; int append_update( spider_string *str, int link_idx ); - int append_delete_part(); + int append_delete_part() override; int append_delete( spider_string *str ); - int append_update_set_part(); + int append_update_set_part() override; int append_update_set( spider_string *str ); #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS - int append_direct_update_set_part(); + int append_direct_update_set_part() override; int append_direct_update_set( spider_string *str ); int append_dup_update_pushdown_part( const char *alias, uint alias_length - ); + ) override; int append_update_columns_part( const char *alias, uint alias_length - ); - int check_update_columns_part(); + ) override; + int check_update_columns_part() override; int append_update_columns( spider_string *str, const char *alias, @@ -882,28 +882,28 @@ public: #endif int append_select_part( ulong sql_type - ); + ) override; int append_select( spider_string *str, ulong sql_type - ); + ) override; int append_table_select_part( ulong sql_type - ); + ) override; int append_table_select( spider_string *str ); int append_key_select_part( ulong sql_type, uint idx - ); + ) override; int append_key_select( spider_string *str, uint idx ); int append_minimum_select_part( ulong sql_type - ); + ) override; int append_minimum_select( spider_string *str, ulong sql_type @@ -931,47 +931,47 @@ public: ); int append_hint_after_table_part( ulong sql_type - ); + ) override; int append_hint_after_table( spider_string *str ); void set_where_pos( ulong sql_type - ); + ) override; void set_where_to_pos( ulong sql_type - ); + ) override; int check_item_type( Item *item - ); + ) override; int append_values_connector_part( ulong sql_type - ); + ) override; int append_values_connector( spider_string *str ); int append_values_terminator_part( ulong sql_type - ); + ) override; int append_values_terminator( spider_string *str ); int append_union_table_connector_part( ulong sql_type - ); + ) override; int append_union_table_connector( spider_string *str ); int append_union_table_terminator_part( ulong sql_type - ); + ) override; int append_union_table_terminator( spider_string *str ); int append_key_column_values_part( const key_range *start_key, ulong sql_type - ); + ) override; int append_key_column_values( spider_string *str, const key_range *start_key @@ -979,7 +979,7 @@ public: int append_key_column_values_with_name_part( const key_range *start_key, ulong sql_type - ); + ) override; int append_key_column_values_with_name( spider_string *str, const key_range *start_key @@ -988,7 +988,7 @@ public: const key_range *start_key, const key_range *end_key, ulong sql_type - ); + ) override; int append_key_where( spider_string *str, spider_string *str_part, @@ -1005,7 +1005,7 @@ public: const uchar **ptr, bool key_eq, bool tgt_final - ); + ) override; int append_is_null( ulong sql_type, spider_string *str, @@ -1021,7 +1021,7 @@ public: ulong sql_type, bool set_order, int key_count - ); + ) override; int append_where_terminator( ulong sql_type, spider_string *str, @@ -1032,7 +1032,7 @@ public: ); int append_match_where_part( ulong sql_type - ); + ) override; int append_match_where( spider_string *str ); @@ -1046,7 +1046,7 @@ public: uint alias_length, ulong sql_type, bool test_flg - ); + ) override; int append_condition( spider_string *str, const char *alias, @@ -1070,7 +1070,7 @@ public: ulong sql_type, const char *alias, uint alias_length - ); + ) override; int append_match_select( spider_string *str, const char *alias, @@ -1081,7 +1081,7 @@ public: ulong sql_type, const char *alias, uint alias_length - ); + ) override; int append_sum_select( spider_string *str, const char *alias, @@ -1090,16 +1090,16 @@ public: #endif void set_order_pos( ulong sql_type - ); + ) override; void set_order_to_pos( ulong sql_type - ); + ) override; #ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_group_by_part( const char *alias, uint alias_length, ulong sql_type - ); + ) override; int append_group_by( spider_string *str, const char *alias, @@ -1110,7 +1110,7 @@ public: const char *alias, uint alias_length, ulong sql_type - ); + ) override; int append_key_order_for_merge_with_alias( spider_string *str, const char *alias, @@ -1120,7 +1120,7 @@ public: const char *alias, uint alias_length, ulong sql_type - ); + ) override; int append_key_order_for_direct_order_limit_with_alias( spider_string *str, const char *alias, @@ -1130,7 +1130,7 @@ public: const char *alias, uint alias_length, ulong sql_type - ); + ) override; int append_key_order_for_handler( spider_string *str, const char *alias, @@ -1145,12 +1145,12 @@ public: longlong offset, longlong limit, ulong sql_type - ); + ) override; int reappend_limit_part( longlong offset, longlong limit, ulong sql_type - ); + ) override; int append_limit( spider_string *str, longlong offset, @@ -1158,25 +1158,25 @@ public: ); int append_select_lock_part( ulong sql_type - ); + ) override; int append_select_lock( spider_string *str ); int append_union_all_start_part( ulong sql_type - ); + ) override; int append_union_all_start( spider_string *str ); int append_union_all_part( ulong sql_type - ); + ) override; int append_union_all( spider_string *str ); int append_union_all_end_part( ulong sql_type - ); + ) override; int append_union_all_end( spider_string *str ); @@ -1184,7 +1184,7 @@ public: ulong sql_type, uint multi_range_cnt, bool with_comma - ); + ) override; int append_multi_range_cnt( spider_string *str, uint multi_range_cnt, @@ -1193,7 +1193,7 @@ public: int append_multi_range_cnt_with_name_part( ulong sql_type, uint multi_range_cnt - ); + ) override; int append_multi_range_cnt_with_name( spider_string *str, uint multi_range_cnt @@ -1203,7 +1203,7 @@ public: uint handler_id, SPIDER_CONN *conn, int link_idx - ); + ) override; int append_open_handler( spider_string *str, uint handler_id, @@ -1213,36 +1213,36 @@ public: int append_close_handler_part( ulong sql_type, int link_idx - ); + ) override; int append_close_handler( spider_string *str, int link_idx ); int append_insert_terminator_part( ulong sql_type - ); + ) override; int append_insert_terminator( spider_string *str ); int append_insert_values_part( ulong sql_type - ); + ) override; int append_insert_values( spider_string *str ); int append_into_part( ulong sql_type - ); + ) override; int append_into( spider_string *str ); void set_insert_to_pos( ulong sql_type - ); + ) override; int append_from_part( ulong sql_type, int link_idx - ); + ) override; int append_from( spider_string *str, ulong sql_type, @@ -1288,7 +1288,7 @@ public: ); int append_delete_all_rows_part( ulong sql_type - ); + ) override; int append_delete_all_rows( spider_string *str, ulong sql_type @@ -1303,7 +1303,7 @@ public: const key_range *end_key, ulong sql_type, int link_idx - ); + ) override; int append_explain_select( spider_string *str, const key_range *start_key, @@ -1313,32 +1313,32 @@ public: ); bool is_sole_projection_field( uint16 field_index - ); + ) override; bool is_bulk_insert_exec_period( bool bulk_end - ); + ) override; bool sql_is_filled_up( ulong sql_type - ); + ) override; bool sql_is_empty( ulong sql_type - ); - bool support_multi_split_read(); - bool support_bulk_update(); - int bulk_tmp_table_insert(); + ) override; + bool support_multi_split_read() override; + bool support_bulk_update() override; + int bulk_tmp_table_insert() override; int bulk_tmp_table_insert( int link_idx - ); - int bulk_tmp_table_end_bulk_insert(); - int bulk_tmp_table_rnd_init(); - int bulk_tmp_table_rnd_next(); - int bulk_tmp_table_rnd_end(); + ) override; + int bulk_tmp_table_end_bulk_insert() override; + int bulk_tmp_table_rnd_init() override; + int bulk_tmp_table_rnd_next() override; + int bulk_tmp_table_rnd_end() override; bool need_copy_for_update( int link_idx - ); - bool bulk_tmp_table_created(); - int mk_bulk_tmp_table_and_bulk_start(); - void rm_bulk_tmp_table(); + ) override; + bool bulk_tmp_table_created() override; + int mk_bulk_tmp_table_and_bulk_start() override; + void rm_bulk_tmp_table() override; int store_sql_to_bulk_tmp_table( spider_string *str, TABLE *tmp_table @@ -1350,156 +1350,156 @@ public: int insert_lock_tables_list( SPIDER_CONN *conn, int link_idx - ); + ) override; int append_lock_tables_list( SPIDER_CONN *conn, int link_idx, int *appended - ); + ) override; int realloc_sql( ulong *realloced - ); + ) override; int reset_sql( ulong sql_type - ); + ) override; #ifdef SPIDER_HAS_GROUP_BY_HANDLER int set_sql_for_exec( ulong sql_type, int link_idx, SPIDER_LINK_IDX_CHAIN *link_idx_chain - ); + ) override; #endif int set_sql_for_exec( ulong sql_type, int link_idx - ); + ) override; int set_sql_for_exec( spider_db_copy_table *tgt_ct, ulong sql_type - ); + ) override; int execute_sql( ulong sql_type, SPIDER_CONN *conn, int quick_mode, int *need_mon - ); - int reset(); + ) override; + int reset() override; int sts_mode_exchange( int sts_mode - ); + ) override; int show_table_status( int link_idx, int sts_mode, uint flag - ); + ) override; int crd_mode_exchange( int crd_mode - ); + ) override; int show_index( int link_idx, int crd_mode - ); + ) override; int simple_action( uint simple_action, int link_idx ); int show_records( int link_idx - ); + ) override; #ifdef HA_HAS_CHECKSUM_EXTENDED int checksum_table( int link_idx - ); + ) override; #endif int show_last_insert_id( int link_idx, ulonglong &last_insert_id - ); + ) override; ha_rows explain_select( const key_range *start_key, const key_range *end_key, int link_idx - ); + ) override; int lock_tables( int link_idx - ); + ) override; int unlock_tables( int link_idx - ); + ) override; int disable_keys( SPIDER_CONN *conn, int link_idx - ); + ) override; int enable_keys( SPIDER_CONN *conn, int link_idx - ); + ) override; int check_table( SPIDER_CONN *conn, int link_idx, HA_CHECK_OPT* check_opt - ); + ) override; int repair_table( SPIDER_CONN *conn, int link_idx, HA_CHECK_OPT* check_opt - ); + ) override; int analyze_table( SPIDER_CONN *conn, int link_idx - ); + ) override; int optimize_table( SPIDER_CONN *conn, int link_idx - ); + ) override; int flush_tables( SPIDER_CONN *conn, int link_idx, bool lock - ); + ) override; int flush_logs( SPIDER_CONN *conn, int link_idx - ); + ) override; int insert_opened_handler( SPIDER_CONN *conn, int link_idx - ); + ) override; int delete_opened_handler( SPIDER_CONN *conn, int link_idx - ); + ) override; int sync_from_clone_source( spider_db_handler *dbton_hdl - ); + ) override; bool support_use_handler( int use_handler - ); + ) override; void minimum_select_bitmap_create(); bool minimum_select_bit_is_set( uint field_index - ); + ) override; void copy_minimum_select_bitmap( uchar *bitmap - ); - int init_union_table_name_pos(); - int set_union_table_name_pos(); + ) override; + int init_union_table_name_pos() override; + int set_union_table_name_pos() override; int reset_union_table_name( spider_string *str, int link_idx, ulong sql_type - ); + ) override; #ifdef SPIDER_HAS_GROUP_BY_HANDLER int append_from_and_tables_part( spider_fields *fields, ulong sql_type - ); + ) override; int append_where_part( ulong sql_type - ); + ) override; int append_having_part( ulong sql_type - ); + ) override; int append_item_type_part( Item *item, const char *alias, @@ -1507,7 +1507,7 @@ public: bool use_fields, spider_fields *fields, ulong sql_type - ); + ) override; int append_list_item_select_part( List *select, const char *alias, @@ -1515,7 +1515,7 @@ public: bool use_fields, spider_fields *fields, ulong sql_type - ); + ) override; int append_list_item_select( List *select, spider_string *str, @@ -1531,7 +1531,7 @@ public: bool use_fields, spider_fields *fields, ulong sql_type - ); + ) override; int append_group_by( ORDER *order, spider_string *str, @@ -1547,7 +1547,7 @@ public: bool use_fields, spider_fields *fields, ulong sql_type - ); + ) override; int append_order_by( ORDER *order, spider_string *str, @@ -1562,12 +1562,12 @@ public: st_select_lex *select_lex, longlong select_limit, longlong offset_limit - ); + ) override; bool check_direct_delete( st_select_lex *select_lex, longlong select_limit, longlong offset_limit - ); + ) override; #endif }; @@ -1601,49 +1601,49 @@ public: spider_mbase_share *db_share ); virtual ~spider_mbase_copy_table(); - int init(); + int init() override; void set_sql_charset( CHARSET_INFO *cs - ); - int append_select_str(); + ) override; + int append_select_str() override; int append_insert_str( int insert_flg - ); + ) override; int append_table_columns( TABLE_SHARE *table_share - ); - int append_from_str(); + ) override; + int append_from_str() override; int append_table_name( int link_idx - ); - void set_sql_pos(); - void set_sql_to_pos(); + ) override; + void set_sql_pos() override; + void set_sql_to_pos() override; int append_copy_where( spider_db_copy_table *source_ct, KEY *key_info, ulong *last_row_pos, ulong *last_lengths - ); + ) override; int append_key_order_str( KEY *key_info, int start_pos, bool desc_flg - ); + ) override; int append_limit( longlong offset, longlong limit - ); - int append_into_str(); - int append_open_paren_str(); - int append_values_str(); + ) override; + int append_into_str() override; + int append_open_paren_str() override; + int append_values_str() override; int append_select_lock_str( int lock_mode - ); + ) override; int exec_query( SPIDER_CONN *conn, int quick_mode, int *need_mon - ); + ) override; int copy_key_row( spider_db_copy_table *source_ct, Field *field, @@ -1661,15 +1661,15 @@ public: SPIDER_DB_ROW *row, ulong **last_row_pos, ulong **last_lengths - ); + ) override; int copy_rows( TABLE *table, SPIDER_DB_ROW *row - ); - int append_insert_terminator(); + ) override; + int append_insert_terminator() override; int copy_insert_values( spider_db_copy_table *source_ct - ); + ) override; }; class spider_mysql_copy_table: public spider_mbase_copy_table diff --git a/storage/spider/spd_group_by_handler.h b/storage/spider/spd_group_by_handler.h index 09f82168708..b3984951ec5 100644 --- a/storage/spider/spd_group_by_handler.h +++ b/storage/spider/spd_group_by_handler.h @@ -32,9 +32,9 @@ public: spider_fields *fields_arg ); ~spider_group_by_handler(); - int init_scan(); - int next_row(); - int end_scan(); + int init_scan() override; + int next_row() override; + int end_scan() override; }; group_by_handler *spider_create_group_by_handler( diff --git a/storage/test_sql_discovery/test_sql_discovery.cc b/storage/test_sql_discovery/test_sql_discovery.cc index 0758d5f503f..0e009fca59b 100644 --- a/storage/test_sql_discovery/test_sql_discovery.cc +++ b/storage/test_sql_discovery/test_sql_discovery.cc @@ -48,7 +48,7 @@ public: { thr_lock_init(&lock); } - ~TSD_share() + ~TSD_share() override { thr_lock_delete(&lock); } @@ -64,17 +64,17 @@ private: public: ha_tsd(handlerton *hton, TABLE_SHARE *table_arg) : handler(hton, table_arg) { } - ulonglong table_flags() const + ulonglong table_flags() const override { // NO_TRANSACTIONS and everything that affects CREATE TABLE return HA_NO_TRANSACTIONS | HA_CAN_GEOMETRY | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_CAN_RTREEKEYS | HA_CAN_FULLTEXT; } - ulong index_flags(uint inx, uint part, bool all_parts) const { return 0; } + ulong index_flags(uint inx, uint part, bool all_parts) const override { return 0; } THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type) + enum thr_lock_type lock_type) override { if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) lock.type = lock_type; @@ -82,17 +82,17 @@ public: return to; } - int rnd_init(bool scan) { return 0; } - int rnd_next(unsigned char *buf) { return HA_ERR_END_OF_FILE; } - void position(const uchar *record) { } - int rnd_pos(uchar *buf, uchar *pos) { return HA_ERR_END_OF_FILE; } - int info(uint flag) { return 0; } - uint max_supported_keys() const { return 16; } + int rnd_init(bool scan) override { return 0; } + int rnd_next(unsigned char *buf) override { return HA_ERR_END_OF_FILE; } + void position(const uchar *record) override { } + int rnd_pos(uchar *buf, uchar *pos) override { return HA_ERR_END_OF_FILE; } + int info(uint flag) override { return 0; } + uint max_supported_keys() const override { return 16; } int create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info) { return HA_ERR_WRONG_COMMAND; } + HA_CREATE_INFO *create_info) override { return HA_ERR_WRONG_COMMAND; } - int open(const char *name, int mode, uint test_if_locked); - int close(void); + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; }; TSD_share *ha_tsd::get_share() diff --git a/storage/tokudb/PerconaFT/ftcxx/exceptions.hpp b/storage/tokudb/PerconaFT/ftcxx/exceptions.hpp index d8080d41b91..f0347c0cb3d 100644 --- a/storage/tokudb/PerconaFT/ftcxx/exceptions.hpp +++ b/storage/tokudb/PerconaFT/ftcxx/exceptions.hpp @@ -117,7 +117,7 @@ namespace ftcxx { return _code; } - virtual const char *what() const noexcept { + const char *what() const noexcept override { return ft_strerror(_code); } }; @@ -132,7 +132,7 @@ namespace ftcxx { return _code; } - virtual const char *what() const noexcept { + const char *what() const noexcept override { return strerror(_code); } }; diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 5a7027a6b04..9c9513097a5 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -728,21 +728,21 @@ public: ~ha_tokudb(); const char *table_type() const; - const char *index_type(uint inx); + const char *index_type(uint inx) override; const char **bas_ext() const; // // Returns a bit mask of capabilities of storage engine. Capabilities // defined in sql/handler.h // - ulonglong table_flags() const; + ulonglong table_flags() const override; - ulong index_flags(uint inx, uint part, bool all_parts) const; + ulong index_flags(uint inx, uint part, bool all_parts) const override; // // Returns limit on the number of keys imposed by tokudb. // - uint max_supported_keys() const { + uint max_supported_keys() const override { return MAX_KEY; } @@ -754,43 +754,43 @@ public: // // Returns the limit on the key length imposed by tokudb. // - uint max_supported_key_length() const { + uint max_supported_key_length() const override { return UINT_MAX32; } // // Returns limit on key part length imposed by tokudb. // - uint max_supported_key_part_length() const { + uint max_supported_key_part_length() const override { return UINT_MAX32; } - const key_map *keys_to_use_for_scanning() { + const key_map *keys_to_use_for_scanning() override { return &key_map_full; } - double scan_time(); + double scan_time() override; - double read_time(uint index, uint ranges, ha_rows rows); + double read_time(uint index, uint ranges, ha_rows rows) override; // Defined in mariadb - double keyread_time(uint index, uint ranges, ha_rows rows); + double keyread_time(uint index, uint ranges, ha_rows rows) override; // Defined in mysql 5.6 double index_only_read_time(uint keynr, double records); - int open(const char *name, int mode, uint test_if_locked); - int close(); - void update_create_info(HA_CREATE_INFO* create_info); - int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info); - int delete_table(const char *name); - int rename_table(const char *from, const char *to); - int optimize(THD * thd, HA_CHECK_OPT * check_opt); - int analyze(THD * thd, HA_CHECK_OPT * check_opt); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); + int open(const char *name, int mode, uint test_if_locked) override; + int close() override; + void update_create_info(HA_CREATE_INFO* create_info) override; + int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info) override; + int delete_table(const char *name) override; + int rename_table(const char *from, const char *to) override; + int optimize(THD * thd, HA_CHECK_OPT * check_opt) override; + int analyze(THD * thd, HA_CHECK_OPT * check_opt) override; + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; #if MYSQL_VERSION_ID >= 100000 - void start_bulk_insert(ha_rows rows, uint flags); + void start_bulk_insert(ha_rows rows, uint flags) override; #else void start_bulk_insert(ha_rows rows); #endif @@ -807,49 +807,49 @@ public: DBT* key, DBT* val, void* error_extra); - int end_bulk_insert(); + int end_bulk_insert() override; int end_bulk_insert(bool abort); - int prepare_index_scan(); - int prepare_index_key_scan( const uchar * key, uint key_len ); - int prepare_range_scan( const key_range *start_key, const key_range *end_key); - void column_bitmaps_signal(); - int index_init(uint index, bool sorted); - int index_end(); - int index_next_same(uchar * buf, const uchar * key, uint keylen); - int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag); - int index_read_last(uchar * buf, const uchar * key, uint key_len); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); + int prepare_index_scan() override; + int prepare_index_key_scan( const uchar * key, uint key_len ) override; + int prepare_range_scan( const key_range *start_key, const key_range *end_key) override; + void column_bitmaps_signal() override; + int index_init(uint index, bool sorted) override; + int index_end() override; + int index_next_same(uchar * buf, const uchar * key, uint keylen) override; + int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag) override; + int index_read_last(uchar * buf, const uchar * key, uint key_len) override; + int index_next(uchar * buf) override; + int index_prev(uchar * buf) override; + int index_first(uchar * buf) override; + int index_last(uchar * buf) override; bool has_gap_locks() const { return true; } - int rnd_init(bool scan); - int rnd_end(); - int rnd_next(uchar * buf); - int rnd_pos(uchar * buf, uchar * pos); + int rnd_init(bool scan) override; + int rnd_end() override; + int rnd_next(uchar * buf) override; + int rnd_pos(uchar * buf, uchar * pos) override; int read_range_first(const key_range *start_key, const key_range *end_key, - bool eq_range, bool sorted); - int read_range_next(); + bool eq_range, bool sorted) override; + int read_range_next() override; - void position(const uchar * record); - int info(uint); - int extra(enum ha_extra_function operation); - int reset(); - int external_lock(THD * thd, int lock_type); - int start_stmt(THD * thd, thr_lock_type lock_type); + void position(const uchar * record) override; + int info(uint) override; + int extra(enum ha_extra_function operation) override; + int reset() override; + int external_lock(THD * thd, int lock_type) override; + int start_stmt(THD * thd, thr_lock_type lock_type) override; ha_rows records_in_range(uint inx, const key_range * min_key, const key_range * max_key, - page_range *pages); + page_range *pages) override; uint32_t get_cursor_isolation_flags(enum thr_lock_type lock_type, THD* thd); - THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type); + THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type) override; int get_status(DB_TXN* trans); void init_hidden_prim_key_info(DB_TXN *txn); @@ -859,20 +859,20 @@ public: hpk_num_to_char(to, share->auto_ident); share->unlock(); } - virtual void get_auto_increment( + void get_auto_increment( ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong* first_value, - ulonglong* nb_reserved_values); + ulonglong* nb_reserved_values) override; bool is_optimize_blocking(); bool is_auto_inc_singleton(); - void print_error(int error, myf errflag); - uint8 table_cache_type() { + void print_error(int error, myf errflag) override; + uint8 table_cache_type() override { return HA_CACHE_TBL_TRANSACT; } - int cmp_ref(const uchar * ref1, const uchar * ref2); - bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes); + int cmp_ref(const uchar * ref1, const uchar * ref2) override; + bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes) override; #ifdef MARIADB_BASE_VERSION @@ -884,16 +884,16 @@ public: int multi_range_read_init(RANGE_SEQ_IF* seq, void* seq_init_param, uint n_ranges, uint mode, - HANDLER_BUFFER *buf); - int multi_range_read_next(range_id_t *range_info); + HANDLER_BUFFER *buf) override; + int multi_range_read_next(range_id_t *range_info) override; ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, - uint *flags, COST_VECT *cost); + uint *flags, COST_VECT *cost) override; ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint *bufsz, - uint *flags, COST_VECT *cost); - int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); + uint *flags, COST_VECT *cost) override; + int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) override; #else @@ -912,18 +912,18 @@ public: #endif - Item* idx_cond_push(uint keyno, class Item* idx_cond); - void cancel_pushed_idx_cond(); + Item* idx_cond_push(uint keyno, class Item* idx_cond) override; + void cancel_pushed_idx_cond() override; bool can_convert_varstring(const Field_varstring* field, const Column_definition&new_type) const; #if defined(TOKU_INCLUDE_ALTER_56) && TOKU_INCLUDE_ALTER_56 public: - enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info *ha_alter_info); - bool prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info); - bool inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info); - bool commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit); + enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info *ha_alter_info) override; + bool prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info) override; + bool inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info) override; + bool commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit) override; private: int alter_table_add_index(Alter_inplace_info* ha_alter_info); int alter_table_drop_index(Alter_inplace_info* ha_alter_info); @@ -968,9 +968,9 @@ public: public: // delete all rows from the table // effect: all dictionaries, including the main and indexes, should be empty - int discard_or_import_tablespace(my_bool discard); - int truncate(); - int delete_all_rows(); + int discard_or_import_tablespace(my_bool discard) override; + int truncate() override; + int delete_all_rows() override; void extract_hidden_primary_key(uint keynr, DBT const *found_key); void read_key_only(uchar * buf, uint keynr, DBT const *found_key); int read_row_callback (uchar * buf, uint keynr, DBT const *row, DBT const *found_key); @@ -1003,7 +1003,7 @@ public: // uint primary_key; - int check(THD *thd, HA_CHECK_OPT *check_opt); + int check(THD *thd, HA_CHECK_OPT *check_opt) override; int fill_range_query_buf( bool need_val, diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index 514aabbf7e5..14652fcfb37 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -42,17 +42,17 @@ public: virtual ~recount_rows_t(); - virtual const char* key(); - virtual const char* database(); - virtual const char* table(); - virtual const char* type(); - virtual const char* parameters(); - virtual const char* status(); + const char* key() override; + const char* database() override; + const char* table() override; + const char* type() override; + const char* parameters() override; + const char* status() override; protected: - virtual void on_run(); + void on_run() override; - virtual void on_destroy(); + void on_destroy() override; private: // to be provided by the initiator of recount rows @@ -281,17 +281,17 @@ public: virtual ~standard_t(); - virtual const char* key(void); - virtual const char* database(); - virtual const char* table(); - virtual const char* type(); - virtual const char* parameters(); - virtual const char* status(); + const char* key(void) override; + const char* database() override; + const char* table() override; + const char* type() override; + const char* parameters() override; + const char* status() override; protected: - virtual void on_run(); + void on_run() override; - virtual void on_destroy(); + void on_destroy() override; private: // to be provided by initiator of analyze diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc index 4bc58c2930c..4167b8cdd1a 100644 --- a/tpool/aio_simulated.cc +++ b/tpool/aio_simulated.cc @@ -142,7 +142,7 @@ public: pool->submit_task(&cb->m_internal_task); } - virtual int submit_io(aiocb *aiocb) override + int submit_io(aiocb *aiocb) override { aiocb->m_internal_task.m_func = simulated_aio_callback; aiocb->m_internal_task.m_arg = aiocb; @@ -152,8 +152,8 @@ public: return 0; } - virtual int bind(native_file_handle &fd) override { return 0; } - virtual int unbind(const native_file_handle &fd) override { return 0; } + int bind(native_file_handle &fd) override { return 0; } + int unbind(const native_file_handle &fd) override { return 0; } }; aio *create_simulated_aio(thread_pool *tp) diff --git a/tpool/aio_win.cc b/tpool/aio_win.cc index b44f705bd1e..eec37383152 100644 --- a/tpool/aio_win.cc +++ b/tpool/aio_win.cc @@ -102,7 +102,7 @@ public: m_thread.join(); } - virtual int submit_io(aiocb* cb) override + int submit_io(aiocb* cb) override { memset((OVERLAPPED *)cb, 0, sizeof(OVERLAPPED)); cb->m_internal = this; @@ -123,12 +123,12 @@ public: } // Inherited via aio - virtual int bind(native_file_handle& fd) override + int bind(native_file_handle& fd) override { return CreateIoCompletionPort(fd, m_completion_port, 0, 0) ? 0 : GetLastError(); } - virtual int unbind(const native_file_handle& fd) override { return 0; } + int unbind(const native_file_handle& fd) override { return 0; } }; aio* create_win_aio(thread_pool* pool, int max_io) diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc index 6d2dc22926b..926256640dc 100644 --- a/tpool/tpool_generic.cc +++ b/tpool/tpool_generic.cc @@ -321,11 +321,11 @@ class thread_pool_generic : public thread_pool } public: thread_pool_generic(int min_threads, int max_threads); - ~thread_pool_generic(); + ~thread_pool_generic() override; void wait_begin() override; void wait_end() override; void submit_task(task *task) override; - virtual aio *create_native_aio(int max_io) override + aio *create_native_aio(int max_io) override { #ifdef _WIN32 return create_win_aio(this, max_io); @@ -454,13 +454,13 @@ public: m_task.wait(); } - virtual ~timer_generic() + ~timer_generic() override { disarm(); } }; timer_generic m_maintenance_timer; - virtual timer* create_timer(callback_func func, void *data) override + timer* create_timer(callback_func func, void *data) override { return new timer_generic(func, data, this); } diff --git a/tpool/tpool_win.cc b/tpool/tpool_win.cc index 09fd49d9411..2b413b8d1b6 100644 --- a/tpool/tpool_win.cc +++ b/tpool/tpool_win.cc @@ -144,7 +144,7 @@ class thread_pool_win : public thread_pool /** Submit async IO. */ - virtual int submit_io(aiocb* cb) override + int submit_io(aiocb* cb) override { memset((OVERLAPPED *)cb, 0, sizeof(OVERLAPPED)); @@ -192,7 +192,7 @@ class thread_pool_win : public thread_pool /** Binds the file handle via CreateThreadpoolIo(). */ - virtual int bind(native_file_handle& fd) override + int bind(native_file_handle& fd) override { fd.m_ptp_io = CreateThreadpoolIo(fd.m_handle, io_completion_callback, 0, &(m_pool.m_env)); @@ -204,7 +204,7 @@ class thread_pool_win : public thread_pool /** Unbind the file handle via CloseThreadpoolIo. */ - virtual int unbind(const native_file_handle& fd) override + int unbind(const native_file_handle& fd) override { if (fd.m_ptp_io) CloseThreadpoolIo(fd.m_ptp_io); @@ -262,7 +262,7 @@ public: task->execute(); } - virtual void submit_task(task *task) override + void submit_task(task *task) override { auto entry= m_task_cache.get(); task->add_ref(); diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index c08e7281c92..f1a28225f41 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -123,7 +123,7 @@ public: int *where_to; // Where to write it Apc_order(int a, int *b) : value(a), where_to(b) {} - void call_in_target_thread() + void call_in_target_thread() override { my_sleep(int_rand(1000)); *where_to = value; From 49b4a6e26d02dc5bd93802480a5d04229c719518 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 21 Jun 2024 10:52:09 +0300 Subject: [PATCH 32/85] Fix the testcase for MDEV-31558: log_slow_verbosity_innodb log_slow_innodb.test sets "log_slow_verbosity_innodb_expected_matches" in include/log_slow_grep.inc: - Fix a typo: take value from log_slow_*VERBOSITY*_innodb_expected_matches - Add a missing "--source include/log_grep.inc" - two-line search patterns do not work, search for each line individually. --- mysql-test/include/log_slow_grep.inc | 9 +++++++-- mysql-test/main/log_slow_innodb.result | 16 ++++++++++++++++ mysql-test/main/log_slow_innodb.test | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/log_slow_grep.inc b/mysql-test/include/log_slow_grep.inc index 004c8ccefbc..db82f3cb8fb 100644 --- a/mysql-test/include/log_slow_grep.inc +++ b/mysql-test/include/log_slow_grep.inc @@ -21,5 +21,10 @@ --source include/log_grep.inc # InnoDB/Engines ---let log_expected_matches = $log_slow_innodb_expected_matches ---let grep_pattern = ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+\n# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+\$ +--let log_expected_matches = $log_slow_verbosity_innodb_expected_matches +--let grep_pattern = ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+\$ +--source include/log_grep.inc + +--let grep_pattern = ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+\$ +--source include/log_grep.inc + diff --git a/mysql-test/main/log_slow_innodb.result b/mysql-test/main/log_slow_innodb.result index a7c2ac86eed..11a6f2c32c0 100644 --- a/mysql-test/main/log_slow_innodb.result +++ b/mysql-test/main/log_slow_innodb.result @@ -23,6 +23,10 @@ UPDATE t1 set b=b+1 where a=1 or a=999; [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 SET SESSION log_slow_verbosity='innodb,query_plan'; [slow_log_start.inc] log_slow_innodb-verbosity_2 SELECT 1; @@ -43,6 +47,10 @@ SELECT 1; [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+$ +[log_grep.inc] lines: 0 SET SESSION log_slow_verbosity='query_plan'; [log_slow_stop.inc] log_slow_innodb-verbosity_3 --source include/log_slow_start.inc @@ -75,4 +83,12 @@ INSERT INTO t1 VALUE(1000) pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Ye --source include/log_slow_start.inc INSERT INTO t1 VALUE(1000) pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+$ +[log_grep.inc] lines: 0 DROP TABLE t1; diff --git a/mysql-test/main/log_slow_innodb.test b/mysql-test/main/log_slow_innodb.test index 31eab5f414f..9cdb1e0cc0f 100644 --- a/mysql-test/main/log_slow_innodb.test +++ b/mysql-test/main/log_slow_innodb.test @@ -72,7 +72,7 @@ let log_file=$log_slow_prefix-verbosity_3 INSERT INTO t1 VALUE(1000); --source include/log_slow_stop.inc ---let log_slow_verbosity_innodb_expected_matches= 1 +--let log_slow_verbosity_innodb_expected_matches= 0 --source include/log_slow_grep.inc DROP TABLE t1; From 5979dcf95bb2c1e38295eb713062d4b5358d2d7a Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 21 Jun 2024 12:38:19 +0530 Subject: [PATCH 33/85] MDEV-34435 Increase code coverage for debug_dbug test case during startup - Few of test case should make sure that InnoDB does hit the debug sync point during startup of the server. InnoDB can remove the double quotes of debug point in restart parameters. --- .../suite/binlog/t/binlog_recover_checksum_error.test | 2 +- mysql-test/suite/galera_3nodes/t/MDEV-29171.test | 2 +- .../suite/innodb/r/innodb_buffer_pool_fail.result | 1 + mysql-test/suite/innodb/r/recovery_memory,debug.rdiff | 10 ++++++++++ mysql-test/suite/innodb/t/alter_copy.test | 2 +- mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test | 5 ++++- mysql-test/suite/innodb/t/recovery_memory.test | 7 ++++++- 7 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 mysql-test/suite/innodb/r/recovery_memory,debug.rdiff diff --git a/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test b/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test index 12c9f3d914f..377eaba89a5 100644 --- a/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test +++ b/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test @@ -16,7 +16,7 @@ call mtr.add_suppression("Error in Log_event::read_log_event"); # Proof of no crash follows. # There's no need for actual bin-loggable queries to the server ---let $restart_parameters= --master_verify_checksum=ON --debug_dbug="+d,corrupt_read_log_event_char" +--let $restart_parameters= --master_verify_checksum=ON --debug_dbug=+d,corrupt_read_log_event_char --let $shutdown_timeout=0 --source include/restart_mysqld.inc --let $restart_parameters= diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test index 1ce33bee974..9e35cd0e0d9 100644 --- a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test @@ -90,7 +90,7 @@ show variables like 'wsrep_gtid_domain_id'; # If bug is present, node_3 remains on domain id 100 # --connection node_3 ---let $restart_parameters = --wsrep_sst_donor="node2" +--let $restart_parameters = --wsrep_sst_donor=node2 --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect --source include/start_mysqld.inc diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result index 9879ef206f2..1a8f16e4efb 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result @@ -6,3 +6,4 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile # MDEV-25019 memory allocation failures during startup cause server failure in different, confusing ways # # restart: --debug_dbug=+d,ib_buf_chunk_init_fails +FOUND 1 /\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff b/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff new file mode 100644 index 00000000000..f0e9985b04e --- /dev/null +++ b/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff @@ -0,0 +1,10 @@ +--- recovery_memory.result 2024-06-21 12:54:38.026355524 +0530 ++++ recovery_memory.reject 2024-06-21 17:22:49.394535026 +0530 +@@ -23,6 +23,7 @@ + CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; + INSERT INTO t1 SELECT * FROM seq_1_to_65536; + # restart: with restart_parameters ++FOUND 1 /\[ERROR\] InnoDB: The change buffer is corrupted or has been removed on upgrade to MariaDB 11.0 or later/ in mysqld.1.err + # restart + SHOW CREATE TABLE t1; + Table Create Table diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index f321308ce26..9165eca312d 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -57,7 +57,7 @@ ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; let $shutdown_timeout=0; ---let $restart_parameters= --innodb-force-recovery=3 --debug_dbug="+d,recv_ran_out_of_buffer" +--let $restart_parameters= --innodb-force-recovery=3 --debug_dbug=+d,recv_ran_out_of_buffer --source include/restart_mysqld.inc disconnect hang; let $shutdown_timeout=; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test index 1d938e12e78..e8e070c5061 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test @@ -7,5 +7,8 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile --echo # --echo # MDEV-25019 memory allocation failures during startup cause server failure in different, confusing ways --echo # -let restart_parameters=--debug_dbug="+d,ib_buf_chunk_init_fails"; +let restart_parameters=--debug_dbug=+d,ib_buf_chunk_init_fails; --source include/restart_mysqld.inc +let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool; +--source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/recovery_memory.test b/mysql-test/suite/innodb/t/recovery_memory.test index 145b39d56f6..06101377f10 100644 --- a/mysql-test/suite/innodb/t/recovery_memory.test +++ b/mysql-test/suite/innodb/t/recovery_memory.test @@ -33,7 +33,7 @@ DROP PROCEDURE dorepeat; --echo # if ($have_debug) { SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; -let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug="+d,ibuf_init_corrupt"; +let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug=+d,ibuf_init_corrupt; } if (!$have_debug) { --echo SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; @@ -44,6 +44,11 @@ INSERT INTO t1 SELECT * FROM seq_1_to_65536; let $restart_noprint=1; let $shutdown_timeout=0; --source include/restart_mysqld.inc +if ($have_debug) { +let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=\[ERROR\] InnoDB: The change buffer is corrupted or has been removed on upgrade to MariaDB 11.0 or later; +--source include/search_pattern_in_file.inc +} let $restart_noprint=0; let $restart_parameters=; --source include/restart_mysqld.inc From 9e800eda8602a09212f6c35b6f8b32c48c8df8e8 Mon Sep 17 00:00:00 2001 From: Rex Date: Tue, 19 Mar 2024 08:50:19 +1200 Subject: [PATCH 34/85] MDEV-32583 UUID() should be treated as stochastic for the purposes of forcing query materialization RAND() and UUID() are treated differently with respect to subquery materialization both should be marked as uncacheable, forcing materialization. Altered Create_func_uuid(_short)::create_builder(). Added comment in header about UNCACHEABLE_RAND meaning also unmergeable. --- mysql-test/main/func_misc.result | 13 +++++++++++++ mysql-test/main/func_misc.test | 15 +++++++++++++++ sql/item_create.cc | 4 ++-- sql/sql_lex.h | 9 +++++++++ sql/sql_priv.h | 5 ++++- 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index d4c7c9915ad..a6869296090 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -1732,3 +1732,16 @@ RELEASE_ALL_LOCKS() SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA FROM information_schema.metadata_lock_info WHERE thread_id>0 ORDER BY TABLE_SCHEMA; LOCK_MODE LOCK_TYPE TABLE_SCHEMA +# +# MDEV-32583 UUID() should be treated as stochastic for the purposes of +# forcing query materialization +# +create table t1 as WITH cte AS (SELECT UUID() as r FROM seq_1_to_10) +SELECT r as r1, r FROM cte; +select count(*) from t1 where r1!=r; +count(*) +0 +drop table t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index b6edde29890..d0f622421bd 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -1361,3 +1361,18 @@ FROM information_schema.metadata_lock_info WHERE thread_id>0 ORDER BY TABLE_SCHE --enable_ps2_protocol --enable_view_protocol + +--echo # +--echo # MDEV-32583 UUID() should be treated as stochastic for the purposes of +--echo # forcing query materialization +--echo # + +--source include/have_sequence.inc +create table t1 as WITH cte AS (SELECT UUID() as r FROM seq_1_to_10) +SELECT r as r1, r FROM cte; +select count(*) from t1 where r1!=r; +drop table t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/sql/item_create.cc b/sql/item_create.cc index f9588eaa953..2c54bc9118e 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -5301,7 +5301,7 @@ Create_func_uuid::create_builder(THD *thd) { DBUG_ENTER("Create_func_uuid::create"); thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); - thd->lex->safe_to_cache_query= 0; + thd->lex->uncacheable(UNCACHEABLE_RAND); // disallow cache and query merges DBUG_RETURN(new (thd->mem_root) Item_func_uuid(thd)); } @@ -5313,7 +5313,7 @@ Create_func_uuid_short::create_builder(THD *thd) { DBUG_ENTER("Create_func_uuid_short::create"); thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); - thd->lex->safe_to_cache_query= 0; + thd->lex->uncacheable(UNCACHEABLE_RAND); // disallow cache and query merges DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short(thd)); } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 3ab50d4aaa8..0a88e92d723 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3621,6 +3621,15 @@ public: return (context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW); } + /** + Mark all queries in this lex structure as uncacheable for the cause given + + @param cause the reason queries are to be marked as uncacheable + + Note, any cause is sufficient for st_select_lex_unit::can_be_merged() to + disallow query merges. + */ + inline void uncacheable(uint8 cause) { safe_to_cache_query= 0; diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 7c8b604539c..2335c6ba516 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -316,7 +316,10 @@ */ /* This subquery has fields from outer query (put by user) */ #define UNCACHEABLE_DEPENDENT_GENERATED 1 -/* This subquery contains functions with random result */ +/* + This subquery contains functions with random result. + Something that is uncacheable is by default unmergeable. +*/ #define UNCACHEABLE_RAND 2 /* This subquery contains functions with side effect */ #define UNCACHEABLE_SIDEEFFECT 4 From 105473233dd49b198758432fa0da5d0811f99c08 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 11 Jun 2024 10:19:55 +0200 Subject: [PATCH 35/85] MDEV-20053: set @sbindir@ for scripts The variable `sbindir` is never set for cmake. This adds borked paths to `galera_recovery`, though it dit not break as the systemd unit changes the dir to make the relative path work anyway. Let's fix this nevertheless... --- scripts/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 34bd059e3c3..99c99dc8804 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -228,6 +228,7 @@ ELSE() SET(sysconfdir "/etc") ENDIF() SET(bindir ${INSTALL_BINDIRABS}) +SET(sbindir ${INSTALL_SBINDIRABS}) SET(libexecdir ${INSTALL_SBINDIRABS}) SET(scriptdir ${INSTALL_BINDIRABS}) SET(datadir ${INSTALL_MYSQLSHAREDIRABS}) From 3d2e54ff8c6070800ead60dd1616df30c5936c8b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 11 Jun 2024 10:28:10 +0200 Subject: [PATCH 36/85] MDEV-20053: update systemd unit Now that we have proper paths in `galera_recovery` changing the directory is no longer required. --- support-files/mariadb.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index dce845a9f72..27e6ac08184 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -80,7 +80,7 @@ PermissionsStartOnly=true # Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ - VAR=`cd @bindir@/..; @bindir@/galera_recovery`; [ $? -eq 0 ] \ + VAR=`@bindir@/galera_recovery`; [ $? -eq 0 ] \ && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" # Needed to create system tables etc. From acc077ffa1a62fa12c66d4521946464eec6115e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 24 Jun 2024 10:39:13 +0300 Subject: [PATCH 37/85] MDEV-34443 ha_innobase::info_low() does not distinguish HA_STATUS_VARIABLE_EXTRA ha_innobase::info_low(): For HA_STATUS_VARIABLE without HA_STATUS_VARIABLE_EXTRA, let us avoid unnecessary and costly updates of the data_free statistics, which are only needed for SHOW TABLE STATUS. This optimization had been enabled in commit 247ecb7597015d02a93732373c742e0c8bd8fc73 but not utilized until now. --- storage/innobase/handler/ha_innodb.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ae79e7f39a0..cd460b20c1a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14493,11 +14493,13 @@ ha_innobase::info_low( stats.index_file_length = ulonglong(stat_sum_of_other_index_sizes) * size; - rw_lock_s_lock(&space->latch); - stats.delete_length = 1024 - * fsp_get_available_space_in_free_extents( + if (flag & HA_STATUS_VARIABLE_EXTRA) { + rw_lock_s_lock(&space->latch); + stats.delete_length = 1024 + * fsp_get_available_space_in_free_extents( *space); - rw_lock_s_unlock(&space->latch); + rw_lock_s_unlock(&space->latch); + } } stats.check_time = 0; stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *)); From 2455f1a93dfb4f6fe771a6fcb5d13b55217b8a81 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Thu, 25 Apr 2024 01:32:58 +0530 Subject: [PATCH 38/85] MDEV-31543: ASAN heap-buffer-overflow in strncpy when fetching keys using JSON_OBJECT_FILTER_KEYS function Analysis: Insufficient buffer size while copying the data. Fix: Change buffer size to accomodate all data. --- mysql-test/main/func_json.result | 10 ++++++++++ mysql-test/main/func_json.test | 10 ++++++++++ sql/item_jsonfunc.cc | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index a403b6b3ae2..78906c19713 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -5197,5 +5197,15 @@ JSON_ARRAY_INTERSECT(c1, c2) [4] DROP TABLE t1; # +# MDEV-31543: ASAN heap-buffer-overflow in strncpy when fetching keys using JSON_OBJECT_FILTER_KEYS function +# +SET @arr1='[1,2,"c"]'; +SET character_set_database=ucs2; +SET CHARACTER SET utf8; +SET @obj1='{ "a": 1,"b": 2,"c": 3}'; +SELECT JSON_OBJECT_FILTER_KEYS (@obj1,@arr1); +JSON_OBJECT_FILTER_KEYS (@obj1,@arr1) +NULL +# # End of 11.2 Test # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index a9688f2bee8..dd26112b70d 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -4086,6 +4086,16 @@ SELECT JSON_ARRAY_INTERSECT(c1, c2) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-31543: ASAN heap-buffer-overflow in strncpy when fetching keys using JSON_OBJECT_FILTER_KEYS function +--echo # + +SET @arr1='[1,2,"c"]'; +SET character_set_database=ucs2; +SET CHARACTER SET utf8; +SET @obj1='{ "a": 1,"b": 2,"c": 3}'; +SELECT JSON_OBJECT_FILTER_KEYS (@obj1,@arr1); + --echo # --echo # End of 11.2 Test --echo # diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 88f971694e4..61b81eb65f7 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -5418,7 +5418,7 @@ static bool filter_keys(json_engine_t *je1, String *str, HASH items) str.append('"'); str.append('\0'); - char *curr_key= (char*)malloc((size_t)(key_end-key_start+3)); + char *curr_key= (char*)malloc((size_t)(str.length()+3)); strncpy(curr_key, str.ptr(), str.length()); if (my_hash_search(&items, (const uchar*)curr_key, strlen(curr_key))) From d9dd673fee7a3fc67bce3b9f4be456a37892994a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 24 Jun 2024 12:08:13 +0300 Subject: [PATCH 39/85] MDEV-12008 fixup: Do not add a new error code New error codes can only be added in the latest major version. Adding ER_KILL_DENIED_HIGH_PRIORITY would shift by one all error codes that were added in MariaDB Server 10.6 or later. This amends commit 1001dae186d17e89e78a5596f1076cdda6467785 Suggested by: Sergei Golubchik --- .../suite/galera/r/galera_kill_applier.result | 8 ++--- .../suite/galera/r/galera_kill_bf.result | 4 +-- .../suite/galera/t/galera_kill_applier.test | 8 ++--- mysql-test/suite/galera/t/galera_kill_bf.test | 4 +-- sql/share/errmsg-utf8.txt | 2 -- sql/sql_parse.cc | 31 +++++++++++++++---- 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result index 65b6096db2e..c0538212a5f 100644 --- a/mysql-test/suite/galera/r/galera_kill_applier.result +++ b/mysql-test/suite/galera/r/galera_kill_applier.result @@ -6,13 +6,13 @@ SELECT @@wsrep_slave_threads; 1 SET GLOBAL wsrep_slave_threads=2; KILL ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster KILL QUERY ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster KILL ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster KILL QUERY ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster SET GLOBAL wsrep_slave_threads=DEFAULT; connection node_1; create table t1(a int not null primary key) engine=innodb; diff --git a/mysql-test/suite/galera/r/galera_kill_bf.result b/mysql-test/suite/galera/r/galera_kill_bf.result index c5b76560933..783ce7e09e4 100644 --- a/mysql-test/suite/galera/r/galera_kill_bf.result +++ b/mysql-test/suite/galera/r/galera_kill_bf.result @@ -10,9 +10,9 @@ connection node_1; SET SESSION wsrep_sync_wait = 0; SET DEBUG_SYNC = 'now WAIT_FOR bf_started'; KILL ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster KILL QUERY ID; -ERROR HY000: This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster +ERROR HY000: This is a high priority thread/query and cannot be killed without compromising the consistency of the cluster connection node_1; SET DEBUG_SYNC = 'now SIGNAL bf_continue'; connection con1; diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test index eb05551b334..90c553a0591 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.test +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -17,21 +17,21 @@ SET GLOBAL wsrep_slave_threads=2; --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1` --replace_result $applier_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL $applier_thread --replace_result $applier_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL QUERY $applier_thread --let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` --replace_result $aborter_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL $aborter_thread --replace_result $aborter_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL QUERY $aborter_thread SET GLOBAL wsrep_slave_threads=DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_kill_bf.test b/mysql-test/suite/galera/t/galera_kill_bf.test index 7a5d2ef512a..ba588ab659d 100644 --- a/mysql-test/suite/galera/t/galera_kill_bf.test +++ b/mysql-test/suite/galera/t/galera_kill_bf.test @@ -21,11 +21,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR bf_started'; --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%' LIMIT 1` --replace_result $applier_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL $applier_thread --replace_result $applier_thread ID ---error ER_KILL_DENIED_HIGH_PRIORITY +--error ER_KILL_DENIED_ERROR --eval KILL QUERY $applier_thread --connection node_1 diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 9c9b9ea734f..13642a62c73 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -9111,5 +9111,3 @@ ER_NOT_ALLOWED_IN_THIS_CONTEXT eng "'%-.128s' is not allowed in this context" ER_DATA_WAS_COMMITED_UNDER_ROLLBACK eng "Engine %s does not support rollback. Changes were committed during rollback call" -ER_KILL_DENIED_HIGH_PRIORITY - eng "This is a high-priority thread/query and cannot be killed without compromising the consistency of the cluster" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 30646f494ff..f3b7cb75c81 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9379,8 +9379,12 @@ THD *find_thread_by_id(longlong id, bool query_id) @param type Type of id: thread id or query id */ -uint -kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type type) +static uint +kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type type +#ifdef WITH_WSREP + , bool &wsrep_high_priority +#endif +) { THD *tmp; uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD); @@ -9421,9 +9425,10 @@ kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type #ifdef WITH_WSREP if (wsrep_thd_is_BF(tmp, false) || tmp->wsrep_applier) { - error= ER_KILL_DENIED_HIGH_PRIORITY; + error= ER_KILL_DENIED_ERROR; + wsrep_high_priority= true; push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_KILL_DENIED_HIGH_PRIORITY, + ER_KILL_DENIED_ERROR, "Thread %lld is %s and cannot be killed", tmp->thread_id, (tmp->wsrep_applier ? "wsrep applier" : "high priority")); @@ -9562,14 +9567,28 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user, static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { - uint error; - if (likely(!(error= kill_one_thread(thd, id, state, type)))) +#ifdef WITH_WSREP + bool wsrep_high_priority= false; +#endif + uint error= kill_one_thread(thd, id, state, type +#ifdef WITH_WSREP + , wsrep_high_priority +#endif + ); + + if (likely(!error)) { if (!thd->killed) my_ok(thd); else thd->send_kill_message(); } +#ifdef WITH_WSREP + else if (wsrep_high_priority) + my_printf_error(error, "This is a high priority thread/query and" + " cannot be killed without compromising" + " the consistency of the cluster", MYF(0)); +#endif else { my_error(error, MYF(0), id); From d513a4ce74cb1932ca945a8708a6746175ddf745 Mon Sep 17 00:00:00 2001 From: Rex Date: Tue, 30 Apr 2024 10:39:20 +1100 Subject: [PATCH 40/85] MDEV-19520 Extend condition normalization to include 'NOT a' Having Item_func_not items in item trees breaks assumptions during the optimization phase about transformation possibilities in fix_fields(). Remove Item_func_not by extending normalization during parsing. Reviewed by Oleksandr Byelkin (sanja@mariadb.com) --- mysql-test/main/having_cond_pushdown.result | 12 ++++++++++++ mysql-test/main/having_cond_pushdown.test | 12 ++++++++++++ sql/sql_parse.cc | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index fea8f83f9a1..1afed563fcb 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -4969,4 +4969,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); a b 0 11 DROP TABLE t1; +# +# MDEV-19520 Extend condition normalization to include 'NOT a' +# having Item_func_not in item tree breaks assumptions during the +# optimization phase about transformation possibilities in fix_fields(). +# Remove Item_func_not by extending normalization during parsing. +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(1); +SELECT a FROM t1 GROUP BY a HAVING NOT a; +a +0 +DROP TABLE t1; End of 10.4 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 6d42b4ffefe..57f70152375 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1485,4 +1485,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); DROP TABLE t1; +--echo # +--echo # MDEV-19520 Extend condition normalization to include 'NOT a' +--echo # having Item_func_not in item tree breaks assumptions during the +--echo # optimization phase about transformation possibilities in fix_fields(). +--echo # Remove Item_func_not by extending normalization during parsing. +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(1); +SELECT a FROM t1 GROUP BY a HAVING NOT a; +DROP TABLE t1; + --echo End of 10.4 tests diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f3b7cb75c81..561aca11e20 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9234,6 +9234,7 @@ push_new_name_resolution_context(THD *thd, /** Fix condition which contains only field (f turns to f <> 0 ) + or only contains the function NOT field (not f turns to f == 0) @param cond The condition to fix @@ -9249,6 +9250,21 @@ Item *normalize_cond(THD *thd, Item *cond) { cond= new (thd->mem_root) Item_func_ne(thd, cond, new (thd->mem_root) Item_int(thd, 0)); } + else + { + if (type == Item::FUNC_ITEM) + { + Item_func *func_item= (Item_func *)cond; + if (func_item->functype() == Item_func::NOT_FUNC) + { + Item *arg= func_item->arguments()[0]; + if (arg->type() == Item::FIELD_ITEM || + arg->type() == Item::REF_ITEM) + cond= new (thd->mem_root) Item_func_eq(thd, arg, + new (thd->mem_root) Item_int(thd, 0)); + } + } + } } return cond; } From 8b169949d64ecfb4a6b6ba9f693d564e807df990 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Mon, 24 Jun 2024 21:51:19 +0700 Subject: [PATCH 41/85] MDEV-24411: Trigger doesn't work correctly with bulk insert Executing an INSERT statement in PS mode having positional parameter bound with an array could result in incorrect number of inserted rows in case there is a BEFORE INSERT trigger that executes yet another INSERT statement to put a copy of row being inserted into some table. The reason for incorrect number of inserted rows is that a data structure used for binding positional argument with its actual values is stored in THD (this is thd->bulk_param) and reused on processing every INSERT statement. It leads to consuming actual values bound with top-level INSERT statement by other INSERT statements used by triggers' body. To fix the issue, reset the thd->bulk_param temporary to the value nullptr before invoking triggers and restore its value on finishing its execution. --- sql/sql_insert.cc | 21 ++++++++ tests/mysql_client_test.c | 100 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2792ca8e015..35eec93f540 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1021,10 +1021,19 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, */ restore_record(table,s->default_values); // Get empty record table->reset_default_fields(); + /* + Reset the sentinel thd->bulk_param in order not to consume the next + values of a bound array in case one of statement executed by + the trigger's body is INSERT statement. + */ + void *save_bulk_param= thd->bulk_param; + thd->bulk_param= nullptr; + if (unlikely(fill_record_n_invoke_before_triggers(thd, table, fields, *values, 0, TRG_EVENT_INSERT))) { + thd->bulk_param= save_bulk_param; if (values_list.elements != 1 && ! thd->is_error()) { info.records++; @@ -1038,6 +1047,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, error=1; break; } + thd->bulk_param= save_bulk_param; } else { @@ -1067,12 +1077,22 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, } } table->reset_default_fields(); + + /* + Reset the sentinel thd->bulk_param in order not to consume the next + values of a bound array in case one of statement executed by + the trigger's body is INSERT statement. + */ + void *save_bulk_param= thd->bulk_param; + thd->bulk_param= nullptr; + if (unlikely(fill_record_n_invoke_before_triggers(thd, table, table-> field_to_fill(), *values, 0, TRG_EVENT_INSERT))) { + thd->bulk_param= save_bulk_param; if (values_list.elements != 1 && ! thd->is_error()) { info.records++; @@ -1081,6 +1101,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, error=1; break; } + thd->bulk_param= save_bulk_param; } /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ebc462bea50..66281641b08 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -21870,6 +21870,103 @@ static void test_mdev19838() rc = mysql_query(mysql, "drop table mdev19838"); myquery(rc); } + +static void test_mdev_24411() +{ + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND bind; + MYSQL_RES *result; + MYSQL_ROW row; + my_ulonglong row_count; + unsigned int vals[] = { 1, 2, 3}; + unsigned int vals_array_len = 3; + const char *insert_stmt= "INSERT INTO t1 VALUES (?)"; + + myheader("test_mdev_24411"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t2"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t2 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, + "CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW " + "BEGIN INSERT INTO t2 (a) VALUES (NEW.a); END;"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + + rc= mysql_stmt_prepare(stmt, insert_stmt, strlen(insert_stmt)); + check_execute(stmt, rc); + + memset(&bind, 0, sizeof(bind)); + bind.buffer_type= MYSQL_TYPE_LONG; + bind.buffer= vals; + + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &vals_array_len); + check_execute(stmt, rc); + + rc= mysql_stmt_bind_param(stmt, &bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + /* + It's expected that the INSERT statement adds three rows into + the table t1 + */ + row_count = mysql_stmt_affected_rows(stmt); + DIE_UNLESS(row_count == 3); + + /* + * Check that the BEFORE INSERT trigger of the table t1 does work correct + * and inserted the rows (1), (2), (3) into the table t2. + */ + rc= mysql_query(mysql, "SELECT 't1' tname, a FROM t1 " + "UNION SELECT 't2' tname, a FROM t2 ORDER BY tname,a"); + myquery(rc); + + result= mysql_store_result(mysql); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 1); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 2); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 3); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 1); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 2); + + row = mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(row == NULL); + + mysql_free_result(result); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE t1, t2"); + myquery(rc); +} + #endif // EMBEDDED_LIBRARY @@ -22307,6 +22404,9 @@ static struct my_tests_st my_tests[]= { { "test_mdev20261", test_mdev20261 }, { "test_mdev_30159", test_mdev_30159 }, { "test_connect_autocommit", test_connect_autocommit}, +#ifndef EMBEDDED_LIBRARY + { "test_mdev_24411", test_mdev_24411}, +#endif { 0, 0 } }; From 77c465d5aacdd561c6d94a702577617ea66ab128 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Tue, 25 Jun 2024 11:11:36 +0700 Subject: [PATCH 42/85] MDEV-34171: Memory leakage is detected on running the test versioning.partition One of possible use cases that reproduces the memory leakage listed below: set timestamp= unix_timestamp('2000-01-01 00:00:00'); create or replace table t1 (x int) with system versioning partition by system_time interval 1 hour auto partitions 3; create table t2 (x int); create trigger tr after insert on t2 for each row update t1 set x= 11; create or replace procedure sp2() insert into t2 values (5); set timestamp= unix_timestamp('2000-01-01 04:00:00'); call sp2; set timestamp= unix_timestamp('2000-01-01 13:00:00'); call sp2; # <<=== Memory leak happens there. In case MariaDB server is built with the option -DWITH_PROTECT_STATEMENT_MEMROOT, the second execution would hit assert failure. The reason of leaking a memory is that once a new partition be created the table should be closed and re-opened. It results in calling the function extend_table_list() that indirectly invokes the function sp_add_used_routine() to add routines implicitly used by the statement that makes a new memory allocation. To fix it, don't remove routines and tables the statement implicitly depends on when a table being closed for subsequent re-opening. --- sql/sql_base.cc | 44 ++++++++++++++++++++++++++------------------ sql/sql_base.h | 19 ++++++++++++++++--- sql/sql_parse.cc | 2 +- 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ae191a1a9d3..32461202346 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4656,7 +4656,8 @@ restart: have failed to open since closing tables can trigger removal of elements from the table list (if MERGE tables are involved), */ - close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp()); + close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp(), + ot_ctx.remove_implicitly_used_deps()); /* Here we rely on the fact that 'tables' still points to the valid @@ -4724,10 +4725,10 @@ restart: /* F.ex. deadlock happened */ if (ot_ctx.can_recover_from_failed_open()) { - DBUG_ASSERT(ot_ctx.get_action() != - Open_table_context::OT_ADD_HISTORY_PARTITION); + DBUG_ASSERT(ot_ctx.remove_implicitly_used_deps()); close_tables_for_reopen(thd, start, - ot_ctx.start_of_statement_svp()); + ot_ctx.start_of_statement_svp(), + ot_ctx.remove_implicitly_used_deps()); if (ot_ctx.recover_from_failed_open()) goto error; @@ -6017,27 +6018,34 @@ bool restart_trans_for_tables(THD *thd, TABLE_LIST *table) trying to reopen tables. NULL if no metadata locks were held and thus all metadata locks should be released. + @param[in] remove_implicit_deps True in case routines and tables implicitly + used by a statement should be removed. */ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, - const MDL_savepoint &start_of_statement_svp) + const MDL_savepoint &start_of_statement_svp, + bool remove_implicit_deps) { TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); TABLE_LIST *tmp; - /* - If table list consists only from tables from prelocking set, table list - for new attempt should be empty, so we have to update list's root pointer. - */ - if (first_not_own_table == *tables) - *tables= 0; - thd->lex->chop_off_not_own_tables(); - /* Reset MDL tickets for procedures/functions */ - for (Sroutine_hash_entry *rt= - (Sroutine_hash_entry*)thd->lex->sroutines_list.first; - rt; rt= rt->next) - rt->mdl_request.ticket= NULL; - sp_remove_not_own_routines(thd->lex); + if (remove_implicit_deps) + { + /* + If table list consists only from tables from prelocking set, table list + for new attempt should be empty, so we have to update list's root pointer. + */ + if (first_not_own_table == *tables) + *tables= 0; + thd->lex->chop_off_not_own_tables(); + + /* Reset MDL tickets for procedures/functions */ + for (Sroutine_hash_entry *rt= + (Sroutine_hash_entry*)thd->lex->sroutines_list.first; + rt; rt= rt->next) + rt->mdl_request.ticket= NULL; + sp_remove_not_own_routines(thd->lex); + } for (tmp= *tables; tmp; tmp= tmp->next_global) { tmp->table= 0; diff --git a/sql/sql_base.h b/sql/sql_base.h index f80c38a806c..e476880ae81 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -156,7 +156,8 @@ thr_lock_type read_lock_type_for_table(THD *thd, my_bool mysql_rm_tmp_tables(void); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, - const MDL_savepoint &start_of_statement_svp); + const MDL_savepoint &start_of_statement_svp, + bool remove_implicit_dependencies); bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_CSTRING *db, LEX_CSTRING *table, thr_lock_type lock_type); TABLE_LIST *find_table_in_list(TABLE_LIST *table, @@ -566,9 +567,21 @@ public: return m_timeout; } - enum_open_table_action get_action() const + /** + Return true in case tables and routines the statement implicilty + dependent on should be removed, else return false. + + @note The use case when routines and tables the statement implicitly + dependent on shouldn't be removed is the one when a new partition be + created on handling the INSERT statement against a versioning partitioned + table. For this case re-opening a versioning table would result in adding + implicitly dependent routines (e.g. table's triggers) that lead to + allocation of memory on PS mem_root and so leaking a memory until the PS + statement be deallocated. + */ + bool remove_implicitly_used_deps() const { - return m_action; + return m_action != OT_ADD_HISTORY_PARTITION; } uint get_flags() const { return m_flags; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4c9657522d8..a32265f44aa 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2945,7 +2945,7 @@ retry: Deadlock occurred during upgrade of metadata lock. Let us restart acquring and opening tables for LOCK TABLES. */ - close_tables_for_reopen(thd, &tables, mdl_savepoint); + close_tables_for_reopen(thd, &tables, mdl_savepoint, true); if (thd->open_temporary_tables(tables)) goto err; goto retry; From aebd2397cce9b9b14a171ad9e3718fb07a017622 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 17 Jun 2024 14:08:20 +0800 Subject: [PATCH 43/85] MDEV-34404 Use safe_str in spider udfs to avoid passing NULL str --- sql/sql_class.h | 2 +- storage/spider/spd_copy_tables.cc | 2 +- storage/spider/spd_direct_sql.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 63e21a35d86..08a04665383 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4580,7 +4580,7 @@ public: to->length= db.length; return to->str == NULL; /* True on error */ } - /* Get db name or "". Use for printing current db */ + /* Get db name or "". */ const char *get_db() { return safe_str(db.str); } diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 524ad7dd9e9..2a3b848c3ce 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -52,7 +52,7 @@ int spider_udf_set_copy_tables_param_default( copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd); if ( !(copy_tables->database = spider_create_string( - SPIDER_THD_db_str(copy_tables->trx->thd), + copy_tables->trx->thd->get_db(), copy_tables->database_length)) ) { my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 15b777ea739..462d83f3a84 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -1109,7 +1109,7 @@ int spider_udf_set_direct_sql_param_default( direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd); if ( !(direct_sql->tgt_default_db_name = spider_create_string( - SPIDER_THD_db_str(trx->thd), + trx->thd->get_db(), direct_sql->tgt_default_db_name_length)) ) { my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); From 01289dac4148da50c9bd13b07447d158fe0050c1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 11 Jun 2024 16:40:53 +1000 Subject: [PATCH 44/85] MDEV-34361 Split my.cnf in the spider suite. Just like the spider/bugfix suite. One caveat is that my_2_3.cnf needs something under mysqld.2.3 group, otherwise mtr will fail with something like: There is no group named 'mysqld.2.3' that can be used to resolve 'port' for ... This will allow new tests under the spider suite to use what is needed. It also somehow fixes issues of running a test followed by spider.slave_trx_isolation. --- storage/spider/mysql-test/spider/my.cnf | 183 +------------------- storage/spider/mysql-test/spider/my_1_1.cnf | 44 +++++ storage/spider/mysql-test/spider/my_2_1.cnf | 56 ++++++ storage/spider/mysql-test/spider/my_2_2.cnf | 38 ++++ storage/spider/mysql-test/spider/my_2_3.cnf | 9 + storage/spider/mysql-test/spider/my_3_1.cnf | 11 ++ storage/spider/mysql-test/spider/my_3_2.cnf | 9 + storage/spider/mysql-test/spider/my_3_3.cnf | 9 + storage/spider/mysql-test/spider/my_4_1.cnf | 9 + 9 files changed, 193 insertions(+), 175 deletions(-) create mode 100644 storage/spider/mysql-test/spider/my_1_1.cnf create mode 100644 storage/spider/mysql-test/spider/my_2_1.cnf create mode 100644 storage/spider/mysql-test/spider/my_2_2.cnf create mode 100644 storage/spider/mysql-test/spider/my_2_3.cnf create mode 100644 storage/spider/mysql-test/spider/my_3_1.cnf create mode 100644 storage/spider/mysql-test/spider/my_3_2.cnf create mode 100644 storage/spider/mysql-test/spider/my_3_3.cnf create mode 100644 storage/spider/mysql-test/spider/my_4_1.cnf diff --git a/storage/spider/mysql-test/spider/my.cnf b/storage/spider/mysql-test/spider/my.cnf index db4f7656fbc..bef57333086 100644 --- a/storage/spider/mysql-test/spider/my.cnf +++ b/storage/spider/mysql-test/spider/my.cnf @@ -1,177 +1,10 @@ # Use default setting for mysqld processes !include include/default_mysqld.cnf - -[mysqld.1.1] -log-bin= master-bin -loose_handlersocket_port= 20000 -loose_handlersocket_port_wr= 20001 -loose_handlersocket_threads= 2 -loose_handlersocket_threads_wr= 1 -loose_handlersocket_support_merge_table= 0 -loose_handlersocket_direct_update_mode= 2 -loose_handlersocket_unlimited_boundary= 65536 -loose_handlersocket_bulk_insert= 0 -loose_handlersocket_bulk_insert_timeout= 0 -loose_handlersocket_general_log= 1 -loose_handlersocket_timeout= 30 -loose_handlersocket_close_table_interval=2 -open_files_limit= 4096 -loose_partition= 1 - -[mysqld.2.1] -loose_handlersocket_port= 20002 -loose_handlersocket_port_wr= 20003 -loose_handlersocket_threads= 2 -loose_handlersocket_threads_wr= 1 -loose_handlersocket_support_merge_table= 0 -loose_handlersocket_direct_update_mode= 2 -loose_handlersocket_unlimited_boundary= 65536 -loose_handlersocket_bulk_insert= 0 -loose_handlersocket_bulk_insert_timeout= 0 -loose_handlersocket_general_log= 1 -loose_handlersocket_timeout= 30 -loose_handlersocket_close_table_interval=2 -open_files_limit= 4096 - -[mysqld.2.2] -loose_handlersocket_port= 20004 -loose_handlersocket_port_wr= 20005 -loose_handlersocket_threads= 2 -loose_handlersocket_threads_wr= 1 -loose_handlersocket_support_merge_table= 0 -loose_handlersocket_direct_update_mode= 2 -loose_handlersocket_unlimited_boundary= 65536 -loose_handlersocket_bulk_insert= 0 -loose_handlersocket_bulk_insert_timeout= 0 -loose_handlersocket_general_log= 1 -loose_handlersocket_timeout= 30 -loose_handlersocket_close_table_interval=2 -open_files_limit= 4096 - -[mysqld.2.3] - -[mysqld.3.1] -loose_partition= 1 - -[mysqld.3.2] -loose_partition= 1 - -[mysqld.3.3] -loose_partition= 1 - -[mysqld.4.1] -loose_partition= 1 - - -[ENV] -USE_GEOMETRY_TEST= 1 -USE_FULLTEXT_TEST= 1 -USE_HA_TEST= 1 -USE_GENERAL_LOG= 1 -USE_REPLICATION= 1 -MASTER_1_MYPORT= @mysqld.1.1.port -MASTER_1_HSRPORT= 20000 -MASTER_1_HSWPORT= 20001 -MASTER_1_MYSOCK= @mysqld.1.1.socket -MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM -MASTER_1_ENGINE= ENGINE=Spider -MASTER_1_CHARSET= DEFAULT CHARSET=utf8 -MASTER_1_ENGINE2= ENGINE=MyISAM -MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 -MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -SLAVE1_1_MYPORT= @mysqld.4.1.port -SLAVE1_1_MYSOCK= @mysqld.4.1.socket -SLAVE1_1_ENGINE_TYPE= MyISAM -SLAVE1_1_ENGINE= ENGINE=MyISAM -SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP2= 1 -OUTPUT_CHILD_GROUP2= 0 -CHILD2_1_MYPORT= @mysqld.2.1.port -CHILD2_1_HSRPORT= 20002 -CHILD2_1_HSWPORT= 20003 -CHILD2_1_MYSOCK= @mysqld.2.1.socket -CHILD2_1_ENGINE_TYPE= InnoDB -CHILD2_1_ENGINE= ENGINE=InnoDB -CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -CHILD2_2_MYPORT= @mysqld.2.2.port -CHILD2_2_HSRPORT= 20004 -CHILD2_2_HSWPORT= 20005 -CHILD2_2_MYSOCK= @mysqld.2.2.socket -CHILD2_2_ENGINE_TYPE= InnoDB -CHILD2_2_ENGINE= ENGINE=InnoDB -CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_3_MYPORT= @mysqld.2.3.port -CHILD2_3_MYSOCK= @mysqld.2.3.socket -CHILD2_3_ENGINE_TYPE= InnoDB -CHILD2_3_ENGINE= ENGINE=InnoDB -CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_FT_MYPORT= @mysqld.2.1.port -CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket -CHILD2_1_FT_ENGINE_TYPE= MyISAM -CHILD2_1_FT_ENGINE= ENGINE=MyISAM -CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_FT_MYPORT= @mysqld.2.2.port -CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket -CHILD2_2_FT_ENGINE_TYPE= MyISAM -CHILD2_2_FT_ENGINE= ENGINE=MyISAM -CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_GM_MYPORT= @mysqld.2.1.port -CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket -CHILD2_1_GM_ENGINE_TYPE= MyISAM -CHILD2_1_GM_ENGINE= ENGINE=MyISAM -CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_GM_MYPORT= @mysqld.2.2.port -CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket -CHILD2_2_GM_ENGINE_TYPE= MyISAM -CHILD2_2_GM_ENGINE= ENGINE=MyISAM -CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP3= 1 -OUTPUT_CHILD_GROUP3= 0 -CHILD3_1_MYPORT= @mysqld.3.1.port -CHILD3_1_MYSOCK= @mysqld.3.1.socket -CHILD3_1_ENGINE_TYPE= InnoDB -CHILD3_1_ENGINE= ENGINE=InnoDB -CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_2_MYPORT= @mysqld.3.2.port -CHILD3_2_MYSOCK= @mysqld.3.2.socket -CHILD3_2_ENGINE_TYPE= InnoDB -CHILD3_2_ENGINE= ENGINE=InnoDB -CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_3_MYPORT= @mysqld.3.3.port -CHILD3_3_MYSOCK= @mysqld.3.3.socket -CHILD3_3_ENGINE_TYPE= InnoDB -CHILD3_3_ENGINE= ENGINE=InnoDB -CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 - -STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES +!include my_1_1.cnf +!include my_2_1.cnf +!include my_2_2.cnf +!include my_2_3.cnf +!include my_3_1.cnf +!include my_3_2.cnf +!include my_3_3.cnf +!include my_4_1.cnf diff --git a/storage/spider/mysql-test/spider/my_1_1.cnf b/storage/spider/mysql-test/spider/my_1_1.cnf new file mode 100644 index 00000000000..5f17295d895 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_1_1.cnf @@ -0,0 +1,44 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 1 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/my_2_1.cnf b/storage/spider/mysql-test/spider/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/my_2_2.cnf b/storage/spider/mysql-test/spider/my_2_2.cnf new file mode 100644 index 00000000000..2d3c2a89a7d --- /dev/null +++ b/storage/spider/mysql-test/spider/my_2_2.cnf @@ -0,0 +1,38 @@ +[mysqld.2.2] +loose_handlersocket_port= 20004 +loose_handlersocket_port_wr= 20005 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +CHILD2_2_MYPORT= @mysqld.2.2.port +CHILD2_2_HSRPORT= 20004 +CHILD2_2_HSWPORT= 20005 +CHILD2_2_MYSOCK= @mysqld.2.2.socket +CHILD2_2_ENGINE_TYPE= InnoDB +CHILD2_2_ENGINE= ENGINE=InnoDB +CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_FT_MYPORT= @mysqld.2.2.port +CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket +CHILD2_2_FT_ENGINE_TYPE= MyISAM +CHILD2_2_FT_ENGINE= ENGINE=MyISAM +CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_GM_MYPORT= @mysqld.2.2.port +CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket +CHILD2_2_GM_ENGINE_TYPE= MyISAM +CHILD2_2_GM_ENGINE= ENGINE=MyISAM +CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_2_DROP_TABLES +# CHILD2_2_CREATE_TABLES +# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/my_2_3.cnf b/storage/spider/mysql-test/spider/my_2_3.cnf new file mode 100644 index 00000000000..3e62d151b3d --- /dev/null +++ b/storage/spider/mysql-test/spider/my_2_3.cnf @@ -0,0 +1,9 @@ +[mysqld.2.3] +loose_partition= 1 + +[ENV] +CHILD2_3_MYPORT= @mysqld.2.3.port +CHILD2_3_MYSOCK= @mysqld.2.3.socket +CHILD2_3_ENGINE_TYPE= InnoDB +CHILD2_3_ENGINE= ENGINE=InnoDB +CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/my_3_1.cnf b/storage/spider/mysql-test/spider/my_3_1.cnf new file mode 100644 index 00000000000..fad21607789 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_3_1.cnf @@ -0,0 +1,11 @@ +[mysqld.3.1] +loose_partition= 1 + +[ENV] +USE_CHILD_GROUP3= 1 +OUTPUT_CHILD_GROUP3= 0 +CHILD3_1_MYPORT= @mysqld.3.1.port +CHILD3_1_MYSOCK= @mysqld.3.1.socket +CHILD3_1_ENGINE_TYPE= InnoDB +CHILD3_1_ENGINE= ENGINE=InnoDB +CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/my_3_2.cnf b/storage/spider/mysql-test/spider/my_3_2.cnf new file mode 100644 index 00000000000..6f027b6f525 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_3_2.cnf @@ -0,0 +1,9 @@ +[mysqld.3.2] +loose_partition= 1 + +[ENV] +CHILD3_2_MYPORT= @mysqld.3.2.port +CHILD3_2_MYSOCK= @mysqld.3.2.socket +CHILD3_2_ENGINE_TYPE= InnoDB +CHILD3_2_ENGINE= ENGINE=InnoDB +CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/my_3_3.cnf b/storage/spider/mysql-test/spider/my_3_3.cnf new file mode 100644 index 00000000000..fbb33694738 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_3_3.cnf @@ -0,0 +1,9 @@ +[mysqld.3.3] +loose_partition= 1 + +[ENV] +CHILD3_3_MYPORT= @mysqld.3.3.port +CHILD3_3_MYSOCK= @mysqld.3.3.socket +CHILD3_3_ENGINE_TYPE= InnoDB +CHILD3_3_ENGINE= ENGINE=InnoDB +CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/my_4_1.cnf b/storage/spider/mysql-test/spider/my_4_1.cnf new file mode 100644 index 00000000000..d1812a48b68 --- /dev/null +++ b/storage/spider/mysql-test/spider/my_4_1.cnf @@ -0,0 +1,9 @@ +[mysqld.4.1] +loose_partition= 1 + +[ENV] +SLAVE1_1_MYPORT= @mysqld.4.1.port +SLAVE1_1_MYSOCK= @mysqld.4.1.socket +SLAVE1_1_ENGINE_TYPE= MyISAM +SLAVE1_1_ENGINE= ENGINE=MyISAM +SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 From ad0ee8cdb9b5692745c7e4cae334133e45bf63e8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 25 Jun 2024 14:22:25 +0800 Subject: [PATCH 45/85] MDEV-33746 [fixup] Add suggested overrides in oqgraph --- storage/oqgraph/graphcore.cc | 18 +++++----- storage/oqgraph/ha_oqgraph.h | 66 ++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc index 92796538de3..ecf7a066b2b 100644 --- a/storage/oqgraph/graphcore.cc +++ b/storage/oqgraph/graphcore.cc @@ -266,10 +266,10 @@ namespace open_query { : oqgraph_cursor(arg), no_weight(), sequence(0), results(), last() { } - int fetch_row(const row &, row&); - int fetch_row(const row &, row&, const reference&); + int fetch_row(const row &, row&) override; + int fetch_row(const row &, row&, const reference&) override; - void current(reference& ref) const + void current(reference& ref) const override { ref= last; } @@ -286,10 +286,10 @@ namespace open_query { : oqgraph_cursor(arg), position(0) { } - int fetch_row(const row &, row&); - int fetch_row(const row &, row&, const reference&); + int fetch_row(const row &, row&) override; + int fetch_row(const row &, row&, const reference&) override; - void current(reference& ref) const + void current(reference& ref) const override { ref= last; } @@ -308,10 +308,10 @@ namespace open_query { : oqgraph_cursor(arg), position(0), last() { } - int fetch_row(const row &, row&); - int fetch_row(const row &, row&, const reference&); + int fetch_row(const row &, row&) override; + int fetch_row(const row &, row&, const reference&) override; - void current(reference& ref) const + void current(reference& ref) const override { ref= last; } diff --git a/storage/oqgraph/ha_oqgraph.h b/storage/oqgraph/ha_oqgraph.h index c8e175df616..8303823da28 100644 --- a/storage/oqgraph/ha_oqgraph.h +++ b/storage/oqgraph/ha_oqgraph.h @@ -58,59 +58,59 @@ class ha_oqgraph: public handler public: #if MYSQL_VERSION_ID >= 50100 ha_oqgraph(handlerton *hton, TABLE_SHARE *table); - ulonglong table_flags() const; + ulonglong table_flags() const override; #else ha_oqgraph(TABLE *table); Table_flags table_flags() const; #endif virtual ~ha_oqgraph(); - const char *index_type(uint inx) + const char *index_type(uint inx) override { return "HASH"; } /* Rows also use a fixed-size format */ - enum row_type get_row_type() const { return ROW_TYPE_FIXED; } - ulong index_flags(uint inx, uint part, bool all_parts) const; + enum row_type get_row_type() const override { return ROW_TYPE_FIXED; } + ulong index_flags(uint inx, uint part, bool all_parts) const override; const char **bas_ext() const; - uint max_supported_keys() const { return MAX_KEY; } - uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; } - double scan_time() { return (double) 1000000000; } - double read_time(uint index, uint ranges, ha_rows rows) + uint max_supported_keys() const override { return MAX_KEY; } + uint max_supported_key_part_length() const override { return MAX_KEY_LENGTH; } + double scan_time() override { return (double) 1000000000; } + double read_time(uint, uint, ha_rows) override { return 1; } // Doesn't make sense to change the engine on a virtual table. - virtual bool can_switch_engines() { return false; } + virtual bool can_switch_engines() override { return false; } - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(const byte * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const byte * buf); + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override; + int write_row(const byte * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const byte * buf) override; int index_read(byte * buf, const byte * key, - uint key_len, enum ha_rkey_function find_flag); + uint key_len, enum ha_rkey_function find_flag) override; int index_read_idx(byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag); - int index_next_same(byte * buf, const byte * key, uint key_len); - int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - void position(const byte *record); - int info(uint); - int extra(enum ha_extra_function operation); - int external_lock(THD *thd, int lock_type); - int delete_all_rows(void); + int index_next_same(byte * buf, const byte * key, uint key_len) override; + int rnd_init(bool scan) override; + int rnd_next(byte *buf) override; + int rnd_pos(byte * buf, byte *pos) override; + void position(const byte *record) override; + int info(uint) override; + int extra(enum ha_extra_function operation) override; + int external_lock(THD *thd, int lock_type) override; + int delete_all_rows(void) override; ha_rows records_in_range(uint inx, const key_range *min_key, - const key_range *max_key, page_range *pages); - 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); - void update_create_info(HA_CREATE_INFO *create_info); + const key_range *max_key, page_range *pages) override; + int delete_table(const char *from) override; + int rename_table(const char * from, const char * to) override; + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override; + void update_create_info(HA_CREATE_INFO *create_info) override; THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - int cmp_ref(const byte *ref1, const byte *ref2); + enum thr_lock_type lock_type) override; + int cmp_ref(const byte *ref1, const byte *ref2) override; - bool get_error_message(int error, String* buf); + bool get_error_message(int error, String* buf) override; void fprint_error(const char* fmt, ...); @@ -123,7 +123,7 @@ public: uint key_length, qc_engine_callback *engine_callback, - ulonglong *engine_data) + ulonglong *engine_data) override { /* Do not put data from OQGRAPH tables into query cache (because there From 53a4867837fa7012199a9ab6eef5c4a57f3df564 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 6 Jun 2024 15:53:16 +1000 Subject: [PATCH 46/85] MDEV-34313: compiler mariadb-binlog WITHOUT_SERVER The log_event_old.cc is included by mysqlbinlog.cc. With -DWITHOUT_SERVER the include path for the wsrep include headers isn't there. As these aren't needed by the mariadb-binlog, move these to under a ifndef MYSQL_CLIENT preprocessor. Caused by MDEV-18590 --- sql/log_event_old.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 4246595f8e4..a493cedfd94 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -27,13 +27,13 @@ #include "lock.h" // mysql_unlock_tables #include "rpl_rli.h" #include "rpl_utility.h" -#endif -#include "log_event_old.h" -#include "rpl_record_old.h" -#include "transaction.h" #ifdef WITH_WSREP #include "wsrep_mysqld.h" #endif /* WITH_WSREP */ +#endif /* MYSQL_CLIENT */ +#include "log_event_old.h" +#include "rpl_record_old.h" +#include "transaction.h" PSI_memory_key key_memory_log_event_old; From d5bad49011633c63ce5cf9ad369defd906b46f68 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 7 Jun 2024 16:56:17 +1000 Subject: [PATCH 47/85] MDEV-34313: compile WITHOUT_SERVER and WSREP=ON CMake WSREP=ON has some implications for client executables so still present this as an option when compiling WITHOUT_SERVER. In this case default to ON for maximium compatibility of the build client executables and libraries. --- cmake/wsrep.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index 368ae61d1d3..66d99a1890a 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -17,7 +17,9 @@ # # Galera library does not compile with windows # -IF (NOT WITHOUT_SERVER) +IF(WITHOUT_SERVER) + OPTION(WITH_WSREP "Galera server compatibility in build client utilities" ON) +ELSE() IF(UNIX) SET(with_wsrep_default ON) ELSE() From c9212b7a43da212565b9443f670428d44b192b6a Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 26 Jun 2024 11:08:56 +0800 Subject: [PATCH 48/85] MDEV-33746 [fixup] Add suggested overrides in mroonga --- storage/mroonga/ha_mroonga.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 2bc5c2b30f3..aba123649f0 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -403,7 +403,7 @@ private: public: ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg); ~ha_mroonga(); - const char *table_type() const; // required + const char *table_type() const override; // required const char *index_type(uint inx) mrn_override; const char **bas_ext() const; // required From cc1363071a9e6759e59142f3103245a091eacecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Jun 2024 08:23:54 +0300 Subject: [PATCH 49/85] MDEV-34455 innodb_read_only=ON fails to imply innodb_doublewrite=OFF innodb_doublewrite_update(): Disallow any change if srv_read_only_mode holds, that is, the server was started with innodb_read_only=ON or innodb_force_recovery=6. This fixes up commit 1122ac978e2e709ae17a19335cbf0e4e5b53ad01 (MDEV-33545). --- mysql-test/suite/innodb/r/alter_copy.result | 5 +++++ mysql-test/suite/innodb/t/alter_copy.test | 4 ++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result index 72ae28e9652..f9151409a44 100644 --- a/mysql-test/suite/innodb/r/alter_copy.result +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -186,6 +186,11 @@ t1 CREATE TABLE `t1` ( CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK +SET GLOBAL innodb_doublewrite=ON; +SELECT @@GLOBAL.innodb_doublewrite "OFF expected"; +OFF expected +OFF +SET GLOBAL innodb_buf_flush_list_now=ON; # restart FTS_INDEX_1.ibd FTS_INDEX_2.ibd diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index 90f2171d10b..7592d6c37d6 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -87,6 +87,10 @@ SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column'); SHOW CREATE TABLE t1; CHECK TABLE t1; +SET GLOBAL innodb_doublewrite=ON; +SELECT @@GLOBAL.innodb_doublewrite "OFF expected"; +SET GLOBAL innodb_buf_flush_list_now=ON; + --let $restart_parameters= --source include/restart_mysqld.inc --replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4458c6b95b1..d2ceb9d7308 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18420,7 +18420,8 @@ static void innodb_data_file_write_through_update(THD *, st_mysql_sys_var*, static void innodb_doublewrite_update(THD *, st_mysql_sys_var*, void *, const void *save) { - fil_system.set_use_doublewrite(*static_cast(save)); + if (!srv_read_only_mode) + fil_system.set_use_doublewrite(*static_cast(save)); } static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, From 2f6df9374806665db0764c74187a384b562b150a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Jun 2024 13:51:38 +0300 Subject: [PATCH 50/85] MDEV-34458 wait_for_read in buf_page_get_low hurts performance BTR_MODIFY_PREV: Remove. This mode was only used by the change buffer, which commit f27e9c894779a4c7ebe6446ba9aa408f1771c114 (MDEV-29694) removed. buf_page_get_gen(): Revert the change that was made in commit 90b95c6149c72f43aa2324353a76f370d018a5ac (MDEV-33543) because it is not applicable after MDEV-29694. This fixes the performance regression that Vladislav Vaintroub reported. This is a 11.x specific fix; this needs to be fixed differently in older major versions where the change buffer is present. --- storage/innobase/btr/btr0cur.cc | 6 +----- storage/innobase/btr/btr0pcur.cc | 21 ++++++--------------- storage/innobase/buf/buf0buf.cc | 15 +++------------ storage/innobase/gis/gis0sea.cc | 1 - storage/innobase/include/btr0types.h | 3 --- 5 files changed, 10 insertions(+), 36 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index f0ba346dd0e..4616673164a 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1220,7 +1220,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, ut_ad(rw_lock_type_t(latch_mode & ~12) == RW_X_LATCH); goto relatch_x; } - if (latch_mode != BTR_MODIFY_PREV) + else { if (!latch_by_caller) /* Release the tree s-latch */ @@ -1292,8 +1292,6 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, switch (latch_mode) { case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: - static_assert(BTR_MODIFY_PREV & BTR_MODIFY_LEAF, ""); static_assert(BTR_SEARCH_PREV & BTR_SEARCH_LEAF, ""); ut_ad(!latch_by_caller); ut_ad(rw_latch == @@ -1470,7 +1468,6 @@ release_tree: case BTR_MODIFY_ROOT_AND_LEAF: rw_latch= RW_X_LATCH; break; - case BTR_MODIFY_PREV: /* btr_pcur_move_to_prev() */ case BTR_SEARCH_PREV: /* btr_pcur_move_to_prev() */ ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); @@ -1854,7 +1851,6 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, ut_ad(!(latch_mode & 8)); /* This function doesn't need to lock left page of the leaf page */ static_assert(int{BTR_SEARCH_PREV} == (4 | BTR_SEARCH_LEAF), ""); - static_assert(int{BTR_MODIFY_PREV} == (4 | BTR_MODIFY_LEAF), ""); latch_mode= btr_latch_mode(latch_mode & (RW_S_LATCH | RW_X_LATCH)); ut_ad(!latch_by_caller || mtr->memo_contains_flagged(&index->lock, diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 61afa3c9132..527ecfe354a 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -215,24 +215,18 @@ static bool btr_pcur_optimistic_latch_leaves(btr_pcur_t *pcur, btr_latch_mode *latch_mode, mtr_t *mtr) { - static_assert(BTR_SEARCH_PREV & BTR_SEARCH_LEAF, ""); - static_assert(BTR_MODIFY_PREV & BTR_MODIFY_LEAF, ""); - static_assert((BTR_SEARCH_PREV ^ BTR_MODIFY_PREV) == - (RW_S_LATCH ^ RW_X_LATCH), ""); - buf_block_t *const block= buf_page_optimistic_fix(pcur->btr_cur.page_cur.block, pcur->old_page_id); if (!block) return false; - if (*latch_mode == BTR_SEARCH_LEAF || *latch_mode == BTR_MODIFY_LEAF) + if (*latch_mode != BTR_SEARCH_PREV) + { + ut_ad(*latch_mode == BTR_SEARCH_LEAF || *latch_mode == BTR_MODIFY_LEAF); return buf_page_optimistic_get(block, rw_lock_type_t(*latch_mode), pcur->modify_clock, mtr); - - ut_ad(*latch_mode == BTR_SEARCH_PREV || *latch_mode == BTR_MODIFY_PREV); - const rw_lock_type_t mode= - rw_lock_type_t(*latch_mode & (RW_X_LATCH | RW_S_LATCH)); + } uint64_t modify_clock; uint32_t left_page_no; @@ -258,7 +252,7 @@ static bool btr_pcur_optimistic_latch_leaves(btr_pcur_t *pcur, { prev= buf_page_get_gen(page_id_t(pcur->old_page_id.space(), left_page_no), block->zip_size(), - mode, nullptr, BUF_GET_POSSIBLY_FREED, mtr); + RW_S_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, mtr); if (!prev || page_is_comp(prev->page.frame) != page_is_comp(block->page.frame) || memcmp_aligned<2>(block->page.frame, prev->page.frame, 2) || @@ -269,7 +263,7 @@ static bool btr_pcur_optimistic_latch_leaves(btr_pcur_t *pcur, else prev= nullptr; - mtr->upgrade_buffer_fix(savepoint, mode); + mtr->upgrade_buffer_fix(savepoint, RW_S_LATCH); if (UNIV_UNLIKELY(block->modify_clock != modify_clock) || UNIV_UNLIKELY(block->page.is_freed()) || @@ -343,11 +337,9 @@ btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) ut_a(old_n_fields); static_assert(BTR_SEARCH_PREV == (4 | BTR_SEARCH_LEAF), ""); - static_assert(BTR_MODIFY_PREV == (4 | BTR_MODIFY_LEAF), ""); switch (restore_latch_mode | 4) { case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: /* Try optimistic restoration. */ if (btr_pcur_optimistic_latch_leaves(this, &restore_latch_mode, mtr)) { @@ -579,7 +571,6 @@ btr_pcur_move_backward_from_page( mtr_start(mtr); static_assert(BTR_SEARCH_PREV == (4 | BTR_SEARCH_LEAF), ""); - static_assert(BTR_MODIFY_PREV == (4 | BTR_MODIFY_LEAF), ""); if (UNIV_UNLIKELY(cursor->restore_position( btr_latch_mode(4 | latch_mode), mtr) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 21a8818afb6..0157206460b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2740,15 +2740,7 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - if (rw_latch != RW_NO_LATCH) { - block->page.lock.s_lock(); - } else if (!block->page.lock.s_lock_try()) { - /* For RW_NO_LATCH, we should not try to acquire S or X - latch directly as we could be violating the latching - order resulting in deadlock. Instead we try latching the - page and retry in case of a failure. */ - goto wait_for_read; - } + block->page.lock.s_lock(); state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); @@ -2756,15 +2748,15 @@ ignore_unfixed: block->page.lock.s_unlock(); if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + block->page.unfix(); if (UNIV_UNLIKELY(id == page_id)) { /* The page read was completed, and another thread marked the page as free while we were waiting. */ - goto ignore_block; + goto ignore_unfixed; } ut_ad(id == page_id_t{~0ULL}); - block->page.unfix(); if (++retries < BUF_PAGE_READ_MAX_RETRIES) { goto loop; @@ -2803,7 +2795,6 @@ free_unfixed_block: if (UNIV_UNLIKELY(!block->page.frame)) { if (!block->page.lock.x_lock_try()) { wait_for_unzip: -wait_for_read: /* The page is being read or written, or another thread is executing buf_zip_decompress() in buf_page_get_gen() on it. */ diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 10a12a785df..7d4c7730499 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -604,7 +604,6 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, upper_rw_latch= RW_X_LATCH; break; default: - ut_ad(latch_mode != BTR_MODIFY_PREV); ut_ad(latch_mode != BTR_SEARCH_PREV); if (!latch_by_caller) mtr_s_lock_index(index, mtr); diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 966247ffa00..d5a1e79c573 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -68,9 +68,6 @@ enum btr_latch_mode { /** Search the previous record. Used in btr_pcur_move_backward_from_page(). */ BTR_SEARCH_PREV = 4 | BTR_SEARCH_LEAF, - /** Modify the previous record. - Used in btr_pcur_move_backward_from_page(). */ - BTR_MODIFY_PREV = 4 | BTR_MODIFY_LEAF, /** Start modifying the entire B-tree. */ BTR_MODIFY_TREE = 8 | BTR_MODIFY_LEAF, /** Continue modifying the entire R-tree. From 55db59f16de3dea3d8bfc35bdca33f2ca62fdef4 Mon Sep 17 00:00:00 2001 From: Meng-Hsiu Chiang Date: Wed, 6 Dec 2023 19:48:53 +0000 Subject: [PATCH 51/85] [MDEV-28162] Replace PFS_atomic with std::atomic PFS_atomic class contains wrappers around my_atomic_* operations, which are macros to GNU atomic operations (__atomic_*). Due to different implementations of compilers, clang may encounter errors when compiling on x86_32 architecture. The following functions are replaced with C++ std::atomic type in performance schema code base: - PFS_atomic::store_*() -> my_atomic_store* -> __atomic_store_n() => std::atomic::store() - PFS_atomic::load_*() -> my_atomic_load* -> __atomic_load_n() => std::atomic::load() - PFS_atomic::add_*() -> my_atomic_add* -> __atomic_fetch_add() => std::atomic::fetch_add() - PFS_atomic::cas_*() -> my_atomic_cas* -> __atomic_compare_exchange_n() => std::atomic::compare_exchange_strong() and PFS_atomic class could be dropped completely. Note that in the wrapper memory order passed to original GNU atomic extensions are hard-coded as `__ATOMIC_SEQ_CST`, which is equivalent to `std::memory_order_seq_cst` in C++, and is the default parameter for std::atomic_* functions. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services. --- storage/perfschema/CMakeLists.txt | 1 - storage/perfschema/pfs_account.h | 11 +- storage/perfschema/pfs_atomic.h | 141 ------------------ storage/perfschema/pfs_buffer_container.h | 15 +- storage/perfschema/pfs_digest.cc | 6 +- storage/perfschema/pfs_events_stages.cc | 7 +- storage/perfschema/pfs_events_statements.cc | 7 +- storage/perfschema/pfs_events_transactions.cc | 7 +- storage/perfschema/pfs_events_waits.cc | 7 +- storage/perfschema/pfs_global.h | 6 +- storage/perfschema/pfs_host.h | 12 +- storage/perfschema/pfs_instr.cc | 2 +- storage/perfschema/pfs_instr_class.cc | 74 ++++----- storage/perfschema/pfs_instr_class.h | 13 +- storage/perfschema/pfs_lock.h | 34 ++--- storage/perfschema/pfs_memory.cc | 1 - storage/perfschema/pfs_status.cc | 1 - storage/perfschema/pfs_user.h | 12 +- 18 files changed, 109 insertions(+), 248 deletions(-) delete mode 100644 storage/perfschema/pfs_atomic.h diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt index bb486457dde..aea4040c408 100644 --- a/storage/perfschema/CMakeLists.txt +++ b/storage/perfschema/CMakeLists.txt @@ -49,7 +49,6 @@ cursor_by_thread.h cursor_by_user.h pfs.h pfs_account.h -pfs_atomic.h pfs_buffer_container.h pfs_builtin_memory.h pfs_column_types.h diff --git a/storage/perfschema/pfs_account.h b/storage/perfschema/pfs_account.h index 0aa36204e12..8a2d40c5017 100644 --- a/storage/perfschema/pfs_account.h +++ b/storage/perfschema/pfs_account.h @@ -27,6 +27,7 @@ @file storage/perfschema/pfs_account.h Performance schema account (declarations). */ +#include #include "pfs_lock.h" #include "lf.h" @@ -62,22 +63,22 @@ struct PFS_ALIGNED PFS_account : PFS_connection_slice public: inline void init_refcount(void) { - PFS_atomic::store_32(& m_refcount, 1); + m_refcount.store(1); } inline int get_refcount(void) { - return PFS_atomic::load_32(& m_refcount); + return m_refcount.load(); } inline void inc_refcount(void) { - PFS_atomic::add_32(& m_refcount, 1); + m_refcount.fetch_add(1); } inline void dec_refcount(void) { - PFS_atomic::add_32(& m_refcount, -1); + m_refcount.fetch_sub(1); } void aggregate(bool alive, PFS_user *safe_user, PFS_host *safe_host); @@ -109,7 +110,7 @@ public: ulonglong m_disconnected_count; private: - int m_refcount; + std::atomic m_refcount; }; int init_account(const PFS_global_param *param); diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h deleted file mode 100644 index 8543cdabc88..00000000000 --- a/storage/perfschema/pfs_atomic.h +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright (c) 2009, 2023, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - 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, version 2.0, 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, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef PFS_ATOMIC_H -#define PFS_ATOMIC_H - -/** - @file storage/perfschema/pfs_atomic.h - Atomic operations (declarations). -*/ - -#include - -/** Helper for atomic operations. */ -class PFS_atomic -{ -public: - /** Atomic load. */ - static inline int32 load_32(int32 *ptr) - { - return my_atomic_load32(ptr); - } - - /** Atomic load. */ - static inline int64 load_64(int64 *ptr) - { - return my_atomic_load64(ptr); - } - - /** Atomic load. */ - static inline uint32 load_u32(uint32 *ptr) - { - return (uint32) my_atomic_load32((int32*) ptr); - } - - /** Atomic load. */ - static inline uint64 load_u64(uint64 *ptr) - { - return (uint64) my_atomic_load64((int64*) ptr); - } - - /** Atomic store. */ - static inline void store_32(int32 *ptr, int32 value) - { - my_atomic_store32(ptr, value); - } - - /** Atomic store. */ - static inline void store_64(int64 *ptr, int64 value) - { - my_atomic_store64(ptr, value); - } - - /** Atomic store. */ - static inline void store_u32(uint32 *ptr, uint32 value) - { - my_atomic_store32((int32*) ptr, (int32) value); - } - - /** Atomic store. */ - static inline void store_u64(uint64 *ptr, uint64 value) - { - my_atomic_store64((int64*) ptr, (int64) value); - } - - /** Atomic add. */ - static inline int32 add_32(int32 *ptr, int32 value) - { - return my_atomic_add32(ptr, value); - } - - /** Atomic add. */ - static inline int64 add_64(int64 *ptr, int64 value) - { - return my_atomic_add64(ptr, value); - } - - /** Atomic add. */ - static inline uint32 add_u32(uint32 *ptr, uint32 value) - { - return (uint32) my_atomic_add32((int32*) ptr, (int32) value); - } - - /** Atomic add. */ - static inline uint64 add_u64(uint64 *ptr, uint64 value) - { - return (uint64) my_atomic_add64((int64*) ptr, (int64) value); - } - - /** Atomic compare and swap. */ - static inline bool cas_32(int32 *ptr, int32 *old_value, - int32 new_value) - { - return my_atomic_cas32(ptr, old_value, new_value); - } - - /** Atomic compare and swap. */ - static inline bool cas_64(int64 *ptr, int64 *old_value, - int64 new_value) - { - return my_atomic_cas64(ptr, old_value, new_value); - } - - /** Atomic compare and swap. */ - static inline bool cas_u32(uint32 *ptr, uint32 *old_value, - uint32 new_value) - { - return my_atomic_cas32((int32*) ptr, (int32*) old_value, - (uint32) new_value); - } - - /** Atomic compare and swap. */ - static inline bool cas_u64(uint64 *ptr, uint64 *old_value, - uint64 new_value) - { - return my_atomic_cas64((int64*) ptr, (int64*) old_value, - (uint64) new_value); - } -}; - -#endif - diff --git a/storage/perfschema/pfs_buffer_container.h b/storage/perfschema/pfs_buffer_container.h index b5506fe0195..c1cd9e644ef 100644 --- a/storage/perfschema/pfs_buffer_container.h +++ b/storage/perfschema/pfs_buffer_container.h @@ -87,7 +87,7 @@ public: if (m_full) return NULL; - monotonic= PFS_atomic::add_u32(& m_monotonic.m_u32, 1); + monotonic= m_monotonic.m_u32.fetch_add(1); monotonic_max= monotonic + static_cast(m_max); while (monotonic < monotonic_max) @@ -99,7 +99,8 @@ public: { return pfs; } - monotonic= PFS_atomic::add_u32(& m_monotonic.m_u32, 1); + monotonic= m_monotonic.m_u32.fetch_add(1); + } m_full= true; @@ -517,7 +518,7 @@ public: ulong get_row_count() { - ulong page_count= PFS_atomic::load_u32(& m_max_page_index.m_u32); + ulong page_count= m_max_page_index.m_u32.load(); return page_count * PFS_PAGE_SIZE; } @@ -554,11 +555,11 @@ public: /* 1: Try to find an available record within the existing pages */ - current_page_count= PFS_atomic::load_u32(& m_max_page_index.m_u32); + current_page_count= m_max_page_index.m_u32.load(); if (current_page_count != 0) { - monotonic= PFS_atomic::load_u32(& m_monotonic.m_u32); + monotonic= m_monotonic.m_u32.load(); monotonic_max= monotonic + current_page_count; while (monotonic < monotonic_max) @@ -602,7 +603,7 @@ public: counter faster and then move on to the detection of new pages, in part 2: below. */ - monotonic= PFS_atomic::add_u32(& m_monotonic.m_u32, 1); + monotonic= m_monotonic.m_u32.fetch_add(1); }; } @@ -683,7 +684,7 @@ public: my_atomic_storeptr(typed_addr, ptr); /* Advertise the new page */ - PFS_atomic::add_u32(& m_max_page_index.m_u32, 1); + m_max_page_index.m_u32.fetch_add(1); } pthread_mutex_unlock(& m_critical_section); diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc index c2541f7f7e7..46a97534bb2 100644 --- a/storage/perfschema/pfs_digest.cc +++ b/storage/perfschema/pfs_digest.cc @@ -75,7 +75,7 @@ int init_digest(const PFS_global_param *param) */ digest_max= param->m_digest_sizing; digest_lost= 0; - PFS_atomic::store_u32(& digest_monotonic_index.m_u32, 1); + digest_monotonic_index.m_u32.store(1); digest_full= false; if (digest_max == 0) @@ -274,7 +274,7 @@ search: while (++attempts <= digest_max) { - safe_index= PFS_atomic::add_u32(& digest_monotonic_index.m_u32, 1) % digest_max; + safe_index= digest_monotonic_index.m_u32.fetch_add(1) % digest_max; if (safe_index == 0) { /* Record [0] is reserved. */ @@ -406,7 +406,7 @@ void reset_esms_by_digest() Reset index which indicates where the next calculated digest information to be inserted in statements_digest_stat_array. */ - PFS_atomic::store_u32(& digest_monotonic_index.m_u32, 1); + digest_monotonic_index.m_u32.store(1); digest_full= false; } diff --git a/storage/perfschema/pfs_events_stages.cc b/storage/perfschema/pfs_events_stages.cc index aa1bdf4f7a0..9289d25e38e 100644 --- a/storage/perfschema/pfs_events_stages.cc +++ b/storage/perfschema/pfs_events_stages.cc @@ -34,7 +34,6 @@ #include "pfs_host.h" #include "pfs_user.h" #include "pfs_events_stages.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "pfs_builtin_memory.h" #include "m_string.h" @@ -62,7 +61,7 @@ int init_events_stages_history_long(uint events_stages_history_long_sizing) { events_stages_history_long_size= events_stages_history_long_sizing; events_stages_history_long_full= false; - PFS_atomic::store_u32(&events_stages_history_long_index.m_u32, 0); + events_stages_history_long_index.m_u32.store(0); if (events_stages_history_long_size == 0) return 0; @@ -135,7 +134,7 @@ void insert_events_stages_history_long(PFS_events_stages *stage) assert(events_stages_history_long_array != NULL); - uint index= PFS_atomic::add_u32(&events_stages_history_long_index.m_u32, 1); + uint index= events_stages_history_long_index.m_u32.fetch_add(1); index= index % events_stages_history_long_size; if (index == 0) @@ -176,7 +175,7 @@ void reset_events_stages_history(void) /** Reset table EVENTS_STAGES_HISTORY_LONG data. */ void reset_events_stages_history_long(void) { - PFS_atomic::store_u32(&events_stages_history_long_index.m_u32, 0); + events_stages_history_long_index.m_u32.store(0); events_stages_history_long_full= false; PFS_events_stages *pfs= events_stages_history_long_array; diff --git a/storage/perfschema/pfs_events_statements.cc b/storage/perfschema/pfs_events_statements.cc index 05bdc83fc5c..9bd6013b390 100644 --- a/storage/perfschema/pfs_events_statements.cc +++ b/storage/perfschema/pfs_events_statements.cc @@ -34,7 +34,6 @@ #include "pfs_host.h" #include "pfs_user.h" #include "pfs_events_statements.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "pfs_builtin_memory.h" #include "m_string.h" @@ -64,7 +63,7 @@ int init_events_statements_history_long(size_t events_statements_history_long_si { events_statements_history_long_size= events_statements_history_long_sizing; events_statements_history_long_full= false; - PFS_atomic::store_u32(&events_statements_history_long_index.m_u32, 0); + events_statements_history_long_index.m_u32.store(0); if (events_statements_history_long_size == 0) return 0; @@ -213,7 +212,7 @@ void insert_events_statements_history_long(PFS_events_statements *statement) assert(events_statements_history_long_array != NULL); - uint index= PFS_atomic::add_u32(&events_statements_history_long_index.m_u32, 1); + uint index= events_statements_history_long_index.m_u32.fetch_add(1); index= index % events_statements_history_long_size; if (index == 0) @@ -258,7 +257,7 @@ void reset_events_statements_history(void) /** Reset table EVENTS_STATEMENTS_HISTORY_LONG data. */ void reset_events_statements_history_long(void) { - PFS_atomic::store_u32(&events_statements_history_long_index.m_u32, 0); + events_statements_history_long_index.m_u32.store(0); events_statements_history_long_full= false; PFS_events_statements *pfs= events_statements_history_long_array; diff --git a/storage/perfschema/pfs_events_transactions.cc b/storage/perfschema/pfs_events_transactions.cc index 5ccdb0345d7..563de844f3a 100644 --- a/storage/perfschema/pfs_events_transactions.cc +++ b/storage/perfschema/pfs_events_transactions.cc @@ -34,7 +34,6 @@ #include "pfs_host.h" #include "pfs_user.h" #include "pfs_events_transactions.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "pfs_builtin_memory.h" #include "m_string.h" @@ -62,7 +61,7 @@ int init_events_transactions_history_long(uint events_transactions_history_long_ { events_transactions_history_long_size= events_transactions_history_long_sizing; events_transactions_history_long_full= false; - PFS_atomic::store_u32(&events_transactions_history_long_index.m_u32, 0); + events_transactions_history_long_index.m_u32.store(0); if (events_transactions_history_long_size == 0) return 0; @@ -135,7 +134,7 @@ void insert_events_transactions_history_long(PFS_events_transactions *transactio assert(events_transactions_history_long_array != NULL); - uint index= PFS_atomic::add_u32(&events_transactions_history_long_index.m_u32, 1); + uint index= events_transactions_history_long_index.m_u32.fetch_add(1); index= index % events_transactions_history_long_size; if (index == 0) @@ -176,7 +175,7 @@ void reset_events_transactions_history(void) /** Reset table EVENTS_TRANSACTIONS_HISTORY_LONG data. */ void reset_events_transactions_history_long(void) { - PFS_atomic::store_u32(&events_transactions_history_long_index.m_u32, 0); + events_transactions_history_long_index.m_u32.store(0); events_transactions_history_long_full= false; PFS_events_transactions *pfs= events_transactions_history_long_array; diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index 3ec6a671913..bceb8d3b791 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -34,7 +34,6 @@ #include "pfs_host.h" #include "pfs_account.h" #include "pfs_events_waits.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "pfs_builtin_memory.h" #include "m_string.h" @@ -66,7 +65,7 @@ int init_events_waits_history_long(uint events_waits_history_long_sizing) { events_waits_history_long_size= events_waits_history_long_sizing; events_waits_history_long_full= false; - PFS_atomic::store_u32(&events_waits_history_long_index.m_u32, 0); + events_waits_history_long_index.m_u32.store(0); if (events_waits_history_long_size == 0) return 0; @@ -135,7 +134,7 @@ void insert_events_waits_history_long(PFS_events_waits *wait) if (unlikely(events_waits_history_long_size == 0)) return; - uint index= PFS_atomic::add_u32(&events_waits_history_long_index.m_u32, 1); + uint index= events_waits_history_long_index.m_u32.fetch_add(1); index= index % events_waits_history_long_size; if (index == 0) @@ -181,7 +180,7 @@ void reset_events_waits_history(void) /** Reset table EVENTS_WAITS_HISTORY_LONG data. */ void reset_events_waits_history_long(void) { - PFS_atomic::store_u32(&events_waits_history_long_index.m_u32, 0); + events_waits_history_long_index.m_u32.store(0); events_waits_history_long_full= false; PFS_events_waits *wait= events_waits_history_long_array; diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h index 9f2fba7123e..28e62ca3057 100644 --- a/storage/perfschema/pfs_global.h +++ b/storage/perfschema/pfs_global.h @@ -23,6 +23,8 @@ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H +#include + #include "my_compiler.h" /** @@ -59,7 +61,7 @@ extern size_t pfs_allocated_memory; */ struct PFS_cacheline_uint32 { - uint32 m_u32; + std::atomic m_u32; char m_full_cache_line[PFS_CACHE_LINE_SIZE - sizeof(uint32)]; PFS_cacheline_uint32() @@ -73,7 +75,7 @@ struct PFS_cacheline_uint32 */ struct PFS_cacheline_uint64 { - uint64 m_u64; + std::atomic m_u64; char m_full_cache_line[PFS_CACHE_LINE_SIZE - sizeof(uint64)]; PFS_cacheline_uint64() diff --git a/storage/perfschema/pfs_host.h b/storage/perfschema/pfs_host.h index 56bcccb94ac..89dd05df864 100644 --- a/storage/perfschema/pfs_host.h +++ b/storage/perfschema/pfs_host.h @@ -28,6 +28,8 @@ Performance schema host (declarations). */ +#include + #include "pfs_lock.h" #include "lf.h" #include "pfs_con_slice.h" @@ -58,22 +60,22 @@ struct PFS_ALIGNED PFS_host : PFS_connection_slice public: inline void init_refcount(void) { - PFS_atomic::store_32(& m_refcount, 1); + m_refcount.store(1); } inline int get_refcount(void) { - return PFS_atomic::load_32(& m_refcount); + return m_refcount.load(); } inline void inc_refcount(void) { - PFS_atomic::add_32(& m_refcount, 1); + m_refcount.fetch_add(1); } inline void dec_refcount(void) { - PFS_atomic::add_32(& m_refcount, -1); + m_refcount.fetch_sub(1); } void aggregate(bool alive); @@ -97,7 +99,7 @@ public: ulonglong m_disconnected_count; private: - int m_refcount; + std::atomic m_refcount; }; int init_host(const PFS_global_param *param); diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 8d0e1265011..9e2d0a81f13 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -526,7 +526,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, if (pfs != NULL) { pfs->m_thread_internal_id= - PFS_atomic::add_u64(&thread_internal_id_counter.m_u64, 1); + thread_internal_id_counter.m_u64.fetch_add(1); pfs->m_parent_thread_internal_id= 0; pfs->m_processlist_id= static_cast(processlist_id); pfs->m_thread_os_id= my_thread_os_id(); diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index 56573d3dffd..49aa73f078a 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -25,6 +25,7 @@ @file storage/perfschema/pfs_instr_class.cc Performance schema instruments meta data (implementation). */ +#include #include "my_global.h" #include "my_sys.h" @@ -36,7 +37,6 @@ #include "pfs_timer.h" #include "pfs_events_waits.h" #include "pfs_setup_object.h" -#include "pfs_atomic.h" #include "pfs_program.h" #include "pfs_buffer_container.h" #include "mysql/psi/mysql_thread.h" @@ -76,12 +76,12 @@ static void init_instr_class(PFS_instr_class *klass, - the performance schema initialization - a plugin initialization */ -static uint32 mutex_class_dirty_count= 0; -static uint32 mutex_class_allocated_count= 0; -static uint32 rwlock_class_dirty_count= 0; -static uint32 rwlock_class_allocated_count= 0; -static uint32 cond_class_dirty_count= 0; -static uint32 cond_class_allocated_count= 0; +static std::atomic mutex_class_dirty_count(0); +static std::atomic mutex_class_allocated_count(0); +static std::atomic rwlock_class_dirty_count(0); +static std::atomic rwlock_class_allocated_count(0); +static std::atomic cond_class_dirty_count(0); +static std::atomic cond_class_allocated_count(0); /** Size of the mutex class array. @sa mutex_class_array */ ulong mutex_class_max= 0; @@ -137,8 +137,8 @@ PFS_cond_class *cond_class_array= NULL; - the performance schema initialization - a plugin initialization */ -static uint32 thread_class_dirty_count= 0; -static uint32 thread_class_allocated_count= 0; +static std::atomic thread_class_dirty_count(0); +static std::atomic thread_class_allocated_count(0); static PFS_thread_class *thread_class_array= NULL; @@ -185,28 +185,28 @@ LF_HASH table_share_hash; /** True if table_share_hash is initialized. */ static bool table_share_hash_inited= false; -static uint32 file_class_dirty_count= 0; -static uint32 file_class_allocated_count= 0; +static std::atomic file_class_dirty_count(0); +static std::atomic file_class_allocated_count(0); PFS_file_class *file_class_array= NULL; -static uint32 stage_class_dirty_count= 0; -static uint32 stage_class_allocated_count= 0; +static std::atomic stage_class_dirty_count(0); +static std::atomic stage_class_allocated_count(0); static PFS_stage_class *stage_class_array= NULL; -static uint32 statement_class_dirty_count= 0; -static uint32 statement_class_allocated_count= 0; +static std::atomic statement_class_dirty_count(0); +static std::atomic statement_class_allocated_count(0); static PFS_statement_class *statement_class_array= NULL; -static uint32 socket_class_dirty_count= 0; -static uint32 socket_class_allocated_count= 0; +static std::atomic socket_class_dirty_count(0); +static std::atomic socket_class_allocated_count(0); static PFS_socket_class *socket_class_array= NULL; -static uint32 memory_class_dirty_count= 0; -static uint32 memory_class_allocated_count= 0; +static std::atomic memory_class_dirty_count(0); +static std::atomic memory_class_allocated_count(0); static PFS_memory_class *memory_class_array= NULL; @@ -1092,7 +1092,7 @@ PFS_sync_key register_mutex_class(const char *name, uint name_length, mutex_class_dirty_count is incremented *before* an entry is added mutex_class_allocated_count is incremented *after* an entry is added */ - index= PFS_atomic::add_u32(&mutex_class_dirty_count, 1); + index= mutex_class_dirty_count.fetch_add(1); if (index < mutex_class_max) { @@ -1148,7 +1148,7 @@ PFS_sync_key register_mutex_class(const char *name, uint name_length, empty/NULL/zero, but this won't cause a crash (mutex_class_array is initialized with MY_ZEROFILL). */ - PFS_atomic::add_u32(&mutex_class_allocated_count, 1); + mutex_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1178,7 +1178,7 @@ PFS_sync_key register_rwlock_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, rwlock_class_array, rwlock_class_max, name, name_length) - index= PFS_atomic::add_u32(&rwlock_class_dirty_count, 1); + index= rwlock_class_dirty_count.fetch_add(1); if (index < rwlock_class_max) { @@ -1191,7 +1191,7 @@ PFS_sync_key register_rwlock_class(const char *name, uint name_length, entry->m_timed= false; /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&rwlock_class_allocated_count, 1); + rwlock_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1217,7 +1217,7 @@ PFS_sync_key register_cond_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, cond_class_array, cond_class_max, name, name_length) - index= PFS_atomic::add_u32(&cond_class_dirty_count, 1); + index= cond_class_dirty_count.fetch_add(1); if (index < cond_class_max) { @@ -1229,7 +1229,7 @@ PFS_sync_key register_cond_class(const char *name, uint name_length, entry->m_timed= false; /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&cond_class_allocated_count, 1); + cond_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1311,7 +1311,7 @@ PFS_thread_key register_thread_class(const char *name, uint name_length, return (index + 1); } - index= PFS_atomic::add_u32(&thread_class_dirty_count, 1); + index= thread_class_dirty_count.fetch_add(1); if (index < thread_class_max) { @@ -1320,7 +1320,7 @@ PFS_thread_key register_thread_class(const char *name, uint name_length, strncpy(entry->m_name, name, name_length); entry->m_name_length= name_length; entry->m_enabled= true; - PFS_atomic::add_u32(&thread_class_allocated_count, 1); + thread_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1361,7 +1361,7 @@ PFS_file_key register_file_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, file_class_array, file_class_max, name, name_length) - index= PFS_atomic::add_u32(&file_class_dirty_count, 1); + index= file_class_dirty_count.fetch_add(1); if (index < file_class_max) { @@ -1373,7 +1373,7 @@ PFS_file_key register_file_class(const char *name, uint name_length, entry->m_timed= true; /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&file_class_allocated_count, 1); + file_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1403,7 +1403,7 @@ PFS_stage_key register_stage_class(const char *name, REGISTER_CLASS_BODY_PART(index, stage_class_array, stage_class_max, name, name_length) - index= PFS_atomic::add_u32(&stage_class_dirty_count, 1); + index= stage_class_dirty_count.fetch_add(1); if (index < stage_class_max) { @@ -1427,7 +1427,7 @@ PFS_stage_key register_stage_class(const char *name, /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&stage_class_allocated_count, 1); + stage_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1454,7 +1454,7 @@ PFS_statement_key register_statement_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, statement_class_array, statement_class_max, name, name_length) - index= PFS_atomic::add_u32(&statement_class_dirty_count, 1); + index= statement_class_dirty_count.fetch_add(1); if (index < statement_class_max) { @@ -1465,7 +1465,7 @@ PFS_statement_key register_statement_class(const char *name, uint name_length, entry->m_timed= true; /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&statement_class_allocated_count, 1); + statement_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1537,7 +1537,7 @@ PFS_socket_key register_socket_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, socket_class_array, socket_class_max, name, name_length) - index= PFS_atomic::add_u32(&socket_class_dirty_count, 1); + index= socket_class_dirty_count.fetch_add(1); if (index < socket_class_max) { @@ -1549,7 +1549,7 @@ PFS_socket_key register_socket_class(const char *name, uint name_length, entry->m_timed= false; /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); - PFS_atomic::add_u32(&socket_class_allocated_count, 1); + socket_class_allocated_count.fetch_add(1); return (index + 1); } @@ -1590,7 +1590,7 @@ PFS_memory_key register_memory_class(const char *name, uint name_length, REGISTER_CLASS_BODY_PART(index, memory_class_array, memory_class_max, name, name_length) - index= PFS_atomic::add_u32(&memory_class_dirty_count, 1); + index= memory_class_dirty_count.fetch_add(1); if (index < memory_class_max) { @@ -1601,7 +1601,7 @@ PFS_memory_key register_memory_class(const char *name, uint name_length, /* Set user-defined configuration options for this instrument */ configure_instr_class(entry); entry->m_timed= false; /* Immutable */ - PFS_atomic::add_u32(&memory_class_allocated_count, 1); + memory_class_allocated_count.fetch_add(1); return (index + 1); } diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h index f353c410d4c..57c7f9e5464 100644 --- a/storage/perfschema/pfs_instr_class.h +++ b/storage/perfschema/pfs_instr_class.h @@ -23,11 +23,12 @@ #ifndef PFS_INSTR_CLASS_H #define PFS_INSTR_CLASS_H +#include + #include "my_global.h" #include "mysql_com.h" /* NAME_LEN */ #include "lf.h" #include "pfs_global.h" -#include "pfs_atomic.h" #include "sql_array.h" /** @@ -329,22 +330,22 @@ public: inline void init_refcount(void) { - PFS_atomic::store_32(& m_refcount, 1); + m_refcount.store(1); } inline int get_refcount(void) { - return PFS_atomic::load_32(& m_refcount); + return m_refcount.load(); } inline void inc_refcount(void) { - PFS_atomic::add_32(& m_refcount, 1); + m_refcount.fetch_add(1); } inline void dec_refcount(void) { - PFS_atomic::add_32(& m_refcount, -1); + m_refcount.fetch_sub(1); } void refresh_setup_object_flags(PFS_thread *thread); @@ -387,7 +388,7 @@ public: private: /** Number of opened table handles. */ - int m_refcount; + std::atomic m_refcount; /** Table locks statistics. */ PFS_table_share_lock *m_race_lock_stat; /** Table indexes' stats. */ diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h index 0f4bcb6de8f..4d3c7c040e8 100644 --- a/storage/perfschema/pfs_lock.h +++ b/storage/perfschema/pfs_lock.h @@ -28,9 +28,9 @@ Performance schema internal locks (declarations). */ -#include "my_global.h" +#include -#include "pfs_atomic.h" +#include "my_global.h" /* to cause bugs, testing */ // #define MEM(X) std::memory_order_relaxed @@ -103,7 +103,7 @@ struct pfs_lock The version number is stored in the high 30 bits. The state is stored in the low 2 bits. */ - uint32 m_version_state; + std::atomic m_version_state; uint32 copy_version_state() { @@ -119,7 +119,7 @@ struct pfs_lock { uint32 copy; - copy= PFS_atomic::load_u32(&m_version_state); + copy= m_version_state.load(); return ((copy & STATE_MASK) == PFS_LOCK_FREE); } @@ -129,7 +129,7 @@ struct pfs_lock { uint32 copy; - copy= PFS_atomic::load_u32(&m_version_state); + copy= m_version_state.load(); return ((copy & STATE_MASK) == PFS_LOCK_ALLOCATED); } @@ -144,7 +144,7 @@ struct pfs_lock { uint32 old_val; - old_val= PFS_atomic::load_u32(&m_version_state); + old_val= m_version_state.load(); if ((old_val & STATE_MASK) != PFS_LOCK_FREE) { @@ -154,7 +154,7 @@ struct pfs_lock uint32 new_val= (old_val & VERSION_MASK) + PFS_LOCK_DIRTY; bool pass; - pass= PFS_atomic::cas_u32(&m_version_state, &old_val, new_val); + pass= m_version_state.compare_exchange_strong(old_val, new_val); if (pass) { @@ -178,7 +178,7 @@ struct pfs_lock uint32 new_val= (copy & VERSION_MASK) + PFS_LOCK_DIRTY; /* We own the record, no need to use compare and swap. */ - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); copy_ptr->m_version_state= new_val; } @@ -195,7 +195,7 @@ struct pfs_lock /* Increment the version, set the ALLOCATED state */ uint32 new_val= (copy->m_version_state & VERSION_MASK) + VERSION_INC + PFS_LOCK_ALLOCATED; - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); } /** @@ -210,7 +210,7 @@ struct pfs_lock /* Increment the version, set the ALLOCATED state */ uint32 new_val= (copy & VERSION_MASK) + VERSION_INC + PFS_LOCK_ALLOCATED; - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); } /** @@ -219,10 +219,10 @@ struct pfs_lock void set_dirty(pfs_dirty_state *copy_ptr) { /* Do not set the version to 0, read the previous value. */ - uint32 copy= PFS_atomic::load_u32(&m_version_state); + uint32 copy= m_version_state.load(); /* Increment the version, set the DIRTY state */ uint32 new_val= (copy & VERSION_MASK) + VERSION_INC + PFS_LOCK_DIRTY; - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); copy_ptr->m_version_state= new_val; } @@ -238,7 +238,7 @@ struct pfs_lock /* Keep the same version, set the FREE state */ uint32 new_val= (copy->m_version_state & VERSION_MASK) + PFS_LOCK_FREE; - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); } /** @@ -258,7 +258,7 @@ struct pfs_lock /* Keep the same version, set the FREE state */ uint32 new_val= (copy & VERSION_MASK) + PFS_LOCK_FREE; - PFS_atomic::store_u32(&m_version_state, new_val); + m_version_state.store(new_val); } /** @@ -268,7 +268,7 @@ struct pfs_lock */ void begin_optimistic_lock(struct pfs_optimistic_state *copy) { - copy->m_version_state= PFS_atomic::load_u32(&m_version_state); + copy->m_version_state= m_version_state.load(); } /** @@ -285,7 +285,7 @@ struct pfs_lock if ((copy->m_version_state & STATE_MASK) != PFS_LOCK_ALLOCATED) return false; - version_state= PFS_atomic::load_u32(&m_version_state); + version_state= m_version_state.load(); /* Check the version + state has not changed. */ if (copy->m_version_state != version_state) @@ -298,7 +298,7 @@ struct pfs_lock { uint32 version_state; - version_state= PFS_atomic::load_u32(&m_version_state); + version_state= m_version_state.load(); return (version_state & VERSION_MASK); } diff --git a/storage/perfschema/pfs_memory.cc b/storage/perfschema/pfs_memory.cc index 0ee8e3dd7df..7cb932b3502 100644 --- a/storage/perfschema/pfs_memory.cc +++ b/storage/perfschema/pfs_memory.cc @@ -33,7 +33,6 @@ #include "pfs_account.h" #include "pfs_host.h" #include "pfs_user.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "m_string.h" diff --git a/storage/perfschema/pfs_status.cc b/storage/perfschema/pfs_status.cc index 2596c53c4ad..9d3bcd43ec3 100644 --- a/storage/perfschema/pfs_status.cc +++ b/storage/perfschema/pfs_status.cc @@ -34,7 +34,6 @@ #include "pfs_host.h" #include "pfs_user.h" #include "pfs_status.h" -#include "pfs_atomic.h" #include "pfs_buffer_container.h" #include "sql_show.h" /* reset_status_vars */ diff --git a/storage/perfschema/pfs_user.h b/storage/perfschema/pfs_user.h index e15e733e5ac..e92629e4dd7 100644 --- a/storage/perfschema/pfs_user.h +++ b/storage/perfschema/pfs_user.h @@ -28,6 +28,8 @@ Performance schema user (declarations). */ +#include + #include "pfs_lock.h" #include "lf.h" #include "pfs_con_slice.h" @@ -58,22 +60,22 @@ struct PFS_ALIGNED PFS_user : public PFS_connection_slice public: inline void init_refcount(void) { - PFS_atomic::store_32(& m_refcount, 1); + m_refcount.store(1); } inline int get_refcount(void) { - return PFS_atomic::load_32(& m_refcount); + return m_refcount.load(); } inline void inc_refcount(void) { - PFS_atomic::add_32(& m_refcount, 1); + m_refcount.fetch_add(1); } inline void dec_refcount(void) { - PFS_atomic::add_32(& m_refcount, -1); + m_refcount.fetch_sub(1); } void aggregate(bool alive); @@ -97,7 +99,7 @@ public: ulonglong m_disconnected_count; private: - int m_refcount; + std::atomic m_refcount; }; int init_user(const PFS_global_param *param); From 4ca355d863e3b6a14439eebbb2958afccb3548e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Jun 2024 16:38:08 +0300 Subject: [PATCH 52/85] MDEV-33894: Resurrect innodb_log_write_ahead_size As part of commit 685d958e38b825ad9829be311f26729cccf37c46 (MDEV-14425) the parameter innodb_log_write_ahead_size was removed, because it was thought that determining the physical block size would be a sufficient replacement. However, we can only determine the physical block size on Linux or Microsoft Windows. On some file systems, the physical block size is not relevant. For example, XFS uses a block size of 4096 bytes even if the underlying block size may be smaller. On Linux, we failed to determine the physical block size if innodb_log_file_buffered=OFF was not requested or possible. This will be fixed. log_sys.write_size: The value of the reintroduced parameter innodb_log_write_ahead_size. To keep it simple, this is read-only and a power of two between 512 and 4096 bytes, so that the previous alignment guarantees are fulfilled. This will replace the previous log_sys.get_block_size(). log_sys.block_size, log_t::get_block_size(): Remove. log_t::set_block_size(): Ensure that write_size will not be less than the physical block size. There is no point to invoke this function with 512 or less, because that is the minimum value of write_size. innodb_params_adjust(): Add some disabled code for adjusting the minimum value and default value of innodb_log_write_ahead_size to reflect the log_sys.write_size. log_t::set_recovered(): Mark the recovery completed. This is the place to adjust some things if we want to allow write_size>4096. log_t::resize_write_buf(): Refer to write_size. log_t::resize_start(): Refer to write_size instead of get_block_size(). log_write_buf(): Simplify some arithmetics and remove a goto. log_t::write_buf(): Refer to write_size. If we are writing less than that, do not switch buffers, but keep writing to the same buffer. Move some code to improve the locality of reference. recv_scan_log(): Refer to write_size instead of get_block_size(). os_file_create_func(): For type==OS_LOG_FILE on Linux, always invoke os_file_log_maybe_unbuffered(), so that log_sys.set_block_size() will be invoked even if we are not attempting to use O_DIRECT. recv_sys_t::find_checkpoint(): Read the entire log header in a single 12 KiB request into log_sys.buf. Tested with: ./mtr --loose-innodb-log-write-ahead-size=4096 ./mtr --loose-innodb-log-write-ahead-size=2048 --- extra/mariabackup/xtrabackup.cc | 16 +- mysql-test/suite/innodb/r/log_file.result | 15 +- mysql-test/suite/innodb/t/log_file.test | 14 +- mysql-test/suite/mariabackup/full_backup.test | 4 +- .../suite/sys_vars/r/sysvars_innodb.result | 12 ++ sql/mysqld.cc | 1 - storage/innobase/buf/buf0flu.cc | 7 +- storage/innobase/handler/ha_innodb.cc | 58 ++++--- storage/innobase/include/log0log.h | 25 +-- storage/innobase/log/log0log.cc | 149 ++++++++++-------- storage/innobase/log/log0recv.cc | 48 +++--- storage/innobase/os/os0file.cc | 22 ++- storage/innobase/srv/srv0start.cc | 2 +- 13 files changed, 232 insertions(+), 141 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3b3011bc4a6..39ff1cdd8dc 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1333,7 +1333,7 @@ enum options_xtrabackup OPT_INNODB_LOG_FILE_BUFFERING, #endif OPT_INNODB_LOG_FILE_SIZE, - OPT_INNODB_LOG_FILES_IN_GROUP, + OPT_INNODB_LOG_WRITE_AHEAD_SIZE, OPT_INNODB_OPEN_FILES, OPT_XTRA_DEBUG_SYNC, OPT_INNODB_CHECKSUM_ALGORITHM, @@ -1905,6 +1905,10 @@ struct my_option xb_server_options[] = {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR, "Path to InnoDB log files.", &srv_log_group_home_dir, &srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"innodb_log_write_ahead_size", OPT_INNODB_LOG_WRITE_AHEAD_SIZE, + "ib_logfile0 write size", + (G_PTR*) &log_sys.write_size, (G_PTR*) &srv_log_file_size, 0, + GET_UINT, REQUIRED_ARG, 512, 512, 4096, 0, 1, 0}, {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, "Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct, @@ -2233,7 +2237,6 @@ xb_get_one_option(const struct my_option *opt, ADD_PRINT_PARAM_OPT(srv_log_group_home_dir); break; - case OPT_INNODB_LOG_FILES_IN_GROUP: case OPT_INNODB_LOG_FILE_SIZE: break; @@ -2374,6 +2377,11 @@ xb_get_one_option(const struct my_option *opt, static bool innodb_init_param() { + if (!ut_is_2pow(log_sys.write_size)) { + msg("InnoDB: innodb_log_write_ahead_size=%u" + " is not a power of two", log_sys.write_size); + return true; + } srv_is_being_started = TRUE; /* === some variables from mysqld === */ memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list)); @@ -3370,7 +3378,7 @@ static bool xtrabackup_copy_logfile() ut_a(dst_log_file); ut_ad(recv_sys.is_initialised()); const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; - const size_t block_size_1{log_sys.get_block_size() - 1}; + const size_t block_size_1{log_sys.write_size - 1}; ut_ad(!log_sys.is_pmem()); @@ -3445,7 +3453,7 @@ static bool xtrabackup_copy_logfile() if (r == recv_sys_t::GOT_EOF) break; - if (recv_sys.offset < log_sys.get_block_size()) + if (recv_sys.offset < log_sys.write_size) break; if (xtrabackup_throttle && io_ticket-- < 0) diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result index f5e98d30b30..19789f42768 100644 --- a/mysql-test/suite/innodb/r/log_file.result +++ b/mysql-test/suite/innodb/r/log_file.result @@ -287,7 +287,20 @@ WHERE engine='innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); 1 1 -# restart +# restart: --innodb-log-write-ahead-size=513 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart: --innodb-log-write-ahead-size=4095 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart: --innodb-log-write-ahead-size=10000 +SELECT @@innodb_log_write_ahead_size; +@@innodb_log_write_ahead_size +4096 # Cleanup bak_ib_logfile0 bak_ibdata1 diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test index 805a4b4cd56..7ff0de0fc01 100644 --- a/mysql-test/suite/innodb/t/log_file.test +++ b/mysql-test/suite/innodb/t/log_file.test @@ -210,8 +210,20 @@ eval $check_no_innodb; eval $check_yes_innodb; --source include/shutdown_mysqld.inc ---let $restart_parameters= +--let $restart_parameters=--innodb-log-write-ahead-size=513 --source include/start_mysqld.inc +eval $check_no_innodb; +--source include/shutdown_mysqld.inc + +--let $restart_parameters=--innodb-log-write-ahead-size=4095 +--source include/start_mysqld.inc +eval $check_no_innodb; +--source include/shutdown_mysqld.inc + +# this will be silently truncated to the maximum +--let $restart_parameters=--innodb-log-write-ahead-size=10000 +--source include/start_mysqld.inc +SELECT @@innodb_log_write_ahead_size; --echo # Cleanup --list_files $bugdir diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index 385f3b8785d..d3d3661ce6c 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -7,7 +7,9 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; --let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --parallel=10 > $backup_log 2>&1; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --parallel=10 --innodb-log-write-ahead-size=4095 > $backup_log 2>&1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --parallel=10 --innodb-log-write-ahead-size=10000 > $backup_log 2>&1; --enable_result_log # The following warning must not appear after MDEV-27343 fix diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 6a7e184f68e..f72e0d6f05d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1039,6 +1039,18 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_LOG_WRITE_AHEAD_SIZE +SESSION_VALUE NULL +DEFAULT_VALUE 512 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE INT UNSIGNED +VARIABLE_COMMENT Redo log write size to avoid read-on-write; must be a power of two +NUMERIC_MIN_VALUE 512 +NUMERIC_MAX_VALUE 4096 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_LRU_FLUSH_SIZE SESSION_VALUE NULL DEFAULT_VALUE 32 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 68d8a04430f..890fe8cf87e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5355,7 +5355,6 @@ static int init_server_components() MARIADB_REMOVED_OPTION("innodb-log-compressed-pages"), MARIADB_REMOVED_OPTION("innodb-log-files-in-group"), MARIADB_REMOVED_OPTION("innodb-log-optimize-ddl"), - MARIADB_REMOVED_OPTION("innodb-log-write-ahead-size"), MARIADB_REMOVED_OPTION("innodb-page-cleaners"), MARIADB_REMOVED_OPTION("innodb-replication-delay"), MARIADB_REMOVED_OPTION("innodb-scrub-log"), diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 641eba00265..e5a418ffa09 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1796,15 +1796,18 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept log_write_and_flush_prepare(); resizing= resize_lsn.load(std::memory_order_relaxed); /* FIXME: issue an asynchronous write */ - log.write(offset, {c, get_block_size()}); + ut_ad(ut_is_2pow(write_size)); + ut_ad(write_size >= 512); + ut_ad(write_size <= 4096); + log.write(offset, {c, write_size}); if (resizing > 1 && resizing <= next_checkpoint_lsn) { + resize_log.write(CHECKPOINT_1, {c, write_size}); byte *buf= static_cast(aligned_malloc(4096, 4096)); memset_aligned<4096>(buf, 0, 4096); header_write(buf, resizing, is_encrypted()); resize_log.write(0, {buf, 4096}); aligned_free(buf); - resize_log.write(CHECKPOINT_1, {c, get_block_size()}); } if (srv_file_flush_method != SRV_O_DSYNC) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ba8ff245faa..047c8b744e8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1214,11 +1214,8 @@ struct } log_requests; -/** @brief Adjust some InnoDB startup parameters based on file contents -or innodb_page_size. */ -static -void -innodb_params_adjust(); +/** Adjust some InnoDB startup parameters based on the data directory */ +static void innodb_params_adjust(); /*******************************************************************//** This function is used to prepare an X/Open XA distributed transaction. @@ -3688,6 +3685,11 @@ static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, 2ULL << 20, LLONG_MAX, 1024*1024L); +static MYSQL_SYSVAR_UINT(log_write_ahead_size, log_sys.write_size, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Redo log write size to avoid read-on-write; must be a power of two", + nullptr, nullptr, 512, 512, 4096, 1); + /****************************************************************//** Gives the file extension of an InnoDB single-table tablespace. */ static const char* ha_innobase_exts[] = { @@ -3809,6 +3811,13 @@ static int innodb_init_params() DBUG_RETURN(HA_ERR_INITIALIZATION); } + if (!ut_is_2pow(log_sys.write_size)) { + sql_print_error("InnoDB: innodb_log_write_ahead_size=%u" + " is not a power of two", + log_sys.write_size); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } + if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG)) DBUG_RETURN(HA_ERR_INITIALIZATION); @@ -19850,6 +19859,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(log_file_buffering), #endif MYSQL_SYSVAR(log_file_size), + MYSQL_SYSVAR(log_write_ahead_size), MYSQL_SYSVAR(log_spin_wait_delay), MYSQL_SYSVAR(log_group_home_dir), MYSQL_SYSVAR(max_dirty_pages_pct), @@ -20010,20 +20020,32 @@ i_s_innodb_sys_virtual, i_s_innodb_tablespaces_encryption maria_declare_plugin_end; -/** @brief Adjust some InnoDB startup parameters based on file contents -or innodb_page_size. */ -static -void -innodb_params_adjust() +/** Adjust some InnoDB startup parameters based on the data directory */ +static void innodb_params_adjust() { - MYSQL_SYSVAR_NAME(max_undo_log_size).max_val - = 1ULL << (32U + srv_page_size_shift); - MYSQL_SYSVAR_NAME(max_undo_log_size).min_val - = MYSQL_SYSVAR_NAME(max_undo_log_size).def_val - = ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) - << srv_page_size_shift; - MYSQL_SYSVAR_NAME(max_undo_log_size).max_val - = 1ULL << (32U + srv_page_size_shift); + MYSQL_SYSVAR_NAME(max_undo_log_size).max_val= + 1ULL << (32U + srv_page_size_shift); + MYSQL_SYSVAR_NAME(max_undo_log_size).min_val= + MYSQL_SYSVAR_NAME(max_undo_log_size).def_val= + ulonglong{SRV_UNDO_TABLESPACE_SIZE_IN_PAGES} << srv_page_size_shift; + MYSQL_SYSVAR_NAME(max_undo_log_size).max_val= + 1ULL << (32U + srv_page_size_shift); +#if 0 /* FIXME: INFORMATION_SCHEMA.SYSTEM_VARIABLES won't reflect this. */ + /* plugin_opt_set_limits() would have copied all MYSQL_SYSVAR + before innodb_init() was invoked. Therefore, changing the + min_val, def_val, max_val will have no observable effect. */ +# if defined __linux__ || defined _WIN32 + uint &min_val= MYSQL_SYSVAR_NAME(log_write_ahead_size).min_val; + if (min_val < log_sys.write_size) + { + min_val= log_sys.write_size; + MYSQL_SYSVAR_NAME(log_write_ahead_size).def_val= log_sys.write_size; + } +# endif + ut_ad(MYSQL_SYSVAR_NAME(log_write_ahead_size).min_val <= + log_sys.write_size); +#endif + ut_ad(MYSQL_SYSVAR_NAME(log_write_ahead_size).max_val == 4096); } /**************************************************************************** diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index cef0dcae1b0..b9e2171f596 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -274,11 +274,9 @@ private: std::atomic resize_lsn; /** the log sequence number at the start of the log file */ lsn_t first_lsn; -#if defined __linux__ || defined _WIN32 - /** The physical block size of the storage */ - uint32_t block_size; -#endif public: + /** current innodb_log_write_ahead_size */ + uint write_size; /** format of the redo log: e.g., FORMAT_10_8 */ uint32_t format; #if defined __linux__ || defined _WIN32 @@ -328,6 +326,8 @@ public: max_buf_free; } + inline void set_recovered() noexcept; + void set_buf_free(size_t f) noexcept { ut_ad(f < buf_free_LOCK); buf_free.store(f, std::memory_order_relaxed); } @@ -368,9 +368,12 @@ public: inline void resize_write(lsn_t lsn, const byte *end, size_t len, size_t seq) noexcept; +private: /** Write resize_buf to resize_log. @param length the used length of resize_buf */ - ATTRIBUTE_COLD void resize_write_buf(size_t length) noexcept; + ATTRIBUTE_COLD ATTRIBUTE_NOINLINE + void resize_write_buf(size_t length) noexcept; +public: /** Rename a log file after resizing. @return whether an error occurred */ @@ -467,14 +470,12 @@ public: void close(); #if defined __linux__ || defined _WIN32 - /** @return the physical block size of the storage */ - size_t get_block_size() const noexcept - { ut_ad(block_size); return block_size; } /** Set the log block size for file I/O. */ - void set_block_size(uint32_t size) noexcept { block_size= size; } -#else - /** @return the physical block size of the storage */ - static size_t get_block_size() { return 512; } + void set_block_size(uint32 size) noexcept + { + if (write_size < size) + write_size= size; + } #endif private: diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index ea717de226a..f5d9cf85c41 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -236,9 +236,6 @@ void log_t::attach_low(log_file_t file, os_offset_t size) mprotect(ptr, size_t(size), PROT_READ); buf= static_cast(ptr); max_buf_free= 1; -# if defined __linux__ || defined _WIN32 - set_block_size(CPU_LEVEL1_DCACHE_LINESIZE); -# endif log_maybe_unbuffered= true; log_buffered= false; mtr_t::finisher_update(); @@ -273,13 +270,16 @@ void log_t::attach_low(log_file_t file, os_offset_t size) log_buffered ? "Buffered log writes" : "File system buffers for log disabled", - block_size); + write_size); #endif mtr_t::finisher_update(); #ifdef HAVE_PMEM - checkpoint_buf= static_cast(aligned_malloc(block_size, block_size)); - memset_aligned<64>(checkpoint_buf, 0, block_size); + ut_ad(ut_is_2pow(write_size)); + ut_ad(write_size >= 512); + ut_ad(write_size <= 4096); + checkpoint_buf= static_cast(aligned_malloc(write_size, write_size)); + memset_aligned<512>(checkpoint_buf, 0, write_size); return true; #endif } @@ -430,7 +430,7 @@ void log_t::set_buffered(bool buffered) log_buffered ? "Buffered log writes" : "File system buffers for log disabled", - block_size); + write_size); } log_resize_release(); } @@ -467,6 +467,8 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept OS_FILE_NORMAL, OS_LOG_FILE, false, &success); if (success) { + ut_ad(!(size_t(file_size) & (write_size - 1))); + ut_ad(!(size_t(size) & (write_size - 1))); log_resize_release(); void *ptr= nullptr, *ptr2= nullptr; @@ -522,7 +524,7 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept { memcpy_aligned<16>(resize_buf, buf, (buf_free + 15) & ~15); start_lsn= first_lsn + - (~lsn_t{get_block_size() - 1} & (write_lsn - first_lsn)); + (~lsn_t{write_size - 1} & (write_lsn - first_lsn)); } } resize_lsn.store(start_lsn, std::memory_order_relaxed); @@ -578,32 +580,30 @@ void log_t::resize_abort() noexcept /** Write an aligned buffer to ib_logfile0. @param buf buffer to be written -@param len length of data to be written +@param length length of data to be written @param offset log file offset */ -static void log_write_buf(const byte *buf, size_t len, lsn_t offset) +static void log_write_buf(const byte *buf, size_t length, lsn_t offset) { ut_ad(write_lock.is_owner()); ut_ad(!recv_no_log_write); - ut_d(const size_t block_size_1= log_sys.get_block_size() - 1); + ut_d(const size_t block_size_1= log_sys.write_size - 1); ut_ad(!(offset & block_size_1)); - ut_ad(!(len & block_size_1)); + ut_ad(!(length & block_size_1)); ut_ad(!(size_t(buf) & block_size_1)); - ut_ad(len); + ut_ad(length); - if (UNIV_LIKELY(offset + len <= log_sys.file_size)) + const lsn_t maximum_write_length{log_sys.file_size - offset}; + ut_ad(maximum_write_length <= log_sys.file_size - log_sys.START_OFFSET); + + if (UNIV_UNLIKELY(length > maximum_write_length)) { -write: - log_sys.log.write(offset, {buf, len}); - return; + log_sys.log.write(offset, {buf, size_t(maximum_write_length)}); + length-= size_t(maximum_write_length); + buf+= size_t(maximum_write_length); + ut_ad(log_sys.START_OFFSET + length < offset); + offset= log_sys.START_OFFSET; } - - const size_t write_len= size_t(log_sys.file_size - offset); - log_sys.log.write(offset, {buf, write_len}); - len-= write_len; - buf+= write_len; - ut_ad(log_sys.START_OFFSET + len < offset); - offset= log_sys.START_OFFSET; - goto write; + log_sys.log.write(offset, {buf, length}); } /** Invoke commit_checkpoint_notify_ha() to notify that outstanding @@ -778,11 +778,12 @@ inline void log_t::persist(lsn_t lsn) noexcept } #endif +ATTRIBUTE_COLD ATTRIBUTE_NOINLINE /** Write resize_buf to resize_log. @param length the used length of resize_buf */ -ATTRIBUTE_COLD void log_t::resize_write_buf(size_t length) noexcept +void log_t::resize_write_buf(size_t length) noexcept { - const size_t block_size_1= get_block_size() - 1; + const size_t block_size_1= write_size - 1; ut_ad(!(resize_target & block_size_1)); ut_ad(!(length & block_size_1)); ut_ad(length > block_size_1); @@ -802,7 +803,7 @@ ATTRIBUTE_COLD void log_t::resize_write_buf(size_t length) noexcept } ut_a(os_file_write_func(IORequestWrite, "ib_logfile101", resize_log.m_file, - resize_flush_buf, offset, length) == DB_SUCCESS); + buf, offset, length) == DB_SUCCESS); } /** Write buf to ib_logfile0. @@ -824,64 +825,88 @@ template inline lsn_t log_t::write_buf() noexcept } else { + ut_ad(write_lock.is_owner()); ut_ad(!recv_no_log_write); write_lock.set_pending(lsn); ut_ad(write_lsn >= get_flushed_lsn()); - const size_t block_size_1{get_block_size() - 1}; - lsn_t offset{calc_lsn_offset(write_lsn) & ~lsn_t{block_size_1}}; + const size_t write_size_1{write_size - 1}; + ut_ad(ut_is_2pow(write_size)); + size_t length{buf_free.load(std::memory_order_relaxed)}; + lsn_t offset{calc_lsn_offset(write_lsn)}; + ut_ad(length >= (offset & write_size_1)); + ut_ad(write_size_1 >= 511); - DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF, - write_lsn, lsn, offset)); - const byte *write_buf{buf}; - size_t length{buf_free}; - ut_ad(length >= (calc_lsn_offset(write_lsn) & block_size_1)); - const size_t new_buf_free{length & block_size_1}; - buf_free= new_buf_free; - ut_ad(new_buf_free == ((lsn - first_lsn) & block_size_1)); + const byte *const write_buf{buf}; + offset&= ~lsn_t{write_size_1}; - if (new_buf_free) + if (length <= write_size_1) { + ut_ad(!((length ^ (size_t(lsn) - size_t(first_lsn))) & write_size_1)); + /* Keep filling the same buffer until we have more than one block. */ #if 0 /* TODO: Pad the last log block with dummy records. */ - buf_free= log_pad(lsn, get_block_size() - new_buf_free, - buf + new_buf_free, flush_buf); + buf_free= log_pad(lsn, (write_size_1 + 1) - length, + buf + length, flush_buf); ... /* TODO: Update the LSN and adjust other code. */ #else - /* The rest of the block will be written as garbage. - (We want to avoid memset() while holding exclusive log_sys.latch) - This block will be overwritten later, once records beyond - the current LSN are generated. */ # ifdef HAVE_valgrind - MEM_MAKE_DEFINED(buf + length, get_block_size() - new_buf_free); - if (UNIV_LIKELY_NULL(resize_flush_buf)) - MEM_MAKE_DEFINED(resize_buf + length, get_block_size() - new_buf_free); + MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - length); + if (UNIV_LIKELY_NULL(resize_buf)) + MEM_MAKE_DEFINED(resize_buf + length, (write_size_1 + 1) - length); # endif buf[length]= 0; /* allow recovery to catch EOF faster */ - length&= ~block_size_1; - memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15); - if (UNIV_LIKELY_NULL(resize_flush_buf)) - memcpy_aligned<16>(resize_flush_buf, resize_buf + length, - (new_buf_free + 15) & ~15); - length+= get_block_size(); #endif + length= write_size_1 + 1; + } + else + { + const size_t new_buf_free{length & write_size_1}; + ut_ad(new_buf_free == ((lsn - first_lsn) & write_size_1)); + buf_free.store(new_buf_free, std::memory_order_relaxed); + + if (new_buf_free) + { + /* The rest of the block will be written as garbage. + (We want to avoid memset() while holding exclusive log_sys.latch) + This block will be overwritten later, once records beyond + the current LSN are generated. */ +#ifdef HAVE_valgrind + MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - new_buf_free); + if (UNIV_LIKELY_NULL(resize_buf)) + MEM_MAKE_DEFINED(resize_buf + length, (write_size_1 + 1) - + new_buf_free); +#endif + buf[length]= 0; /* allow recovery to catch EOF faster */ + length&= ~write_size_1; + memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15); + if (UNIV_LIKELY_NULL(resize_buf)) + memcpy_aligned<16>(resize_flush_buf, resize_buf + length, + (new_buf_free + 15) & ~15); + length+= write_size_1 + 1; + } + + std::swap(buf, flush_buf); + std::swap(resize_buf, resize_flush_buf); } - std::swap(buf, flush_buf); - std::swap(resize_buf, resize_flush_buf); write_to_log++; if (release_latch) latch.wr_unlock(); + DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF, + write_lsn, lsn, offset)); + + /* Do the write to the log file */ + log_write_buf(write_buf, length, offset); + + if (UNIV_LIKELY_NULL(resize_buf)) + resize_write_buf(length); + write_lsn= lsn; + if (UNIV_UNLIKELY(srv_shutdown_state > SRV_SHUTDOWN_INITIATED)) { service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, "InnoDB log write: " LSN_PF, write_lsn); } - - /* Do the write to the log file */ - log_write_buf(write_buf, length, offset); - if (UNIV_LIKELY_NULL(resize_buf)) - resize_write_buf(length); - write_lsn= lsn; } set_check_for_checkpoint(false); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 1f73ea53f71..d593c51696a 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1773,7 +1773,7 @@ dberr_t recv_sys_t::find_checkpoint() lsn= 0; buf= my_assume_aligned<4096>(log_sys.buf); if (!log_sys.is_pmem()) - if (dberr_t err= log_sys.log.read(0, {buf, 4096})) + if (dberr_t err= log_sys.log.read(0, {buf, log_sys.START_OFFSET})) return err; /* Check the header page checksum. There was no checksum in the first redo log format (version 0). */ @@ -1842,12 +1842,7 @@ dberr_t recv_sys_t::find_checkpoint() for (size_t field= log_t::CHECKPOINT_1; field <= log_t::CHECKPOINT_2; field+= log_t::CHECKPOINT_2 - log_t::CHECKPOINT_1) { - if (log_sys.is_pmem()) - buf= log_sys.buf + field; - else - if (dberr_t err= log_sys.log.read(field, - {buf, log_sys.get_block_size()})) - return err; + buf= log_sys.buf + field; const lsn_t checkpoint_lsn{mach_read_from_8(buf)}; const lsn_t end_lsn{mach_read_from_8(buf + 8)}; if (checkpoint_lsn < first_lsn || end_lsn < checkpoint_lsn || @@ -4019,7 +4014,7 @@ static bool recv_scan_log(bool last_phase) DBUG_ENTER("recv_scan_log"); ut_ad(log_sys.is_latest()); - const size_t block_size_1{log_sys.get_block_size() - 1}; + const size_t block_size_1{log_sys.write_size - 1}; mysql_mutex_lock(&recv_sys.mutex); if (!last_phase) @@ -4201,7 +4196,7 @@ static bool recv_scan_log(bool last_phase) if (recv_sys.is_corrupt_log()) break; - if (recv_sys.offset < log_sys.get_block_size() && + if (recv_sys.offset < log_sys.write_size && recv_sys.lsn == recv_sys.scanned_lsn) goto got_eof; @@ -4537,6 +4532,24 @@ dberr_t recv_recovery_read_checkpoint() return err; } +inline void log_t::set_recovered() noexcept +{ + ut_ad(get_flushed_lsn() == get_lsn()); + ut_ad(recv_sys.lsn == get_lsn()); + size_t offset{recv_sys.offset}; + if (!is_pmem()) + { + const size_t bs{log_sys.write_size}, bs_1{bs - 1}; + memmove_aligned<512>(buf, buf + (offset & ~bs_1), bs); + offset&= bs_1; + } +#ifdef HAVE_PMEM + else + mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); +#endif + set_buf_free(offset); +} + /** Start recovering from a redo log checkpoint. of first system tablespace page @return error code or DB_SUCCESS */ @@ -4710,22 +4723,7 @@ err_exit: } if (!srv_read_only_mode && log_sys.is_latest()) { - ut_ad(log_sys.get_flushed_lsn() == log_sys.get_lsn()); - ut_ad(recv_sys.lsn == log_sys.get_lsn()); - if (!log_sys.is_pmem()) { - const size_t bs_1{log_sys.get_block_size() - 1}; - const size_t ro{recv_sys.offset}; - recv_sys.offset &= bs_1; - memmove_aligned<64>(log_sys.buf, - log_sys.buf + (ro & ~bs_1), - log_sys.get_block_size()); -#ifdef HAVE_PMEM - } else { - mprotect(log_sys.buf, size_t(log_sys.file_size), - PROT_READ | PROT_WRITE); -#endif - } - log_sys.set_buf_free(recv_sys.offset); + log_sys.set_recovered(); if (recv_needed_recovery && srv_operation <= SRV_OPERATION_EXPORT_RESTORED && recv_sys.lsn - log_sys.next_checkpoint_lsn diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 3293db12815..e85f8456490 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1094,7 +1094,6 @@ static ATTRIBUTE_COLD void os_file_log_buffered() { log_sys.log_maybe_unbuffered= false; log_sys.log_buffered= true; - log_sys.set_block_size(512); } # endif @@ -1209,11 +1208,7 @@ os_file_create_func( break; } # ifdef __linux__ - } else if (type != OS_LOG_FILE) { - } else if (log_sys.log_buffered) { - skip_o_direct: - os_file_log_buffered(); - } else if (create_mode != OS_FILE_CREATE + } else if (type == OS_LOG_FILE && create_mode != OS_FILE_CREATE && create_mode != OS_FILE_CREATE_SILENT && !log_sys.is_opened()) { if (stat(name, &st)) { @@ -1225,15 +1220,16 @@ os_file_create_func( "InnoDB: File %s was not found", name); goto not_found; } + log_sys.set_block_size(512); goto skip_o_direct; + } else if (!os_file_log_maybe_unbuffered(st) + || log_sys.log_buffered) { +skip_o_direct: + os_file_log_buffered(); + } else { + direct_flag = O_DIRECT; + log_sys.log_maybe_unbuffered = true; } - - if (!os_file_log_maybe_unbuffered(st)) { - goto skip_o_direct; - } - - direct_flag = O_DIRECT; - log_sys.log_maybe_unbuffered= true; # endif } #else diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 0609f8f19e8..124ac4b294d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -175,7 +175,7 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn) /* We will retain ib_logfile0 until we have written a new logically empty log as ib_logfile101 and atomically renamed it to - ib_logfile0 in log_t::rename_resized(). */ + ib_logfile0 in log_t::resize_rename(). */ delete_log_files(); ut_ad(!os_aio_pending_reads()); From 9e74a7f4f330cde50143ce94fdf09be68abebba0 Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Mon, 22 Apr 2024 17:53:06 +0700 Subject: [PATCH 53/85] Removing MDEV-27871 from tastcases because it is not a bug --- mysql-test/include/ctype_myanmar.inc | 8 +- mysql-test/include/ctype_numconv.inc | 46 +- mysql-test/include/ctype_pad.inc | 15 +- mysql-test/include/ctype_str_to_date.inc | 5 +- mysql-test/include/ctype_utf8mb4.inc | 42 +- mysql-test/include/empty_string_literal.inc | 21 +- mysql-test/include/gis_debug.inc | 22 +- mysql-test/include/index_merge1.inc | 17 +- mysql-test/main/ctype_big5.result | 80 +- mysql-test/main/ctype_binary.result | 68 +- mysql-test/main/ctype_binary.test | 14 +- mysql-test/main/ctype_cp1251.result | 68 +- mysql-test/main/ctype_cp932.result | 80 +- mysql-test/main/ctype_cp932.test | 3 - mysql-test/main/ctype_eucjpms.result | 80 +- mysql-test/main/ctype_euckr.result | 80 +- mysql-test/main/ctype_gb2312.result | 80 +- mysql-test/main/ctype_gbk.result | 80 +- mysql-test/main/ctype_gbk.test | 3 - mysql-test/main/ctype_latin1.result | 152 +- mysql-test/main/ctype_latin1.test | 7 +- mysql-test/main/ctype_ldml.result | 88 +- mysql-test/main/ctype_ldml.test | 57 +- mysql-test/main/ctype_nopad_8bit.result | 1840 ++++++++--------- mysql-test/main/ctype_sjis.result | 84 +- mysql-test/main/ctype_swe7.result | 80 +- mysql-test/main/ctype_tis620.result | 80 +- mysql-test/main/ctype_uca.result | 8 +- mysql-test/main/ctype_ucs.result | 152 +- mysql-test/main/ctype_ucs.test | 8 + mysql-test/main/ctype_ucs2_uca.result | 80 +- mysql-test/main/ctype_ujis.result | 96 +- mysql-test/main/ctype_ujis.test | 17 +- mysql-test/main/ctype_utf16.result | 80 +- mysql-test/main/ctype_utf16_uca.result | 84 +- mysql-test/main/ctype_utf16le.result | 80 +- mysql-test/main/ctype_utf32.result | 124 +- mysql-test/main/ctype_utf32.test | 34 +- mysql-test/main/ctype_utf32_uca.result | 84 +- mysql-test/main/ctype_utf8.result | 188 +- mysql-test/main/ctype_utf8.test | 32 +- mysql-test/main/ctype_utf8_uca.result | 80 +- mysql-test/main/ctype_utf8mb4.result | 80 +- mysql-test/main/ctype_utf8mb4_heap.result | 60 +- mysql-test/main/ctype_utf8mb4_innodb.result | 60 +- mysql-test/main/ctype_utf8mb4_innodb.test | 3 - mysql-test/main/ctype_utf8mb4_myisam.result | 60 +- mysql-test/main/ctype_utf8mb4_uca.result | 84 +- mysql-test/main/date_formats.result | 17 +- mysql-test/main/date_formats.test | 11 +- mysql-test/main/fulltext_left_join.result | 8 +- mysql-test/main/fulltext_left_join.test | 7 +- mysql-test/main/func_gconcat.result | 4 +- mysql-test/main/func_gconcat.test | 5 +- mysql-test/main/func_group_innodb.result | 4 +- mysql-test/main/func_group_innodb.test | 5 +- mysql-test/main/func_in.result | 10 +- mysql-test/main/func_in.test | 7 +- mysql-test/main/func_regexp_pcre.result | 34 +- mysql-test/main/func_regexp_pcre.test | 33 +- mysql-test/main/func_str.result | 120 +- mysql-test/main/func_str.test | 99 +- mysql-test/main/func_time_hires.result | 16 +- mysql-test/main/func_time_hires.test | 11 +- mysql-test/main/gis-debug.result | 42 +- mysql-test/main/gis-precise.result | 497 ++--- mysql-test/main/gis-precise.test | 237 +-- mysql-test/main/index_merge_myisam.result | 18 +- mysql-test/main/join_cache.result | 36 +- mysql-test/main/join_cache.test | 53 +- mysql-test/main/opt_trace.result | 16 +- mysql-test/main/opt_trace.test | 14 +- mysql-test/main/order_by.result | 16 +- mysql-test/main/order_by.test | 17 +- mysql-test/main/order_by_pack_big.result | 14 +- mysql-test/main/order_by_pack_big.test | 8 +- mysql-test/main/parser.result | 76 +- mysql-test/main/parser.test | 54 +- mysql-test/main/range.result | 8 +- mysql-test/main/range.test | 7 +- mysql-test/main/range_mrr_icp.result | 8 +- mysql-test/main/subselect_innodb.result | 33 +- mysql-test/main/subselect_innodb.test | 25 +- mysql-test/main/subselect_mat.result | 7 +- mysql-test/main/subselect_mat.test | 8 +- mysql-test/main/timezone2.result | 36 +- mysql-test/main/timezone2.test | 33 +- mysql-test/main/type_datetime.result | 68 +- mysql-test/main/type_datetime.test | 50 +- mysql-test/main/type_newdecimal.result | 13 +- mysql-test/main/type_newdecimal.test | 17 +- mysql-test/main/win.result | 112 +- mysql-test/main/win.test | 80 +- mysql-test/main/win_avg.result | 8 +- mysql-test/main/win_avg.test | 7 +- mysql-test/main/win_big.result | 24 +- mysql-test/main/win_big.test | 30 +- mysql-test/main/win_nth_value.result | 30 +- mysql-test/main/win_nth_value.test | 32 +- mysql-test/main/win_ntile.result | 6 +- mysql-test/main/win_ntile.test | 7 +- mysql-test/main/win_percentile.result | 6 +- mysql-test/main/win_percentile.test | 7 +- mysql-test/main/win_sum.result | 8 +- mysql-test/main/win_sum.test | 8 +- mysql-test/main/xml.result | 194 +- mysql-test/main/xml.test | 143 +- .../encryption/r/tempfiles_encrypted.result | 112 +- .../suite/innodb/r/innodb_ctype_big5.result | 40 +- .../suite/innodb/r/innodb_ctype_latin1.result | 40 +- .../suite/innodb/r/innodb_ctype_utf8.result | 40 +- mysql-test/suite/innodb_gis/r/precise.result | 42 +- 112 files changed, 3523 insertions(+), 3949 deletions(-) diff --git a/mysql-test/include/ctype_myanmar.inc b/mysql-test/include/ctype_myanmar.inc index a305430835f..75de5f07a5d 100644 --- a/mysql-test/include/ctype_myanmar.inc +++ b/mysql-test/include/ctype_myanmar.inc @@ -1293,11 +1293,9 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -# enable view-protocol after fix MDEV-27871 ---disable_view_protocol - -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; ---enable_view_protocol +--disable_service_connection +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +--enable_service_connection DROP TABLE t1; diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index 065aca0873a..ee60c9196e2 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1,7 +1,3 @@ -#remove this include after fix MDEV-27871 -# maybe some tests need to be excluded separately after fix ---source include/no_view_protocol.inc - SET TIME_ZONE = _latin1 '+03:00'; --echo # @@ -464,6 +460,7 @@ show create table t1; drop table t1; --disable_ps2_protocol +--disable_view_protocol # Ensure that row_count() value is reset after drop table. select 1; select hex(concat(row_count())); @@ -475,6 +472,7 @@ select hex(concat(found_rows())); create table t1 as select concat(found_rows()) as c1; show create table t1; drop table t1; +--enable_view_protocol --enable_ps2_protocol create table t1 as select concat(uuid_short()) as c1; @@ -664,71 +662,71 @@ create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)')) show create table t1; drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; drop table t1; @@ -874,7 +872,7 @@ create table t1 as select concat(sec_to_time(2378)) as c1; show create table t1; drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; drop table t1; @@ -894,12 +892,12 @@ create table t1 as select concat(from_unixtime(1111885200)) as c1; show create table t1; drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; select * from t1; @@ -1646,9 +1644,11 @@ INSERT INTO t1 VALUES (1234567); SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1; SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; +--disable_view_protocol --enable_metadata SELECT COALESCE(a,'') FROM t1 GROUP BY 1; --disable_metadata +--enable_view_protocol --echo # All columns must be VARCHAR(9) with the same length: --disable_warnings CREATE TABLE t2 AS @@ -1764,15 +1764,17 @@ SELECT DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; SHOW CREATE TABLE t1; DROP TABLE t1; ---enable_metadata # PS protocol gives different "Max length" value for DATETIME. --disable_ps_protocol +--disable_view_protocol +--enable_metadata SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; --disable_metadata +--enable_view_protocol --enable_ps_protocol SELECT HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, diff --git a/mysql-test/include/ctype_pad.inc b/mysql-test/include/ctype_pad.inc index a18876145df..8790525701c 100644 --- a/mysql-test/include/ctype_pad.inc +++ b/mysql-test/include/ctype_pad.inc @@ -52,14 +52,13 @@ DROP TABLE t1; --echo # --echo # IF, CASE, LEAST --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -eval SELECT IF('abc' COLLATE $coll = 'abc ', 'pad', 'nopad'); -eval SELECT CASE 'abc' COLLATE $coll WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -eval SELECT CASE WHEN 'abc' COLLATE $coll = 'abc ' THEN 'pad' ELSE 'nopad' END; -eval SELECT HEX(LEAST('abc ' COLLATE $coll, 'abc ')); -eval SELECT HEX(GREATEST('abc ' COLLATE $coll, 'abc ')); ---enable_view_protocol + +eval SELECT IF('abc' COLLATE $coll = 'abc ', 'pad', 'nopad') as exp; +eval SELECT CASE 'abc' COLLATE $coll WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +eval SELECT CASE WHEN 'abc' COLLATE $coll = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +eval SELECT HEX(LEAST('abc ' COLLATE $coll, 'abc ')) as exp; +eval SELECT HEX(GREATEST('abc ' COLLATE $coll, 'abc ')) as exp; + --echo # --echo # Collation mix --echo # diff --git a/mysql-test/include/ctype_str_to_date.inc b/mysql-test/include/ctype_str_to_date.inc index fc7d6801adf..03a3b699497 100644 --- a/mysql-test/include/ctype_str_to_date.inc +++ b/mysql-test/include/ctype_str_to_date.inc @@ -3,10 +3,7 @@ --echo # SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); -# enable view-protocol after fix MDEV-27871 ---disable_view_protocol -SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); ---enable_view_protocol +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) as exp; CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index 436b0f2782f..fffe1d719c8 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -2,11 +2,6 @@ # Tests with the utf8mb4 character set # -# Tests will be skipped for the view protocol because the view protocol uses -# an additional util connection and don't use for this nessesary configurations -# Also need to resolve MDEV-27871 --- source include/no_view_protocol.inc - --source include/default_optimizer_switch.inc --disable_warnings drop table if exists t1,t2; @@ -31,26 +26,26 @@ select locate('HE','hello' collate utf8mb4_bin); select locate('HE','hello' collate utf8mb4_bin,2); select locate('LO','hello' collate utf8mb4_bin,2); -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) as exp; +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) as exp; +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) as exp; +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) as exp; +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) as exp; -select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1) as exp; select 'a' like 'a'; select 'A' like 'a'; select 'A' like 'a' collate utf8mb4_bin; -select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') as exp; # Bug #6040: can't retrieve records with umlaut # characters in case insensitive manner. # Case insensitive search LIKE comparison # was broken for multibyte characters: -select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4); -select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4); -select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4); +select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4) as exp; +select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4) as exp; +select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) as exp; # # Check the following: @@ -666,6 +661,7 @@ DROP TABLE t1; # # Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table # +--disable_service_connection SET NAMES latin1; eval CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, @@ -682,6 +678,7 @@ SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest"); DROP TABLE t1; } +--enable_service_connection # # Bug #6019 SELECT tries to use too short prefix index on utf8mb4 data @@ -747,10 +744,10 @@ drop table t1; # # Bug#22638 SOUNDEX broken for international characters # -select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -select soundex(_utf8mb4 0xD091D092D093); -select hex(soundex(_utf8mb4 0xD091D092D093)); +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +select soundex(_utf8mb4 0xD091D092D093) as exp; +select hex(soundex(_utf8mb4 0xD091D092D093)) as exp; SET collation_connection='utf8mb4_general_ci'; @@ -786,7 +783,7 @@ drop table t1; # # Bug#8385: utf8mb4_general_ci treats Cyrillic letters I and SHORT I as the same # -select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4); +select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4) as exp; # # Bugs#5980: NULL requires a characterset in a union @@ -1191,6 +1188,7 @@ DROP TABLE t1; # (see bug #16674 as well) # +--disable_service_connection SET NAMES latin2; if (!$is_heap) @@ -1220,6 +1218,7 @@ SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN DROP TABLE t1; } +--enable_service_connection # # Bug 20709: problem with utf8mb4 fields in temporary tables @@ -1420,8 +1419,11 @@ set names utf8mb4; eval create table t1 (a varchar(10) character set latin1, b int) engine $engine; insert into t1 values ('a',1); select concat(a, if(b>10, N'x', N'y')) from t1; +#Incorrect collation in error message with view protocol +--disable_view_protocol --error 1267 select concat(a, if(b>10, N'æ', N'ß')) from t1; +--enable_view_protocol drop table t1; # Conversion tests for character set introducers diff --git a/mysql-test/include/empty_string_literal.inc b/mysql-test/include/empty_string_literal.inc index 5857c26d4ee..86ddee5db76 100644 --- a/mysql-test/include/empty_string_literal.inc +++ b/mysql-test/include/empty_string_literal.inc @@ -1,17 +1,15 @@ SET SESSION character_set_connection=latin2; SET SESSION character_set_client=cp1250; ---disable_service_connection - --echo # --echo # Test litteral --echo # -#enable view protocol after fix MDEV-27871 and -# it is necessary that the view protocol uses the same connection, -# not util connection +# For "--view-protocol" NULLIF('','') converts to nullif(NULL,NULL) +# in view definition and CHARSET(nullif(NULL,NULL)) returns 'binary'. +# Also view does not allow columns with the same name, +# so it uses generated names --disable_view_protocol - SET sql_mode=@mode; select @@sql_mode; SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST(null as char(10))), 'x', CHARSET('x'); @@ -21,7 +19,6 @@ SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST SELECT CHARSET(NULLIF('','')),NULLIF('',''); - --echo # --echo # Test NCHAR litteral --echo # @@ -33,7 +30,6 @@ SELECT N'',CHARSET(N''), N'x', CHARSET(N'x'); SELECT CHARSET(NULLIF(N'',N'')),NULLIF(N'',N''); - --echo # --echo # Test CHARSET prefix litteral --echo # @@ -63,12 +59,12 @@ SELECT '' '' ''; SELECT '' '' '',CHARSET('' '' ''); SELECT _latin1'' '' '',CHARSET(_latin1'' '' ''); SELECT N'' '' '',CHARSET(N'' '' ''); - --enable_view_protocol --echo # --echo # UNION - implicit group by --echo # +--disable_service_connection SELECT 1, null UNION SELECT 1 , '' @@ -84,16 +80,10 @@ UNION SELECT 1 , _cp1250 '' ORDER BY 1; -# it is necessary that the view protocol uses the same connection, -# not util connection ---disable_view_protocol - SELECT NULLIF(_cp1250 '',_cp1250 '') UNION SELECT NULLIF(N'',N''); ---enable_view_protocol - --error ER_CANT_AGGREGATE_2COLLATIONS SELECT 1 , _latin2 '' UNION @@ -131,5 +121,4 @@ EXPLAIN EXTENDED SELECT ''; EXPLAIN EXTENDED SELECT _latin1''; EXPLAIN EXTENDED SELECT N''; EXPLAIN EXTENDED SELECT '' ''; - --enable_service_connection diff --git a/mysql-test/include/gis_debug.inc b/mysql-test/include/gis_debug.inc index 813ae252070..993ed9a4a1a 100644 --- a/mysql-test/include/gis_debug.inc +++ b/mysql-test/include/gis_debug.inc @@ -119,28 +119,25 @@ CALL p1(-1, 'GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8, --enable_query_log -#enable after fix MDEV-27871 ---disable_view_protocol SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), - GeomFromText('POINT(5 10)')); + GeomFromText('POINT(5 10)')) as geom; SELECT AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), - GeomFromText('POINT(5 10)'))); + GeomFromText('POINT(5 10)'))) as geom; DROP PROCEDURE p1; --echo # --echo # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE --echo # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) as geom; --echo # --echo # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL --echo # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) as geom; ---enable_view_protocol --echo # --echo # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER @@ -148,22 +145,19 @@ SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); -#enable after fix MDEV-27871 ---disable_view_protocol SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), - ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); + ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))) as st; SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), - ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); + ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) as st; SELECT ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), - SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); + SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) as st; SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), - SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); + SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) as st; ---enable_view_protocol diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index 91609f628ca..db51df6963b 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -301,31 +301,28 @@ select count(*) from t0; # Test for BUG#4177 -# enable view-protocol after fix MDEV-27871 ---disable_view_protocol - drop table t4; create table t4 (a int); insert into t4 values (1),(4),(3); set @save_join_buffer_size=@@join_buffer_size; set join_buffer_size= 4096; -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) and (B.key1 < 500000 or B.key2 < 3); -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) and (B.key1 < 500000 or B.key2 < 3); update t0 set key1=1; -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) and (B.key1 = 1 or B.key2 = 1); -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) and (B.key1 = 1 or B.key2 = 1); @@ -338,12 +335,12 @@ update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500; # scan cost estimates depend on ha_myisam::ref_length) --replace_column 9 # --replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?" -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); @@ -353,8 +350,6 @@ set join_buffer_size= @save_join_buffer_size; drop table t0, t1, t2, t3, t4; ---enable_view_protocol - # BUG#16166 CREATE TABLE t1 ( cola char(3) not null, colb char(3) not null, filler char(200), diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result index 20d6a97cc5d..a89f8a75dc0 100644 --- a/mysql-test/main/ctype_big5.result +++ b/mysql-test/main/ctype_big5.result @@ -4927,20 +4927,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5065,20 +5065,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5204,20 +5204,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5342,20 +5342,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index 03c7d902013..d91faf4c3d6 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -1131,8 +1131,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1141,8 +1141,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); -hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; @@ -1151,8 +1151,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 30 create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1161,8 +1161,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); -hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; +exp 31 create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; @@ -1171,8 +1171,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); -hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; +exp 30 create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1181,8 +1181,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); -hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; +exp 31 create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1191,8 +1191,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); -hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; +exp 30 create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; @@ -1201,13 +1201,13 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); -hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; +exp 31 create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); -hex(concat(x(GeomFromText('Point(1 2)')))) +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; +exp 31 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1216,8 +1216,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); -hex(concat(y(GeomFromText('Point(1 2)')))) +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; +exp 32 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1226,8 +1226,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); -hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; +exp 31 create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; @@ -1236,8 +1236,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); -hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; +exp 31 create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; @@ -1246,8 +1246,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); -hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E54 create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1256,8 +1256,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); -hex(concat(AsText(GeomFromText('Point(1 2)')))) +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E542831203229 create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1526,8 +1526,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); -hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; +exp 32343A30303A3030 create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; @@ -1566,8 +1566,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); -hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; +exp 323030332D31322D33312032303A30303A3030 create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; @@ -1576,8 +1576,8 @@ t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); -hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; +exp 323030342D30312D30322031323A30303A3030 create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index b7a0c3deb4e..26618ec235b 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -1,7 +1,3 @@ - -#remove this include after fix MDEV-27871 ---source include/no_view_protocol.inc - set names binary; --source include/ctype_numconv.inc @@ -234,22 +230,30 @@ SET NAMES latin1,character_set_connection=binary; --echo # Binary format, binary result SELECT DATE_FORMAT('2004-02-02','%W'); SELECT HEX(DATE_FORMAT('2004-02-02','%W')); +#Enable after fix MDEV-33936 +--disable_view_protocol SELECT DATE_FORMAT(TIME'-01:01:01','%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); +--enable_view_protocol --echo # latin1 format, binary result SELECT DATE_FORMAT('2004-02-02',_latin1'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W')); +#Enable after fix MDEV-33936 +--disable_view_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h')); +--enable_view_protocol --echo # Binary format, latin1 result SET NAMES latin1; SELECT DATE_FORMAT('2004-02-02',_binary'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W')); +#Enable after fix MDEV-33936 +--disable_view_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h')); - +--enable_view_protocol --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 0e72f82bc77..add4866e6a6 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -1543,8 +1543,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1553,8 +1553,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); -hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; @@ -1563,8 +1563,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 30 create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1573,8 +1573,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); -hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; +exp 31 create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; @@ -1583,8 +1583,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); -hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; +exp 30 create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1593,8 +1593,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); -hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; +exp 31 create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1603,8 +1603,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); -hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; +exp 30 create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; @@ -1613,13 +1613,13 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); -hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; +exp 31 create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); -hex(concat(x(GeomFromText('Point(1 2)')))) +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; +exp 31 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1628,8 +1628,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); -hex(concat(y(GeomFromText('Point(1 2)')))) +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; +exp 32 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1638,8 +1638,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); -hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; +exp 31 create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; @@ -1648,8 +1648,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); -hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; +exp 31 create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; @@ -1658,8 +1658,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); -hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E54 create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1668,8 +1668,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(20) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); -hex(concat(AsText(GeomFromText('Point(1 2)')))) +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E542831203229 create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1938,8 +1938,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); -hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; +exp 32343A30303A3030 create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; @@ -1978,8 +1978,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); -hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; +exp 323030332D31322D33312032303A30303A3030 create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; @@ -1988,8 +1988,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); -hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; +exp 323030342D30312D30322031323A30303A3030 create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; diff --git a/mysql-test/main/ctype_cp932.result b/mysql-test/main/ctype_cp932.result index 415e1ff4f79..ed222c997da 100644 --- a/mysql-test/main/ctype_cp932.result +++ b/mysql-test/main/ctype_cp932.result @@ -135,20 +135,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -273,20 +273,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -412,20 +412,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -550,20 +550,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_cp932.test b/mysql-test/main/ctype_cp932.test index d2ca278c739..0f5ff437d33 100644 --- a/mysql-test/main/ctype_cp932.test +++ b/mysql-test/main/ctype_cp932.test @@ -4,9 +4,6 @@ --echo # USED. --echo # -#remove this include in 10.6 version ---source include/no_view_protocol.inc - SET @old_character_set_client= @@character_set_client; SET @old_character_set_connection= @@character_set_connection; SET @old_character_set_results= @@character_set_results; diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result index d4cfe4e2ca9..b886e340671 100644 --- a/mysql-test/main/ctype_eucjpms.result +++ b/mysql-test/main/ctype_eucjpms.result @@ -34029,20 +34029,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -34167,20 +34167,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -34306,20 +34306,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -34444,20 +34444,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result index 2a6081c79e3..e7f02603786 100644 --- a/mysql-test/main/ctype_euckr.result +++ b/mysql-test/main/ctype_euckr.result @@ -25547,20 +25547,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -25685,20 +25685,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -25824,20 +25824,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -25962,20 +25962,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result index fa52bc5ce8f..f0bbb48621d 100644 --- a/mysql-test/main/ctype_gb2312.result +++ b/mysql-test/main/ctype_gb2312.result @@ -4617,20 +4617,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4755,20 +4755,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4894,20 +4894,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5032,20 +5032,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result index cabea6d439e..cbf396e69ba 100644 --- a/mysql-test/main/ctype_gbk.result +++ b/mysql-test/main/ctype_gbk.result @@ -6085,20 +6085,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6223,20 +6223,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6362,20 +6362,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6500,20 +6500,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test index bf120c97c76..ba41b177b44 100644 --- a/mysql-test/main/ctype_gbk.test +++ b/mysql-test/main/ctype_gbk.test @@ -446,13 +446,10 @@ DROP TABLE t1; --echo # --echo # MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences --echo # -#enable after fix MDEV-27871 ---disable_view_protocol set sql_mode=''; SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) as exp; SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) as exp; set sql_mode=default; ---enable_view_protocol --echo # --echo # End of 10.1 tests diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 1b55c879624..4548c076c1b 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -518,8 +518,8 @@ SELECT '\%b' LIKE '%\%'; SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); @@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) latin1 F7 -SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); -STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) as exp; +exp 2001-01-01 CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; @@ -1852,8 +1852,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1862,8 +1862,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); -hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; @@ -1872,8 +1872,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 30 create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -1882,8 +1882,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); -hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; +exp 31 create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; @@ -1892,8 +1892,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); -hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; +exp 30 create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1902,8 +1902,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); -hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; +exp 31 create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -1912,8 +1912,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); -hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; +exp 30 create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; @@ -1922,13 +1922,13 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); -hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; +exp 31 create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); -hex(concat(x(GeomFromText('Point(1 2)')))) +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; +exp 31 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1937,8 +1937,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); -hex(concat(y(GeomFromText('Point(1 2)')))) +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; +exp 32 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1947,8 +1947,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); -hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; +exp 31 create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; @@ -1957,8 +1957,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); -hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; +exp 31 create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; @@ -1967,8 +1967,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); -hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E54 create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -1977,8 +1977,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); -hex(concat(AsText(GeomFromText('Point(1 2)')))) +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E542831203229 create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -2247,8 +2247,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); -hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; +exp 32343A30303A3030 create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; @@ -2287,8 +2287,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); -hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; +exp 323030332D31322D33312032303A30303A3030 create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; @@ -2297,8 +2297,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); -hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; +exp 323030342D30312D30322031323A30303A3030 create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; @@ -8404,20 +8404,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8542,20 +8542,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8681,20 +8681,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8819,20 +8819,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test index cda022415cc..b00dc374a05 100644 --- a/mysql-test/main/ctype_latin1.test +++ b/mysql-test/main/ctype_latin1.test @@ -139,8 +139,10 @@ select hex(cast(_ascii 0x7f as char(1) character set latin1)); --echo # --echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings --echo # +#view-protocol doubles warning message +--disable_view_protocol SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); - +--enable_view_protocol --echo End of 5.1 tests @@ -223,6 +225,8 @@ SET NAMES latin1 COLLATE latin1_bin; --echo # MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion --echo # SET NAMES utf8, character_set_connection=latin1; + +--disable_service_connection SELECT 'Â'; SELECT HEX('Â'); SELECT HEX(CAST('Â' AS CHAR CHARACTER SET utf8)); @@ -241,6 +245,7 @@ INSERT IGNORE INTO t1 VALUES (' SHOW WARNINGS; SELECT HEX(a),a FROM t1; DROP TABLE t1; +--enable_service_connection --echo # --echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 diff --git a/mysql-test/main/ctype_ldml.result b/mysql-test/main/ctype_ldml.result index 65ffd75dfa0..c53834fa505 100644 --- a/mysql-test/main/ctype_ldml.result +++ b/mysql-test/main/ctype_ldml.result @@ -80,50 +80,50 @@ select * from t1 where c1='b'; c1 a drop table t1; -SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci)); -hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci)) +SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci)) as exp; +exp 120F -SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 314A -SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)); -hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci) hex(lower(@a)) +SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)) as exp; +hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci) exp F0909080 F09090A8 -SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)); -hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci) hex(upper(@a)) +SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)) as exp; +hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci) exp F09090A8 F0909080 -SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)); -hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci) hex(lower(@a)) +SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)) as exp; +hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci) exp E2B080 E2B0B0 -SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)); -hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci) hex(upper(@a)) +SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)) as exp; +hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci) exp E2B0B0 E2B080 -SELECT hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 120F -SELECT hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 120F -SELECT hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 120F -SELECT hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 30D2 -SELECT hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 30D2 -SELECT hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci)); -hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci)) +SELECT hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci)) as exp; +exp 1250 -SELECT hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 1251 -SELECT hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 1251 -SELECT hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci)); -hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci)) +SELECT hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci)) as exp; +exp 1251 CREATE TABLE t1 ( col1 varchar(100) character set utf8 collate utf8_test_ci @@ -528,23 +528,23 @@ SHOW COLLATION LIKE 'utf8_phone_ci'; Collation Charset Id Default Compiled Sortlen utf8_phone_ci utf8 352 8 SET NAMES utf8; -SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)); -hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)) +SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)) as exp; +exp 0E33 -SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)); -hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) +SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) as exp; +exp FFFD -SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); -hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci) hex(lower(@a)) +SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)) as exp; +hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci) exp F0909080 F0909080 -SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); -hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci) hex(upper(@a)) +SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)) as exp; +hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci) exp F09090A8 F09090A8 -SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); -hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci) hex(lower(@a)) +SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)) as exp; +hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci) exp E2B080 E2B080 -SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); -hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci) hex(upper(@a)) +SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)) as exp; +hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci) exp E2B0B0 E2B0B0 # # WL#5624 Collation customization improvements @@ -1014,9 +1014,9 @@ HEX(WEIGHT_STRING(a)) HEX(CONVERT(a USING ucs2)) HEX(a) 15D3 09B809CD E0A6B8E0A78D 15D4 09B909CD E0A6B9E0A78D SELECT HEX(WEIGHT_STRING(a)) as wa, -GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) +GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) as ha FROM t1 GROUP BY a ORDER BY a; -wa GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) +wa ha 15A2 0985 15A3 0986 15A4 0987 diff --git a/mysql-test/main/ctype_ldml.test b/mysql-test/main/ctype_ldml.test index be9d75900c0..ebd44d6ed5d 100644 --- a/mysql-test/main/ctype_ldml.test +++ b/mysql-test/main/ctype_ldml.test @@ -3,9 +3,6 @@ --source include/have_utf16.inc --source include/have_utf32.inc -#remove this include after fix MDEV-27871 ---source include/no_view_protocol.inc - --disable_query_log call mtr.add_suppression("Charset id.*trying to replace"); --enable_query_log @@ -69,25 +66,25 @@ select * from t1 where c1='b'; drop table t1; # make sure utf8_test_ci is Unicode-5.0.0 -SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)); -SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)); -SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)); -SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)); +SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a)) as exp; # check that it works with supplementary characters -SELECT hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci)); +SELECT hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci)) as exp; # check contractions with non-ascii characters -SELECT hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci)); -SELECT hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci)); +SELECT hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci)) as exp; +SELECT hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci)) as exp; # @@ -188,10 +185,12 @@ show collation like '%test%'; show collation like 'ucs2_vn_ci'; create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); insert into t1 values (0x0061); +--disable_view_protocol --enable_metadata set @@character_set_results=NULL; select * from t1; --disable_metadata +--enable_view_protocol drop table t1; # @@ -211,12 +210,12 @@ SHOW COLLATION LIKE 'utf8_phone_ci'; SET NAMES utf8; # make sure utf8mb4_test_400_ci is Unicode-4.0.0 based -SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)); -SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)); -SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); -SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); -SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); -SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); +SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)) as exp; +SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) as exp; +SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)) as exp; +SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)) as exp; --echo # --echo # WL#5624 Collation customization improvements @@ -280,9 +279,14 @@ DROP TABLE t1; SET NAMES utf8 COLLATE utf8_5624_2; SHOW WARNINGS; +# "--view-protocol" generates a dublicate error message in ctype_ldml_log.err +# In one of the following cases, the number of similar error messages is counted, +# so doubling the error causes the case to fail +--disable_view_protocol --error ER_UNKNOWN_COLLATION SELECT _utf8'test' COLLATE utf8_5624_2; SHOW WARNINGS; +--enable_view_protocol --echo # --echo # WL#5624, reset before primary ignorable @@ -353,7 +357,7 @@ INSERT INTO t1 VALUES SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a) FROM t1 ORDER BY a, BINARY(a); SELECT HEX(WEIGHT_STRING(a)) as wa, -GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) +GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) as ha FROM t1 GROUP BY a ORDER BY a; DROP TABLE t1; @@ -405,7 +409,6 @@ perl; close(FILE); EOF - --echo # --echo # MDEV-8686 A user defined collation utf8_confusables doesn't work --echo # @@ -508,6 +511,7 @@ SELECT HEX(a), REPLACE(a,' ','') FROM t1 ORDER BY a DESC; DROP TABLE t1; +--disable_service_connection SET NAMES utf8 COLLATE utf8_czech_test_w2; CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0; --source include/ctype_unicode_latin.inc @@ -609,6 +613,7 @@ SELECT 'chž'< 'i'; --error ER_UNKNOWN_COLLATION SELECT 'a' COLLATE utf8_czech_test_bad_w2; +--enable_service_connection --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/ctype_nopad_8bit.result b/mysql-test/main/ctype_nopad_8bit.result index ddd1f3186c9..8720e8c992a 100644 --- a/mysql-test/main/ctype_nopad_8bit.result +++ b/mysql-test/main/ctype_nopad_8bit.result @@ -97,20 +97,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -235,20 +235,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -374,20 +374,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -512,20 +512,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -652,20 +652,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -790,20 +790,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -929,20 +929,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1067,20 +1067,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1207,20 +1207,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1345,20 +1345,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1484,20 +1484,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1622,20 +1622,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1762,20 +1762,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -1900,20 +1900,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2039,20 +2039,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2177,20 +2177,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2317,20 +2317,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2455,20 +2455,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2594,20 +2594,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2732,20 +2732,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -2872,20 +2872,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3010,20 +3010,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3149,20 +3149,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3287,20 +3287,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3427,20 +3427,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3565,20 +3565,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3704,20 +3704,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3842,20 +3842,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3982,20 +3982,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4120,20 +4120,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4259,20 +4259,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4397,20 +4397,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4537,20 +4537,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4675,20 +4675,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4814,20 +4814,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4952,20 +4952,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5092,20 +5092,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5230,20 +5230,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5369,20 +5369,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5507,20 +5507,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5647,20 +5647,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5785,20 +5785,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -5924,20 +5924,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6062,20 +6062,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6202,20 +6202,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6340,20 +6340,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6479,20 +6479,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6617,20 +6617,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6757,20 +6757,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6895,20 +6895,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7034,20 +7034,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7172,20 +7172,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7312,20 +7312,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7450,20 +7450,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7589,20 +7589,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7727,20 +7727,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -7867,20 +7867,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8005,20 +8005,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8144,20 +8144,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8282,20 +8282,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8422,20 +8422,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8560,20 +8560,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8699,20 +8699,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8837,20 +8837,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -8977,20 +8977,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9115,20 +9115,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9254,20 +9254,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9392,20 +9392,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9532,20 +9532,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9670,20 +9670,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9809,20 +9809,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -9947,20 +9947,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10087,20 +10087,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10225,20 +10225,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10364,20 +10364,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10502,20 +10502,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10642,20 +10642,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10780,20 +10780,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10919,20 +10919,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11057,20 +11057,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11197,20 +11197,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11335,20 +11335,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11474,20 +11474,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11612,20 +11612,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11752,20 +11752,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11890,20 +11890,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12029,20 +12029,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12167,20 +12167,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12307,20 +12307,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12445,20 +12445,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12584,20 +12584,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -12722,20 +12722,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result index 98b9ced45d7..f93a0b8be60 100644 --- a/mysql-test/main/ctype_sjis.result +++ b/mysql-test/main/ctype_sjis.result @@ -218,8 +218,8 @@ DROP TABLE t1; SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); @@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) sjis 8180 -SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); -STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) as exp; +exp 2001-01-01 CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; @@ -18839,20 +18839,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -18977,20 +18977,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -19116,20 +19116,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -19254,20 +19254,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_swe7.result b/mysql-test/main/ctype_swe7.result index 8397db11a38..0dbd362c3db 100644 --- a/mysql-test/main/ctype_swe7.result +++ b/mysql-test/main/ctype_swe7.result @@ -3173,20 +3173,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3311,20 +3311,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3450,20 +3450,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3588,20 +3588,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result index 4530b3ca4a2..615aa2ef7f7 100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@ -3961,20 +3961,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4099,20 +4099,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4238,20 +4238,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4376,20 +4376,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index f329db1826b..7068406518d 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -10021,8 +10021,8 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x1011103910191004103A1038 /* cooked rice */), (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; -id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +id exp 1 2259 108C 2 22593ACB 1037 3 22593ACC 1038 @@ -12597,8 +12597,8 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x1011103910191004103A1038 /* cooked rice */), (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; -id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +id exp 1 2259 108C 2 22593ACB 1037 3 22593ACC 1038 diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 8f747dfd51e..887c01df7e9 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -989,8 +989,8 @@ DROP TABLE t1; SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); @@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) ucs2 00F7 -SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); -STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) as exp; +exp 2001-01-01 CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; @@ -2736,8 +2736,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 0032 create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -2746,8 +2746,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); -hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; +exp 0032 create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; @@ -2756,8 +2756,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 0030 create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -2766,8 +2766,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); -hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; +exp 0031 create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; @@ -2776,8 +2776,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); -hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; +exp 0030 create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -2786,8 +2786,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); -hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; +exp 0031 create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -2796,8 +2796,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); -hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; +exp 0030 create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; @@ -2806,13 +2806,13 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); -hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; +exp 0031 create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); -hex(concat(x(GeomFromText('Point(1 2)')))) +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; +exp 0031 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -2821,8 +2821,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); -hex(concat(y(GeomFromText('Point(1 2)')))) +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; +exp 0032 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -2831,8 +2831,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); -hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; +exp 0031 create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; @@ -2841,8 +2841,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); -hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; +exp 0031 create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; @@ -2851,8 +2851,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); -hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; +exp 0050004F0049004E0054 create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -2861,8 +2861,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); -hex(concat(AsText(GeomFromText('Point(1 2)')))) +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; +exp 0050004F0049004E005400280031002000320029 create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -3131,8 +3131,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); -hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; +exp 00320034003A00300030003A00300030 create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; @@ -3171,8 +3171,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); -hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; +exp 0032003000300033002D00310032002D00330031002000320030003A00300030003A00300030 create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; @@ -3181,8 +3181,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); -hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; +exp 0032003000300034002D00300031002D00300032002000310032003A00300030003A00300030 create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; @@ -5872,20 +5872,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -6010,20 +6010,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -6149,20 +6149,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -6287,20 +6287,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index f2fcee1dbb4..708af6baf8a 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -609,6 +609,7 @@ deallocate prepare stmt; # # Bug#22638 SOUNDEX broken for international characters # +--disable_service_connection set names latin1; set character_set_connection=ucs2; select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); @@ -619,6 +620,7 @@ select hex(soundex(_ucs2 0x041004110412)); # Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter select hex(soundex(_ucs2 0x00BF00C0)); set names latin1; +--enable_service_connection # # Bug #14290: character_maximum_length for text fields @@ -790,10 +792,12 @@ DROP TABLE t1; --echo # Start of 5.5 tests --echo # +--disable_service_connection SET NAMES latin1; SET collation_connection=ucs2_general_ci; --source include/ctype_numconv.inc SET NAMES latin1; +--enable_service_connection --echo # --echo # Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED @@ -1031,8 +1035,10 @@ DROP TABLE t1; --echo # --echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) --echo # +--disable_service_connection SET NAMES utf8; SELECT CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED); +--enable_service_connection --echo # --echo # End of 10.1 tests @@ -1066,6 +1072,7 @@ EXECUTE IMMEDIATE @stmt; --echo # --echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions --echo # +--disable_service_connection SET NAMES utf8, collation_connection=ucs2_bin; SET @stmt='SELECT COLLATION(''a'')'; EXECUTE IMMEDIATE @stmt; @@ -1093,6 +1100,7 @@ EXECUTE IMMEDIATE @stmt; PREPARE stmt FROM @stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +--enable_service_connection --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/ctype_ucs2_uca.result b/mysql-test/main/ctype_ucs2_uca.result index 430f0ec1c37..471cb844aab 100644 --- a/mysql-test/main/ctype_ucs2_uca.result +++ b/mysql-test/main/ctype_ucs2_uca.result @@ -100,20 +100,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -238,20 +238,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -377,20 +377,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -515,20 +515,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result index d31ffab7621..99fa7483b63 100644 --- a/mysql-test/main/ctype_ujis.result +++ b/mysql-test/main/ctype_ujis.result @@ -46,14 +46,14 @@ locate('LO','hello' collate ujis_bin,2) select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3); locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3) 2 -select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%'); -0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%') +select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%') as exp; +exp 1 -select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%'); -_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') as exp; +exp 0 -select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin; -_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin as exp; +exp 0 select 'a' like 'a'; 'a' like 'a' @@ -2534,8 +2534,8 @@ DROP TABLE t2; # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash # SET NAMES utf8; -SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); -CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis) +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis) as exp; +exp Warnings: Warning 1292 Truncated incorrect INTEGER value: 'a' @@ -26348,20 +26348,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -26486,20 +26486,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -26625,20 +26625,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -26763,20 +26763,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_ujis.test b/mysql-test/main/ctype_ujis.test index 8b0ba671abc..71ee27d08f9 100644 --- a/mysql-test/main/ctype_ujis.test +++ b/mysql-test/main/ctype_ujis.test @@ -35,13 +35,10 @@ select locate('HE','hello' collate ujis_bin,2); select locate('LO','hello' collate ujis_bin,2); select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3); -select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%'); -select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%'); +select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%') as exp; +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') as exp; -# enable view-protocol after fix MDEV-27871 ---disable_view_protocol -select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin; ---disable_view_protocol +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin as exp; select 'a' like 'a'; select 'A' like 'a'; @@ -1221,11 +1218,8 @@ DROP TABLE t2; --echo # --echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash --echo # -#enable after fix MDEV-27871 ---disable_view_protocol SET NAMES utf8; -SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); ---enable_view_protocol +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis) as exp; set names default; set character_set_database=@save_character_set_server; @@ -1347,8 +1341,6 @@ DROP TABLE t1; --echo # WL#3664 WEIGHT_STRING --echo # -# enable view-protocol after fix MDEV-27871 ---disable_view_protocol set names ujis; --source include/weight_string.inc --source include/weight_string_l1.inc @@ -1362,7 +1354,6 @@ set collation_connection=ujis_bin; --source include/weight_string_A1A1.inc --source include/weight_string_8EA1.inc --source include/weight_string_8FA2C3.inc ---enable_view_protocol --echo # --echo # End of 5.6 tests diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index 64de622be51..71c7ee77a1d 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -2354,20 +2354,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -2492,20 +2492,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -2631,20 +2631,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -2769,20 +2769,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix diff --git a/mysql-test/main/ctype_utf16_uca.result b/mysql-test/main/ctype_utf16_uca.result index 93a0748adc9..e1fdfade899 100644 --- a/mysql-test/main/ctype_utf16_uca.result +++ b/mysql-test/main/ctype_utf16_uca.result @@ -5327,8 +5327,8 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x1011103910191004103A1038 /* cooked rice */), (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; -id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +id exp 1 2259 108C 2 22593ACB 1037 3 22593ACC 1038 @@ -7413,20 +7413,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -7551,20 +7551,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -7690,20 +7690,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix @@ -7828,20 +7828,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0061006200630020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00610062006300200020 # # Collation mix diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index 9bc53a1041d..efacc2ebbf0 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -2540,20 +2540,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) as exp; +exp 6100620063002000 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) as exp; +exp 61006200630020002000 # # Collation mix @@ -2678,20 +2678,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) as exp; +exp 6100620063002000 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) as exp; +exp 61006200630020002000 # # Collation mix @@ -2817,20 +2817,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) as exp; +exp 6100620063002000 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) as exp; +exp 61006200630020002000 # # Collation mix @@ -2955,20 +2955,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) as exp; +exp 6100620063002000 -SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) as exp; +exp 61006200630020002000 # # Collation mix diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index f9523a783ea..46a8a5fed0f 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -70,29 +70,29 @@ hex(word2) 00000420 00002004 DROP TABLE t1; -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')); -hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')) +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')) as exp; +exp 00000421000004210000042100000421000004210000042100000421000004210000042100000420 -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); -hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) as exp; +exp 00000421000004220000042100000422000004210000042200000421000004220000042100000420 -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); -hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) as exp; +exp 00000421000004220000042300000421000004220000042300000421000004220000042300000420 -SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); -hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) +SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) as exp; +exp 00000420000004210000042200000423000004240000042500000426000004270000042800000429 -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')); -hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')) +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')) as exp; +exp 00000420000004210000042100000421000004210000042100000421000004210000042100000421 -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); -hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) as exp; +exp 00000420000004210000042200000421000004220000042100000422000004210000042200000421 -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); -hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) as exp; +exp 00000420000004210000042200000423000004210000042200000423000004210000042200000423 -SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); -hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) +SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) as exp; +exp 00000420000004210000042200000423000004240000042500000426000004270000042800000429 CREATE TABLE t1 SELECT LPAD(_utf32 X'0420',10,_utf32 X'0421') l, @@ -329,11 +329,11 @@ SELECT * FROM t1 WHERE word LIKE _utf32 x'00000063000000610000005F'; word cat DROP TABLE t1; -select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066); -insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066) +select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066) as exp; +exp abc -select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066); -insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066) +select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066) as exp; +exp defc SET NAMES latin1; CREATE TABLE t1 ( @@ -1642,8 +1642,8 @@ Warning 1260 Row 1 was cut by GROUP_CONCAT() # # incorrect charset for val_str_ascii # -SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second; -'2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second +SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second as exp; +exp 2010-10-10 10:10:10 # # MDEV-5745 analyze MySQL fix for bug#12368495 @@ -2410,20 +2410,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -2548,20 +2548,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -2687,20 +2687,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -2825,20 +2825,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index bcbc3b14691..0e49302c776 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -60,21 +60,15 @@ DROP TABLE t1; # # Check LPAD/RPAD # -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')); -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); -SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); ---enable_view_protocol +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')) as exp; +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) as exp; +SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) as exp; +SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) as exp; -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')); -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); -SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); ---enable_view_protocol +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')) as exp; +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')) as exp; +SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')) as exp; +SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')) as exp; CREATE TABLE t1 SELECT LPAD(_utf32 X'0420',10,_utf32 X'0421') l, @@ -124,11 +118,8 @@ DROP TABLE t1; # # Check that INSERT() works fine. # This invokes charpos() function. -#enable after fix MDEV-27871 ---disable_view_protocol -select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066); -select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066); ---enable_view_protocol +select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066) as exp; +select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066) as exp; ####################################################### @@ -884,10 +875,7 @@ ORDER BY l DESC; --echo # --echo # incorrect charset for val_str_ascii --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second; ---enable_view_protocol +SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second as exp; --echo # --echo # MDEV-5745 analyze MySQL fix for bug#12368495 diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result index a960325afe9..afdfa3f2256 100644 --- a/mysql-test/main/ctype_utf32_uca.result +++ b/mysql-test/main/ctype_utf32_uca.result @@ -5347,8 +5347,8 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x1011103910191004103A1038 /* cooked rice */), (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; -id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +id exp 1 2259 108C 2 22593ACB 1037 3 22593ACC 1038 @@ -7433,20 +7433,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -7571,20 +7571,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -7710,20 +7710,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix @@ -7848,20 +7848,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) as exp; +exp 00000061000000620000006300000020 -SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc ')) as exp; +exp 0000006100000062000000630000002000000020 # # Collation mix diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 46b9a25b332..4a64d22b145 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -63,17 +63,17 @@ select 'A' like 'a'; select 'A' like 'a' collate utf8_bin; 'A' like 'a' collate utf8_bin 0 -select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); -_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%') +select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%') as exp; +exp 1 -select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8); -convert(_latin1'G\xFCnter Andr\xE9' using utf8) like CONVERT(_latin1'G\xDCNTER%' USING utf8) +select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8) as exp; +exp 1 -select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8); -CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8) +select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8) as exp; +exp 1 -select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8); -CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8) +select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8) as exp; +exp 1 SELECT 'a' = 'a '; 'a' = 'a ' @@ -924,17 +924,17 @@ select * from t1 where soundex(a) = soundex('test'); id a 1 Test drop table t1; -select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +exp 阅000 -select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +exp E99885303030 -select soundex(_utf8 0xD091D092D093); -soundex(_utf8 0xD091D092D093) +select soundex(_utf8 0xD091D092D093) as exp; +exp Б000 -select hex(soundex(_utf8 0xD091D092D093)); -hex(soundex(_utf8 0xD091D092D093)) +select hex(soundex(_utf8 0xD091D092D093)) as exp; +exp D091303030 SET collation_connection='utf8_general_ci'; create table t1 select repeat('a',4000) a; @@ -1160,8 +1160,8 @@ DROP TABLE t1; SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); @@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) utf8 C3B7 -SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); -STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) as exp; +exp 2001-01-01 CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; @@ -1294,8 +1294,8 @@ concat(concat(_latin1'->',f1),_latin1'<-') -><- -><- drop table t1; -select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8); -convert(_koi8r'\xC9' using utf8) < convert(_koi8r'\xCA' using utf8) +select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8) as exp; +exp 1 set names latin1; create table t1 (a varchar(10)) character set utf8; @@ -3603,8 +3603,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -3613,8 +3613,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); -hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) as exp; +exp 32 create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; show create table t1; @@ -3623,8 +3623,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); -hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) as exp; +exp 30 create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; show create table t1; @@ -3633,8 +3633,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); -hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) as exp; +exp 31 create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; show create table t1; @@ -3643,8 +3643,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); -hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) as exp; +exp 30 create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -3653,8 +3653,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(21) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); -hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) as exp; +exp 31 create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; @@ -3663,8 +3663,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); -hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) as exp; +exp 30 create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; show create table t1; @@ -3673,13 +3673,13 @@ t1 CREATE TABLE `t1` ( `c1` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); -hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) as exp; +exp 31 create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; drop table t1; -select hex(concat(x(GeomFromText('Point(1 2)')))); -hex(concat(x(GeomFromText('Point(1 2)')))) +select hex(concat(x(GeomFromText('Point(1 2)')))) as exp; +exp 31 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -3688,8 +3688,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(y(GeomFromText('Point(1 2)')))); -hex(concat(y(GeomFromText('Point(1 2)')))) +select hex(concat(y(GeomFromText('Point(1 2)')))) as exp; +exp 32 create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -3698,8 +3698,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); -hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) as exp; +exp 31 create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; show create table t1; @@ -3708,8 +3708,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); -hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) as exp; +exp 31 create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; show create table t1; @@ -3718,8 +3718,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(23) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); -hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E54 create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -3728,8 +3728,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(AsText(GeomFromText('Point(1 2)')))); -hex(concat(AsText(GeomFromText('Point(1 2)')))) +select hex(concat(AsText(GeomFromText('Point(1 2)')))) as exp; +exp 504F494E542831203229 create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; @@ -3998,8 +3998,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); -hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) as exp; +exp 32343A30303A3030 create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; show create table t1; @@ -4038,8 +4038,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); -hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) as exp; +exp 323030332D31322D33312032303A30303A3030 create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; show create table t1; @@ -4048,8 +4048,8 @@ t1 CREATE TABLE `t1` ( `c1` varchar(19) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; -select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); -hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) as exp; +exp 323030342D30312D30322031323A30303A3030 create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; show create table t1; @@ -10784,20 +10784,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -10922,20 +10922,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11061,20 +11061,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -11199,20 +11199,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 3461a5cb206..074a536f0f0 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -3,9 +3,6 @@ # Tests with the utf8 character set # -# Enable after fix MDEV-27904 --- source include/no_view_protocol.inc - let $MYSQLD_DATADIR= `select @@datadir`; let collation=utf8_unicode_ci; @@ -50,15 +47,15 @@ select length(_utf8 0xD0B1), bit_length(_utf8 0xD0B1), char_length(_utf8 0xD0B1) select 'a' like 'a'; select 'A' like 'a'; select 'A' like 'a' collate utf8_bin; -select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); +select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%') as exp; # Bug #6040: can't retrieve records with umlaut # characters in case insensitive manner. # Case insensitive search LIKE comparison # was broken for multibyte characters: -select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8); -select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8); -select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8); +select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8) as exp; +select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8) as exp; +select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8) as exp; # # Check the following: @@ -629,6 +626,7 @@ DROP TABLE t1; # # Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table # +--disable_service_connection SET NAMES latin1; CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, @@ -644,6 +642,7 @@ SELECT id, term FROM t1 where (list_id = 1) AND (term = "test SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest"); DROP TABLE t1; +--enable_service_connection # # Bug #6019 SELECT tries to use too short prefix index on utf8 data @@ -696,10 +695,10 @@ drop table t1; # # Bug#22638 SOUNDEX broken for international characters # -select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -select soundex(_utf8 0xD091D092D093); -select hex(soundex(_utf8 0xD091D092D093)); +select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +select soundex(_utf8 0xD091D092D093) as exp; +select hex(soundex(_utf8 0xD091D092D093)) as exp; SET collation_connection='utf8_general_ci'; @@ -735,7 +734,7 @@ drop table t1; # # Bug#8385: utf8_general_ci treats Cyrillic letters I and SHORT I as the same # -select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8); +select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8) as exp; # # Bugs#5980: NULL requires a characterset in a union @@ -1113,6 +1112,7 @@ DROP TABLE t1; # (see bug #16674 as well) # +--disable_service_connection SET NAMES latin2; CREATE TABLE t1 ( @@ -1139,6 +1139,7 @@ ALTER TABLE t1 ADD KEY idx (tid,val(11)); SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL'; DROP TABLE t1; +--enable_service_connection # # Bug 20709: problem with utf8 fields in temporary tables @@ -1346,6 +1347,7 @@ drop table t1; # Conversion is possible if string repertoire is ASCII. # Conversion is not possible if the string have extended characters # +--disable_service_connection set names utf8; create table t1 (a varchar(10) character set latin1, b int); insert into t1 values ('a',1); @@ -1380,6 +1382,7 @@ select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1; --error 1267 select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1; drop table t1; +--enable_service_connection # # Bug#19960: Inconsistent results when joining @@ -1496,7 +1499,10 @@ SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20)); SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20)); SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)); +#Enable view-protocol after fix MDEV-33942 +--disable_view_protocol SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)); +--enable_view_protocol --echo # --echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI @@ -1573,6 +1579,7 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf8, s4 LONGTEXT CHARACTER SET utf8 ); +--disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; @@ -1581,6 +1588,7 @@ SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata +--enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf8_uca.result b/mysql-test/main/ctype_utf8_uca.result index 16d8b1d1ec1..d3cbe485f26 100644 --- a/mysql-test/main/ctype_utf8_uca.result +++ b/mysql-test/main/ctype_utf8_uca.result @@ -100,20 +100,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -238,20 +238,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -377,20 +377,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -515,20 +515,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 658db490ef5..64f28bd4bf3 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -3665,20 +3665,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3803,20 +3803,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -3942,20 +3942,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -4080,20 +4080,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 6dead2c2190..85960e2d705 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -36,23 +36,23 @@ locate('HE','hello' collate utf8mb4_bin,2) select locate('LO','hello' collate utf8mb4_bin,2); locate('LO','hello' collate utf8mb4_bin,2) 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) as exp; +exp 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) as exp; +exp 0 -select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); -length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 0xD0B1) +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1) as exp; +length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) exp 2 16 1 select 'a' like 'a'; 'a' like 'a' @@ -63,17 +63,17 @@ select 'A' like 'a'; select 'A' like 'a' collate utf8mb4_bin; 'A' like 'a' collate utf8mb4_bin 0 -select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); -_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') as exp; +exp 1 -select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4); -convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4) +select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4); -CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) +select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4); -CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) +select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) as exp; +exp 1 SELECT 'a' = 'a '; 'a' = 'a ' @@ -863,17 +863,17 @@ select * from t1 where soundex(a) = soundex('test'); id a 1 Test drop table t1; -select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +exp 阅000 -select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +exp E99885303030 -select soundex(_utf8mb4 0xD091D092D093); -soundex(_utf8mb4 0xD091D092D093) +select soundex(_utf8mb4 0xD091D092D093) as exp; +exp Б000 -select hex(soundex(_utf8mb4 0xD091D092D093)); -hex(soundex(_utf8mb4 0xD091D092D093)) +select hex(soundex(_utf8mb4 0xD091D092D093)) as exp; +exp D091303030 SET collation_connection='utf8mb4_general_ci'; create table t1 select repeat('a',4000) a; @@ -1214,8 +1214,8 @@ concat(concat(_latin1'->',f1),_latin1'<-') -><- -><- drop table t1; -select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4); -convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4) +select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4) as exp; +exp 1 set names latin1; create table t1 (a varchar(10)) character set utf8mb4 engine heap; diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index 5a21d7522b9..3e2aec2c702 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -36,23 +36,23 @@ locate('HE','hello' collate utf8mb4_bin,2) select locate('LO','hello' collate utf8mb4_bin,2); locate('LO','hello' collate utf8mb4_bin,2) 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) as exp; +exp 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) as exp; +exp 0 -select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); -length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 0xD0B1) +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1) as exp; +length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) exp 2 16 1 select 'a' like 'a'; 'a' like 'a' @@ -63,17 +63,17 @@ select 'A' like 'a'; select 'A' like 'a' collate utf8mb4_bin; 'A' like 'a' collate utf8mb4_bin 0 -select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); -_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') as exp; +exp 1 -select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4); -convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4) +select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4); -CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) +select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4); -CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) +select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) as exp; +exp 1 SELECT 'a' = 'a '; 'a' = 'a ' @@ -926,17 +926,17 @@ select * from t1 where soundex(a) = soundex('test'); id a 1 Test drop table t1; -select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +exp 阅000 -select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +exp E99885303030 -select soundex(_utf8mb4 0xD091D092D093); -soundex(_utf8mb4 0xD091D092D093) +select soundex(_utf8mb4 0xD091D092D093) as exp; +exp Б000 -select hex(soundex(_utf8mb4 0xD091D092D093)); -hex(soundex(_utf8mb4 0xD091D092D093)) +select hex(soundex(_utf8mb4 0xD091D092D093)) as exp; +exp D091303030 SET collation_connection='utf8mb4_general_ci'; create table t1 select repeat('a',4000) a; @@ -1277,8 +1277,8 @@ concat(concat(_latin1'->',f1),_latin1'<-') -><- -><- drop table t1; -select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4); -convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4) +select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4) as exp; +exp 1 set names latin1; create table t1 (a varchar(10)) character set utf8mb4 engine InnoDB; diff --git a/mysql-test/main/ctype_utf8mb4_innodb.test b/mysql-test/main/ctype_utf8mb4_innodb.test index 75667e04d5f..3bf0612a1ab 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.test +++ b/mysql-test/main/ctype_utf8mb4_innodb.test @@ -1,6 +1,3 @@ -# Enable after fix MDEV-27904 --- source include/no_view_protocol.inc - --source include/have_utf8mb4.inc --source include/have_innodb.inc diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index fbcc6613ebb..a225f5a818e 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -36,23 +36,23 @@ locate('HE','hello' collate utf8mb4_bin,2) select locate('LO','hello' collate utf8mb4_bin,2); locate('LO','hello' collate utf8mb4_bin,2) 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) as exp; +exp 2 -select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) as exp; +exp 0 -select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); -locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) as exp; +exp 0 -select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); -length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 0xD0B1) +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1) as exp; +length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) exp 2 16 1 select 'a' like 'a'; 'a' like 'a' @@ -63,17 +63,17 @@ select 'A' like 'a'; select 'A' like 'a' collate utf8mb4_bin; 'A' like 'a' collate utf8mb4_bin 0 -select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); -_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') as exp; +exp 1 -select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4); -convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4) +select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4); -CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) +select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4) as exp; +exp 1 -select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4); -CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) +select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) as exp; +exp 1 SELECT 'a' = 'a '; 'a' = 'a ' @@ -929,17 +929,17 @@ select * from t1 where soundex(a) = soundex('test'); id a 1 Test drop table t1; -select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); -soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) as exp; +exp 阅000 -select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); -hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) as exp; +exp E99885303030 -select soundex(_utf8mb4 0xD091D092D093); -soundex(_utf8mb4 0xD091D092D093) +select soundex(_utf8mb4 0xD091D092D093) as exp; +exp Б000 -select hex(soundex(_utf8mb4 0xD091D092D093)); -hex(soundex(_utf8mb4 0xD091D092D093)) +select hex(soundex(_utf8mb4 0xD091D092D093)) as exp; +exp D091303030 SET collation_connection='utf8mb4_general_ci'; create table t1 select repeat('a',4000) a; @@ -1280,8 +1280,8 @@ concat(concat(_latin1'->',f1),_latin1'<-') -><- -><- drop table t1; -select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4); -convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4) +select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4) as exp; +exp 1 set names latin1; create table t1 (a varchar(10)) character set utf8mb4 engine MyISAM; diff --git a/mysql-test/main/ctype_utf8mb4_uca.result b/mysql-test/main/ctype_utf8mb4_uca.result index 65d8a07a3f3..d2212178817 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.result +++ b/mysql-test/main/ctype_utf8mb4_uca.result @@ -4031,8 +4031,8 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x1011103910191004103A1038 /* cooked rice */), (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); -SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; -id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id; +id exp 1 2259 108C 2 22593ACB 1037 3 22593ACC 1038 @@ -6117,20 +6117,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6255,20 +6255,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6394,20 +6394,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -6532,20 +6532,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/main/date_formats.result b/mysql-test/main/date_formats.result index 463cce39520..b3c0664fd6f 100644 --- a/mysql-test/main/date_formats.result +++ b/mysql-test/main/date_formats.result @@ -16,12 +16,11 @@ DATETIME_FORMAT %Y-%m-%d %H:%i:%s DATE_FORMAT %d.%m.%Y TIME_FORMAT %H.%i.%s select str_to_date(concat('15-01-2001',' 2:59:58.999'), -concat('%d-%m-%Y',' ','%H:%i:%s.%f')); -str_to_date(concat('15-01-2001',' 2:59:58.999'), -concat('%d-%m-%Y',' ','%H:%i:%s.%f')) +concat('%d-%m-%Y',' ','%H:%i:%s.%f')) as exp; +exp 2001-01-15 02:59:58.999000 -select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T'); -STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T') +select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T') as exp; +exp NULL Warnings: Warning 1411 Incorrect time value: '22.30.61' for function str_to_date @@ -256,8 +255,8 @@ Tuesday 52 2001 %W %V %X 00:00:00.000000 15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00.000000 15-01-20 %d-%m-%y 00:00:00.000000 15-2001-1 %d-%Y-%c 00:00:00.000000 -select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')); -concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) +select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) as exp; +exp 2003-01-02 08:11:02.123456 truncate table t1; insert into t1 values @@ -551,8 +550,8 @@ Thursday 01 January 2009 # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' # SET NAMES utf8; -SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); -LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))) +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))) as exp; +exp % SET NAMES latin1; # diff --git a/mysql-test/main/date_formats.test b/mysql-test/main/date_formats.test index 4f252f29a69..998fd42bbd9 100644 --- a/mysql-test/main/date_formats.test +++ b/mysql-test/main/date_formats.test @@ -2,9 +2,6 @@ # Test of date format functions # -#remove this include after fix MDEV-27871 --- source include/no_view_protocol.inc - --disable_warnings drop table if exists t1; --enable_warnings @@ -129,8 +126,8 @@ ORDER BY variable_name; # select str_to_date(concat('15-01-2001',' 2:59:58.999'), - concat('%d-%m-%Y',' ','%H:%i:%s.%f')); -select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T'); + concat('%d-%m-%Y',' ','%H:%i:%s.%f')) as exp; +select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T') as exp; create table t1 (date char(30), format char(30) not null); insert into t1 values @@ -175,7 +172,7 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1; select date,format,TIME(str_to_date(date, format)) as time from t1; select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; # Test small bug in %f handling -select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')); +select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) as exp; # Test wrong dates or converion specifiers @@ -363,7 +360,7 @@ SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; --echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' --echo # SET NAMES utf8; -SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))) as exp; SET NAMES latin1; --echo # diff --git a/mysql-test/main/fulltext_left_join.result b/mysql-test/main/fulltext_left_join.result index d5373037538..230ab39150d 100644 --- a/mysql-test/main/fulltext_left_join.result +++ b/mysql-test/main/fulltext_left_join.result @@ -16,16 +16,16 @@ author VARCHAR(255) NOT NULL INSERT INTO t2 VALUES('123', 'moi'); INSERT INTO t2 VALUES('123', 'lui'); INSERT INTO t2 VALUES('456', 'lui'); -select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) +select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) as exp from t1 left join t2 on t2.id=t1.id; -round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) +exp 0.00000 0.00000 0.67003 0.00000 -select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) +select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) as exp from t1 left join t2 on t2.id=t1.id; -match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) +exp 0 0 1 diff --git a/mysql-test/main/fulltext_left_join.test b/mysql-test/main/fulltext_left_join.test index 8d08fba4301..1763c1802b1 100644 --- a/mysql-test/main/fulltext_left_join.test +++ b/mysql-test/main/fulltext_left_join.test @@ -24,13 +24,10 @@ INSERT INTO t2 VALUES('123', 'moi'); INSERT INTO t2 VALUES('123', 'lui'); INSERT INTO t2 VALUES('456', 'lui'); -select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) +select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) as exp from t1 left join t2 on t2.id=t1.id; -#enable after fix MDEV-27871 ---disable_view_protocol -select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) +select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) as exp from t1 left join t2 on t2.id=t1.id; ---enable_view_protocol drop table t1, t2; diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result index e922134a9da..dfd30336dbb 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -1269,8 +1269,8 @@ SELECT * FROM v1; a GROUP_CONCAT(a ORDER BY a) NULL 10,20,30 DROP VIEW v1; -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); -(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') as exp; +exp 10,20,30 CREATE VIEW v1 AS SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index c9787ce4471..09703db334a 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -950,10 +950,7 @@ SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLU SELECT * FROM v1; DROP VIEW v1; -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); ---enable_view_protocol +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') as exp; CREATE VIEW v1 AS SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); SELECT * FROM v1; diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result index f5a823e4638..8fafa8704fc 100644 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@ -5,8 +5,8 @@ set global innodb_stats_persistent= 1; set global innodb_stats_persistent_sample_pages=100; create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB; insert into t1 values (1, 3); -select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; -count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ +select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ as exp from t1 group by MAX_REQ; +exp 1 select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; Case When Count(*) < MAX_REQ Then 1 Else 0 End diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index b1f9a28b190..6db7fdc2ad7 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -15,10 +15,7 @@ set global innodb_stats_persistent_sample_pages=100; create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB; --enable_warnings insert into t1 values (1, 3); -#enable after fix MDEV-27871 ---disable_view_protocol -select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; ---enable_view_protocol +select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ as exp from t1 group by MAX_REQ; select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; drop table t1; diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result index 36b61a782bd..c0204e1155a 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -871,15 +871,15 @@ DROP TABLE t1; # # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result # -SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32'); -TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') +SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp; +exp 1 -PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')"; +PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp"; EXECUTE stmt; -TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') +exp 1 EXECUTE stmt; -TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') +exp 1 DEALLOCATE PREPARE stmt; # diff --git a/mysql-test/main/func_in.test b/mysql-test/main/func_in.test index 1e335b4b4ad..d9a86e0fe8f 100644 --- a/mysql-test/main/func_in.test +++ b/mysql-test/main/func_in.test @@ -665,14 +665,11 @@ DROP TABLE t1; --echo # --echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32'); -PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')"; +SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp; +PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp"; EXECUTE stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; ---enable_view_protocol --echo # --echo # MDEV-11497 Wrong result for (int_expr IN (mixture of signed and unsigned expressions)) diff --git a/mysql-test/main/func_regexp_pcre.result b/mysql-test/main/func_regexp_pcre.result index c0d91dd9398..57490009be3 100644 --- a/mysql-test/main/func_regexp_pcre.result +++ b/mysql-test/main/func_regexp_pcre.result @@ -720,17 +720,17 @@ REGEXP_INSTR('ваÑÑ','Ñ') SELECT REGEXP_INSTR('ваÑÑ','Ñ'); REGEXP_INSTR('ваÑÑ','Ñ') 4 -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('в' USING koi8r)); -REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('в' USING koi8r)) +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('в' USING koi8r)) as exp; +exp 1 -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('а' USING koi8r)); -REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('а' USING koi8r)) +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('а' USING koi8r)) as exp; +exp 2 -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)); -REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) as exp; +exp 3 -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)); -REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) as exp; +exp 4 # # Checking REGEXP_SUBSTR @@ -757,8 +757,8 @@ t1 CREATE TABLE `t1` ( `REGEXP_SUBSTR('abc','b')+0` double NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; -SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*'); -REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*') +SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*') as exp; +exp https://mariadb.org # # MDEV-6027 RLIKE: "." no longer matching new line @@ -792,14 +792,14 @@ SELECT 'a\nb' RLIKE '(?-s)a.b'; 'a\nb' RLIKE '(?-s)a.b' 0 SET default_regex_flags=DEFAULT; -SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); +SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; ERROR 42000: Regex error 'two named subpatterns have the same name (PCRE2_DUPNAMES not set) at offset 30' SET default_regex_flags='DUPNAMES'; -SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); -REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') +SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; +exp Monday Mon -SELECT REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); -REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') +SELECT REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; +exp Tuesday Tue SET default_regex_flags=DEFAULT; SELECT 'AB' RLIKE 'A B'; @@ -850,8 +850,8 @@ SET default_regex_flags=DEFAULT; # # MDEV-6965 non-captured group \2 in regexp_replace # -SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); -REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that') +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that') as exp; +exp 1 this and that # # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable diff --git a/mysql-test/main/func_regexp_pcre.test b/mysql-test/main/func_regexp_pcre.test index e6e356f4a8c..c194e9aefd0 100644 --- a/mysql-test/main/func_regexp_pcre.test +++ b/mysql-test/main/func_regexp_pcre.test @@ -325,13 +325,10 @@ SELECT REGEXP_INSTR('ваÑÑ','в'); SELECT REGEXP_INSTR('ваÑÑ','а'); SELECT REGEXP_INSTR('ваÑÑ','Ñ'); SELECT REGEXP_INSTR('ваÑÑ','Ñ'); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('в' USING koi8r)); -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('а' USING koi8r)); -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)); -SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)); ---enable_view_protocol +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('в' USING koi8r)) as exp; +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('а' USING koi8r)) as exp; +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) as exp; +SELECT REGEXP_INSTR(CONVERT('ваÑÑ' USING koi8r), CONVERT('Ñ' USING koi8r)) as exp; --echo # --echo # Checking REGEXP_SUBSTR @@ -351,10 +348,7 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0; SHOW CREATE TABLE t1; DROP TABLE t1; -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*'); ---enable_view_protocol +SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*') as exp; --echo # --echo # MDEV-6027 RLIKE: "." no longer matching new line @@ -371,16 +365,13 @@ SELECT 'a\nb' RLIKE 'a.b'; SELECT 'a\nb' RLIKE '(?-s)a.b'; SET default_regex_flags=DEFAULT; -#enable after fix MDEV-27871 ---disable_view_protocol # note that old pcre2 reports a different offset --replace_result 29 30 --error ER_REGEXP_ERROR -SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); +SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; SET default_regex_flags='DUPNAMES'; -SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); -SELECT REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); ---enable_view_protocol +SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; +SELECT REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$') as exp; SET default_regex_flags=DEFAULT; SELECT 'AB' RLIKE 'A B'; @@ -416,10 +407,7 @@ SET default_regex_flags=DEFAULT; --echo # --echo # MDEV-6965 non-captured group \2 in regexp_replace --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); ---enable_view_protocol +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that') as exp; --echo # --echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable @@ -454,9 +442,6 @@ SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck; SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$'); --enable_result_log --enable_warnings -#enable after fix MDEV-27871 ---disable_view_protocol ---enable_view_protocol # # MDEV-12942 REGEXP_INSTR returns 1 when using brackets diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index e5a21af03a3..b5217d98fd2 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -40,11 +40,11 @@ position(binary 'll' in 'hello') position('a' in binary 'hello') select left('hello',null), right('hello',null); left('hello',null) right('hello',null) NULL NULL -select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ; +select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5); left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5) he lo el hello -select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ; -concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) +select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) as exp; +exp happy select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1); substring_index('www.tcx.se','.',-2) substring_index('www.tcx.se','.',1) @@ -172,23 +172,23 @@ the king of select substring_index('the king of the the hill','the',3); substring_index('the king of the the hill','the',3) the king of the -select concat(':',ltrim(' left '),':',rtrim(' right '),':'); -concat(':',ltrim(' left '),':',rtrim(' right '),':') +select concat(':',ltrim(' left '),':',rtrim(' right '),':') as exp; +exp :left : right: -select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); -concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':') +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':') as exp; +exp :left : right: -select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); -concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') +select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') as exp; +exp :left: right: -select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); -concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':') +select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':') as exp; +exp :m:y:s: -select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); -concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':') +select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':') as exp; +exp :my:sql: -select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':'); -concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':') +select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':') as exp; +exp :my:sql: select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo"); TRIM("foo" FROM "foo") TRIM("foo" FROM "foook") TRIM("foo" FROM "okfoo") @@ -202,8 +202,8 @@ NULL select concat_ws(',','',NULL,'a'); concat_ws(',','',NULL,'a') ,a -SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"'); -CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"') +SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"') as exp; +exp "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es') @@ -216,8 +216,8 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def replace('aaaa','a','bbbb') 253 16 16 Y 0 39 8 replace('aaaa','a','bbbb') bbbbbbbbbbbbbbbb -select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ; -replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') +select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') as exp; +exp this is a REAL test select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb') @@ -312,11 +312,11 @@ NULL NULL select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0"); least(1,2,3) | greatest(16,32,8) least(5,4)*1 greatest(-1.0,1.0)*1 least(3,2,1)*1.0 greatest(1,1.1,1.0) least("10",9) greatest("A","B","0") 33 4 1.0 1.0 1.1 9 B -select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000); -decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000) +select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000) as exp; +exp 1 -select decode(encode("abcdef","monty"),"monty")="abcdef"; -decode(encode("abcdef","monty"),"monty")="abcdef" +select decode(encode("abcdef","monty"),"monty")="abcdef" as exp; +exp 1 select quote('\'\"\\test'); quote('\'\"\\test') @@ -332,11 +332,11 @@ Warning 1365 Division by 0 select length(quote(concat(char(0),"test"))); length(quote(concat(char(0),"test"))) 8 -select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))); -hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))) +select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))) as exp; +exp 27E0E3E6E7E8EAEB27 -select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL); -unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") unhex(NULL) +select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL) as exp; +unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") exp foobar 1234567890ABCDEF 4Vx NULL select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456")); hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456")) @@ -409,17 +409,17 @@ bugstatus int(10) unsigned default NULL, submitter int(10) unsigned default NULL ) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4); -SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1; -CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') +SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') as exp FROM t1; +exp "Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4" -SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1; -CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') +SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') as exp FROM t1; +exp "Link";"1";"1";"1";"0";"4" -SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1; -CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) +SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) as exp FROM t1; +exp Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4 -SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; -bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') +SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') as exp from t1 group by bugdesc; +bugdesc exp aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa drop table t1; CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) ENGINE=MyISAM; @@ -2017,35 +2017,35 @@ hello select insert('hello', 4294967297, 4294967297, 'hi'); insert('hello', 4294967297, 4294967297, 'hi') hello -select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); -insert('hello', -18446744073709551615, -18446744073709551615, 'hi') +select insert('hello', -18446744073709551615, -18446744073709551615, 'hi') as exp; +exp hello Warnings: Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated -select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); -insert('hello', 18446744073709551615, 18446744073709551615, 'hi') +select insert('hello', 18446744073709551615, 18446744073709551615, 'hi') as exp; +exp hello -select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); -insert('hello', -18446744073709551616, -18446744073709551616, 'hi') +select insert('hello', -18446744073709551616, -18446744073709551616, 'hi') as exp; +exp hello Warnings: Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated -select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); -insert('hello', 18446744073709551616, 18446744073709551616, 'hi') +select insert('hello', 18446744073709551616, 18446744073709551616, 'hi') as exp; +exp hello Warnings: Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated -select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); -insert('hello', -18446744073709551617, -18446744073709551617, 'hi') +select insert('hello', -18446744073709551617, -18446744073709551617, 'hi') as exp; +exp hello Warnings: Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated -select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); -insert('hello', 18446744073709551617, 18446744073709551617, 'hi') +select insert('hello', 18446744073709551617, 18446744073709551617, 'hi') as exp; +exp hello Warnings: Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated @@ -2767,25 +2767,25 @@ CREATE TABLE t1 (a VARCHAR(20), b INT); CREATE TABLE t2 (a VARCHAR(20), b INT); INSERT INTO t1 VALUES ('ABC', 1); INSERT INTO t2 VALUES ('ABC', 1); -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; -DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +exp secret -SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; -DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +exp secret -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; -DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') +exp secret TRUNCATE TABLE t1; TRUNCATE TABLE t2; INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) as exp FROM t2 WHERE t2.b = 1 GROUP BY t2.b; -DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) +exp secret DROP TABLE t1, t2; # @@ -3067,10 +3067,8 @@ SELECT (rpad(1.0,2048,1)) IS NOT FALSE; 1 SELECT ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), -(32767.1))); -((+0) IN -((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), -(32767.1))) +(32767.1))) as exp; +exp 0 SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)) @@ -5024,8 +5022,8 @@ DROP TABLE t1; # # MDEV-24742 Server crashes in Charset::numchars / String::numchars # -SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux'); -NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux') +SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux') as exp; +exp NULL # # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index c42c27538d8..39957aabe70 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -31,14 +31,11 @@ select position(binary 'll' in 'hello'),position('a' in binary 'hello'); # strange undocumented behaviour, strict mode # select left('hello',null), right('hello',null); -select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ; -#enable after fix MDEV-27871 ---disable_view_protocol -select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ; +select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5); +select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) as exp; select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1); select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1); select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1); ---enable_view_protocol select substring_index('aaaaaaaaa1','a',1); select substring_index('aaaaaaaaa1','aa',1); select substring_index('aaaaaaaaa1','aa',2); @@ -79,32 +76,28 @@ select substring_index('the king of the the hill','the',1); select substring_index('the king of the the hill','the',2); select substring_index('the king of the the hill','the',3); -select concat(':',ltrim(' left '),':',rtrim(' right '),':'); -#enable after fix MDEV-27871 ---disable_view_protocol -select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); -select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); -select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); -select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); -select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':'); +select concat(':',ltrim(' left '),':',rtrim(' right '),':') as exp; +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':') as exp; +select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') as exp; +select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':') as exp; +select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':') as exp; +select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':') as exp; select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo"); ---enable_view_protocol select concat_ws(', ','monty','was here','again'); select concat_ws(NULL,'a'),concat_ws(',',NULL,''); select concat_ws(',','',NULL,'a'); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"'); +SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"') as exp; select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c'); +--disable_view_protocol --enable_metadata select replace('aaaa','a','bbbb'); --disable_metadata -select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ; -select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); --enable_view_protocol +select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') as exp; +select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); select 'mood' sounds like 'mud'; select 'Glazgo' sounds like 'Liverpool'; select null sounds like 'null'; @@ -137,32 +130,22 @@ select rpad('abcd',7),lpad('abcd',7); select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'); select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0"); -#enable after fix MDEV-27871 ---disable_view_protocol -select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000); ---enable_view_protocol -select decode(encode("abcdef","monty"),"monty")="abcdef"; +select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000) as exp; +select decode(encode("abcdef","monty"),"monty")="abcdef" as exp; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); select length(quote(concat(char(0),"test"))); -#enable after fix MDEV-27871 ---disable_view_protocol -select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))); -select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL); ---enable_view_protocol +select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))) as exp; +select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL) as exp; select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456")); select length(unhex(md5("abrakadabra"))); # # Bug #6564: QUOTE(NULL # - -#enable after fix MDEV-28651 ---disable_view_protocol select concat('a', quote(NULL)); ---enable_view_protocol # # Wrong usage of functions @@ -211,14 +194,11 @@ CREATE TABLE t1 ( submitter int(10) unsigned default NULL ) ENGINE=MyISAM; -#enable after fix MDEV-27871 ---disable_view_protocol INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4); -SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1; -SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1; -SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1; -SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; ---enable_view_protocol +SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') as exp FROM t1; +SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') as exp FROM t1; +SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) as exp FROM t1; +SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') as exp from t1 group by bugdesc; drop table t1; # @@ -1135,15 +1115,12 @@ select insert('hello', -4294967296, -4294967296, 'hi'); select insert('hello', 4294967296, 4294967296, 'hi'); select insert('hello', -4294967297, -4294967297, 'hi'); select insert('hello', 4294967297, 4294967297, 'hi'); -#enable after fix MDEV-27871 ---disable_view_protocol -select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); -select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); -select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); -select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); -select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); -select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); ---enable_view_protocol +select insert('hello', -18446744073709551615, -18446744073709551615, 'hi') as exp; +select insert('hello', 18446744073709551615, 18446744073709551615, 'hi') as exp; +select insert('hello', -18446744073709551616, -18446744073709551616, 'hi') as exp; +select insert('hello', 18446744073709551616, 18446744073709551616, 'hi') as exp; +select insert('hello', -18446744073709551617, -18446744073709551617, 'hi') as exp; +select insert('hello', 18446744073709551617, 18446744073709551617, 'hi') as exp; select repeat('hello', -1); select repeat('hello', -4294967295); @@ -1488,17 +1465,14 @@ CREATE TABLE t2 (a VARCHAR(20), b INT); INSERT INTO t1 VALUES ('ABC', 1); INSERT INTO t2 VALUES ('ABC', 1); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; -SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') as exp FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; ---enable_view_protocol TRUNCATE TABLE t1; TRUNCATE TABLE t2; @@ -1506,11 +1480,8 @@ TRUNCATE TABLE t2; INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) as exp FROM t2 WHERE t2.b = 1 GROUP BY t2.b; ---enable_view_protocol DROP TABLE t1, t2; @@ -1676,14 +1647,11 @@ SELECT CONV(1,-2147483648,-2147483648); --echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY --echo # -#enable after fix MDEV-27871 ---disable_view_protocol SELECT (rpad(1.0,2048,1)) IS NOT FALSE; SELECT ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), -(32767.1))); +(32767.1))) as exp; SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); ---enable_view_protocol --error 1690 SELECT @@ -2111,10 +2079,7 @@ DROP TABLE t1; --echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux'); ---enable_view_protocol +SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux') as exp; --echo # --echo # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY diff --git a/mysql-test/main/func_time_hires.result b/mysql-test/main/func_time_hires.result index c6fcec73696..812e2fb49b7 100644 --- a/mysql-test/main/func_time_hires.result +++ b/mysql-test/main/func_time_hires.result @@ -162,17 +162,17 @@ cast(cast(@a as time(2)) as time(6)) 12:13:14.120000 select CAST(@a AS DATETIME(7)); ERROR 42000: Too big precision 7 specified for '@`a`'. Maximum is 6 -SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); -CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') +SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') as exp; +exp 2011-01-02 15:00:00 -SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); -CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00') +SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00') as exp; +exp 2011-01-02 15:00:00.123 -SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); -CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00') +SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00') as exp; +exp 2011-01-02 15:00:00.123456 -SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00'); -CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00') +SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00') as exp; +exp 2010-10-10 13:10:10.1234 create table t1 (a varchar(200)); insert t1 values (now(6)); diff --git a/mysql-test/main/func_time_hires.test b/mysql-test/main/func_time_hires.test index dca8d458f8a..507c7ac240f 100644 --- a/mysql-test/main/func_time_hires.test +++ b/mysql-test/main/func_time_hires.test @@ -80,13 +80,10 @@ select CAST(@a AS DATETIME(7)); # # CONVERT_TZ # -SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); -SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); -SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00'); ---enable_view_protocol +SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') as exp; +SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00') as exp; +SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00') as exp; +SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00') as exp; # # Field::store_time() diff --git a/mysql-test/main/gis-debug.result b/mysql-test/main/gis-debug.result index 7d143ad3f45..7c217c16393 100644 --- a/mysql-test/main/gis-debug.result +++ b/mysql-test/main/gis-debug.result @@ -238,30 +238,26 @@ dist buffer buf_area -1 POLYGON 16.00 SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')); -ST_CONTAINS( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')) +GeomFromText('POINT(5 10)')) as geom; +geom 0 SELECT AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))); -AsText(ST_UNION( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))) +GeomFromText('POINT(5 10)'))) as geom; +geom GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10)) DROP PROCEDURE p1; # # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) as geom; +geom POLYGON # # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) as geom; +geom POLYGON # # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER @@ -272,27 +268,21 @@ Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); -ST_WITHIN( -LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), -ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ') +ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))) as st; +st 0 SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); -ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) +ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) as st; +st 2 SELECT ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); -ST_NUMINTERIORRINGS( -ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) +SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) as st; +st 0 SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); -ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) +SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) as st; +st POLYGON((9 9,5 2,4 5,9 9)) # # Start of 10.2 tests diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index 513d8b6e8c2..a75b71f4c8b 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -1,21 +1,21 @@ DROP TABLE IF EXISTS t1; -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); -1 ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')) +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')) as result; +1 result 1 1 -select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); -0 ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')) +select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')) as result; +0 result 0 0 -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')); -1 ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')) +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')) as result; +1 result 1 1 -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -1 ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +1 result 1 1 -select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -0 ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +0 result 0 0 -select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); -1 ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')) +select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')) as result; +1 result 1 1 create table t1 (g point); insert into t1 values @@ -66,89 +66,89 @@ POINT(6 2) POINT(6 6) POINT(8 4) DROP TABLE t1; -select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -0 ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +0 result 0 0 -select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -1 ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +1 result 1 1 -select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)')); -1 ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)')) +select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)')) as result; +1 result 1 1 -select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)')); -0 ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)')) +select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)')) as result; +0 result 0 1 -select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); -1 ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) +select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) as result; +1 result 1 1 -select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); -astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) +select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) as result; +result POLYGON((0 0,1 2,2 0,0 0)) -select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); -astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) +select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) as result; +result POINT(1 1) -select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); -ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) +select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) as result; +result 1 -select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')); -ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')) +select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')) as result; +result 0 -select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')); -ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')) +select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')) as result; +result 1 -select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); -ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) +select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) as result; +result 0 -select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); -ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) +select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) as result; +result 1 -select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); -ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')) +select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')) as result; +result 0 -select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); -ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; +result 0.7071067811865475 -select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)')); -ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)')) +select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)')) as result; +result 0 -select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); -ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; +result 0 -select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)')); -ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)')) +select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)')) as result; +result 0.4472135954999579 -select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); -ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; +result 0.8944271909999159 -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))); -astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))) +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))) as result; +result POLYGON((26.47058823529412 23.823529411764707,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734,29.289940828402365 26.36094674556213,26.47058823529412 23.823529411764707)) -select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))); -astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))) +select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))) as result; +result MULTIPOINT(26.47058823529412 23.823529411764707,29.289940828402365 26.36094674556213,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734) -select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))); -astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))) +select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))) as result; +result POINT(29.289940828402365 26.36094674556213) -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)'))); -astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)'))) +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)'))) as result; +result POINT(20 20) -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)'))); -astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)'))) +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)'))) as result; +result LINESTRING(0 0,46.666666666666664 46.666666666666664) -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); -astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; +result MULTILINESTRING((0 0,46.666666666666664 46.666666666666664),(8 10,45.33333333333333 47.33333333333333)) -select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); -astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; +result GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) -select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); -astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) +select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) as result; +result POLYGON((0 0,0 1,0.5 0.5,0 0)) -select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); -astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) +select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) as result; +result MULTIPOLYGON(((0 0,0.5 0.5,1 0,0 0)),((0.5 0.5,0 1,0 2,1 1,0.5 0.5))) -select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); -astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; +result GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) select astext(ST_buffer(geometryfromtext('point(1 1)'), 1)); astext(ST_buffer(geometryfromtext('point(1 1)'), 1)) @@ -170,26 +170,26 @@ select ST_NUMPOINTS(ST_EXTERIORRING(@buff)); ST_NUMPOINTS(ST_EXTERIORRING(@buff)) 202 DROP TABLE t1; -select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')); -st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')) +select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')) as result; +result 0 -select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')); -st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')) +select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')) as result; +result 0 -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')); -st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')) +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')) as result; +result 1 -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)')); -st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)')) +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)')) as result; +result 0 -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)')); -st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)')) +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)')) as result; +result 0 -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); -st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) as result; +result 0 -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); -st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) as result; +result 1 SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result; result @@ -226,16 +226,14 @@ SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t; ERROR HY000: Illegal parameter data type boolean for operation 'st_astext' SELECT astext(ST_UNION ( PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), -ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))); -astext(ST_UNION ( -PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), -ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))) +ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))) as result; +result GEOMETRYCOLLECTION(POLYGON((0 0,1 9,8 2,0 0),(2 2,2 7,3 2,2 2)),LINESTRING(0.5555555555555556 5,0 5,0 0,5 0,5 1.25),LINESTRING(2 5,2.4 5)) SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)); astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)) LINESTRING(0 0,1 1) -SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5); -Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5) +SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5) as result; +result 78.68426 SELECT ST_INTERSECTION(NULL, NULL); ST_INTERSECTION(NULL, NULL) @@ -247,21 +245,14 @@ MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)) MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 4,2 5,3 5)), ((2 2,9 2,0 2,2 6,2 2)), ((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), - ((9 9,6 8,7 0,9 9)))'))); -ASTEXT(ST_INTERSECTION( -MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)), - ((0 5,3 5,3 0,0 0,0 1,2 1,2 2,0 2,0 5), (1 3,2 3,2 4,1 4,1 3)), - ((2 2,5 2,4 4,2 8,2 2)))'), -MULTIPOLY + ((9 9,6 8,7 0,9 9)))'))) as result; +result POLYGON((0 2,1 4,1 3,2 3,2 4,1 4,1.5 5,2 5,2 8,8 8,8 2,0 2),(4 4,4 6,6 6,6 4,4 4)) SELECT ROUND(ST_LENGTH(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0), (8 2,1 3,9 0,4 4))'), -MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7); -ROUND(ST_LENGTH(ST_UNION( -MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0), - (8 2,1 3,9 0,4 4))'), -MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6) +MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7) as result; +result 90.2783626 SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8), @@ -274,18 +265,13 @@ MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 0,9 3,2 5,3 6,3 2), MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((7 7,3 7,3 1,7 8,7 7)), ((3 5,2 4,2 5,3 5)), ((7 7,8 7,3 7,7 7,7 7)), - ((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))')))); -ST_NUMGEOMETRIES((ST_UNION(ST_UNION( -MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8), - (6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0), - + ((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))')))) as result; +result 192 SELECT Round(ST_AREA(ST_BUFFER( ST_UNION( POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'), -POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6); -Round(ST_AREA(ST_BUFFER( ST_UNION( -POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'), -POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6) +POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6) as result; +result 21.901344 SELECT AsText(ST_UNION(MultiPolygonFromText(' MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)), @@ -294,21 +280,14 @@ SELECT AsText(ST_UNION(MultiPolygonFromText(' MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)), ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)), ((7 7, 4 7, 6 3, 7 2, 7 7)), - ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) '))); -AsText(ST_UNION(MultiPolygonFromText(' - MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)), - ((0 0, 8 3, 7 4, 0 0)), - ((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'), -MultiPolygonFr + ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) '))) as result; +result POLYGON((0 0,0 5,0.5555555555555556 5,1 9,2 8,8 8,8 2,5.333333333333334 2,3 1.125,3 0,0 0),(1 1,1 1.5,1.3333333333333333 2,2 2,2 1.1428571428571428,1.75 1,1 1),(3 1.7142857142857142,3 2,3.5 2,3 1.7142857142857142),(4 4,4 6,4.5 6,5.5 4,4 4)) SELECT AsText(ST_SYMDIFFERENCE( MultiLineStringFromText('MULTILINESTRING((7 7, 1 7, 8 5, 7 8, 7 7), (6 3, 3 4, 1 1, 9 9, 9 0, 8 4, 9 9))'), -Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)')))); -AsText(ST_SYMDIFFERENCE( -MultiLineStringFromText('MULTILINESTRING((7 7, 1 7, 8 5, 7 8, 7 7), - (6 3, 3 4, 1 1, 9 9, 9 0, 8 4, 9 9))'), -Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)')))) +Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)')))) as result; +result GEOMETRYCOLLECTION(POLYGON((0 0,0 9,7 9,7 0,0 0)),LINESTRING(9 9,8 4,9 0,9 9),LINESTRING(7 5.285714285714286,8 5,7.25 7.25),LINESTRING(7 7,7.25 7.25),LINESTRING(7.25 7.25,7 8),LINESTRING(7.25 7.25,9 9)) SELECT AsText(ST_UNION( MultiPolygonFromText('MULTIPOLYGON(((9 9, 7 9, 1 1, 9 9)), @@ -316,50 +295,38 @@ MultiPolygonFromText('MULTIPOLYGON(((9 9, 7 9, 1 1, 9 9)), ((0 0, 7 5, 9 6, 0 0)), ((7 7, 5 7, 1 5, 7 1, 7 7)))'), MultiPolygonFromText('MULTIPOLYGON(((2 2, 2 2, 1 5, 2 7, 2 2)), - ((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))'))); -AsText(ST_UNION( -MultiPolygonFromText('MULTIPOLYGON(((9 9, 7 9, 1 1, 9 9)), - ((2 2, 1 2, 3 3, 2 2, 2 2)), - ((0 0, 7 5, 9 6, 0 0)), - + ((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))'))) as result; +result POLYGON((0 0,0 5,1 5,2 7,2 5.5,5 7,5.5 7,7 9,9 9,7 7,7 5,9 6,7 4.666666666666667,7 1,4.25 2.833333333333333,3 2,3 0,0 0),(1 1,1 4,1.3333333333333333 4,1.8571428571428572 2.4285714285714284,1 2,1.75 2,1 1,2 2,2 1.4285714285714284,1.4 1,1 1),(1.5 1,2 1.3333333333333333,2 1,1.5 1),(3 2.142857142857143,3 3,3.4 3.4,4.1034482758620685 2.9310344827586206,3 2.142857142857143)) SELECT AsText( ST_INTERSECTION( LinestringFromText('LINESTRING( 3 5, 2 5, 2 4, 3 4, 3 5 ) ') , LinestringFromText('LINESTRING( 3 5, 2 4, 2 5, 3 5 ) ') -)); -AsText( ST_INTERSECTION( -LinestringFromText('LINESTRING( 3 5, 2 5, 2 4, 3 4, 3 5 ) ') , -LinestringFromText('LINESTRING( 3 5, 2 4, 2 5, 3 5 ) ') -)) +)) as result; +result LINESTRING(2 4,2 5,3 5) SELECT AsText( ST_UNION( PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 7 5 , 2 0 , 2 2 ) ) ') , -PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) ); -AsText( ST_UNION( -PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 7 5 , 2 0 , 2 2 ) ) ') , -PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) ) +PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) ) as result; +result POLYGON((2 0,2 5,3 3,3 2,7 5,2 0)) -SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)'))); -AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)'))) +SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)'))) as result; +result GEOMETRYCOLLECTION EMPTY -SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))'))); -AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))'))) +SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))'))) as result; +result GEOMETRYCOLLECTION(POINT(8 1),LINESTRING(2 4,2 5,3 5,3 4,2 4)) SELECT ST_DISTANCE(POINTFROMTEXT('POINT(7 1)'),MULTILINESTRINGFROMTEXT('MULTILINESTRING( - (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))')); -ST_DISTANCE(POINTFROMTEXT('POINT(7 1)'),MULTILINESTRINGFROMTEXT('MULTILINESTRING( - (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))')) + (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))')) as result; +result 1 -SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))'))); -AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))'))) +SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))'))) as result; +result GEOMETRYCOLLECTION(POLYGON((2 0,2 2,3 2,3 6,12 9,3 0,3 1,2 0)),LINESTRING(5 2,7 2)) SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) , MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2, 1 5))') -), 16))); -ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION( -MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) , -MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2 +), 16))) as result; +result 278 SELECT ST_NUMGEOMETRIES(ST_DIFFERENCE ( ST_UNION ( @@ -372,10 +339,8 @@ MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) ) ), MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 9 , 1 3 , 7 3 , 8 5 ) , ( 5 0 , 8 1 , 2 0 , 7 4 , 1 0 ) , ( 9 2 , 5 2 , 6 5 , 8 8 , 0 2 ) , ( 0 8 , 3 9 , 4 0 , 1 0 ) , ( 0 0 , 7 6 , 8 3 , 0 0 ) ) ' ) -)); -ST_NUMGEOMETRIES(ST_DIFFERENCE ( -ST_UNION ( -MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 4 , 5 0 , 2 9 , 6 2 , 0 2 ) , ( 4 3 , 5 6 , 9 4 , 0 7 , 7 2 , 2 0 , 8 2 ) , ( 5 0 , 1 5 , 3 7 , 7 7 ) , ( 2 3 , 9 5 , 2 0 , 8 1 ) , ( 0 9 , 9 3 , 2 8 , 8 1 , 9 4 ) +)) as result; +result 125 SELECT ASTEXT(ST_DIFFERENCE ( POLYGONFROMTEXT( ' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ' ) , @@ -389,21 +354,14 @@ GEOMETRYFROMTEXT( ' MULTILINESTRING( ( 3 7 , 7 3 , 5 8 , 4 8 ) , ( 3 2 , 5 0 , 9 ) ) ) -)); -ASTEXT(ST_DIFFERENCE ( -POLYGONFROMTEXT( ' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ' ) , -ST_UNION ( -MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ' ) , -ST_SYMDIFFERENCE ( -MULTILINESTRINGFROMTEX +)) as result; +result POLYGON((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)) SELECT ST_NUMGEOMETRIES(ST_UNION ( MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 0 8 , 1 9 , 5 7 , 2 8 , 5 8 , 6 7 ) , ( 4 5 , 8 4 , 0 3 , 5 1 ) , ( 6 8 , 2 7 , 1 6 , 9 9 , 7 2 ) , ( 9 5 , 2 8 , 1 2 , 9 6 , 2 0 ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 7 7 , 2 7, 6 8, 7 1 , 7 7 ) ) ) ' ) -)); -ST_NUMGEOMETRIES(ST_UNION ( -MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 0 8 , 1 9 , 5 7 , 2 8 , 5 8 , 6 7 ) , ( 4 5 , 8 4 , 0 3 , 5 1 ) , ( 6 8 , 2 7 , 1 6 , 9 9 , 7 2 ) , ( 9 5 , 2 8 , 1 2 , 9 6 , 2 0 ) ) ' ) , -MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( +)) as result; +result 50 SELECT ST_BUFFER ( LINESTRINGFROMTEXT( ' LINESTRING( 5 4 , 3 8 , 2 6 , 5 5 , 7 9 ) ' ) , @@ -414,49 +372,50 @@ MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ) ) -) ; -ST_BUFFER ( -LINESTRINGFROMTEXT( ' LINESTRING( 5 4 , 3 8 , 2 6 , 5 5 , 7 9 ) ' ) , -ST_DISTANCE ( -MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) , +) as result; +result +NULL +SELECT ST_DISTANCE ( ST_DIFFERENCE ( -MULTIPOL +MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , +MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) +), +MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) +) as result; +result NULL -SELECT ST_DISTANCE ( ST_DIFFERENCE ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ), MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ) ; -ST_DISTANCE ( ST_DIFFERENCE ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , -NULL -SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') )); -ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)) +SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') )) as result; +result MULTIPOINT(7 5,7 5.142857142857142,5.899999999999998 5.300000000000001,5.799999999999997 5.600000000000001,3 7) -SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')); -ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')) +SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')) as result; +result 0 -SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ); -ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ) +SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ) as result; +result 0 -SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) ')); -ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) ')) +SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) ')) as result; +result 1 -select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY'))); -ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY'))) +select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY'))) as result; +result GEOMETRYCOLLECTION EMPTY -SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') ); -ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') ) +SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') ) as result; +result 0 -SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') ); -ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') ) +SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') ) as result; +result 0 -SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') ); -ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') ) +SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') ) as result; +result 0 -SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') ); -ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') ) +SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') ) as result; +result 1 -SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ')); -ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ')) +SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ')) as result; +result 0 -SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') ); -ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19, +SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') ) as result; +result 1 SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, -2.910427500435995 0.727606875108998, @@ -464,26 +423,20 @@ SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 7.664100588675687 1.503849116986468, 1.664100588675687 -2.496150883013531, 0.0 -3.0 -))' ), 3 ))); -ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, - -2.910427500435995 0.727606875108998, - -0.910427500435995 8.727606875108998, - 7.664100588675687 1.503849116986468, - 1.664100588675687 -2.496150883013531, - 0.0 -3.0 -))' ), +))' ), 3 ))) as result; +result 136 -select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)); -astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)) +select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)) as result; +result GEOMETRYCOLLECTION EMPTY -select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')); -ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) +select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) as result; +result 1 -select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')); -ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) +select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) as result; +result 1 -select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')); -ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) +select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) as result; +result 0 SELECT ST_RELATE( ST_DIFFERENCE( @@ -750,30 +703,26 @@ dist buffer buf_area -1 POLYGON 16.00 SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')); -ST_CONTAINS( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')) +GeomFromText('POINT(5 10)')) as geom; +geom 0 SELECT AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))); -AsText(ST_UNION( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))) +GeomFromText('POINT(5 10)'))) as geom; +geom GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10)) DROP PROCEDURE p1; # # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) as geom; +geom POLYGON # # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) as geom; +geom POLYGON # # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER @@ -784,27 +733,21 @@ Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); -ST_WITHIN( -LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), -ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ') +ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))) as st; +st 0 SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); -ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) +ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) as st; +st 2 SELECT ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); -ST_NUMINTERIORRINGS( -ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) +SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) as st; +st 0 SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); -ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) +SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) as st; +st POLYGON((9 9,5 2,4 5,9 9)) # # MDEV-13467 Feature request: Support for ST_Distance_Sphere() @@ -832,74 +775,74 @@ ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere. SELECT ST_DISTANCE_SPHERE(1, 1, NULL); ST_DISTANCE_SPHERE(1, 1, NULL) NULL -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; ERROR HY000: Internal error: st_distance_sphere # Test Points and radius -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) as result; +result 157249.0357231545 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result; +result 157225.0865419108 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result; +result 0.024682056391766436 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; ERROR HY000: Internal error: Radius must be greater than zero. -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; ERROR HY000: Internal error: Radius must be greater than zero. # Test longitude/lattitude -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; +result 157225.0865419108 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10) as result; +result 222355.4901806686 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; +result 222389.3645969269 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')) as result; +result 157249.0357231545 # Test Points - Multipoints -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')) as result; +result 157249.0357231545 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')) as result; +result 157249.0357231545 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')) as result; +result 157249.0357231545 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')) as result; +result 157249.0357231545 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1) as result; +result 0.024682056391766436 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1) as result; +result 0.024682056391766436 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1) as result; +result 0.024682056391766436 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1) as result; +result 0.024682056391766436 # Test Multipoints - Multipoints -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')); -ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')) +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')) as result; +result 0 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10) as result; +result 314282.5644496733 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result; +result 314282.5644496733 -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17); -TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result; +result 0.04933028646581131 -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; ERROR HY000: Internal error: Radius must be greater than zero. set @pt1 = ST_GeomFromText('POINT(190 -30)'); set @pt2 = ST_GeomFromText('POINT(-30 50)'); diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index ceaf1f1b89a..666c443e5fe 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -9,15 +9,12 @@ DROP TABLE IF EXISTS t1; --enable_warnings -#enable after fix MDEV-27871 ---disable_view_protocol -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); -select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')); -select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); ---enable_view_protocol +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')) as result; +select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')) as result; +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')) as result; +select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')) as result; create table t1 (g point); insert into t1 values @@ -38,53 +35,49 @@ select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, DROP TABLE t1; -#enable after fix MDEV-27871 ---disable_view_protocol -select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); -select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; +select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) as result; -select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)')); -select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)')); +select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)')) as result; +select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)')) as result; -select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); +select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) as result; -select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); -select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); +select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) as result; +select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) as result; -select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); -select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')); -select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')); -select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); -select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); -select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); +select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) as result; +select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')) as result; +select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')) as result; +select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) as result; +select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) as result; +select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')) as result; # Distance tests -select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); -select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)')); -select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); -select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)')); -select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; +select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)')) as result; +select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; +select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)')) as result; +select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) as result; # Operations tests -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))); -select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))); -select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))); -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)'))); -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)'))); +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))) as result; +select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))) as result; +select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))) as result; +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)'))) as result; +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)'))) as result; --replace_result 7.999999999999999 8 -select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; --replace_result 7.999999999999999 8 -select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; -select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); +select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) as result; -select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); +select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) as result; --replace_result 7.999999999999999 8 -select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); - ---enable_view_protocol +select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) as result; # Buffer() tests --replace_result 0012045437948276 00120454379482759 @@ -103,25 +96,20 @@ select ST_NUMPOINTS(ST_EXTERIORRING(@buff)); # cleanup DROP TABLE t1; -#enable after fix MDEV-27871 ---disable_view_protocol - #Touches tests -select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')); -select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')); -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')); -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)')); -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)')); -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); -select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); +select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')) as result; +select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')) as result; +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')) as result; +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)')) as result; +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)')) as result; +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) as result; +select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) as result; #Equals test SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result; SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result; SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result; ---enable_view_protocol - --echo # --echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD --echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL @@ -150,30 +138,19 @@ SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t; # bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION -#enable after fix MDEV-27871 ---disable_view_protocol - SELECT astext(ST_UNION ( PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), - ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))); - ---enable_view_protocol + ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))) as result; #bug 801189 ST_BUFFER asserts if radius = 0 SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)); -#enable after fix MDEV-27871 ---disable_view_protocol #bug 801199 Infinite recursion in Gcalc_function::count_internal with ST_BUFFER over MULTIPOINT -SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5); ---enable_view_protocol +SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5) as result; #bug 801212 Assertion with ST_INTERSECTION on NULL values SELECT ST_INTERSECTION(NULL, NULL); -#enable after fix MDEV-27871 ---disable_view_protocol - #bug 804305 Crash in wkb_get_double with ST_INTERSECTION SELECT ASTEXT(ST_INTERSECTION( MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)), @@ -182,14 +159,14 @@ SELECT ASTEXT(ST_INTERSECTION( MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 4,2 5,3 5)), ((2 2,9 2,0 2,2 6,2 2)), ((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), - ((9 9,6 8,7 0,9 9)))'))); + ((9 9,6 8,7 0,9 9)))'))) as result; #bug 804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection SELECT ROUND(ST_LENGTH(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0), (8 2,1 3,9 0,4 4))'), - MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7); + MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7) as result; SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8), @@ -202,13 +179,13 @@ SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION( MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((7 7,3 7,3 1,7 8,7 7)), ((3 5,2 4,2 5,3 5)), ((7 7,8 7,3 7,7 7,7 7)), - ((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))')))); + ((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))')))) as result; #bug #805860 Second assertion Assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sinco SELECT Round(ST_AREA(ST_BUFFER( ST_UNION( POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'), - POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6); + POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6) as result; #bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult @@ -220,7 +197,7 @@ SELECT AsText(ST_UNION(MultiPolygonFromText(' MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)), ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)), ((7 7, 4 7, 6 3, 7 2, 7 7)), - ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) '))); + ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) '))) as result; #bug 801217 Assertion `t1->result_range' in Gcalc_operation_reducer::end_couple @@ -228,7 +205,7 @@ MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)), SELECT AsText(ST_SYMDIFFERENCE( MultiLineStringFromText('MULTILINESTRING((7 7, 1 7, 8 5, 7 8, 7 7), (6 3, 3 4, 1 1, 9 9, 9 0, 8 4, 9 9))'), - Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)')))); + Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)')))) as result; #bug 804266 Memory corruption/valgrind warning/crash in move_hole() with ST_UNION @@ -238,34 +215,34 @@ SELECT AsText(ST_UNION( ((0 0, 7 5, 9 6, 0 0)), ((7 7, 5 7, 1 5, 7 1, 7 7)))'), MultiPolygonFromText('MULTIPOLYGON(((2 2, 2 2, 1 5, 2 7, 2 2)), - ((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))'))); + ((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))'))) as result; #bug 802376 ST_INTERSECTION returns wrong result on two overlapping linestrings in maria-5.3-gis SELECT AsText( ST_INTERSECTION( LinestringFromText('LINESTRING( 3 5, 2 5, 2 4, 3 4, 3 5 ) ') , LinestringFromText('LINESTRING( 3 5, 2 4, 2 5, 3 5 ) ') -)); +)) as result; #bug 801560 ST_UNION of adjacent polygons includes extra line in maria-5.3-gis SELECT AsText( ST_UNION( PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 7 5 , 2 0 , 2 2 ) ) ') , - PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) ); + PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) ) as result; #bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis -SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)'))); +SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)'))) as result; #bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis -SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))'))); +SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))'))) as result; #bug 839318 Crash in Gcalc_scan_iterator::point::get_shape with ST_DISTANCE and MULTILINESTRING in maria-5.3-gis SELECT ST_DISTANCE(POINTFROMTEXT('POINT(7 1)'),MULTILINESTRINGFROMTEXT('MULTILINESTRING( - (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))')); + (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))')) as result; #bug 839327 Crash in Gcalc_operation_reducer::end_couple with ST_UNION and MULTIPOLYGONs in 5.3-gis -SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))'))); +SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))'))) as result; #bug 841622 Assertion `t->rp->type == Gcalc_function::shape_line' failed in Gcalc_operation_reducer::end_line in maria-5.3-gis @@ -273,7 +250,7 @@ SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYG SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION( MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) , MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2, 1 5))') - ), 16))); + ), 16))) as result; #bug 841625 Assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis @@ -288,7 +265,7 @@ SELECT ST_NUMGEOMETRIES(ST_DIFFERENCE ( ) ), MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 9 , 1 3 , 7 3 , 8 5 ) , ( 5 0 , 8 1 , 2 0 , 7 4 , 1 0 ) , ( 9 2 , 5 2 , 6 5 , 8 8 , 0 2 ) , ( 0 8 , 3 9 , 4 0 , 1 0 ) , ( 0 0 , 7 6 , 8 3 , 0 0 ) ) ' ) -)); +)) as result; #bug 841745 ssertion `!sp0->is_bottom()' failed in Gcalc_scan_iterator::find_intersections in maria-5.3-gis @@ -304,13 +281,13 @@ SELECT ASTEXT(ST_DIFFERENCE ( ) ) ) -)); +)) as result; #bug 841773 Assertion `t0->rp->type == t1->rp->type' failed in Gcalc_operation_reducer::end_couple in maria-5.3-gis SELECT ST_NUMGEOMETRIES(ST_UNION ( MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 0 8 , 1 9 , 5 7 , 2 8 , 5 8 , 6 7 ) , ( 4 5 , 8 4 , 0 3 , 5 1 ) , ( 6 8 , 2 7 , 1 6 , 9 9 , 7 2 ) , ( 9 5 , 2 8 , 1 2 , 9 6 , 2 0 ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 7 7 , 2 7, 6 8, 7 1 , 7 7 ) ) ) ' ) -)); +)) as result; #bug 841662 Third assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sincos SELECT ST_BUFFER ( @@ -322,47 +299,53 @@ SELECT ST_BUFFER ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ) ) - ) ; -SELECT ST_DISTANCE ( ST_DIFFERENCE ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ), MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ) ; + ) as result; +SELECT ST_DISTANCE ( + ST_DIFFERENCE ( + MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , + MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) + ), + MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) +) as result; #bug 848939 Wrong result with ST_INTERSECTION between linestrings and a polygon in 5.3-gis -SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') )); +SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') )) as result; #bug 855485 ST_CROSSES returns different result than PostGIS for overlapping polygons -SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')); +SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')) as result; #bug 855487 ST_WITHIN returns wrong result for partially overlapping polygons -SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ); +SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ) as result; #bug 855492 ST_WITHIN returns TRUE on point on the edge of a polygon -SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) ')); +SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) ')) as result; #bug 855497 ST_ENVELOPE of GEOMETRYCOLLECTION EMPTY returns NULL and not GEOMETRYCOLLECTION EMPTY -select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY'))); +select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY'))) as result; #bug 855503 ST_EQUALS reports TRUE between a POLYGON and a MULTILINESTRING -SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') ); +SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') ) as result; #bug 855505 ST_TOUCHES reports TRUE for intersecting polygon and linestring -SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') ); +SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') ) as result; #bug 857051 ST_EQUALS returns TRUE on two nonidentical MULTIPOINTs -SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') ); -SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') ); +SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') ) as result; +SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') ) as result; #bug 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON -SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ')); +SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ')) as result; #bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs -SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') ); +SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') ) as result; #bug 977201 ST_BUFFER fails with the negative D. TODO - check the result deeper. # select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)); @@ -374,15 +357,15 @@ SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 7.664100588675687 1.503849116986468, 1.664100588675687 -2.496150883013531, 0.0 -3.0 -))' ), 3 ))); +))' ), 3 ))) as result; # MDEV-5615 crash in Gcalc_function::add_operation -select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)); +select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)) as result; # MDEV-7925 Inconsistent behavior of ST_Touches with a POINT as one of arguments -select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')); -select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')); -select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')); +select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) as result; +select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) as result; +select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) as result; # MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11. SELECT ST_RELATE( @@ -403,8 +386,6 @@ SELECT ST_RELATE( 'F*FFFF**F' ) as relate_res; ---enable_view_protocol - # MDEV-18920 Prepared statements with st_convexhull hang and eat 100% cpu. prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))'; execute s; @@ -442,45 +423,41 @@ SELECT ST_DISTANCE_SPHERE(1, 1, 3); SELECT ST_DISTANCE_SPHERE(1, 1, NULL); # Wrong geometry --error ER_INTERNAL_ERROR -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; -#enable after fix MDEV-27871 ---disable_view_protocol --echo # Test Points and radius -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) as result; # make bb x86 happy -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result; --error ER_INTERNAL_ERROR -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; --error ER_INTERNAL_ERROR -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; --echo # Test longitude/lattitude # make bb x86 happy -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10); -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10) as result; +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')) as result; --echo # Test Points - Multipoints -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1); -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1) as result; +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1) as result; --echo # Test Multipoints - Multipoints -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')) as result; # make bb x86 happy -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10); -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10) as result; +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result; # make bb x86 happy -SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result; --error ER_INTERNAL_ERROR -SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); - ---enable_view_protocol +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; # Longitude out of range [-180,180] set @pt1 = ST_GeomFromText('POINT(190 -30)'); diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result index 1ecc1ded83a..7bca3b4d252 100644 --- a/mysql-test/main/index_merge_myisam.result +++ b/mysql-test/main/index_merge_myisam.result @@ -371,47 +371,47 @@ create table t4 (a int); insert into t4 values (1),(4),(3); set @save_join_buffer_size=@@join_buffer_size; set join_buffer_size= 4096; -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) and (B.key1 < 500000 or B.key2 < 3); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where 1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where; Using join buffer (flat, BNL join) -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) and (B.key1 < 500000 or B.key2 < 3); -max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +exp 10240 update t0 set key1=1; -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) and (B.key1 = 1 or B.key2 = 1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where 1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where; Using join buffer (flat, BNL join) -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) and (B.key1 = 1 or B.key2 = 1); -max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +exp 8194 alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200); update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500; -explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where 1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where; Using join buffer (flat, BNL join) -select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) as exp from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); -max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) +exp 8186 set join_buffer_size= @save_join_buffer_size; drop table t0, t1, t2, t3, t4; diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 728ab19a71f..1e42f798d2c 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -917,7 +917,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -925,12 +925,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 @@ -1117,7 +1117,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -1125,12 +1125,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 @@ -1376,7 +1376,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -1384,12 +1384,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 @@ -1573,7 +1573,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -1581,12 +1581,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 @@ -1770,7 +1770,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -1778,12 +1778,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 @@ -1967,7 +1967,7 @@ Klaipeda ?iauliai Panevezys EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE @@ -1975,12 +1975,12 @@ Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where 1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -Name IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +Name epx Australia 81.2 United Kingdom 97.3 Canada 60.4 diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index 8d341c9e0fc..e9c81a08562 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -411,24 +411,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol - show variables like 'join_buffer_size'; set join_cache_level=4; show variables like 'join_cache_level'; @@ -470,24 +465,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol - --replace_column 9 # EXPLAIN SELECT Country.Name, Country.Population, City.Name, City.Population @@ -558,24 +548,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol - set join_cache_level=6; show variables like 'join_cache_level'; @@ -616,24 +601,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol - set join_cache_level=7; show variables like 'join_cache_level'; @@ -674,24 +654,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol - set join_cache_level=8; show variables like 'join_cache_level'; @@ -732,23 +707,19 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -#enable after fix MDEV-27871 ---disable_view_protocol - EXPLAIN -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) +SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) as epx FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; ---enable_view_protocol set join_buffer_size=256; show variables like 'join_buffer_size'; diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 5b1ecbe78a1..71494123fba 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -9165,9 +9165,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY NULL NULL NULL 1 Impossible ON condition 1 SIMPLE t2 const PRIMARY NULL NULL NULL 1 Impossible ON condition 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) +select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) as jd from information_schema.optimizer_trace; -JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) +jd [ { "members": @@ -9190,9 +9190,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY ref key0 key0 4 test.t0.a 2 FirstMatch(t0) 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +jd [ { "item": "t0.a in (1,2,3,4,5,6)", @@ -9243,9 +9243,9 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) explain select * from t0 where a in (1,2,3,4,5,a+1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +jd [ { "item": "t0.a in (1,2,3,4,5,t0.a + 1)", @@ -9256,9 +9256,9 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) explain select * from t0 where a in ('1','2','3','4','5','6'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +jd [ { "item": "t0.a in ('1','2','3','4','5','6')", diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 8763ed6a68b..309de72337c 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -833,11 +833,8 @@ insert into t3 select a,a from t0; explain select * from t1 left join (t2 join t3 on t3.pk=1000) on t2.a=t1.a and t2.pk is null; -#enable after fix MDEV-27871 ---disable_view_protocol -select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) +select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) as jd from information_schema.optimizer_trace; ---enable_view_protocol drop table t0, t1, t2, t3; @@ -845,8 +842,6 @@ drop table t0, t1, t2, t3; --echo # MDEV-23767: IN-to-subquery conversion is not visible in optimizer trace --echo # -#enable after fix MDEV-27871 ---disable_view_protocol create table t0 (a int); INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -855,21 +850,20 @@ set in_predicate_conversion_threshold=3; explain select * from t0 where a in (1,2,3,4,5,6); -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; explain select * from t0 where a in (1,2,3,4,5,a+1); -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; explain select * from t0 where a in ('1','2','3','4','5','6'); -select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) +select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; set in_predicate_conversion_threshold=@tmp; drop table t0; ---enable_view_protocol --echo # --echo # MDEV-29298: INSERT ... SELECT Does not produce an optimizer trace diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 9567ab02a5c..08303bb20c8 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -1532,9 +1532,9 @@ INSERT INTO t1 (a) VALUES (1), (2); INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT -(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) +(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) as exp FROM t3; -(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) +exp 2 NULL DROP TABLE t1, t2, t3; @@ -3631,7 +3631,7 @@ WHERE t2.key1 = t1.a and t2.key1 IS NOT NULL ORDER BY t2.key2 ASC -LIMIT 1) +LIMIT 1) as exp from t1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 10 @@ -3643,15 +3643,9 @@ WHERE t2.key1 = t1.a and t2.key1 IS NOT NULL ORDER BY t2.key2 ASC -LIMIT 1) +LIMIT 1) as exp from t1; -(SELECT concat(id, '-', key1, '-', col1) -FROM t2 -WHERE -t2.key1 = t1.a and t2.key1 IS NOT NULL -ORDER BY -t2.key2 ASC -LIMIT 1) +exp 900-0-123456 901-1-123456 902-2-123456 diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index c1e0c318283..47ead9e9e5e 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -3,11 +3,6 @@ # Testing ORDER BY # -# Tests will be skipped for the view protocol because the view protocol creates -# an additional util connection and other statistics data -# Check after fix MDEV-27871, possible this include can be removed ---source include/no_view_protocol.inc - call mtr.add_suppression("Sort aborted.*"); --disable_warnings @@ -830,6 +825,7 @@ INSERT INTO t1 SELECT a +64, b +64 FROM t1; EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; +--disable_view_protocol --disable_query_log --let $q = `show status like 'Created_tmp_tables';` eval set @tmp_tables_before = @@ -848,6 +844,7 @@ eval set @tmp_tables_after = --enable_query_log SELECT @tmp_tables_after = @tmp_tables_before ; +--enable_view_protocol EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; @@ -894,7 +891,7 @@ INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT - (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) + (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) as exp FROM t3; DROP TABLE t1, t2, t3; @@ -1464,6 +1461,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0; SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10; SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10; +--disable_view_protocol --disable_ps2_protocol ################ ## Test with SQL_CALC_FOUND_ROWS @@ -1512,6 +1510,7 @@ WHERE t1.f2>20 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30; SELECT FOUND_ROWS(); --enable_ps2_protocol +--enable_view_protocol ################ ## Test views @@ -1885,6 +1884,7 @@ insert into t1 analyze table t1; --enable_result_log +--disable_view_protocol --disable_ps2_protocol explain select b, count(*) num_cnt from t1 @@ -1906,6 +1906,7 @@ select b, count(*) num_cnt from t1 --enable_result_log show status like '%Handler_read%'; --enable_ps2_protocol +--enable_view_protocol drop table t0, t1; @@ -2004,9 +2005,11 @@ WHERE f1 = ANY ( SELECT f1 WHERE t3a.f3 < f1 OR t3b.f3 != f1 ) ORDER BY field; +--disable_view_protocol eval $q1; eval $q2; eval EXPLAIN EXTENDED $q2; +--enable_view_protocol DROP TABLE t1,t2,t3; @@ -2401,7 +2404,7 @@ let $query= select t2.key1 = t1.a and t2.key1 IS NOT NULL ORDER BY t2.key2 ASC - LIMIT 1) + LIMIT 1) as exp from t1; --echo # here type should show ref not index diff --git a/mysql-test/main/order_by_pack_big.result b/mysql-test/main/order_by_pack_big.result index a7cf2436bcc..cffbf15dd68 100644 --- a/mysql-test/main/order_by_pack_big.result +++ b/mysql-test/main/order_by_pack_big.result @@ -84,7 +84,7 @@ select id, generate_random_string(a), generate_random_string(b) from t2; set sort_buffer_size=262144*10; analyze format=json select id DIV 100 as x, MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +order by id)) as md5 FROM t3 GROUP BY x; ANALYZE @@ -121,11 +121,10 @@ ANALYZE flush status; select id DIV 100 as x, MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +order by id)) as md5 FROM t3 GROUP BY x; -x MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +x md5 0 3d24cb0237caf81aa74a2dddf367ac23 1 618f9b8b6cefaa268dcb5477eece5e90 2 fbfe93cc7713f852852f66e578d999aa @@ -241,7 +240,7 @@ set sort_buffer_size=default; set sort_buffer_size=32768; analyze format=json select id DIV 100 as x, MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +order by id)) as md5 FROM t3 GROUP BY x; ANALYZE @@ -279,11 +278,10 @@ ANALYZE flush status; select id DIV 100 as x, MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +order by id)) as md5 FROM t3 GROUP BY x; -x MD5(group_concat(substring(names,1,3), substring(address,1,3) -order by id)) +x md5 0 3d24cb0237caf81aa74a2dddf367ac23 1 618f9b8b6cefaa268dcb5477eece5e90 2 fbfe93cc7713f852852f66e578d999aa diff --git a/mysql-test/main/order_by_pack_big.test b/mysql-test/main/order_by_pack_big.test index ec8e0c12c54..b83a5416e91 100644 --- a/mysql-test/main/order_by_pack_big.test +++ b/mysql-test/main/order_by_pack_big.test @@ -100,7 +100,7 @@ select id, generate_random_string(a), generate_random_string(b) from t2; let $query= select id DIV 100 as x, MD5(group_concat(substring(names,1,3), substring(address,1,3) - order by id)) + order by id)) as md5 FROM t3 GROUP BY x; @@ -112,12 +112,9 @@ set sort_buffer_size=262144*10; --source include/analyze-format.inc eval analyze format=json $query; flush status; -# Enable view-protocol after fix MDEV-27871 ---disable_view_protocol --disable_ps2_protocol eval $query; --enable_ps2_protocol ---enable_view_protocol show status like '%sort%'; set sort_buffer_size=default; @@ -129,12 +126,9 @@ set sort_buffer_size=32768; --source include/analyze-format.inc eval analyze format=json $query; flush status; -# Enable view-protocol after fix MDEV-27871 ---disable_view_protocol --disable_ps2_protocol eval $query; --enable_ps2_protocol ---enable_view_protocol show status like '%sort%'; set sort_buffer_size=default; diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result index b2585fd9eab..b2be07ab807 100644 --- a/mysql-test/main/parser.result +++ b/mysql-test/main/parser.result @@ -556,8 +556,8 @@ DROP TABLE IF EXISTS t1; SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE 22:10:00 -SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; -STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE +SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE as time; +time 22:01:00 SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; "1997-12-31 23:59:59" + INTERVAL 1 SECOND @@ -1087,35 +1087,35 @@ DROP TABLE t1; # Subquery, one row, ROLLUP CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL); -(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) as exp; +exp NULL -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL); -(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) as exp; +exp 10 -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1; -(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) as exp FROM t1; +exp NULL -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1; -(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) as exp FROM t1; +exp 10 -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP); ERROR 21000: Subquery returns more than 1 row @@ -1145,27 +1145,27 @@ DROP TABLE t1; # Subquery, multiple rows, ROLLUP CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10),(20),(30); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +exp 10 -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 10 10 -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 10 10 -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +exp 10 10 10 @@ -1819,12 +1819,8 @@ SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT 1 -))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); -(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT -(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT -(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT -(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT -(SELECT +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) as exp; +exp 1 # # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index 72975f51055..8565667acdb 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -694,10 +694,7 @@ DROP TABLE IF EXISTS t1; SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; -#enable view protocol after fix MDEV-27871 ---disable_view_protocol -SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; ---enable_view_protocol +SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE as time; SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; SELECT 1 + INTERVAL(1,0,1,2) + 1; @@ -1189,22 +1186,16 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -#enable view protocol after fix MDEV-27871 ---disable_view_protocol -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); ---enable_view_protocol -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1; -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1; -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -#enable view protocol after fix MDEV-27871 ---disable_view_protocol -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; ---enable_view_protocol +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) as exp; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) as exp; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) as exp FROM t1; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) as exp FROM t1; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; --error ER_SUBQUERY_NO_1_ROW SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP); @@ -1238,18 +1229,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10),(20),(30); -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); -#enable view protocol after fix MDEV-27871 ---disable_view_protocol -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); ---enable_view_protocol -SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; -#enable view protocol after fix MDEV-27871 ---disable_view_protocol -SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; ---enable_view_protocol +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp; +SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) as exp FROM t1; --error ER_SUBQUERY_NO_1_ROW SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP); @@ -1569,8 +1554,6 @@ DROP PROCEDURE p1; --echo # MDEV-16697: Fix difference between 32bit/windows and 64bit --echo # systems in allowed select nest level --echo # -#enable view protocol after fix MDEV-27871 ---disable_view_protocol SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT @@ -1580,8 +1563,7 @@ DROP PROCEDURE p1; (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT 1 -))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); ---enable_view_protocol +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) as exp; --echo # --echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result index 31777773240..1ce8dbbcd9d 100644 --- a/mysql-test/main/range.result +++ b/mysql-test/main/range.result @@ -1627,13 +1627,13 @@ Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date -SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; -str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' +SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' as exp; +exp 1 Warnings: Warning 1292 Truncated incorrect datetime value: '' -SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; -str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' +SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' as exp; +exp NULL Warnings: Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date diff --git a/mysql-test/main/range.test b/mysql-test/main/range.test index ba6f2942a9b..293d0db5c86 100644 --- a/mysql-test/main/range.test +++ b/mysql-test/main/range.test @@ -1265,11 +1265,8 @@ SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND str_to_date('2007-20-00', '%Y-%m-%d') <= ''; --enable_view_protocol -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; -SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; ---enable_view_protocol +SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' as exp; +SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' as exp; SELECT str_to_date('', '%Y-%m-%d'); diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result index 6817edd30cd..283123d9484 100644 --- a/mysql-test/main/range_mrr_icp.result +++ b/mysql-test/main/range_mrr_icp.result @@ -1630,13 +1630,13 @@ Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date -SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; -str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' +SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' as exp; +exp 1 Warnings: Warning 1292 Truncated incorrect datetime value: '' -SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; -str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' +SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' as exp; +exp NULL Warnings: Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result index 212afa69dd2..ec73a72b62e 100644 --- a/mysql-test/main/subselect_innodb.result +++ b/mysql-test/main/subselect_innodb.result @@ -21,8 +21,8 @@ CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID); INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1"); INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1"); INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); -SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1'); -'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1') +SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1') as exp; +exp 0 drop table t1; create table t1 (a int) engine=innodb; @@ -58,8 +58,8 @@ FOREIGN KEY (yod_id) REFERENCES t3(yod_id) INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t3 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); -SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1; -processor_id (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) +SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) as result FROM t1 p1; +processor_id result 1 1 2 2 3 3 @@ -199,15 +199,9 @@ WHERE rs.t1_id= (SELECT lt.t1_id FROM t1 lt WHERE lt.t3_id=a.t3_id) -ORDER BY b DESC LIMIT 1) +ORDER BY b DESC LIMIT 1) as exp from t3 AS a; -(SELECT rs.t2_id -FROM t2 rs -WHERE rs.t1_id= -(SELECT lt.t1_id -FROM t1 lt -WHERE lt.t3_id=a.t3_id) -ORDER BY b DESC LIMIT 1) +exp NULL DROP PROCEDURE IF EXISTS p1; create procedure p1() @@ -643,15 +637,8 @@ WHERE a IS NOT NULL GROUP BY (SELECT NULL from dual WHERE a = 1) -); -1 IN ( -SELECT NULL -FROM t1 -WHERE -a IS NOT NULL -GROUP BY -(SELECT NULL from dual WHERE a = 1) -) +) as exp; +exp 0 drop table t1; # Testcase from MDEV-26164 @@ -671,8 +658,8 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (3),(4); -SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))); -1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))) +SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))) as exp; +exp 1 drop table t1,t2; # diff --git a/mysql-test/main/subselect_innodb.test b/mysql-test/main/subselect_innodb.test index 7b2d93186f3..e86828fc143 100644 --- a/mysql-test/main/subselect_innodb.test +++ b/mysql-test/main/subselect_innodb.test @@ -31,10 +31,7 @@ CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID); INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1"); INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1"); INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1'); ---enable_view_protocol +SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1') as exp; drop table t1; # @@ -71,10 +68,7 @@ CREATE TABLE t2 ( INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t3 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1; ---enable_view_protocol +SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) as result FROM t1 p1; drop table t2,t1,t3; # @@ -212,8 +206,6 @@ CREATE TABLE `t3` ( `t3_id` int NOT NULL ); INSERT INTO `t3` VALUES (3); -#enable after fix MDEV-27871 ---disable_view_protocol select (SELECT rs.t2_id FROM t2 rs @@ -221,9 +213,8 @@ select (SELECT lt.t1_id FROM t1 lt WHERE lt.t3_id=a.t3_id) - ORDER BY b DESC LIMIT 1) + ORDER BY b DESC LIMIT 1) as exp from t3 AS a; ---enable_view_protocol # repeat above query in SP --disable_warnings DROP PROCEDURE IF EXISTS p1; @@ -639,8 +630,6 @@ set character_set_connection=@save_character_set_connection; --echo # MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker --echo # CREATE TABLE t1 (a int) engine=innodb; -#enable abter fix MDEV-27871 ---disable_view_protocol SELECT 1 IN ( SELECT NULL FROM t1 @@ -648,8 +637,7 @@ SELECT 1 IN ( a IS NOT NULL GROUP BY (SELECT NULL from dual WHERE a = 1) -); ---enable_view_protocol +) as exp; drop table t1; --echo # Testcase from MDEV-26164 @@ -671,10 +659,7 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (3),(4); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))); ---enable_view_protocol +SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))) as exp; drop table t1,t2; --echo # diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index bbe81cec319..8a15fcbd7fa 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -2894,16 +2894,15 @@ INSERT INTO t2 VALUES (1000,6,2); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; EXPLAIN SELECT (f1, f2, f3) NOT IN -(SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) +(SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) as exp FROM t2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 Using filesort SELECT (f1, f2, f3) NOT IN -(SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) +(SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) as exp FROM t2; -(f1, f2, f3) NOT IN -(SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) +exp 1 drop table t1, t2; # diff --git a/mysql-test/main/subselect_mat.test b/mysql-test/main/subselect_mat.test index cacafb0000f..b8d95a97050 100644 --- a/mysql-test/main/subselect_mat.test +++ b/mysql-test/main/subselect_mat.test @@ -192,19 +192,15 @@ INSERT INTO t2 VALUES (1000,6,2); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; -#enable after fix MDEV-27871 ---disable_view_protocol EXPLAIN SELECT (f1, f2, f3) NOT IN - (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) + (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) as exp FROM t2; SELECT (f1, f2, f3) NOT IN - (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) + (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) as exp FROM t2; ---enable_view_protocol - drop table t1, t2; --echo # diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result index 806255f26f5..51be6dda69b 100644 --- a/mysql-test/main/timezone2.result +++ b/mysql-test/main/timezone2.result @@ -2,18 +2,18 @@ drop table if exists t1, t2; drop function if exists f1; create table t1 (ts timestamp); set time_zone='+00:00'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); -unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; +exp 0 insert into t1 (ts) values ('2003-03-30 02:30:00'); set time_zone='+10:30'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); -unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; +exp -37800 insert into t1 (ts) values ('2003-03-30 02:30:00'); set time_zone='-10:00'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); -unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; +exp 36000 insert into t1 (ts) values ('2003-03-30 02:30:00'); select * from t1; @@ -239,20 +239,20 @@ tz convert_tz('2003-12-31 00:00:00',tz,'UTC') convert_tz('2003-12-31 00:00:00',' MET 2003-12-30 23:00:00 2003-12-31 01:00:00 UTC 2003-12-31 00:00:00 2003-12-31 00:00:00 drop table t1; -select convert_tz('2003-12-31 04:00:00', NULL, 'UTC'); -convert_tz('2003-12-31 04:00:00', NULL, 'UTC') +select convert_tz('2003-12-31 04:00:00', NULL, 'UTC') as exp; +exp NULL -select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC'); -convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC') +select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC') as exp; +exp NULL -select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone'); -convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone') +select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone') as exp; +exp NULL -select convert_tz('2003-12-31 04:00:00', 'MET', NULL); -convert_tz('2003-12-31 04:00:00', 'MET', NULL) +select convert_tz('2003-12-31 04:00:00', 'MET', NULL) as exp; +exp NULL -select convert_tz( NULL, 'MET', 'UTC'); -convert_tz( NULL, 'MET', 'UTC') +select convert_tz( NULL, 'MET', 'UTC') as exp; +exp NULL create table t1 (ts timestamp); set timestamp=1000000000; @@ -326,8 +326,8 @@ SET timestamp=DEFAULT; # # MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c on server shutdown after SELECT with CONVERT_TZ # -SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); -CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ) +SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ) as exp; +exp NULL # # End of 5.3 tests diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test index 20c926a796c..b4da4ba6e8f 100644 --- a/mysql-test/main/timezone2.test +++ b/mysql-test/main/timezone2.test @@ -12,26 +12,21 @@ drop function if exists f1; # create table t1 (ts timestamp); -#enable after fix MDEV-27871 ---disable_view_protocol - set time_zone='+00:00'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; insert into t1 (ts) values ('2003-03-30 02:30:00'); set time_zone='+10:30'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; insert into t1 (ts) values ('2003-03-30 02:30:00'); set time_zone='-10:00'; -select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); +select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()) as exp; insert into t1 (ts) values ('2003-03-30 02:30:00'); # Here we will get different results select * from t1; ---enable_view_protocol - drop table t1; @@ -192,17 +187,12 @@ insert into t1 (tz) values ('MET'), ('UTC'); select tz, convert_tz('2003-12-31 00:00:00',tz,'UTC'), convert_tz('2003-12-31 00:00:00','UTC',tz) from t1 order by tz; drop table t1; -#enable after fix MDEV-27871 ---disable_view_protocol - # Parameters to CONVERT_TZ() what should give NULL -select convert_tz('2003-12-31 04:00:00', NULL, 'UTC'); -select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC'); -select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone'); -select convert_tz('2003-12-31 04:00:00', 'MET', NULL); -select convert_tz( NULL, 'MET', 'UTC'); - ---enable_view_protocol +select convert_tz('2003-12-31 04:00:00', NULL, 'UTC') as exp; +select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC') as exp; +select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone') as exp; +select convert_tz('2003-12-31 04:00:00', 'MET', NULL) as exp; +select convert_tz( NULL, 'MET', 'UTC') as exp; # # Test for bug #4508 "CONVERT_TZ() function with new time zone as param @@ -315,12 +305,7 @@ SET timestamp=DEFAULT; --echo # MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c on server shutdown after SELECT with CONVERT_TZ --echo # -#enable after fix MDEV-27871 ---disable_view_protocol - -SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); - ---enable_view_protocol +SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ) as exp; --echo # --echo # End of 5.3 tests diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result index 2293050292a..a27554b4d9f 100644 --- a/mysql-test/main/type_datetime.result +++ b/mysql-test/main/type_datetime.result @@ -184,17 +184,17 @@ a 2006-06-06 15:55:55 DROP PREPARE s; DROP TABLE t1; -SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)); -CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)) +SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)) as exp; +exp 20060810.000000 -SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)); -CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)) +SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)) as exp; +exp 20060810101112.000000 -SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)); -CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)) +SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)) as exp; +exp 20060810101112.000014 -SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)); -CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)) +SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)) as exp; +exp 101112.098700 set @org_mode=@@sql_mode; create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03'); @@ -351,26 +351,26 @@ select f1 from t1 where ('1',f1) in (('1','01-01-01'),('1','2001-1-1 0:0:0'),('1 f1 2001-01-01 drop table t1,t2,t3; -select least(cast('01-01-01' as date), '01-01-02'); -least(cast('01-01-01' as date), '01-01-02') +select least(cast('01-01-01' as date), '01-01-02') as exp; +exp 2001-01-01 -select greatest(cast('01-01-01' as date), '01-01-02'); -greatest(cast('01-01-01' as date), '01-01-02') +select greatest(cast('01-01-01' as date), '01-01-02') as exp; +exp 2001-01-02 -select least(cast('01-01-01' as date), '01-01-02') + 0; -least(cast('01-01-01' as date), '01-01-02') + 0 +select least(cast('01-01-01' as date), '01-01-02') + 0 as exp; +exp 20010101 -select greatest(cast('01-01-01' as date), '01-01-02') + 0; -greatest(cast('01-01-01' as date), '01-01-02') + 0 +select greatest(cast('01-01-01' as date), '01-01-02') + 0 as exp; +exp 20010102 -select least(cast('01-01-01' as datetime), '01-01-02') + 0; -least(cast('01-01-01' as datetime), '01-01-02') + 0 +select least(cast('01-01-01' as datetime), '01-01-02') + 0 as exp; +exp 20010101000000 -select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); -cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) +select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) as exp; +exp 20010101000000 -select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)); -cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)) +select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)) as exp; +exp 20010101000000.00 DROP PROCEDURE IF EXISTS test27759 ; CREATE PROCEDURE test27759() @@ -627,21 +627,21 @@ ERROR 42000: Invalid default value for 'da' create table t1 (t time default '916:00:00 a'); ERROR 42000: Invalid default value for 't' set @@sql_mode= @org_mode; -SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7)); -CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) +SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; +exp 20060810101112.0123450 Warnings: Note 1292 Truncated incorrect datetime value: '2006-08-10 10:11:12.0123450' -SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7)); -CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) +SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; +exp 20060810101112.0123450 Warnings: Note 1292 Truncated incorrect datetime value: '00000002006-000008-0000010 000010:0000011:00000012.0123450' -SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)); -CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)) +SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; +exp 20060810101112.0123450 -SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)); -CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)) +SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)) as exp; +exp 20080729104251.1234560 Warnings: Note 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567' @@ -685,8 +685,8 @@ drop table t1,t2; # # MDEV-4634 Crash in CONVERT_TZ # -SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5'); -CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5') +SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5') as exp; +exp NULL Warnings: Warning 1292 Incorrect datetime value: '2022-00-00 00:00:00' @@ -951,8 +951,8 @@ CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)) SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME) 0000-00-00 10:20:30 -SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); -CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)) +SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)) as exp; +exp 0000-00-00 00:00:00.000001 SET old_mode=DEFAULT; SET sql_mode=DEFAULT; diff --git a/mysql-test/main/type_datetime.test b/mysql-test/main/type_datetime.test index 4a14bee4319..1193ec524e9 100644 --- a/mysql-test/main/type_datetime.test +++ b/mysql-test/main/type_datetime.test @@ -138,13 +138,10 @@ DROP TABLE t1; # # Bug 19491 (CAST DATE AS DECIMAL returns incorrect result # -SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)); -SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)); -SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)); ---disable_view_protocol +SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)) as exp; +SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)) as exp; +SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)) as exp; +SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)) as exp; # # Test of storing datetime into date fields @@ -246,16 +243,13 @@ drop table t1,t2,t3; # # Bug#27759: Wrong DATE/DATETIME comparison in LEAST()/GREATEST() functions. # -select least(cast('01-01-01' as date), '01-01-02'); -select greatest(cast('01-01-01' as date), '01-01-02'); -select least(cast('01-01-01' as date), '01-01-02') + 0; -select greatest(cast('01-01-01' as date), '01-01-02') + 0; -select least(cast('01-01-01' as datetime), '01-01-02') + 0; -select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); -#enable after fix MDEV-27871 ---disable_view_protocol -select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)); ---enable_view_protocol +select least(cast('01-01-01' as date), '01-01-02') as exp; +select greatest(cast('01-01-01' as date), '01-01-02') as exp; +select least(cast('01-01-01' as date), '01-01-02') + 0 as exp; +select greatest(cast('01-01-01' as date), '01-01-02') + 0 as exp; +select least(cast('01-01-01' as datetime), '01-01-02') + 0 as exp; +select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) as exp; +select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)) as exp; --disable_warnings DROP PROCEDURE IF EXISTS test27759 ; --enable_warnings @@ -447,27 +441,23 @@ create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '196 create table t1 (t time default '916:00:00 a'); set @@sql_mode= @org_mode; -#enable after fix MDEV-27871 ---disable_view_protocol - # # Bug #42146 - DATETIME fractional seconds parse error # # show we trucate microseconds from the right -- special case: leftmost is 0 -SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7)); +SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; # show that we ignore leading zeroes for all other fields -SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7)); +SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; # once more with feeling (but no warnings) -SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)); +SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)) as exp; # # Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE # # show we truncate microseconds from the right -SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)); ---enable_view_protocol +SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)) as exp; --echo # --echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or @@ -510,10 +500,7 @@ drop table t1,t2; --echo # --echo # MDEV-4634 Crash in CONVERT_TZ --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5'); ---enable_view_protocol +SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5') as exp; --echo # --echo # MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value @@ -674,10 +661,7 @@ SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6)); SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME); SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)); SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); ---enable_view_protocol +SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)) as exp; SET old_mode=DEFAULT; SET sql_mode=DEFAULT; diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result index 645178db2ce..5f959d83438 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -912,8 +912,8 @@ select * from t1; col1 -9223372036854775808 drop table t1; -select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)); -cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)) +select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)) as exp; +exp 0.000000000100000 select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3; c1 c2 c3 @@ -1527,9 +1527,8 @@ f1 99999999999999999999999999999.999999999999999999999999999999999999 DROP TABLE t1; select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 * -1.01500000 * 1.01500000 * 0.99500000); -(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 * -1.01500000 * 1.01500000 * 0.99500000) +1.01500000 * 1.01500000 * 0.99500000) as exp; +exp 0.81298807395367312459230693948000000000 create table t1 as select 5.05 / 0.014; Warnings: @@ -2460,8 +2459,8 @@ drop table t1; # decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' # failed in decimal_bin_size_inline/decimal_bin_size. # -SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001); -AVG(DISTINCT 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001) as exp; +exp 0.00000000000000000000000000000000000000 CREATE TABLE t1 AS SELECT NULL AS v1; SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ; diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index 366199e8aa8..77ef338f93e 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -952,10 +952,7 @@ drop table t1; # # Bug #10891 (converting to decimal crashes server) # -#enable after fix MDEV-27871 ---disable_view_protocol -select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)); ---enable_view_protocol +select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)) as exp; # # Bug #11708 (conversion to decimal fails in decimal part) @@ -1245,15 +1242,11 @@ DROP TABLE t1; # # Bug #36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1 # -#enable after fix MDEV-27871 ---disable_view_protocol # show that if we need to truncate the scale of an operand, we pick the # right one (that is, we discard the least significant decimal places) select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 * - 1.01500000 * 1.01500000 * 0.99500000); - ---enable_view_protocol + 1.01500000 * 1.01500000 * 0.99500000) as exp; # # Bug #31616 div_precision_increment description looks wrong @@ -1924,10 +1917,8 @@ drop table t1; --echo # decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' --echo # failed in decimal_bin_size_inline/decimal_bin_size. --echo # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001); ---enable_view_protocol +SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001) as exp; + CREATE TABLE t1 AS SELECT NULL AS v1; SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ; DROP TABLE t1; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 668f7b793cb..533173797b5 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -1099,11 +1099,9 @@ select a, count(col1) over (order by a range between 0.1 preceding -and 0.1 following) +and 0.1 following) as count from t1; -a count(col1) over (order by a -range between 0.1 preceding -and 0.1 following) +a count 0.450 3 0.500 3 0.550 3 @@ -1249,33 +1247,33 @@ insert into t1 values (1,1,'foo'); insert into t1 values (2,2,'bar'); select count(*) over (order by a,b -range between unbounded preceding and current row) +range between unbounded preceding and current row) as count from t1; ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key select count(*) over (order by c -range between unbounded preceding and current row) +range between unbounded preceding and current row) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame select count(*) over (order by a -range between 'abcd' preceding and current row) +range between 'abcd' preceding and current row) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame select count(*) over (order by a -range between current row and 'foo' following) +range between current row and 'foo' following) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame # Try range frame with invalid bounds select count(*) over (order by a -rows between 0.5 preceding and current row) +rows between 0.5 preceding and current row) as count from t1; ERROR HY000: Integer is required for ROWS-type frame select count(*) over (order by a -rows between current row and 3.14 following) +rows between current row and 3.14 following) as count from t1; ERROR HY000: Integer is required for ROWS-type frame # @@ -1284,29 +1282,27 @@ ERROR HY000: Integer is required for ROWS-type frame select count(*) over (order by a rows between 1 preceding and 1 following -exclude current row) +exclude current row) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a range between 1 preceding and 1 following -exclude ties) +exclude ties) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a range between 1 preceding and 1 following -exclude group) +exclude group) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a rows between 1 preceding and 1 following -exclude no others) +exclude no others) as count from t1; -count(*) over (order by a -rows between 1 preceding and 1 following -exclude no others) +count 2 2 drop table t1; @@ -1602,10 +1598,10 @@ insert into t1 values # Check using counters flush status; select -rank() over (partition by c order by a), -rank() over (partition by c order by b) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by b) as rank_b from t1; -rank() over (partition by c order by a) rank() over (partition by c order by b) +rank_a rank_b 1 3 2 2 3 1 @@ -1618,10 +1614,10 @@ Sort_rows 6 Sort_scan 2 flush status; select -rank() over (partition by c order by a), -rank() over (partition by c order by a) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by a) as rank_b from t1; -rank() over (partition by c order by a) rank() over (partition by c order by a) +rank_a rank_b 1 1 2 2 3 3 @@ -1634,8 +1630,8 @@ Sort_rows 3 Sort_scan 1 explain format=json select -rank() over (partition by c order by a), -rank() over (partition by c order by a) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by a) as rank_b from t1; EXPLAIN { @@ -1686,8 +1682,8 @@ EXPLAIN } explain format=json select -rank() over (partition by c order by a), -count(*) over (partition by c) +rank() over (partition by c order by a) as rank_a, +count(*) over (partition by c) as count_c from t1; EXPLAIN { @@ -1712,8 +1708,8 @@ EXPLAIN } explain format=json select -count(*) over (partition by c), -rank() over (partition by c order by a) +count(*) over (partition by c) as count_c, +rank() over (partition by c order by a) as rank_a from t1; EXPLAIN { @@ -1842,18 +1838,18 @@ insert into t1 values (1, 3, 4); insert into t1 values (1, 4, 8); select pk, a, -sum(a) over (order by pk rows between 0 preceding and current row) +sum(a) over (order by pk rows between 0 preceding and current row) as sum from t1; -pk a sum(a) over (order by pk rows between 0 preceding and current row) +pk a sum 1 1 1 2 2 2 3 4 4 4 8 8 select pk, a, -sum(a) over (order by pk rows between 1 preceding and 0 preceding) +sum(a) over (order by pk rows between 1 preceding and 0 preceding) as sum from t1; -pk a sum(a) over (order by pk rows between 1 preceding and 0 preceding) +pk a sum 1 1 1 2 2 3 3 4 6 @@ -1864,9 +1860,9 @@ insert into t1 values (200, 3, 4); insert into t1 values (200, 4, 8); select part_id, pk, a, -sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) as sum from t1; -part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +part_id pk a sum 1 1 1 1 1 2 2 2 1 3 4 4 @@ -1877,9 +1873,9 @@ part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preced 200 4 8 8 select part_id, pk, a, -sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) as sum from t1; -part_id pk a sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +part_id pk a sum 1 1 1 1 1 2 2 3 1 3 4 6 @@ -1904,8 +1900,8 @@ insert into t1 values (2000, 3), (2000, 3), (2000, 3); -select rank() over (partition by part_id order by a) from t1; -rank() over (partition by part_id order by a) +select rank() over (partition by part_id order by a) as rank from t1; +rank 1 2 2 @@ -1915,14 +1911,14 @@ rank() over (partition by part_id order by a) 3 3 3 -select distinct rank() over (partition by part_id order by a) from t1; -rank() over (partition by part_id order by a) +select distinct rank() over (partition by part_id order by a) as rank from t1; +rank 1 2 4 3 explain format=json -select distinct rank() over (partition by part_id order by a) from t1; +select distinct rank() over (partition by part_id order by a) as rank from t1; EXPLAIN { "query_block": { @@ -2002,11 +1998,8 @@ INSERT INTO `orders` VALUES (59940,238); SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey RANGE BETWEEN 15 FOLLOWING -AND 15 FOLLOWING) from orders; -o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey) -ORDER BY o_custkey -RANGE BETWEEN 15 FOLLOWING -AND 15 FOLLOWING) +AND 15 FOLLOWING) as avg from orders; +o_custkey avg 238 NULL 242 NULL DROP table orders; @@ -2218,15 +2211,15 @@ a NULL NULL NULL -SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t; -ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) +SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) as result from t; +result 0.00000000000000 0.00000000000000 0.00000000000000 SELECT sum(t.a) over (partition by t.b order by a), -sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) as sum from t; -sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +sum(t.a) over (partition by t.b order by a) sum 0.0000000000 0 1.0000000000 1 3.0000000000 1.7320508075688772 @@ -2401,9 +2394,9 @@ INSERT INTO t1 VALUES (1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200), (7,2000), (8,2100), (9,1600); SELECT id, sum(a) OVER (PARTITION BY id -ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; -id sum(a) OVER (PARTITION BY id +id sum 1 1000 2 1100 3 1800 @@ -2413,10 +2406,9 @@ id sum(a) OVER (PARTITION BY id 7 2000 8 2100 9 1600 -ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) -SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; -id sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +id sum 1 14000 2 13000 3 5900 @@ -3151,8 +3143,8 @@ DROP TABLE t1; # CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM; INSERT IGNORE INTO t1 VALUES ('foo'); -SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1); -('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) +SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) as result; +result 0 DROP TABLE t1; # @@ -3185,8 +3177,8 @@ DROP TABLE t1; # CREATE TABLE t1 (dt DATETIME); INSERT INTO t1 VALUES ('2017-05-17'); -SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; -MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) as result FROM t1; +result NULL DROP TABLE t1; # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 363bf8f8ad9..fa2034a145d 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2,9 +2,6 @@ # Window Functions Tests # --source include/no_valgrind_without_big.inc -#remove this include after fix MDEV-27871, MDEV-27938 ---source include/no_view_protocol.inc - --source include/have_sequence.inc --disable_warnings @@ -694,7 +691,7 @@ select a, count(col1) over (order by a range between 0.1 preceding - and 0.1 following) + and 0.1 following) as count from t1; drop table t1; @@ -787,38 +784,38 @@ insert into t1 values (2,2,'bar'); --error ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY select count(*) over (order by a,b - range between unbounded preceding and current row) + range between unbounded preceding and current row) as count from t1; --error ER_WRONG_TYPE_FOR_RANGE_FRAME select count(*) over (order by c - range between unbounded preceding and current row) + range between unbounded preceding and current row) as count from t1; --error ER_WRONG_TYPE_FOR_RANGE_FRAME select count(*) over (order by a - range between 'abcd' preceding and current row) + range between 'abcd' preceding and current row) as count from t1; --error ER_WRONG_TYPE_FOR_RANGE_FRAME select count(*) over (order by a - range between current row and 'foo' following) + range between current row and 'foo' following) as count from t1; --echo # Try range frame with invalid bounds --error ER_WRONG_TYPE_FOR_ROWS_FRAME select count(*) over (order by a - rows between 0.5 preceding and current row) + rows between 0.5 preceding and current row) as count from t1; --error ER_WRONG_TYPE_FOR_ROWS_FRAME select count(*) over (order by a - rows between current row and 3.14 following) + rows between current row and 3.14 following) as count from t1; --echo # @@ -829,28 +826,28 @@ from t1; select count(*) over (order by a rows between 1 preceding and 1 following - exclude current row) + exclude current row) as count from t1; --error ER_FRAME_EXCLUSION_NOT_SUPPORTED select count(*) over (order by a range between 1 preceding and 1 following - exclude ties) + exclude ties) as count from t1; --error ER_FRAME_EXCLUSION_NOT_SUPPORTED select count(*) over (order by a range between 1 preceding and 1 following - exclude group) + exclude group) as count from t1; # EXCLUDE NO OTHERS means 'don't exclude anything' select count(*) over (order by a rows between 1 preceding and 1 following - exclude no others) + exclude no others) as count from t1; drop table t1; @@ -1027,24 +1024,24 @@ insert into t1 values flush status; --sorted_result select - rank() over (partition by c order by a), - rank() over (partition by c order by b) + rank() over (partition by c order by a) as rank_a, + rank() over (partition by c order by b) as rank_b from t1; show status like '%sort%'; flush status; --sorted_result select - rank() over (partition by c order by a), - rank() over (partition by c order by a) + rank() over (partition by c order by a) as rank_a, + rank() over (partition by c order by a) as rank_b from t1; show status like '%sort%'; # Check using EXPLAIN FORMAT=JSON explain format=json select - rank() over (partition by c order by a), - rank() over (partition by c order by a) + rank() over (partition by c order by a) as rank_a, + rank() over (partition by c order by a) as rank_b from t1; explain format=json @@ -1055,14 +1052,14 @@ from t1; explain format=json select - rank() over (partition by c order by a), - count(*) over (partition by c) + rank() over (partition by c order by a) as rank_a, + count(*) over (partition by c) as count_c from t1; explain format=json select - count(*) over (partition by c), - rank() over (partition by c order by a) + count(*) over (partition by c) as count_c, + rank() over (partition by c order by a) as rank_a from t1; drop table t1; @@ -1137,12 +1134,12 @@ insert into t1 values (1, 4, 8); select pk, a, - sum(a) over (order by pk rows between 0 preceding and current row) + sum(a) over (order by pk rows between 0 preceding and current row) as sum from t1; select pk, a, - sum(a) over (order by pk rows between 1 preceding and 0 preceding) + sum(a) over (order by pk rows between 1 preceding and 0 preceding) as sum from t1; insert into t1 values (200, 1, 1); @@ -1151,12 +1148,12 @@ insert into t1 values (200, 3, 4); insert into t1 values (200, 4, 8); select part_id, pk, a, - sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) + sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) as sum from t1; select part_id, pk, a, - sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) + sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) as sum from t1; drop table t1; @@ -1177,10 +1174,10 @@ insert into t1 values (2000, 3), (2000, 3); -select rank() over (partition by part_id order by a) from t1; -select distinct rank() over (partition by part_id order by a) from t1; +select rank() over (partition by part_id order by a) as rank from t1; +select distinct rank() over (partition by part_id order by a) as rank from t1; explain format=json -select distinct rank() over (partition by part_id order by a) from t1; +select distinct rank() over (partition by part_id order by a) as rank from t1; drop table t1; @@ -1237,7 +1234,7 @@ INSERT INTO `orders` VALUES (59940,238); SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey RANGE BETWEEN 15 FOLLOWING - AND 15 FOLLOWING) from orders; + AND 15 FOLLOWING) as avg from orders; DROP table orders; --echo # @@ -1374,9 +1371,9 @@ insert into t(a,b) values(1,1); insert into t(a,b) values(2,1); insert into t(a,b) values(0,1); SELECT (CASE WHEN sum(t.a) over (partition by t.b)=0 THEN null ELSE null END) AS a FROM t; -SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t; +SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) as result from t; SELECT sum(t.a) over (partition by t.b order by a), - sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) + sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) as sum from t; drop table t; @@ -1460,11 +1457,11 @@ INSERT INTO t1 VALUES --sorted_result SELECT id, sum(a) OVER (PARTITION BY id - ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; --sorted_result -SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; DROP TABLE t1; @@ -1613,9 +1610,11 @@ select b, max(i+20) over (partition by b) as f from (select i+10 as i, b from t1) as tt order by i; +--disable_view_protocol select max(i), max(i), sum(i), count(i) from t1 as tt group by b; +--enable_view_protocol select max(i), min(sum(i)) over (partition by count(i)) f from t1 as tt @@ -1629,9 +1628,11 @@ select max(i+10), min(sum(i)+10) over (partition by count(i)) f from t1 as tt group by b; +--disable_view_protocol select max(i), max(i), sum(i), count(i) from (select i+10 as i, b from t1) as tt group by b; +--enable_view_protocol select max(i), min(sum(i)) over (partition by count(i)) f from (select i+10 as i, b from t1) as tt @@ -1946,7 +1947,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM; INSERT IGNORE INTO t1 VALUES ('foo'); -SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1); +SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) as result; DROP TABLE t1; --echo # @@ -1977,7 +1978,7 @@ DROP TABLE t1; CREATE TABLE t1 (dt DATETIME); INSERT INTO t1 VALUES ('2017-05-17'); -SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) as result FROM t1; DROP TABLE t1; --echo # @@ -2767,6 +2768,8 @@ FROM t1 GROUP BY nullif(id, 15532); drop table t1; +#Dublicate warnings +--disable_view_protocol CREATE TABLE t1 ( a char(25), b text); INSERT INTO t1 VALUES ('foo','bar'); @@ -2778,6 +2781,7 @@ GROUP BY LEFT((SYSDATE()), 'foo') WITH ROLLUP; drop table t1; +--enable_view_protocol --echo # --echo # diff --git a/mysql-test/main/win_avg.result b/mysql-test/main/win_avg.result index 7e539d933d8..aa6dda24bd8 100644 --- a/mysql-test/main/win_avg.result +++ b/mysql-test/main/win_avg.result @@ -32,9 +32,9 @@ insert into t1 values (125 , 6, 1, NULL), (126 , 6, 1, NULL), (127 , 6, 1, NULL); -select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as avg from t1; -pk a b avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +pk a b avg 101 0 10 10.0000 102 0 10 10.0000 103 1 10 10.0000 @@ -62,9 +62,9 @@ pk a b avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FO 125 6 1 1.0000 126 6 1 1.0000 127 6 1 1.0000 -select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as avg from t1; -pk a c avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +pk a c avg 101 0 1.1 1.6 102 0 2.1 1.6 103 1 3.1 3.5999999999999996 diff --git a/mysql-test/main/win_avg.test b/mysql-test/main/win_avg.test index 86edcce5679..36e03e083b3 100644 --- a/mysql-test/main/win_avg.test +++ b/mysql-test/main/win_avg.test @@ -35,14 +35,11 @@ insert into t1 values (126 , 6, 1, NULL), (127 , 6, 1, NULL); -#enable after fix MDEV-27871 ---disable_view_protocol --sorted_result -select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as avg from t1; --sorted_result -select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as avg from t1; ---enable_view_protocol drop table t1; diff --git a/mysql-test/main/win_big.result b/mysql-test/main/win_big.result index c8b27b9a1aa..a4b83b07f0a 100644 --- a/mysql-test/main/win_big.result +++ b/mysql-test/main/win_big.result @@ -19,10 +19,10 @@ sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES NO PASSES set sort_buffer_size=1024; flush status; @@ -32,10 +32,10 @@ sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] drop table t21, t22; @@ -51,10 +51,10 @@ sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES NO PASSES set sort_buffer_size=1024; flush status; @@ -66,10 +66,10 @@ sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] drop table t21, t22; @@ -85,10 +85,10 @@ sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_ from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES NO PASSES set sort_buffer_size=1024; flush status; @@ -99,10 +99,10 @@ sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_ from t10; select variable_name, -case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; -variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end +variable_name result SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] drop table t21, t22; diff --git a/mysql-test/main/win_big.test b/mysql-test/main/win_big.test index e53eaa70291..9d37b689f4d 100644 --- a/mysql-test/main/win_big.test +++ b/mysql-test/main/win_big.test @@ -28,13 +28,10 @@ select sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol set sort_buffer_size=1024; flush status; @@ -43,13 +40,10 @@ select sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; @@ -66,13 +60,10 @@ select sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol set sort_buffer_size=1024; flush status; @@ -83,13 +74,10 @@ select sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; @@ -106,13 +94,10 @@ select sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1 from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol set sort_buffer_size=1024; flush status; @@ -122,13 +107,10 @@ select sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1 from t10; -#enable after fix MDEV-27871 ---disable_view_protocol select variable_name, - case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end + case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as result from information_schema.session_status where variable_name like 'Sort_merge_passes'; ---enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; diff --git a/mysql-test/main/win_nth_value.result b/mysql-test/main/win_nth_value.result index abda1a2377f..ca58ad5daac 100644 --- a/mysql-test/main/win_nth_value.result +++ b/mysql-test/main/win_nth_value.result @@ -75,9 +75,9 @@ pk a nth_value(pk, pk) over (partition by a order by pk) nth_value(pk, a + 1) ov 11 2 NULL 9 select pk, a, -nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) +nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) as nth from t1; -pk a nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) +pk a nth 1 0 1 2 0 1 3 0 2 @@ -91,21 +91,21 @@ pk a nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding 11 2 10 select pk, a, -nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following), -nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) +nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth1, +nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth2, +nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth3, +nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth4, +nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth5, +nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth6, +nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth7, +nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth8, +nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth9, +nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth10, +nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth11, +nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth12 from t1 order by pk asc; -pk a nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following) nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) +pk a nth1 nth2 nth3 nth4 nth5 nth6 nth7 nth8 nth9 nth10 nth11 nth12 1 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL 2 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL 3 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL diff --git a/mysql-test/main/win_nth_value.test b/mysql-test/main/win_nth_value.test index 2d47677f65c..afee755680b 100644 --- a/mysql-test/main/win_nth_value.test +++ b/mysql-test/main/win_nth_value.test @@ -42,32 +42,26 @@ select pk, from t1 order by pk asc; -#enable after fix MDEV-27871 ---disable_view_protocol select pk, a, - nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) + nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) as nth from t1; ---enable_view_protocol -#enable after fix MDEV-28535 ---disable_view_protocol select pk, a, - nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following), - nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) + nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth1, + nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth2, + nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth3, + nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth4, + nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth5, + nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth6, + nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth7, + nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth8, + nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth9, + nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth10, + nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth11, + nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) as nth12 from t1 order by pk asc; ---enable_view_protocol drop table t1; diff --git a/mysql-test/main/win_ntile.result b/mysql-test/main/win_ntile.result index 4d02a230e13..e0e651c5ec2 100644 --- a/mysql-test/main/win_ntile.result +++ b/mysql-test/main/win_ntile.result @@ -396,9 +396,9 @@ select t1.a from t1 where pk = 13; a 1 select pk, a, b, -ntile((select a from t1 where pk=13)) over (partition by b order by pk) +ntile((select a from t1 where pk=13)) over (partition by b order by pk) as ntile from t1; -pk a b ntile((select a from t1 where pk=13)) over (partition by b order by pk) +pk a b ntile 11 0 10 1 12 0 10 1 13 1 10 1 @@ -411,7 +411,7 @@ pk a b ntile((select a from t1 where pk=13)) over (partition by b order by pk) 20 4 20 1 explain select pk, a, b, -ntile((select a from t1 where pk=13)) over (partition by b order by pk) +ntile((select a from t1 where pk=13)) over (partition by b order by pk) as ntile from t1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using temporary diff --git a/mysql-test/main/win_ntile.test b/mysql-test/main/win_ntile.test index c508b1627ad..7866f9586a1 100644 --- a/mysql-test/main/win_ntile.test +++ b/mysql-test/main/win_ntile.test @@ -152,17 +152,14 @@ select pk, a, b, from t1; select t1.a from t1 where pk = 13; -#enable after fix MDEV-27871 ---disable_view_protocol select pk, a, b, - ntile((select a from t1 where pk=13)) over (partition by b order by pk) + ntile((select a from t1 where pk=13)) over (partition by b order by pk) as ntile from t1; explain select pk, a, b, - ntile((select a from t1 where pk=13)) over (partition by b order by pk) + ntile((select a from t1 where pk=13)) over (partition by b order by pk) as ntile from t1; ---enable_view_protocol select a from t1; --error ER_SUBQUERY_NO_1_ROW diff --git a/mysql-test/main/win_percentile.result b/mysql-test/main/win_percentile.result index 65788c21e78..e2eea784d81 100644 --- a/mysql-test/main/win_percentile.result +++ b/mysql-test/main/win_percentile.result @@ -96,10 +96,10 @@ Kaolin Tata Tatiana #disallowed fields in order by -select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1; +select score, percentile_cont(0.5) within group(order by name) over (partition by score) as result from t1; ERROR HY000: Numeric datatype is required for percentile_cont function -select score, percentile_disc(0.5) within group(order by name) over (partition by score) from t1; -score percentile_disc(0.5) within group(order by name) over (partition by score) +select score, percentile_disc(0.5) within group(order by name) over (partition by score) as result from t1; +score result 3.0000 Chun 3.0000 Chun 4.0000 Tata diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test index 9626caffc54..fb93be11ab6 100644 --- a/mysql-test/main/win_percentile.test +++ b/mysql-test/main/win_percentile.test @@ -62,12 +62,9 @@ select name from t1 a where (select percentile_disc(0.5) within group (order by --echo #disallowed fields in order by --error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC -select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1; +select score, percentile_cont(0.5) within group(order by name) over (partition by score) as result from t1; -#enable after fix MDEV-27871 ---disable_view_protocol -select score, percentile_disc(0.5) within group(order by name) over (partition by score) from t1; ---enable_view_protocol +select score, percentile_disc(0.5) within group(order by name) over (partition by score) as result from t1; --echo #parameter value should be in the range of [0,1] --error ER_ARGUMENT_OUT_OF_RANGE diff --git a/mysql-test/main/win_sum.result b/mysql-test/main/win_sum.result index 71d87bd6eca..a17c17845af 100644 --- a/mysql-test/main/win_sum.result +++ b/mysql-test/main/win_sum.result @@ -32,9 +32,9 @@ insert into t1 values (125 , 6, 1, NULL), (126 , 6, 1, NULL), (127 , 6, 1, NULL); -select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as sum from t1; -pk a b sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +pk a b sum 101 0 10 20 102 0 10 20 103 1 10 20 @@ -62,9 +62,9 @@ pk a b sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FO 125 6 1 3 126 6 1 3 127 6 1 2 -select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as sum from t1; -pk a c sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +pk a c sum 101 0 1.1 3.2 102 0 2.1 3.2 103 1 3.1 7.199999999999999 diff --git a/mysql-test/main/win_sum.test b/mysql-test/main/win_sum.test index d76ec4d6d24..9800174f54c 100644 --- a/mysql-test/main/win_sum.test +++ b/mysql-test/main/win_sum.test @@ -35,17 +35,13 @@ insert into t1 values (126 , 6, 1, NULL), (127 , 6, 1, NULL); -#enable after fix MDEV-27871 ---disable_view_protocol - --sorted_result -select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as sum from t1; --sorted_result -select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as sum from t1; ---enable_view_protocol drop table t1; diff --git a/mysql-test/main/xml.result b/mysql-test/main/xml.result index d0acb0debf3..d0b1d1782a1 100644 --- a/mysql-test/main/xml.result +++ b/mysql-test/main/xml.result @@ -410,17 +410,17 @@ b1 b2 select extractValue('','/a/@b[2<=position()]'); extractValue('','/a/@b[2<=position()]') b2 b3 -select extractValue('','/a/@b[position()=3 or position()=2]'); -extractValue('','/a/@b[position()=3 or position()=2]') +select extractValue('','/a/@b[position()=3 or position()=2]') as xml; +xml b2 b3 -SELECT extractValue('aa1c1a2','/a/b[count(c)=0]'); -extractValue('aa1c1a2','/a/b[count(c)=0]') +SELECT extractValue('aa1c1a2','/a/b[count(c)=0]') as xml; +xml a2 -SELECT extractValue('aa1c1a2','/a/b[count(c)=1]'); -extractValue('aa1c1a2','/a/b[count(c)=1]') +SELECT extractValue('aa1c1a2','/a/b[count(c)=1]') as xml; +xml a1 -select extractValue('a1b1b24','/a/b[sum(@ba)=3]'); -extractValue('a1b1b24','/a/b[sum(@ba)=3]') +select extractValue('a1b1b24','/a/b[sum(@ba)=3]') as xml; +xml b1 select extractValue('b1b2','/a/b[1]'); extractValue('b1b2','/a/b[1]') @@ -506,14 +506,14 @@ select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]'); extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]') b21 SET @xml='a1b1c1b2a2'; -select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); -UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') +select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') as xml; +xml a1b1+++++++++b2a2 -select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); -UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') +select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') as xml; +xml a1b1+++++++++b2a2 -select UpdateXML('a1b1c1b2a2','/a/b/c',''); -UpdateXML('a1b1c1b2a2','/a/b/c','') +select UpdateXML('a1b1c1b2a2','/a/b/c','') as xml; +xml a1b1b2a2 SET @xml='bb'; select UpdateXML(@xml, '/a/b', 'ccc'); @@ -586,59 +586,59 @@ B C select extractvalue('ABC','/a/self::*'); extractvalue('ABC','/a/self::*') A -select extractvalue('ABC','/a/descendant-or-self::*'); -extractvalue('ABC','/a/descendant-or-self::*') +select extractvalue('ABC','/a/descendant-or-self::*') as xml; +xml A B C select extractvalue('A','/A_B'); extractvalue('A','/A_B') A -select extractvalue('AB1B2','/a/b[position()]'); -extractvalue('AB1B2','/a/b[position()]') +select extractvalue('AB1B2','/a/b[position()]') as xml; +xml B1 B2 -select extractvalue('AB1B2','/a/b[count(.)=last()]'); -extractvalue('AB1B2','/a/b[count(.)=last()]') +select extractvalue('AB1B2','/a/b[count(.)=last()]') as xml; +xml B1 B2 -select extractvalue('AB1B2','/a/b[last()]'); -extractvalue('AB1B2','/a/b[last()]') +select extractvalue('AB1B2','/a/b[last()]') as xml; +xml B2 -select extractvalue('AB1B2','/a/b[last()-1]'); -extractvalue('AB1B2','/a/b[last()-1]') +select extractvalue('AB1B2','/a/b[last()-1]') as xml; +xml B1 -select extractvalue('AB1B2','/a/b[last()=1]'); -extractvalue('AB1B2','/a/b[last()=1]') +select extractvalue('AB1B2','/a/b[last()=1]') as xml; +xml -select extractvalue('AB1B2','/a/b[last()=2]'); -extractvalue('AB1B2','/a/b[last()=2]') +select extractvalue('AB1B2','/a/b[last()=2]') as xml; +xml B1 B2 -select extractvalue('AB1B2','/a/b[last()=position()]'); -extractvalue('AB1B2','/a/b[last()=position()]') +select extractvalue('AB1B2','/a/b[last()=position()]') as xml; +xml B2 -select extractvalue('AB1B2','/a/b[count(.)]'); -extractvalue('AB1B2','/a/b[count(.)]') +select extractvalue('AB1B2','/a/b[count(.)]') as xml; +xml B2 -select extractvalue('AB1B2','/a/b[count(.)-1]'); -extractvalue('AB1B2','/a/b[count(.)-1]') +select extractvalue('AB1B2','/a/b[count(.)-1]') as xml; +xml B1 -select extractvalue('AB1B2','/a/b[count(.)=1]'); -extractvalue('AB1B2','/a/b[count(.)=1]') +select extractvalue('AB1B2','/a/b[count(.)=1]') as xml; +xml -select extractvalue('AB1B2','/a/b[count(.)=2]'); -extractvalue('AB1B2','/a/b[count(.)=2]') +select extractvalue('AB1B2','/a/b[count(.)=2]') as xml; +xml B1 B2 -select extractvalue('AB1B2','/a/b[count(.)=position()]'); -extractvalue('AB1B2','/a/b[count(.)=position()]') +select extractvalue('AB1B2','/a/b[count(.)=position()]') as xml; +xml B2 -select extractvalue('Jack','/a[contains(../a,"J")]'); -extractvalue('Jack','/a[contains(../a,"J")]') +select extractvalue('Jack','/a[contains(../a,"J")]') as xml; +xml Jack -select extractvalue('Jack','/a[contains(../a,"j")]'); -extractvalue('Jack','/a[contains(../a,"j")]') +select extractvalue('Jack','/a[contains(../a,"j")]') as xml; +xml Jack -select extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin); -extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin) +select extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin) as xml; +xml -select extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]'); -extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]') +select extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]') as xml; +xml select ExtractValue('','/tag1'); ExtractValue('','/tag1') @@ -702,25 +702,25 @@ CALL p2(); EXTRACTVALUE(p,'/Ñ/r') A DROP PROCEDURE p2; -select extractValue('','count(ns:element)'); -extractValue('','count(ns:element)') +select extractValue('','count(ns:element)') as xml; +xml 1 -select extractValue('a','/ns:element'); -extractValue('a','/ns:element') +select extractValue('a','/ns:element') as xml; +xml a -select extractValue('a','/ns:element/@xmlns:ns'); -extractValue('a','/ns:element/@xmlns:ns') +select extractValue('a','/ns:element/@xmlns:ns') as xml; +xml myns -select extractValue('DataOtherdata','/foo/foo.bar'); -extractValue('DataOtherdata','/foo/foo.bar') +select extractValue('DataOtherdata','/foo/foo.bar') as xml; +xml Data -select extractValue('DataOtherdata','/foo/something'); -extractValue('DataOtherdata','/foo/something') +select extractValue('DataOtherdata','/foo/something') as xml; +xml Otherdata -select extractValue('<01>10:39:15<02>140','/zot/tim0/02'); +select extractValue('<01>10:39:15<02>140','/zot/tim0/02') as xml; ERROR HY000: XPATH syntax error: '02' -select extractValue('<01>10:39:15<02>140','//*'); -extractValue('<01>10:39:15<02>140','//*') +select extractValue('<01>10:39:15<02>140','//*') as xml; +xml NULL Warnings: Warning 1525 Incorrect XML value: 'parse error at line 1 pos 13: unknown token unexpected (ident or '/' wanted)' @@ -816,17 +816,17 @@ ExtractValue(@xml, "/entry[(50test','/a/b/Text'); -ExtractValue('test','/a/b/Text') +select ExtractValue('test','/a/b/Text') as xml; +xml test -select ExtractValue('test','/a/b/comment'); -ExtractValue('test','/a/b/comment') +select ExtractValue('test','/a/b/comment') as xml; +xml test -select ExtractValue('test','/a/b/node'); -ExtractValue('test','/a/b/node') +select ExtractValue('test','/a/b/node') as xml; +xml test -select ExtractValue('test','/a/b/processing-instruction'); -ExtractValue('test','/a/b/processing-instruction') +select ExtractValue('test','/a/b/processing-instruction') as xml; +xml test select ExtractValue('test', '/a/and'); ExtractValue('test', '/a/and') @@ -852,44 +852,44 @@ test select ExtractValue('test', '/a/div:div'); ExtractValue('test', '/a/div:div') test -select ExtractValue('test', '/a/ancestor'); -ExtractValue('test', '/a/ancestor') +select ExtractValue('test', '/a/ancestor') as xml; +xml test -select ExtractValue('test', '/a/ancestor-or-self'); -ExtractValue('test', '/a/ancestor-or-self') +select ExtractValue('test', '/a/ancestor-or-self') as xml; +xml test -select ExtractValue('test', '/a/attribute'); -ExtractValue('test', '/a/attribute') +select ExtractValue('test', '/a/attribute') as xml; +xml test -select ExtractValue('test', '/a/child'); -ExtractValue('test', '/a/child') +select ExtractValue('test', '/a/child') as xml; +xml test -select ExtractValue('test', '/a/descendant'); -ExtractValue('test', '/a/descendant') +select ExtractValue('test', '/a/descendant') as xml; +xml test -select ExtractValue('test', '/a/descendant-or-self'); -ExtractValue('test', '/a/descendant-or-self') +select ExtractValue('test', '/a/descendant-or-self') as xml; +xml test -select ExtractValue('test', '/a/following'); -ExtractValue('test', '/a/following') +select ExtractValue('test', '/a/following') as xml; +xml test -select ExtractValue('test', '/a/following-sibling'); -ExtractValue('test', '/a/following-sibling') +select ExtractValue('test', '/a/following-sibling') as xml; +xml test -select ExtractValue('test', '/a/namespace'); -ExtractValue('test', '/a/namespace') +select ExtractValue('test', '/a/namespace') as xml; +xml test -select ExtractValue('test', '/a/parent'); -ExtractValue('test', '/a/parent') +select ExtractValue('test', '/a/parent') as xml; +xml test -select ExtractValue('test', '/a/preceding'); -ExtractValue('test', '/a/preceding') +select ExtractValue('test', '/a/preceding') as xml; +xml test -select ExtractValue('test', '/a/preceding-sibling'); -ExtractValue('test', '/a/preceding-sibling') +select ExtractValue('test', '/a/preceding-sibling') as xml; +xml test -select ExtractValue('test', '/a/self'); -ExtractValue('test', '/a/self') +select ExtractValue('test', '/a/self') as xml; +xml test set @i=1; select ExtractValue('b1b2','/a/b[$@i]'); @@ -1181,8 +1181,8 @@ UPDATEXML('x','(a)//a','') SELECT ExtractValue('aabb','(a)/a|(a)/b'); ExtractValue('aabb','(a)/a|(a)/b') aa bb -SELECT ExtractValue('abc21','substring(/a/b,..)'); -ExtractValue('abc21','substring(/a/b,..)') +SELECT ExtractValue('abc21','substring(/a/b,..)') as xml; +xml Warnings: Warning 1292 Truncated incorrect INTEGER value: '' diff --git a/mysql-test/main/xml.test b/mysql-test/main/xml.test index f042c4371ce..2d0dd9907bb 100644 --- a/mysql-test/main/xml.test +++ b/mysql-test/main/xml.test @@ -166,14 +166,11 @@ select extractValue('','/a/@b[2=position()]'); select extractValue('','/a/@b[3=position()]'); select extractValue('','/a/@b[2>=position()]'); select extractValue('','/a/@b[2<=position()]'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractValue('','/a/@b[position()=3 or position()=2]'); +select extractValue('','/a/@b[position()=3 or position()=2]') as xml; -SELECT extractValue('aa1c1a2','/a/b[count(c)=0]'); -SELECT extractValue('aa1c1a2','/a/b[count(c)=1]'); -select extractValue('a1b1b24','/a/b[sum(@ba)=3]'); ---enable_view_protocol +SELECT extractValue('aa1c1a2','/a/b[count(c)=0]') as xml; +SELECT extractValue('aa1c1a2','/a/b[count(c)=1]') as xml; +select extractValue('a1b1b24','/a/b[sum(@ba)=3]') as xml; select extractValue('b1b2','/a/b[1]'); select extractValue('b1b2','/a/b[boolean(1)]'); @@ -216,12 +213,9 @@ select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]'); select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]'); SET @xml='a1b1c1b2a2'; -#enable after fix MDEV-27871 ---disable_view_protocol -select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); -select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); ---enable_view_protocol -select UpdateXML('a1b1c1b2a2','/a/b/c',''); +select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') as xml; +select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++') as xml; +select UpdateXML('a1b1c1b2a2','/a/b/c','') as xml; SET @xml='bb'; select UpdateXML(@xml, '/a/b', 'ccc'); @@ -277,10 +271,7 @@ select extractvalue('bb!','//b!'); # select extractvalue('ABC','/a/descendant::*'); select extractvalue('ABC','/a/self::*'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractvalue('ABC','/a/descendant-or-self::*'); ---enable_view_protocol +select extractvalue('ABC','/a/descendant-or-self::*') as xml; # Bug #16320 XML: extractvalue() won't accept names containing underscores # select extractvalue('A','/A_B'); @@ -288,37 +279,26 @@ select extractvalue('A','/A_B'); # # Bug#16318: XML: extractvalue() incorrectly returns last() = 1 # -select extractvalue('AB1B2','/a/b[position()]'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractvalue('AB1B2','/a/b[count(.)=last()]'); ---enable_view_protocol -select extractvalue('AB1B2','/a/b[last()]'); -select extractvalue('AB1B2','/a/b[last()-1]'); -select extractvalue('AB1B2','/a/b[last()=1]'); -select extractvalue('AB1B2','/a/b[last()=2]'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractvalue('AB1B2','/a/b[last()=position()]'); ---enable_view_protocol -select extractvalue('AB1B2','/a/b[count(.)]'); -select extractvalue('AB1B2','/a/b[count(.)-1]'); -select extractvalue('AB1B2','/a/b[count(.)=1]'); -select extractvalue('AB1B2','/a/b[count(.)=2]'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractvalue('AB1B2','/a/b[count(.)=position()]'); ---enable_view_protocol +select extractvalue('AB1B2','/a/b[position()]') as xml; +select extractvalue('AB1B2','/a/b[count(.)=last()]') as xml; +select extractvalue('AB1B2','/a/b[last()]') as xml; +select extractvalue('AB1B2','/a/b[last()-1]') as xml; +select extractvalue('AB1B2','/a/b[last()=1]') as xml; +select extractvalue('AB1B2','/a/b[last()=2]') as xml; +select extractvalue('AB1B2','/a/b[last()=position()]') as xml; +select extractvalue('AB1B2','/a/b[count(.)]') as xml; +select extractvalue('AB1B2','/a/b[count(.)-1]') as xml; +select extractvalue('AB1B2','/a/b[count(.)=1]') as xml; +select extractvalue('AB1B2','/a/b[count(.)=2]') as xml; +select extractvalue('AB1B2','/a/b[count(.)=position()]') as xml; + # # Bug#16316: XML: extractvalue() is case-sensitive with contains() # -select extractvalue('Jack','/a[contains(../a,"J")]'); -select extractvalue('Jack','/a[contains(../a,"j")]'); -#enable after fix MDEV-27871 ---disable_view_protocol -select extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin); -select extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]'); ---enable_view_protocol +select extractvalue('Jack','/a[contains(../a,"J")]') as xml; +select extractvalue('Jack','/a[contains(../a,"j")]') as xml; +select extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin) as xml; +select extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]') as xml; # # Bug#18285: ExtractValue not returning character @@ -383,33 +363,25 @@ DROP PROCEDURE p2; # Bug#18170: XML: ExtractValue(): # XPath expression can't use QNames (colon in names) # -#enable after fix MDEV-27871 ---disable_view_protocol -select extractValue('','count(ns:element)'); -select extractValue('a','/ns:element'); -select extractValue('a','/ns:element/@xmlns:ns'); ---enable_view_protocol +select extractValue('','count(ns:element)') as xml; +select extractValue('a','/ns:element') as xml; +select extractValue('a','/ns:element/@xmlns:ns') as xml; + # # Bug#20795 extractvalue() won't accept names containing a dot (.) # -#enable after fix MDEV-27871 ---disable_view_protocol -select extractValue('DataOtherdata','/foo/foo.bar'); -select extractValue('DataOtherdata','/foo/something'); ---enable_view_protocol +select extractValue('DataOtherdata','/foo/foo.bar') as xml; +select extractValue('DataOtherdata','/foo/something') as xml; # # Bug#20854 XML functions: wrong result in ExtractValue # -#enable after fix MDEV-27871 ---disable_view_protocol ---error 1105 -select extractValue('<01>10:39:15<02>140','/zot/tim0/02'); -select extractValue('<01>10:39:15<02>140','//*'); ---enable_view_protocol - #view protocol generates additional warning --disable_view_protocol +--error 1105 +select extractValue('<01>10:39:15<02>140','/zot/tim0/02') as xml; +select extractValue('<01>10:39:15<02>140','//*') as xml; + # dot and dash are bad identtifier start character select extractValue('<.>test','//*'); select extractValue('<->test','//*'); @@ -457,13 +429,10 @@ select ExtractValue(@xml, "/entry[(50<=pt)]/id"); # # Test nodetypes in node name context # -select ExtractValue('test','/a/b/Text'); -#enable after fix MDEV-27871 ---disable_view_protocol -select ExtractValue('test','/a/b/comment'); -select ExtractValue('test','/a/b/node'); -select ExtractValue('test','/a/b/processing-instruction'); ---enable_view_protocol +select ExtractValue('test','/a/b/Text') as xml; +select ExtractValue('test','/a/b/comment') as xml; +select ExtractValue('test','/a/b/node') as xml; +select ExtractValue('test','/a/b/processing-instruction') as xml; # # Test keywords in node name contexts @@ -479,22 +448,19 @@ select ExtractValue('test', '/a/div:div'); # # Test axis names in node name context # -select ExtractValue('test', '/a/ancestor'); -#enable after fix MDEV-27871 ---disable_view_protocol -select ExtractValue('test', '/a/ancestor-or-self'); -select ExtractValue('test', '/a/attribute'); -select ExtractValue('test', '/a/child'); -select ExtractValue('test', '/a/descendant'); -select ExtractValue('test', '/a/descendant-or-self'); -select ExtractValue('test', '/a/following'); -select ExtractValue('test', '/a/following-sibling'); -select ExtractValue('test', '/a/namespace'); -select ExtractValue('test', '/a/parent'); -select ExtractValue('test', '/a/preceding'); -select ExtractValue('test', '/a/preceding-sibling'); ---enable_view_protocol -select ExtractValue('test', '/a/self'); +select ExtractValue('test', '/a/ancestor') as xml; +select ExtractValue('test', '/a/ancestor-or-self') as xml; +select ExtractValue('test', '/a/attribute') as xml; +select ExtractValue('test', '/a/child') as xml; +select ExtractValue('test', '/a/descendant') as xml; +select ExtractValue('test', '/a/descendant-or-self') as xml; +select ExtractValue('test', '/a/following') as xml; +select ExtractValue('test', '/a/following-sibling') as xml; +select ExtractValue('test', '/a/namespace') as xml; +select ExtractValue('test', '/a/parent') as xml; +select ExtractValue('test', '/a/preceding') as xml; +select ExtractValue('test', '/a/preceding-sibling') as xml; +select ExtractValue('test', '/a/self') as xml; # # Bug#26518 XPath and variables problem @@ -751,10 +717,7 @@ SELECT ExtractValue('aabb','(a)/a|(a)/b'); # MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes # MySQL bug#12428404 MYSQLD.EXE CRASHES WHEN EXTRACTVALUE() IS CALLED WITH MALFORMED XPATH EXP # -#enable after fix MDEV-27871 ---disable_view_protocol -SELECT ExtractValue('abc21','substring(/a/b,..)'); ---enable_view_protocol +SELECT ExtractValue('abc21','substring(/a/b,..)') as xml; --echo # --echo # Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index b913b295ad3..67347191261 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -1105,11 +1105,9 @@ select a, count(col1) over (order by a range between 0.1 preceding -and 0.1 following) +and 0.1 following) as count from t1; -a count(col1) over (order by a -range between 0.1 preceding -and 0.1 following) +a count 0.450 3 0.500 3 0.550 3 @@ -1255,33 +1253,33 @@ insert into t1 values (1,1,'foo'); insert into t1 values (2,2,'bar'); select count(*) over (order by a,b -range between unbounded preceding and current row) +range between unbounded preceding and current row) as count from t1; ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key select count(*) over (order by c -range between unbounded preceding and current row) +range between unbounded preceding and current row) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame select count(*) over (order by a -range between 'abcd' preceding and current row) +range between 'abcd' preceding and current row) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame select count(*) over (order by a -range between current row and 'foo' following) +range between current row and 'foo' following) as count from t1; ERROR HY000: Numeric datatype is required for RANGE-type frame # Try range frame with invalid bounds select count(*) over (order by a -rows between 0.5 preceding and current row) +rows between 0.5 preceding and current row) as count from t1; ERROR HY000: Integer is required for ROWS-type frame select count(*) over (order by a -rows between current row and 3.14 following) +rows between current row and 3.14 following) as count from t1; ERROR HY000: Integer is required for ROWS-type frame # @@ -1290,29 +1288,27 @@ ERROR HY000: Integer is required for ROWS-type frame select count(*) over (order by a rows between 1 preceding and 1 following -exclude current row) +exclude current row) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a range between 1 preceding and 1 following -exclude ties) +exclude ties) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a range between 1 preceding and 1 following -exclude group) +exclude group) as count from t1; ERROR HY000: Frame exclusion is not supported yet select count(*) over (order by a rows between 1 preceding and 1 following -exclude no others) +exclude no others) as count from t1; -count(*) over (order by a -rows between 1 preceding and 1 following -exclude no others) +count 2 2 drop table t1; @@ -1608,10 +1604,10 @@ insert into t1 values # Check using counters flush status; select -rank() over (partition by c order by a), -rank() over (partition by c order by b) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by b) as rank_b from t1; -rank() over (partition by c order by a) rank() over (partition by c order by b) +rank_a rank_b 1 3 2 2 3 1 @@ -1624,10 +1620,10 @@ Sort_rows 6 Sort_scan 2 flush status; select -rank() over (partition by c order by a), -rank() over (partition by c order by a) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by a) as rank_b from t1; -rank() over (partition by c order by a) rank() over (partition by c order by a) +rank_a rank_b 1 1 2 2 3 3 @@ -1640,8 +1636,8 @@ Sort_rows 3 Sort_scan 1 explain format=json select -rank() over (partition by c order by a), -rank() over (partition by c order by a) +rank() over (partition by c order by a) as rank_a, +rank() over (partition by c order by a) as rank_b from t1; EXPLAIN { @@ -1692,8 +1688,8 @@ EXPLAIN } explain format=json select -rank() over (partition by c order by a), -count(*) over (partition by c) +rank() over (partition by c order by a) as rank_a, +count(*) over (partition by c) as count_c from t1; EXPLAIN { @@ -1718,8 +1714,8 @@ EXPLAIN } explain format=json select -count(*) over (partition by c), -rank() over (partition by c order by a) +count(*) over (partition by c) as count_c, +rank() over (partition by c order by a) as rank_a from t1; EXPLAIN { @@ -1848,18 +1844,18 @@ insert into t1 values (1, 3, 4); insert into t1 values (1, 4, 8); select pk, a, -sum(a) over (order by pk rows between 0 preceding and current row) +sum(a) over (order by pk rows between 0 preceding and current row) as sum from t1; -pk a sum(a) over (order by pk rows between 0 preceding and current row) +pk a sum 1 1 1 2 2 2 3 4 4 4 8 8 select pk, a, -sum(a) over (order by pk rows between 1 preceding and 0 preceding) +sum(a) over (order by pk rows between 1 preceding and 0 preceding) as sum from t1; -pk a sum(a) over (order by pk rows between 1 preceding and 0 preceding) +pk a sum 1 1 1 2 2 3 3 4 6 @@ -1870,9 +1866,9 @@ insert into t1 values (200, 3, 4); insert into t1 values (200, 4, 8); select part_id, pk, a, -sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) as sum from t1; -part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +part_id pk a sum 1 1 1 1 1 2 2 2 1 3 4 4 @@ -1883,9 +1879,9 @@ part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preced 200 4 8 8 select part_id, pk, a, -sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) as sum from t1; -part_id pk a sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +part_id pk a sum 1 1 1 1 1 2 2 3 1 3 4 6 @@ -1910,8 +1906,8 @@ insert into t1 values (2000, 3), (2000, 3), (2000, 3); -select rank() over (partition by part_id order by a) from t1; -rank() over (partition by part_id order by a) +select rank() over (partition by part_id order by a) as rank from t1; +rank 1 2 2 @@ -1921,14 +1917,14 @@ rank() over (partition by part_id order by a) 3 3 3 -select distinct rank() over (partition by part_id order by a) from t1; -rank() over (partition by part_id order by a) +select distinct rank() over (partition by part_id order by a) as rank from t1; +rank 1 2 4 3 explain format=json -select distinct rank() over (partition by part_id order by a) from t1; +select distinct rank() over (partition by part_id order by a) as rank from t1; EXPLAIN { "query_block": { @@ -2008,11 +2004,8 @@ INSERT INTO `orders` VALUES (59940,238); SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey RANGE BETWEEN 15 FOLLOWING -AND 15 FOLLOWING) from orders; -o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey) -ORDER BY o_custkey -RANGE BETWEEN 15 FOLLOWING -AND 15 FOLLOWING) +AND 15 FOLLOWING) as avg from orders; +o_custkey avg 238 NULL 242 NULL DROP table orders; @@ -2224,15 +2217,15 @@ a NULL NULL NULL -SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t; -ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) +SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) as result from t; +result 0.00000000000000 0.00000000000000 0.00000000000000 SELECT sum(t.a) over (partition by t.b order by a), -sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) as sum from t; -sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +sum(t.a) over (partition by t.b order by a) sum 0.0000000000 0 1.0000000000 1 3.0000000000 1.7320508075688772 @@ -2407,9 +2400,9 @@ INSERT INTO t1 VALUES (1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200), (7,2000), (8,2100), (9,1600); SELECT id, sum(a) OVER (PARTITION BY id -ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; -id sum(a) OVER (PARTITION BY id +id sum 1 1000 2 1100 3 1800 @@ -2419,10 +2412,9 @@ id sum(a) OVER (PARTITION BY id 7 2000 8 2100 9 1600 -ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) -SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as sum FROM t1; -id sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +id sum 1 14000 2 13000 3 5900 @@ -3157,8 +3149,8 @@ DROP TABLE t1; # CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM; INSERT IGNORE INTO t1 VALUES ('foo'); -SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1); -('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) +SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) as result; +result 0 DROP TABLE t1; # @@ -3191,8 +3183,8 @@ DROP TABLE t1; # CREATE TABLE t1 (dt DATETIME); INSERT INTO t1 VALUES ('2017-05-17'); -SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; -MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) as result FROM t1; +result NULL DROP TABLE t1; # diff --git a/mysql-test/suite/innodb/r/innodb_ctype_big5.result b/mysql-test/suite/innodb/r/innodb_ctype_big5.result index 4c9f7a81cc3..bba6d4b82e4 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_big5.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_big5.result @@ -100,20 +100,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -237,20 +237,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result index d576f210d5a..c70c50ff3ef 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result @@ -100,20 +100,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -237,20 +237,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result index 78c78dff6eb..5323cdd7f6c 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result @@ -100,20 +100,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) as exp; +exp 6162632020 # # Collation mix @@ -237,20 +237,20 @@ DROP TABLE t1; # # IF, CASE, LEAST # -SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); -IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') as exp; +exp nopad -SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; -CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END as exp; +exp nopad -SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 61626320 -SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); -HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) as exp; +exp 6162632020 # # Collation mix diff --git a/mysql-test/suite/innodb_gis/r/precise.result b/mysql-test/suite/innodb_gis/r/precise.result index 6cc0368fbb4..a3fd4b1a480 100644 --- a/mysql-test/suite/innodb_gis/r/precise.result +++ b/mysql-test/suite/innodb_gis/r/precise.result @@ -456,30 +456,26 @@ dist buffer buf_area -1 POLYGON 16.00 SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')); -ST_CONTAINS( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)')) +GeomFromText('POINT(5 10)')) as geom; +geom 0 SELECT AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))); -AsText(ST_UNION( -GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), -GeomFromText('POINT(5 10)'))) +GeomFromText('POINT(5 10)'))) as geom; +geom GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10)) DROP PROCEDURE p1; # # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) as geom; +geom POLYGON # # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL # -SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); -GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) as geom; +geom POLYGON # # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER @@ -490,25 +486,19 @@ Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); -ST_WITHIN( -LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), -ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ') +ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))) as st; +st 0 SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); -ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), -ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) +ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) as st; +st 2 SELECT ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); -ST_NUMINTERIORRINGS( -ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), -SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) +SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) as st; +st 0 SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); -ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), -SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) +SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) as st; +st POLYGON((9 9,5 2,4 5,9 9)) From d1ecf5cc5f5e452c6c4d368b74c83b30f592526d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Jun 2024 15:57:07 +0300 Subject: [PATCH 54/85] MDEV-32176 Contention in ha_innobase::info_low() During a Sysbench oltp_point_select workload with 1 table and 400 concurrent connections, a bottleneck on dict_table_t::lock_mutex was observed in ha_innobase::info_low(). dict_table_t::lock_latch: Replaces lock_mutex. In ha_innobase::info_low() and several other places, we will acquire a shared dict_table_t::lock_latch or we may elide the latch if hardware memory transactions are available. innobase_build_v_templ(): Remove the parameter "bool locked", and require the caller to hold exclusive dict_table_t::lock_latch (instead of holding an exclusive dict_sys.latch). Tested by: Vladislav Vaintroub Reviewed by: Vladislav Vaintroub --- storage/innobase/handler/ha_innodb.cc | 77 ++++++++++++----------- storage/innobase/handler/ha_innodb.h | 6 +- storage/innobase/handler/handler0alter.cc | 22 ++++--- storage/innobase/handler/i_s.cc | 4 +- storage/innobase/include/dict0dict.h | 53 ++++++++-------- storage/innobase/include/dict0dict.inl | 50 --------------- storage/innobase/include/dict0mem.h | 71 ++++++++++----------- storage/innobase/lock/lock0lock.cc | 6 +- 8 files changed, 119 insertions(+), 170 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b0f69c06d0c..084b7fa350f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3267,9 +3267,9 @@ static bool innobase_query_caching_table_check_low( } #endif - table->lock_mutex_lock(); + table->lock_shared_lock(); auto len= UT_LIST_GET_LEN(table->locks); - table->lock_mutex_unlock(); + table->lock_shared_unlock(); return len == 0; } @@ -5596,15 +5596,13 @@ is done when the table first opened. @param[in] ib_table InnoDB dict_table_t @param[in,out] s_templ InnoDB template structure @param[in] add_v new virtual columns added along with - add index call -@param[in] locked true if dict_sys.latch is held */ + add index call */ void innobase_build_v_templ( const TABLE* table, const dict_table_t* ib_table, dict_vcol_templ_t* s_templ, - const dict_add_v_col_t* add_v, - bool locked) + const dict_add_v_col_t* add_v) { ulint ncol = unsigned(ib_table->n_cols) - DATA_N_SYS_COLS; ulint n_v_col = ib_table->n_v_cols; @@ -5612,6 +5610,7 @@ innobase_build_v_templ( DBUG_ENTER("innobase_build_v_templ"); ut_ad(ncol < REC_MAX_N_FIELDS); + ut_ad(ib_table->lock_mutex_is_owner()); if (add_v != NULL) { n_v_col += add_v->n_v_col; @@ -5619,20 +5618,7 @@ innobase_build_v_templ( ut_ad(n_v_col > 0); - if (!locked) { - dict_sys.lock(SRW_LOCK_CALL); - } - -#if 0 - /* This does not (need to) hold for ctx->new_table in - alter_rebuild_apply_log() */ - ut_ad(dict_sys.locked()); -#endif - if (s_templ->vtempl) { - if (!locked) { - dict_sys.unlock(); - } DBUG_VOID_RETURN; } @@ -5736,12 +5722,9 @@ innobase_build_v_templ( j++; } - if (!locked) { - dict_sys.unlock(); - } - s_templ->db_name = table->s->db.str; s_templ->tb_name = table->s->table_name.str; + DBUG_VOID_RETURN; } @@ -6019,15 +6002,15 @@ ha_innobase::open(const char* name, int, uint) key_used_on_scan = m_primary_key; if (ib_table->n_v_cols) { - dict_sys.lock(SRW_LOCK_CALL); + ib_table->lock_mutex_lock(); + if (ib_table->vc_templ == NULL) { ib_table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); innobase_build_v_templ( - table, ib_table, ib_table->vc_templ, NULL, - true); + table, ib_table, ib_table->vc_templ); } - dict_sys.unlock(); + ib_table->lock_mutex_unlock(); } if (!check_index_consistency(table, ib_table)) { @@ -14731,7 +14714,7 @@ fsp_get_available_space_in_free_extents(const fil_space_t& space) Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. @return HA_ERR_* error code or 0 */ - +TRANSACTIONAL_TARGET int ha_innobase::info_low( /*==================*/ @@ -14812,19 +14795,37 @@ ha_innobase::info_low( ulint stat_clustered_index_size; ulint stat_sum_of_other_index_sizes; - ib_table->stats_mutex_lock(); - ut_a(ib_table->stat_initialized); - n_rows = ib_table->stat_n_rows; +#if !defined NO_ELISION && !defined SUX_LOCK_GENERIC + if (xbegin()) { + if (ib_table->stats_mutex_is_locked()) + xabort(); - stat_clustered_index_size - = ib_table->stat_clustered_index_size; + n_rows = ib_table->stat_n_rows; - stat_sum_of_other_index_sizes - = ib_table->stat_sum_of_other_index_sizes; + stat_clustered_index_size + = ib_table->stat_clustered_index_size; - ib_table->stats_mutex_unlock(); + stat_sum_of_other_index_sizes + = ib_table->stat_sum_of_other_index_sizes; + + xend(); + } else +#endif + { + ib_table->stats_shared_lock(); + + n_rows = ib_table->stat_n_rows; + + stat_clustered_index_size + = ib_table->stat_clustered_index_size; + + stat_sum_of_other_index_sizes + = ib_table->stat_sum_of_other_index_sizes; + + ib_table->stats_shared_unlock(); + } /* The MySQL optimizer seems to assume in a left join that n_rows @@ -14944,9 +14945,9 @@ ha_innobase::info_low( stats.create_time = (ulong) stat_info.ctime; } - ib_table->stats_mutex_lock(); + ib_table->stats_shared_lock(); auto _ = make_scope_exit([ib_table]() { - ib_table->stats_mutex_unlock(); }); + ib_table->stats_shared_unlock(); }); ut_a(ib_table->stat_initialized); diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 50ac423f3a5..40396564589 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -880,15 +880,13 @@ innodb_rec_per_key( @param[in] ib_table InnoDB dict_table_t @param[in,out] s_templ InnoDB template structure @param[in] add_v new virtual columns added along with - add index call -@param[in] locked true if innobase_share_mutex is held */ + add index call */ void innobase_build_v_templ( const TABLE* table, const dict_table_t* ib_table, dict_vcol_templ_t* s_templ, - const dict_add_v_col_t* add_v, - bool locked); + const dict_add_v_col_t* add_v = nullptr); /** callback used by MySQL server layer to initialized the table virtual columns' template diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 15d616ad640..09f541a75d9 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -6521,16 +6521,16 @@ acquire_lock: acquiring an InnoDB table lock even for online operation, to ensure that the rollback of recovered transactions will not run concurrently with online ADD INDEX. */ - user_table->lock_mutex_lock(); + user_table->lock_shared_lock(); for (lock_t *lock = UT_LIST_GET_FIRST(user_table->locks); lock; lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) { if (lock->trx->is_recovered) { - user_table->lock_mutex_unlock(); + user_table->lock_shared_unlock(); goto acquire_lock; } } - user_table->lock_mutex_unlock(); + user_table->lock_shared_unlock(); } if (fts_exist) { @@ -8781,10 +8781,11 @@ ok_exit: } s_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); + ctx->new_table->lock_mutex_lock(); innobase_build_v_templ( - altered_table, ctx->new_table, s_templ, NULL, false); - + altered_table, ctx->new_table, s_templ); ctx->new_table->vc_templ = s_templ; + ctx->new_table->lock_mutex_unlock(); } else if (ctx->num_to_add_vcol > 0 && ctx->num_to_drop_vcol == 0) { /* if there is ongoing drop virtual column, then we disallow inplace add index on newly added virtual column, so it does @@ -8799,10 +8800,12 @@ ok_exit: add_v->v_col = ctx->add_vcol; add_v->v_col_name = ctx->add_vcol_name; + ctx->new_table->lock_mutex_lock(); innobase_build_v_templ( - altered_table, ctx->new_table, s_templ, add_v, false); + altered_table, ctx->new_table, s_templ, add_v); old_templ = ctx->new_table->vc_templ; ctx->new_table->vc_templ = s_templ; + ctx->new_table->lock_mutex_unlock(); } /* Drop virtual column without rebuild will keep dict table @@ -11075,11 +11078,10 @@ static bool alter_rebuild_apply_log( if (ctx->new_table->n_v_cols > 0) { s_templ = UT_NEW_NOKEY( dict_vcol_templ_t()); - s_templ->vtempl = NULL; - - innobase_build_v_templ(altered_table, ctx->new_table, s_templ, - NULL, true); + ctx->new_table->lock_mutex_lock(); + innobase_build_v_templ(altered_table, ctx->new_table, s_templ); ctx->new_table->vc_templ = s_templ; + ctx->new_table->lock_mutex_unlock(); } dberr_t error = row_log_table_apply( diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 0e520a174da..604ce85e93e 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -4986,9 +4986,9 @@ i_s_dict_fill_sys_tablestats(THD* thd, dict_table_t *table, Field **fields= table_to_fill->field; { - table->stats_mutex_lock(); + table->stats_shared_lock(); auto _ = make_scope_exit([table]() { - table->stats_mutex_unlock(); dict_sys.unlock(); }); + table->stats_shared_unlock(); dict_sys.unlock(); }); OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 6f9a0efe02c..8394d746bc4 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -700,35 +700,32 @@ bool dict_table_has_indexed_v_cols( const dict_table_t* table); -/********************************************************************//** -Gets the approximately estimated number of rows in the table. +TPOOL_SUPPRESS_TSAN +/** Get the estimated number of rows in the table. @return estimated number of rows */ -UNIV_INLINE -ib_uint64_t -dict_table_get_n_rows( -/*==================*/ - const dict_table_t* table) /*!< in: table */ - MY_ATTRIBUTE((warn_unused_result)); -/********************************************************************//** -Increment the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_inc( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ - MY_ATTRIBUTE((nonnull)); -/********************************************************************//** -Decrement the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_dec( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ - MY_ATTRIBUTE((nonnull)); +inline uint64_t dict_table_get_n_rows(const dict_table_t *table) +{ + ut_ad(table->stat_initialized); + return table->stat_n_rows; +} + +/** Increment the number of rows in the table by one. +Note that this operation is not protected by any latch, +the number is approximate. */ +TPOOL_SUPPRESS_TSAN inline void dict_table_n_rows_inc(dict_table_t *table) +{ + if (auto n_rows= table->stat_n_rows + 1) + table->stat_n_rows= n_rows; +} + +/** Decrement the number of rows in the table by one. +Note that this operation is not protected by any latch, +the number is approximate. */ +TPOOL_SUPPRESS_TSAN inline void dict_table_n_rows_dec(dict_table_t *table) +{ + if (auto n_rows= table->stat_n_rows) + table->stat_n_rows= n_rows - 1; +} /** Get nth virtual column @param[in] table target table diff --git a/storage/innobase/include/dict0dict.inl b/storage/innobase/include/dict0dict.inl index a210c839020..5c760f1e89d 100644 --- a/storage/innobase/include/dict0dict.inl +++ b/storage/innobase/include/dict0dict.inl @@ -306,56 +306,6 @@ dict_table_has_indexed_v_cols( return(false); } -/********************************************************************//** -Gets the approximately estimated number of rows in the table. -@return estimated number of rows */ -UNIV_INLINE -ib_uint64_t -dict_table_get_n_rows( -/*==================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->stat_initialized); - - return(table->stat_n_rows); -} - -/********************************************************************//** -Increment the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_inc( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ -{ - if (table->stat_initialized) { - ib_uint64_t n_rows = table->stat_n_rows; - if (n_rows < 0xFFFFFFFFFFFFFFFFULL) { - table->stat_n_rows = n_rows + 1; - } - } -} - -/********************************************************************//** -Decrement the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_dec( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ -{ - if (table->stat_initialized) { - ib_uint64_t n_rows = table->stat_n_rows; - if (n_rows > 0) { - table->stat_n_rows = n_rows - 1; - } - } -} - #ifdef UNIV_DEBUG /********************************************************************//** Gets the nth column of a table. diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index f8b83919f83..751d7f1a9e4 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -2018,38 +2018,36 @@ struct dict_table_t { #ifdef UNIV_DEBUG /** @return whether the current thread holds the lock_mutex */ - bool lock_mutex_is_owner() const - { return lock_mutex_owner == pthread_self(); } + bool lock_mutex_is_owner() const { return lock_latch.have_wr(); } /** @return whether the current thread holds the stats_mutex (lock_mutex) */ - bool stats_mutex_is_owner() const - { return lock_mutex_owner == pthread_self(); } + bool stats_mutex_is_owner() const { return lock_latch.have_wr(); } #endif /* UNIV_DEBUG */ - void lock_mutex_init() { lock_mutex.init(); } - void lock_mutex_destroy() { lock_mutex.destroy(); } - /** Acquire lock_mutex */ - void lock_mutex_lock() + void lock_mutex_init() { - ut_ad(!lock_mutex_is_owner()); - lock_mutex.wr_lock(); - ut_ad(!lock_mutex_owner.exchange(pthread_self())); - } - /** Try to acquire lock_mutex */ - bool lock_mutex_trylock() - { - ut_ad(!lock_mutex_is_owner()); - bool acquired= lock_mutex.wr_lock_try(); - ut_ad(!acquired || !lock_mutex_owner.exchange(pthread_self())); - return acquired; - } - /** Release lock_mutex */ - void lock_mutex_unlock() - { - ut_ad(lock_mutex_owner.exchange(0) == pthread_self()); - lock_mutex.wr_unlock(); +#ifdef UNIV_DEBUG + lock_latch.SRW_LOCK_INIT(0); +#else + lock_latch.init(); +#endif } + void lock_mutex_destroy() { lock_latch.destroy(); } + /** Acquire exclusive lock_latch */ + void lock_mutex_lock() { lock_latch.wr_lock(ut_d(SRW_LOCK_CALL)); } + /** Try to acquire exclusive lock_latch */ + bool lock_mutex_trylock() { return lock_latch.wr_lock_try(); } + /** Release exclusive lock_latch */ + void lock_mutex_unlock() { lock_latch.wr_unlock(); } + /** Acquire shared lock_latch */ + void lock_shared_lock() { lock_latch.rd_lock(ut_d(SRW_LOCK_CALL)); } + /** Release shared lock_latch */ + void lock_shared_unlock() { lock_latch.rd_unlock(); } + #ifndef SUX_LOCK_GENERIC - /** @return whether the lock mutex is held by some thread */ - bool lock_mutex_is_locked() const noexcept { return lock_mutex.is_locked(); } + /** @return whether an exclusive lock_latch is held by some thread */ + bool lock_mutex_is_locked() const noexcept + { return lock_latch.is_write_locked(); } + bool stats_mutex_is_locked() const noexcept + { return lock_latch.is_write_locked(); } #endif /* stats mutex lock currently defaults to lock_mutex but in the future, @@ -2060,6 +2058,8 @@ struct dict_table_t { void stats_mutex_destroy() { lock_mutex_destroy(); } void stats_mutex_lock() { lock_mutex_lock(); } void stats_mutex_unlock() { lock_mutex_unlock(); } + void stats_shared_lock() { lock_shared_lock(); } + void stats_shared_unlock() { lock_shared_unlock(); } /** Rename the data file. @param new_name name of the table @@ -2342,18 +2342,19 @@ public: /** Mutex protecting autoinc and freed_indexes. */ srw_spin_mutex autoinc_mutex; private: - /** Mutex protecting locks on this table. */ - srw_spin_mutex lock_mutex; #ifdef UNIV_DEBUG - /** The owner of lock_mutex (0 if none) */ - Atomic_relaxed lock_mutex_owner{0}; + typedef srw_lock_debug lock_latch_type; +#else + typedef srw_spin_lock_low lock_latch_type; #endif + /** RW-lock protecting locks and statistics on this table */ + lock_latch_type lock_latch; public: /** Autoinc counter value to give to the next inserted row. */ uint64_t autoinc; /** The transaction that currently holds the the AUTOINC lock on this table. - Protected by lock_mutex. + Protected by lock_latch. The thread that is executing autoinc_trx may read this field without holding a latch, in row_lock_table_autoinc_for_mysql(). Only the autoinc_trx thread may clear this field; it cannot be @@ -2412,9 +2413,9 @@ public: /** Magic number. */ ulint magic_n; #endif /* UNIV_DEBUG */ - /** mysql_row_templ_t for base columns used for compute the virtual - columns */ - dict_vcol_templ_t* vc_templ; + /** mysql_row_templ_t for base columns used for compute the virtual + columns; protected by lock_latch */ + dict_vcol_templ_t *vc_templ; /* @return whether the table has any other transcation lock other than the given transaction */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 3e3d573ba5b..bae24011fe4 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6388,7 +6388,7 @@ resolve_table_lock: if (!table->lock_mutex_trylock()) { /* The correct latching order is: - lock_sys.latch, table->lock_mutex_lock(), lock_sys.wait_mutex. + lock_sys.latch, table->lock_latch, lock_sys.wait_mutex. Thus, we must release lock_sys.wait_mutex for a blocking wait. */ mysql_mutex_unlock(&lock_sys.wait_mutex); table->lock_mutex_lock(); @@ -6585,9 +6585,9 @@ bool lock_table_has_locks(dict_table_t *table) else #endif { - table->lock_mutex_lock(); + table->lock_shared_lock(); len= UT_LIST_GET_LEN(table->locks); - table->lock_mutex_unlock(); + table->lock_shared_unlock(); } if (len) return true; From 54b7a879e9f56ba987ca887a12d5de9427f6bf3b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 29 Jun 2024 09:48:38 +1000 Subject: [PATCH 55/85] MDEV-34313 WITHOUT_SERVER/WSREP postfix Mismatched IF/ENDIF statements in cmake caused a warning. --- cmake/wsrep.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index 66d99a1890a..a01a1d68f64 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -69,4 +69,4 @@ ENDIF() IF (NOT WIN32) ADD_FEATURE_INFO(WSREP WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)") ENDIF() -ENDIF(NOT WITHOUT_SERVER) +ENDIF(WITHOUT_SERVER) From d472391471547f7f2785b472526df5bbab45ecc2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 29 Jun 2024 14:44:05 +1000 Subject: [PATCH 56/85] tpool: correct LIBAIO_REQIRED typo Noticed thanks to Razvan Liviu Varzaru --- tpool/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpool/CMakeLists.txt b/tpool/CMakeLists.txt index 3a49ea22837..169c53c75fa 100644 --- a/tpool/CMakeLists.txt +++ b/tpool/CMakeLists.txt @@ -7,7 +7,7 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") IF(WITH_URING) SET(URING_REQUIRED REQUIRED) ELSEIF(WITH_LIBAIO) - SET(LIBAIO_REQIRED REQUIRED) + SET(LIBAIO_REQUIRED REQUIRED) ENDIF() FIND_PACKAGE(URING QUIET ${URING_REQUIRED}) IF(URING_FOUND) From e7b76f87c461c988cec28842fdf5f51c8b28a7f9 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 21 Jun 2024 18:21:32 +1000 Subject: [PATCH 57/85] MDEV-34437 restrict port and extra-port to tcp valid values extra_port and port are 16 bit numbers and not 32 bit as they are tcp ports. Restrict their value. --- mysql-test/suite/sys_vars/r/sysvars_server_embedded.result | 4 ++-- mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result | 4 ++-- sql/sys_vars.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index fcd1ee9a141..fd3fa8dae8d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -957,7 +957,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Extra port number to use for tcp connections in a one-thread-per-connection manner. 0 means don't use another port NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 4294967295 +NUMERIC_MAX_VALUE 65535 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES @@ -2777,7 +2777,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Port number to use for connection or 0 to default to, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306), whatever comes first NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 4294967295 +NUMERIC_MAX_VALUE 65535 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 1d5e9499c7a..5b13b35425e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -977,7 +977,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Extra port number to use for tcp connections in a one-thread-per-connection manner. 0 means don't use another port NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 4294967295 +NUMERIC_MAX_VALUE 65535 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES @@ -2937,7 +2937,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Port number to use for connection or 0 to default to, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306), whatever comes first NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 4294967295 +NUMERIC_MAX_VALUE 65535 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 8ccd1bb235e..beab81bf462 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2798,7 +2798,7 @@ static Sys_var_uint Sys_port( #endif "built-in default (" STRINGIFY_ARG(MYSQL_PORT) "), whatever comes first", READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'), - VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1)); + VALID_RANGE(0, UINT_MAX16), DEFAULT(0), BLOCK_SIZE(1)); static Sys_var_ulong Sys_preload_buff_size( "preload_buffer_size", @@ -6244,7 +6244,7 @@ static Sys_var_uint Sys_extra_port( "Extra port number to use for tcp connections in a " "one-thread-per-connection manner. 0 means don't use another port", READ_ONLY GLOBAL_VAR(mysqld_extra_port), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1)); + VALID_RANGE(0, UINT_MAX16), DEFAULT(0), BLOCK_SIZE(1)); static Sys_var_on_access_global From cfbd57dfb7920ed9858d3d12f74f0ba4b6f60c36 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 25 Dec 2023 13:59:07 +0300 Subject: [PATCH 58/85] MDEV-33064: Sync trx->wsrep state from THD on trx start InnoDB transactions may be reused after committed: - when taken from the transaction pool - during a DDL operation execution In this case wsrep flag on trx object is cleared, which may cause wrong execution logic afterwards (wsrep-related hooks are not run). Make trx->wsrep flag initialize from THD object only once on InnoDB transaction start and don't change it throughout the transaction's lifetime. The flag is reset at commit time as before. Unconditionally set wsrep=OFF for THD objects that represent InnoDB background threads. Make Wsrep_schema::store_view() operate in its own transaction. Fix streaming replication transactions' fragments rollback to not switch THD->wsrep value during transaction's execution (use THD->wsrep_ignore_table as a workaround). Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-33064.result | 26 ++++++++++ mysql-test/suite/galera/t/MDEV-33064.test | 57 +++++++++++++++++++++ sql/handler.cc | 4 +- sql/sql_class.cc | 6 ++- sql/wsrep_schema.cc | 41 ++++++++++++++- sql/wsrep_server_service.cc | 24 +-------- storage/innobase/handler/ha_innodb.cc | 12 ++--- storage/innobase/trx/trx0trx.cc | 3 ++ 8 files changed, 140 insertions(+), 33 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-33064.result create mode 100644 mysql-test/suite/galera/t/MDEV-33064.test diff --git a/mysql-test/suite/galera/r/MDEV-33064.result b/mysql-test/suite/galera/r/MDEV-33064.result new file mode 100644 index 00000000000..22e1ce7a77a --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-33064.result @@ -0,0 +1,26 @@ +connection node_2; +connection node_1; +connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1; +CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1_fk(c1 INT PRIMARY KEY, c2 INT, INDEX (c2), FOREIGN KEY (c2) REFERENCES t1(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection con1; +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL may_alter WAIT_FOR bf_abort'; +INSERT INTO t1_fk VALUES (1, 1); +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR may_alter'; +SET DEBUG_SYNC = 'lock_wait_end WAIT_FOR alter_continue'; +ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INPLACE; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL alter_continue'; +connection node_1; +connection node_2; +INSERT INTO t1 (c1, c2) VALUES (2, 2); +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1_fk, t1; +disconnect con1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/MDEV-33064.test b/mysql-test/suite/galera/t/MDEV-33064.test new file mode 100644 index 00000000000..704ed70ab56 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-33064.test @@ -0,0 +1,57 @@ +# +# MDEV-33064: ALTER INPLACE running TOI should abort a conflicting DML operation +# +# DDL operations may commit InnoDB transactions more than once during the execution. +# In this case wsrep flag on trx object is cleared, which may cause wrong logic of +# such operations afterwards (wsrep-related hooks are not run). +# One of the consequences was that DDL operation couldn't abort a DML operation +# holding conflicting locks. +# +# The fix: re-enable wsrep flag on trx restart if it's a part of a DDL operation. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1 + +CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1_fk(c1 INT PRIMARY KEY, c2 INT, INDEX (c2), FOREIGN KEY (c2) REFERENCES t1(c1)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1); + +--connection con1 +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL may_alter WAIT_FOR bf_abort'; +# INSERT also grabs FK-referenced table lock. +--send + INSERT INTO t1_fk VALUES (1, 1); + +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR may_alter'; +SET DEBUG_SYNC = 'lock_wait_end WAIT_FOR alter_continue'; +# ALTER BF-aborts INSERT. +--send + ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INPLACE; + +--connection con1 +# INSERT gets BF-aborted. +--error ER_LOCK_DEADLOCK +--reap +SET DEBUG_SYNC = 'now SIGNAL alter_continue'; + +--connection node_1 +# ALTER succeeds. +--reap + +--connection node_2 +# Sanity check that ALTER has been replicated. +INSERT INTO t1 (c1, c2) VALUES (2, 2); + +# Cleanup. +--connection node_1 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1_fk, t1; +--disconnect con1 +--source include/galera_end.inc diff --git a/sql/handler.cc b/sql/handler.cc index a7214402163..97cf3f15b95 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7885,7 +7885,9 @@ int handler::ha_delete_row(const uchar *buf) } #ifdef WITH_WSREP THD *thd= ha_thd(); - if (WSREP_NNULL(thd)) + /* For streaming replication, when removing fragments, don't call + wsrep_after_row() as that would initiate new streaming transaction */ + if (WSREP_NNULL(thd) && !thd->wsrep_ignore_table) { /* for streaming replication, the following wsrep_after_row() may replicate a fragment, so we have to declare potential PA diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e2d98771c87..7272ee2531b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5068,6 +5068,9 @@ MYSQL_THD create_background_thd() thd->real_id= 0; thd->thread_id= 0; thd->query_id= 0; +#ifdef WITH_WSREP + thd->variables.wsrep_on= FALSE; +#endif /* WITH_WSREP */ return thd; } @@ -6411,7 +6414,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) wsrep_is_active(this) && variables.wsrep_trx_fragment_size > 0) { - if (!is_current_stmt_binlog_format_row()) + if (!is_current_stmt_binlog_disabled() && + !is_current_stmt_binlog_format_row()) { my_message(ER_NOT_SUPPORTED_YET, "Streaming replication not supported with " diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 32ce8310bc4..ec1d67780b9 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -155,6 +155,24 @@ private: my_bool m_wsrep_on; }; +class wsrep_ignore_table +{ +public: + wsrep_ignore_table(THD* thd) + : m_thd(thd) + , m_wsrep_ignore_table(thd->wsrep_ignore_table) + { + thd->wsrep_ignore_table= true; + } + ~wsrep_ignore_table() + { + m_thd->wsrep_ignore_table= m_wsrep_ignore_table; + } +private: + THD* m_thd; + my_bool m_wsrep_ignore_table; +}; + class thd_server_status { public: @@ -739,6 +757,12 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view) Wsrep_schema_impl::binlog_off binlog_off(thd); Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd); + if (trans_begin(thd, MYSQL_START_TRANS_OPT_READ_WRITE)) + { + WSREP_ERROR("Failed to start transaction for store view"); + goto out_not_started; + } + /* Clean up cluster table and members table. */ @@ -832,7 +856,22 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view) #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ ret= 0; out: + if (ret) + { + trans_rollback_stmt(thd); + if (!trans_rollback(thd)) + { + close_thread_tables(thd); + } + } + else if (trans_commit(thd)) + { + ret= 1; + WSREP_ERROR("Failed to commit transaction for store view"); + } + thd->release_transactional_locks(); +out_not_started: DBUG_RETURN(ret); } @@ -1184,7 +1223,7 @@ int Wsrep_schema::remove_fragments(THD* thd, int ret= 0; WSREP_DEBUG("Removing %zu fragments", fragments.size()); - Wsrep_schema_impl::wsrep_off wsrep_off(thd); + Wsrep_schema_impl::wsrep_ignore_table wsrep_ignore_table(thd); Wsrep_schema_impl::binlog_off binlog_off(thd); Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd); diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 19fa4470687..71252c94399 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -239,29 +239,9 @@ void Wsrep_server_service::log_view( view.state_id().seqno().get() >= prev_view.state_id().seqno().get()); } - if (trans_begin(applier->m_thd, MYSQL_START_TRANS_OPT_READ_WRITE)) + if (wsrep_schema->store_view(applier->m_thd, view)) { - WSREP_WARN("Failed to start transaction for store view"); - } - else - { - if (wsrep_schema->store_view(applier->m_thd, view)) - { - WSREP_WARN("Failed to store view"); - trans_rollback_stmt(applier->m_thd); - if (!trans_rollback(applier->m_thd)) - { - close_thread_tables(applier->m_thd); - } - } - else - { - if (trans_commit(applier->m_thd)) - { - WSREP_WARN("Failed to commit transaction for store view"); - } - } - applier->m_thd->release_transactional_locks(); + WSREP_WARN("Failed to store view"); } /* diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 084b7fa350f..d0afde153b0 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2892,10 +2892,6 @@ innobase_trx_init( thd, OPTION_RELAXED_UNIQUE_CHECKS); trx->snapshot_isolation = THDVAR(thd, snapshot_isolation) & 1; -#ifdef WITH_WSREP - trx->wsrep = wsrep_on(thd); -#endif - DBUG_VOID_RETURN; } @@ -4414,9 +4410,6 @@ innobase_commit_low( trx_commit_for_mysql(trx); } else { trx->will_lock = false; -#ifdef WITH_WSREP - trx->wsrep = false; -#endif /* WITH_WSREP */ } #ifdef WITH_WSREP @@ -8718,7 +8711,10 @@ func_exit: } #ifdef WITH_WSREP - if (error == DB_SUCCESS && trx->is_wsrep() + if (error == DB_SUCCESS && + /* For sequences, InnoDB transaction may not have been started yet. + Check THD-level wsrep state in that case. */ + (trx->is_wsrep() || (!trx_is_started(trx) && wsrep_on(m_user_thd))) && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd)) { DBUG_PRINT("wsrep", ("update row key")); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index a05ddbe901d..bd28a491a13 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -919,6 +919,7 @@ trx_start_low( #ifdef WITH_WSREP trx->xid.null(); + trx->wsrep = wsrep_on(trx->mysql_thd); #endif /* WITH_WSREP */ ut_a(ib_vector_is_empty(trx->autoinc_locks)); @@ -1492,6 +1493,8 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr) trx_finalize_for_fts(this, undo_no != 0); #ifdef WITH_WSREP + ut_ad(is_wsrep() == wsrep_on(mysql_thd)); + /* Serialization history has been written and the transaction is committed in memory, which makes this commit ordered. Release commit order critical section. */ From f6fcfc1a6a058fd7cac6bf53216ea73f3a04b22d Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Thu, 20 Jun 2024 12:34:55 +0300 Subject: [PATCH 59/85] MDEV-33064 amendment: replace trx->wsrep=0 with an assert in trx_rollback_for_mysql() Signed-off-by: Julius Goryavsky --- storage/innobase/trx/trx0roll.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 4de7ab29243..d1baab9e684 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -219,7 +219,7 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) even if trx->state is TRX_STATE_NOT_STARTED. */ ut_ad(!(trx->lock.was_chosen_as_deadlock_victim & 1)); #ifdef WITH_WSREP - trx->wsrep= false; + ut_ad(!trx->is_wsrep()); trx->lock.was_chosen_as_deadlock_victim= false; #endif return(DB_SUCCESS); From d046b13e7bbfa05a9b017428765bb5e0660ac33e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 25 Jun 2024 09:27:11 +0400 Subject: [PATCH 60/85] MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) Item_func_hex::fix_length_and_dec() evaluated a too short data type for signed numeric arguments, which resulted in a 'Data too long for column' error on CREATE..SELECT. Fixing the code to take into account that a short negative numer can produce a long HEX value: -1 -> 'FFFFFFFFFFFFFFFF' Also fixing Item_func_hex::val_str_ascii_from_val_real(). Without this change, MTR test with HEX with negative float point arguments failed on some platforms (aarch64, ppc64le, s390-x). --- mysql-test/main/func_str.result | 2 +- mysql-test/main/type_float.result | 79 +++++++++ mysql-test/main/type_float.test | 51 ++++++ mysql-test/main/type_int.result | 161 ++++++++++++++++++ mysql-test/main/type_int.test | 82 +++++++++ mysql-test/main/type_newdecimal.result | 74 ++++++++ mysql-test/main/type_newdecimal.test | 48 ++++++ .../type_test/type_test_double.result | 2 +- .../type_test/type_test_int8.result | 2 +- sql/item_strfunc.cc | 6 +- sql/item_strfunc.h | 14 +- 11 files changed, 514 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index b5217d98fd2..52bfd3f0e3e 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -748,7 +748,7 @@ t1 CREATE TABLE `t1` ( `bin(130)` varchar(64) DEFAULT NULL, `oct(130)` varchar(64) DEFAULT NULL, `conv(130,16,10)` varchar(64) DEFAULT NULL, - `hex(130)` varchar(6) DEFAULT NULL, + `hex(130)` varchar(16) DEFAULT NULL, `char(130)` varbinary(4) DEFAULT NULL, `format(130,10)` varchar(25) DEFAULT NULL, `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index fa850cf9b34..e944b4bb64f 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -1206,3 +1206,82 @@ DROP VIEW v1; # # End of 10.4 tests # +# +# Start of 10.5 tests +# +# +# MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 AS SELECT HEX(-2e0) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFE +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(-1e0) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(1e0) AS h; +SELECT * FROM t1; +h +1 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(2e0) AS h; +SELECT * FROM t1; +h +2 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (-1e38),(-255),(-2),(-1),(+1),(+2),(255),(1e38); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +a h +-1e38 FFFFFFFFFFFFFFFF +-255 FFFFFFFFFFFFFF01 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +255 FF +1e38 FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a float YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (-1e308),(-255),(-2),(-1),(+1),(+2),(255),(1e308); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +a h +-1e308 FFFFFFFFFFFFFFFF +-255 FFFFFFFFFFFFFF01 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +255 FF +1e308 FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a double YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index 12ae5937533..1cc5cc94267 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -745,3 +745,54 @@ DROP VIEW v1; --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +--echo # + +SET sql_mode=STRICT_ALL_TABLES; + +CREATE TABLE t1 AS SELECT HEX(-2e0) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(-1e0) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(1e0) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(2e0) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (-1e38),(-255),(-2),(-1),(+1),(+2),(255),(1e38); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (-1e308),(-255),(-2),(-1),(+1),(+2),(255),(1e308); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index c25b213c7c4..0b933a0de15 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -1686,5 +1686,166 @@ c0 127 drop table t1; # +# MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 AS SELECT HEX(-2) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFE +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(-1) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(1) AS h; +SELECT * FROM t1; +h +1 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(2) AS h; +SELECT * FROM t1; +h +2 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (-0x80),(-2),(-1),(1),(2),(0x7f); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +a h +-128 FFFFFFFFFFFFFF80 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +127 7F +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a tinyint(4) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +a h +-32768 FFFFFFFFFFFF8000 +-128 FFFFFFFFFFFFFF80 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +127 7F +32767 7FFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a smallint(6) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a MEDIUMINT); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +a h +-8388608 FFFFFFFFFF800000 +-32768 FFFFFFFFFFFF8000 +-128 FFFFFFFFFFFFFF80 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +127 7F +32767 7FFF +8388607 7FFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a mediumint(9) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (-0x80000000); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +INSERT INTO t1 VALUES (0x7fffffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +a h +-2147483648 FFFFFFFF80000000 +-8388608 FFFFFFFFFF800000 +-32768 FFFFFFFFFFFF8000 +-128 FFFFFFFFFFFFFF80 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +127 7F +32767 7FFF +8388607 7FFFFF +2147483647 7FFFFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a int(11) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (-0x8000000000000000); +INSERT INTO t1 VALUES (-0x80000000000000); +INSERT INTO t1 VALUES (-0x800000000000); +INSERT INTO t1 VALUES (-0x8000000000); +INSERT INTO t1 VALUES (-0x80000000); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +INSERT INTO t1 VALUES (0x7fffffff); +INSERT INTO t1 VALUES (0x7fffffffff); +INSERT INTO t1 VALUES (0x7fffffffffff); +INSERT INTO t1 VALUES (0x7fffffffffffff); +INSERT INTO t1 VALUES (0x7fffffffffffffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +a h +-9223372036854775808 8000000000000000 +-36028797018963968 FF80000000000000 +-140737488355328 FFFF800000000000 +-549755813888 FFFFFF8000000000 +-2147483648 FFFFFFFF80000000 +-8388608 FFFFFFFFFF800000 +-32768 FFFFFFFFFFFF8000 +-128 FFFFFFFFFFFFFF80 +-2 FFFFFFFFFFFFFFFE +-1 FFFFFFFFFFFFFFFF +1 1 +2 2 +127 7F +32767 7FFF +8388607 7FFFFF +2147483647 7FFFFFFF +549755813887 7FFFFFFFFF +140737488355327 7FFFFFFFFFFF +36028797018963967 7FFFFFFFFFFFFF +9223372036854775807 7FFFFFFFFFFFFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a bigint(20) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# # End of 10.5 tests # diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test index c339bfa1834..290edb80410 100644 --- a/mysql-test/main/type_int.test +++ b/mysql-test/main/type_int.test @@ -564,6 +564,88 @@ insert into t1 values (-128); select * from t1 where 18446744073700599371 > c0; drop table t1; +--echo # +--echo # MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +--echo # + +SET sql_mode=STRICT_ALL_TABLES; + +CREATE TABLE t1 AS SELECT HEX(-2) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(-1) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(1) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(2) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (-0x80),(-2),(-1),(1),(2),(0x7f); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a MEDIUMINT); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (-0x80000000); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +INSERT INTO t1 VALUES (0x7fffffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (-0x8000000000000000); +INSERT INTO t1 VALUES (-0x80000000000000); +INSERT INTO t1 VALUES (-0x800000000000); +INSERT INTO t1 VALUES (-0x8000000000); +INSERT INTO t1 VALUES (-0x80000000); +INSERT INTO t1 VALUES (-0x800000); +INSERT INTO t1 VALUES (-0x8000),(-0x80),(-2),(-1),(1),(2),(0x7f),(0x7fff); +INSERT INTO t1 VALUES (0x7fffff); +INSERT INTO t1 VALUES (0x7fffffff); +INSERT INTO t1 VALUES (0x7fffffffff); +INSERT INTO t1 VALUES (0x7fffffffffff); +INSERT INTO t1 VALUES (0x7fffffffffffff); +INSERT INTO t1 VALUES (0x7fffffffffffffff); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +SET sql_mode=DEFAULT; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result index 5f959d83438..9bd848ddea9 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -2801,3 +2801,77 @@ DROP TABLE t2,t1; # # End of 10.4 tests # +# +# Start of 10.5 tests +# +# +# MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 AS SELECT HEX(-2) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFE +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(-1) AS h; +SELECT * FROM t1; +h +FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(+1) AS h; +SELECT * FROM t1; +h +1 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT HEX(+2) AS h; +SELECT * FROM t1; +h +2 +SHOW COLUMNS IN t1; +Field Type Null Key Default Extra +h varchar(16) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(41,1)); +INSERT INTO t1 VALUES (-1000000000000000000000000000000000000000); +INSERT INTO t1 VALUES (-0x8000000000); +INSERT INTO t1 VALUES (-0x80000000),(-0x800000),(-0x8000),(-0x80),(-2),(-1); +INSERT INTO t1 VALUES (1),(2),(128),(0x7fff),(0x7fffff),(0x7fffffff); +INSERT INTO t1 VALUES (+0x7fffffffff); +INSERT INTO t1 VALUES (+1000000000000000000000000000000000000000); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +a h +-1000000000000000000000000000000000000000.0 FFFFFFFFFFFFFFFF +-549755813888.0 FFFFFF8000000000 +-2147483648.0 FFFFFFFF80000000 +-8388608.0 FFFFFFFFFF800000 +-32768.0 FFFFFFFFFFFF8000 +-128.0 FFFFFFFFFFFFFF80 +-2.0 FFFFFFFFFFFFFFFE +-1.0 FFFFFFFFFFFFFFFF +1.0 1 +2.0 2 +128.0 80 +32767.0 7FFF +8388607.0 7FFFFF +2147483647.0 7FFFFFFF +549755813887.0 7FFFFFFFFF +1000000000000000000000000000000000000000.0 FFFFFFFFFFFFFFFF +SHOW COLUMNS IN t2; +Field Type Null Key Default Extra +a decimal(41,1) YES NULL +h varchar(16) YES NULL +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index 77ef338f93e..33e56da7da8 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -2000,3 +2000,51 @@ DROP TABLE t2,t1; --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-20548 Unexpected error on CREATE..SELECT HEX(num) +--echo # + +SET sql_mode=STRICT_ALL_TABLES; + +CREATE TABLE t1 AS SELECT HEX(-2) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(-1) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(+1) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT HEX(+2) AS h; +SELECT * FROM t1; +SHOW COLUMNS IN t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(41,1)); +INSERT INTO t1 VALUES (-1000000000000000000000000000000000000000); +INSERT INTO t1 VALUES (-0x8000000000); +INSERT INTO t1 VALUES (-0x80000000),(-0x800000),(-0x8000),(-0x80),(-2),(-1); +INSERT INTO t1 VALUES (1),(2),(128),(0x7fff),(0x7fffff),(0x7fffffff); +INSERT INTO t1 VALUES (+0x7fffffffff); +INSERT INTO t1 VALUES (+1000000000000000000000000000000000000000); +CREATE TABLE t2 AS SELECT a, HEX(a) AS h FROM t1; +SELECT * FROM t2 ORDER BY a; +SHOW COLUMNS IN t2; +DROP TABLE t1, t2; + +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.result b/plugin/type_test/mysql-test/type_test/type_test_double.result index edcfdc0eff8..ff009885072 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_double.result +++ b/plugin/type_test/mysql-test/type_test/type_test_double.result @@ -83,7 +83,7 @@ SELECT HEX(a), a; END; $$ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def HEX(a) 253 44 3 Y 0 0 8 +def HEX(a) 253 16 3 Y 0 0 8 def a a 5 22 3 Y 32768 31 63 HEX(a) a 100 256 diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8.result b/plugin/type_test/mysql-test/type_test/type_test_int8.result index 75fcf1f2f5e..4d7175ffe69 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_int8.result +++ b/plugin/type_test/mysql-test/type_test/type_test_int8.result @@ -62,7 +62,7 @@ SELECT HEX(a), a; END; $$ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def HEX(a) 253 40 3 Y 0 0 8 +def HEX(a) 253 16 3 Y 0 0 8 def a a 8 20 3 Y 32768 0 63 HEX(a) a 100 256 diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c36a2a5c072..8c8bb04edef 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3770,9 +3770,11 @@ String *Item_func_hex::val_str_ascii_from_val_real(String *str) return 0; if ((val <= (double) LONGLONG_MIN) || (val >= (double) (ulonglong) ULONGLONG_MAX)) - dec= ~(longlong) 0; + dec= ULONGLONG_MAX; + else if (val < 0) + dec= (ulonglong) (longlong) (val - 0.5); else - dec= (ulonglong) (val + (val > 0 ? 0.5 : -0.5)); + dec= (ulonglong) (val + 0.5); return str->set_hex(dec) ? make_empty_result(str) : str; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index e40726ce255..42a41242e01 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1379,10 +1379,20 @@ public: } bool fix_length_and_dec() override { + m_arg0_type_handler= args[0]->type_handler(); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); decimals=0; - fix_char_length(args[0]->max_length * 2); - m_arg0_type_handler= args[0]->type_handler(); + /* + Reserve space for 16 characters for signed numeric data types: + hex(-1) -> 'FFFFFFFFFFFFFFFF'. + For unsigned numeric types, HEX() can create too large columns. + This should be eventually fixed to create minimum possible columns. + */ + const Type_handler_numeric *tn= + dynamic_cast(m_arg0_type_handler); + size_t char_length= (tn && !(tn->flags() & UNSIGNED_FLAG)) ? + (size_t) 16 : (size_t) args[0]->max_length * 2; + fix_char_length(char_length); return FALSE; } Item *get_copy(THD *thd) override From 090cecd5e82918bb711babd8f22337ca7036b67b Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Wed, 30 Aug 2023 12:22:07 +0700 Subject: [PATCH 61/85] MDEV-31933: Make working view-protocol + ps-protocol (running two protocols together) Fix for v. 10.5 --- mysql-test/main/distinct_notembedded.test | 4 + .../main/group_min_max_notembedded.test | 3 + mysql-test/main/having.test | 9 ++ mysql-test/main/opt_trace.test | 92 +++++++++++++++++++ mysql-test/main/opt_trace_index_merge.test | 2 + .../main/opt_trace_index_merge_innodb.test | 2 + mysql-test/main/opt_trace_ucs2.test | 3 + mysql-test/main/range_notembedded.test | 3 + mysql-test/main/selectivity_notembedded.test | 14 ++- mysql-test/main/subselect.test | 6 ++ mysql-test/main/temp_table_symlink.test | 2 + 11 files changed, 139 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/distinct_notembedded.test b/mysql-test/main/distinct_notembedded.test index 9ef2f45913c..84d39f975a6 100644 --- a/mysql-test/main/distinct_notembedded.test +++ b/mysql-test/main/distinct_notembedded.test @@ -6,6 +6,8 @@ --echo # MDEV-30660 COUNT DISTINCT seems unnecessarily slow when run on a PK --echo # +#Enable after fix MDEV-32034 +--disable_view_protocol set @save_optimizer_trace = @@optimizer_trace; SET optimizer_trace='enabled=on'; let $trace= @@ -104,6 +106,8 @@ eval $trace; DROP TABLE t1, t2, t3; DROP VIEW v1; SET optimizer_trace = @save_optimizer_trace; +--enable_view_protocol + --echo # --echo # end of 10.5 tests --echo # diff --git a/mysql-test/main/group_min_max_notembedded.test b/mysql-test/main/group_min_max_notembedded.test index 930ee8464f8..611cac02460 100644 --- a/mysql-test/main/group_min_max_notembedded.test +++ b/mysql-test/main/group_min_max_notembedded.test @@ -23,10 +23,13 @@ SET SELECT DISTINCT * FROM t1 WHERE a IN (1, 2); +#Enable after fix MDEV-32034 +--disable_view_protocol select CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]') as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE from information_schema.optimizer_trace; +--enable_view_protocol set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2; drop table t1; diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test index f5212d441d5..b114070c60f 100644 --- a/mysql-test/main/having.test +++ b/mysql-test/main/having.test @@ -258,6 +258,8 @@ where t1.col2 in # the having column is resolved in the FROM clause of the outer query - # works in ANSI +#Enable after fix MDEV-31937 +--disable_ps2_protocol select t1.col1 from t1 where t1.col2 in (select t2.col2 from t2 @@ -284,6 +286,7 @@ where t1.col2 in group by t2.col1, t2.col2 having col_t1 <= 10) group by col_t1 having col_t1 <= 20; +--enable_ps2_protocol # # nested HAVING clauses @@ -412,11 +415,14 @@ INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale'); INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna'); INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale'); +#Enable after fix MDEV-31937 +--disable_ps2_protocol SELECT EMPNUM, GRADE*1000 FROM HU.STAFF WHERE GRADE * 1000 > ANY (SELECT SUM(BUDGET) FROM HU.PROJ GROUP BY CITY, PTYPE HAVING HU.PROJ.CITY = HU.STAFF.CITY); +--enable_ps2_protocol DROP SCHEMA HU; USE test; @@ -956,6 +962,8 @@ DROP TABLE t; --echo # MDEV-29731 Crash when HAVING in a correlated subquery references --echo # columns in the outer query --echo # +#Enable after fix MDEV-29731 +--disable_view_protocol CREATE TABLE t (a INT, b INT); SELECT 1 FROM t WHERE b = (SELECT 1 FROM t GROUP BY a HAVING b = a+1); @@ -998,6 +1006,7 @@ UPDATE t SET a = '' WHERE (0, a) IN ((0,-1),(+1,0)) ORDER BY 1+AVG(a) OVER (ORDER BY a)) ORDER BY a; DROP TABLE t; +--enable_view_protocol --echo # --echo # End of 10.4 tests diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 309de72337c..9ff74f15921 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -77,7 +77,9 @@ analyze table t1; analyze table t2; explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b; +--disable_view_protocol select * from information_schema.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1,t2,t0; --echo # @@ -104,7 +106,9 @@ INSERT INTO t1(a) SELECT a FROM t1; analyze table t1; EXPLAIN SELECT DISTINCT a FROM t1; +--disable_view_protocol select * from information_schema.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -114,7 +118,9 @@ CREATE TABLE t1 (a INT, b INT, c int, d int, KEY(a,b,c,d)); INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (1,0,1,1), (3,2,3,3), (4,5,4,4); ANALYZE TABLE t1; EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a; +--disable_view_protocol select * from information_schema.OPTIMIZER_TRACE; +--enable_view_protocol DROP TABLE t1; CREATE TABLE t1 (id INT NOT NULL, a DATE, KEY(id,a)); @@ -128,9 +134,13 @@ INSERT INTO t1 values (1,'2001-01-01'),(1,'2001-01-02'), (4,'2001-01-03'),(4,'2001-01-04'); set optimizer_trace='enabled=on'; EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -159,7 +169,9 @@ update t1 set b=2 where pk between 0 and 20; analyze table t1; set optimizer_trace='enabled=on'; explain select * from t1 where a=1 and b=2 order by c limit 1; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1,ten,one_k; --echo # @@ -185,15 +197,21 @@ analyze table t3; --echo # table t2 should be eliminated explain select t1.a from t1 left join t2 on t1.a=t2.a; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol --echo # no tables should be eliminated explain select * from t1 left join t2 on t2.a=t1.a; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol --echo # multiple tables are eliminated explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0, t1, t2, t3; --echo # @@ -218,7 +236,9 @@ analyze table t1,t10; set optimizer_trace='enabled=on'; explain extended select * from t1 where a in (select pk from t10); +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0,t1,t11,t10,t12,t2; --echo # @@ -244,7 +264,9 @@ set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables= PREFERABLY; set optimizer_trace='enabled=on'; explain select * from t1 where pk = 2 and a=5 and b=1; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@use_stat_tables= @save_use_stat_tables; drop table t0,t1; @@ -321,7 +343,9 @@ alter table t0 add key(a); set optimizer_trace=1; explain delete from t0 where t0.a<3; +--disable_view_protocol select * from information_schema.optimizer_trace; +--enable_view_protocol drop table ten,t0; set optimizer_trace='enabled=off'; @@ -338,7 +362,9 @@ alter table t0 add key(a); create table t1 like t0; insert into t1 select * from t0; explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3; +--disable_view_protocol select * from information_schema.optimizer_trace; +--enable_view_protocol drop table ten,t0,t1; set optimizer_trace='enabled=off'; @@ -350,7 +376,9 @@ set optimizer_trace=1; create table t1 (a int); insert into t1 values (1),(2),(3); explain select * from (select rand() from t1)q; +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; set optimizer_trace='enabled=off'; @@ -365,6 +393,7 @@ create table t2(a int); insert into t2 values (1),(2),(3),(1),(2),(3),(1),(2),(3); set @save_optimizer_switch= @@optimizer_switch; explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_inner_2); +--disable_view_protocol select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; --echo # with Firstmatch, mostly for tracing fix_semijoin_strategies_for_picked_join_order @@ -377,6 +406,7 @@ set optimizer_switch='materialization=on'; explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4); select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol set @@optimizer_switch= @save_optimizer_switch; drop table t1,t2; @@ -405,11 +435,14 @@ create table t1 ( a int, b int, key a_b(a,b)); insert into t1 select a,a from one_k; set optimizer_trace='enabled=on'; +#Enable after fix MDEV-32034 +--disable_view_protocol explain select * from t1 force index (a_b) where a=2 and b=4; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; explain select * from t1 where a >= 900 and b between 10 and 20; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0,t1; @@ -418,7 +451,10 @@ create table t1 (start_date date, end_date date, filler char(100), key(start_dat insert into t1 select date_add(now(), interval a day), date_add(now(), interval (a+7) day), 'data' from one_k; --enable_warnings explain select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01'; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1,one_k; create table ten(a int); @@ -433,7 +469,10 @@ create table t1 ( insert into t1 select a,a, a,a from ten; explain select * from t1 force index(a_b_c) where a between 1 and 4 and b < 50; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table ten,t1; --echo # Ported test from MYSQL for ranges involving Binary column @@ -442,11 +481,14 @@ CREATE TABLE t1(i INT PRIMARY KEY, b BINARY(16), INDEX i_b(b)); INSERT INTO t1 VALUES (1, x'D95B94336A9946A39CF5B58CFE772D8C'); INSERT INTO t1 VALUES (2, NULL); +#Enable after fix MDEV-32034 +--disable_view_protocol EXPLAIN SELECT * FROM t1 WHERE b IN (0xD95B94336A9946A39CF5B58CFE772D8C); select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; EXPLAIN SELECT * FROM t1 WHERE b IS NULL; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; @@ -459,6 +501,8 @@ INSERT INTO t1 VALUES (1, 'ab\n'); INSERT INTO t1 VALUES (2, NULL); set optimizer_trace=1; EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; ALTER TABLE t1 modify column b BINARY(10) AFTER i; @@ -502,6 +546,7 @@ insert into t1 select date_add(now(), interval a day), date_add(now(), interval --enable_warnings explain format=json select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01'; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1, t0, one_k; --echo # @@ -533,13 +578,19 @@ set optimizer_trace=1; --echo # but for joins using condition selectivity it is not as trivial. So, --echo # now we are printing it) explain select * from t0 A, one_k B where A.a<5 and B.a<800; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol set join_cache_level=@tmp_jcl; --echo # This shows post-join selectivity explain select * from t0 A, one_k B where A.a=B.b and B.a<800; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0, one_k; --echo # @@ -551,7 +602,10 @@ insert into t1 values ('foo'), ('bar'); EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0); SELECT * FROM t1 WHERE a= REPEAT('a', 0); +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol DROP TABLE t1; --echo # @@ -569,7 +623,10 @@ insert into t3 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); explain select * from t3 where (a,a) in (select t1.a, t2.a from t1, t2 where t1.b=t2.b); +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1,t2,t3; @@ -581,7 +638,10 @@ create table t1 (kp1 int, kp2 int, key(kp1, kp2)); insert into t1 values (1,1),(1,5),(5,1),(5,5); set optimizer_trace=1; select * from t1 force index(kp1) where (kp1=2 and kp2 >=4); +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -595,7 +655,10 @@ INSERT INTO t2 SELECT seq, seq from seq_1_to_100; SET OPTIMIZER_TRACE=1; EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol DROP TABLE t1,t2; --echo # @@ -607,12 +670,15 @@ CREATE TABLE t1(a INT, b INT); INSERT INTO t1 SELECT seq, seq from seq_1_to_100; SET optimizer_trace=1; ANALYZE TABLE t1 PERSISTENT FOR ALL; +#Enable after fix MDEV-32034 +--disable_view_protocol EXPLAIN EXTENDED SELECT * from t1 WHERE a between 1 and 5 and b <= 5; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; EXPLAIN EXTENDED SELECT * from t1 WHERE a != 5; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -623,7 +689,10 @@ drop table t1; CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) ); SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101; UPDATE t1 SET b=10 WHERE a=1; +#Enable after fix MDEV-32034 +--disable_view_protocol SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol DROP TABLE t1; set optimizer_trace='enabled=off'; @@ -684,10 +753,13 @@ where c5 in (1,2,3,4,5,6,7,8,9,10) and c6 in (1,2,3,4); +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace, '$**.setup_range_conditions')) from information_schema.optimizer_trace; +--enable_view_protocol drop table t1; @@ -701,7 +773,9 @@ CREATE TABLE t (a int, b int); CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c; INSERT INTO t VALUES (0,4),(5,6); UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a; +--disable_view_protocol SELECT * FROM information_schema.optimizer_trace; +--enable_view_protocol SELECT * FROM t; @@ -794,11 +868,14 @@ set optimizer_trace=DEFAULT; --echo # MDEV-29179 Condition pushdown from HAVING into WHERE is not shown in optimizer trace --echo # +#Enable after fix MDEV-32034 +--disable_view_protocol CREATE TABLE t1 (a INT, b VARCHAR(1), KEY (a), KEY(b,a)) ENGINE=MEMORY; INSERT INTO t1 VALUES (4,'n'),(1,'h'),(NULL,'w'); SET optimizer_trace= 'enabled=on'; SELECT b, a FROM t1 WHERE b <> 'p' OR a = 4 GROUP BY b, a HAVING a <= 7; SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ) exp1, JSON_VALID(trace) exp2 FROM information_schema.optimizer_trace; DROP TABLE t1; +--enable_view_protocol --echo # --echo # End of 10.4 tests @@ -833,8 +910,11 @@ insert into t3 select a,a from t0; explain select * from t1 left join (t2 join t3 on t3.pk=1000) on t2.a=t1.a and t2.pk is null; +#Enable after fix MDEV-32034 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) as jd from information_schema.optimizer_trace; +--disable_view_protocol drop table t0, t1, t2, t3; @@ -850,17 +930,27 @@ set in_predicate_conversion_threshold=3; explain select * from t0 where a in (1,2,3,4,5,6); +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; +--enable_view_protocol explain select * from t0 where a in (1,2,3,4,5,a+1); +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; +--enable_view_protocol explain select * from t0 where a in ('1','2','3','4','5','6'); + +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) as jd from information_schema.optimizer_trace; +--enable_view_protocol set in_predicate_conversion_threshold=@tmp; drop table t0; @@ -875,7 +965,9 @@ set optimizer_trace=1; insert into t2 select * from t1 where a<= b and a>4; +--disable_view_protocol select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace; +--enable_view_protocol drop table t1, t2; diff --git a/mysql-test/main/opt_trace_index_merge.test b/mysql-test/main/opt_trace_index_merge.test index 1181aaa3db1..3652e2cfc12 100644 --- a/mysql-test/main/opt_trace_index_merge.test +++ b/mysql-test/main/opt_trace_index_merge.test @@ -15,7 +15,9 @@ from t0 A, t0 B, t0 C; --echo This should use union: explain select * from t1 where a=1 or b=1; +--disable_view_protocol select * from information_schema.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0,t1; set optimizer_trace="enabled=off"; set @@optimizer_switch= @tmp_opt_switch; diff --git a/mysql-test/main/opt_trace_index_merge_innodb.test b/mysql-test/main/opt_trace_index_merge_innodb.test index 42d8c57144c..3b8e60f687e 100644 --- a/mysql-test/main/opt_trace_index_merge_innodb.test +++ b/mysql-test/main/opt_trace_index_merge_innodb.test @@ -33,7 +33,9 @@ set optimizer_trace="enabled=on"; set @tmp_index_merge_ror_cpk=@@optimizer_switch; set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 != 0 and key1 = 1; +--disable_view_protocol select * from information_schema.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; set @@optimizer_switch= @tmp_index_merge_ror_cpk; diff --git a/mysql-test/main/opt_trace_ucs2.test b/mysql-test/main/opt_trace_ucs2.test index eff7d960c17..599bf5ff7a7 100644 --- a/mysql-test/main/opt_trace_ucs2.test +++ b/mysql-test/main/opt_trace_ucs2.test @@ -6,5 +6,8 @@ insert into t1 values ('a', 'a'); insert into t1 values ('a', 'a'); set optimizer_trace=1; explain format=json select * from t1 force index(col1) where col1 >='a'; +# Enable after fix MDEV-31408 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; diff --git a/mysql-test/main/range_notembedded.test b/mysql-test/main/range_notembedded.test index 00d16a5d564..df9fe0fbd40 100644 --- a/mysql-test/main/range_notembedded.test +++ b/mysql-test/main/range_notembedded.test @@ -26,8 +26,11 @@ explain select * from t2 where key1 in (1,2,3) and pk not in (1,2,3); --echo # This should show only ranges in form "(1) <= (key1) <= (1)" --echo # ranges over "pk" should not be constructed. +# Enable after fix MDEV-31408 +--disable_view_protocol select json_detailed(JSON_EXTRACT(trace, '$**.ranges')) from information_schema.optimizer_trace; +--enable_view_protocol set optimizer_trace=@tmp_21958; drop table t2; diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test index 30e0b7f0d2f..323e4ca6bd6 100644 --- a/mysql-test/main/selectivity_notembedded.test +++ b/mysql-test/main/selectivity_notembedded.test @@ -98,9 +98,12 @@ set @tmp=@@optimizer_trace; set optimizer_trace=1; explain select * from t10 where a in (91303); +#Enable after fix MDEV-32034 +--disable_view_protocol --echo # Must have selectivity_from_histogram <= 1.0: select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel from information_schema.optimizer_trace; +--enable_view_protocol set optimizer_trace=@tmp; drop table t0,t1,t10; @@ -169,17 +172,23 @@ while ($i < $N_CONDS) { #echo $query_tbl; evalp $query_tbl; +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace,'$**.selectivity_for_columns[0]')) as JS from information_schema.optimizer_trace; +--enable_view_protocol + evalp $query_tbl; +#Enable after fix MDEV-32034 +--disable_view_protocol eval select json_detailed(json_extract(trace,'\$**.selectivity_for_columns[$N_LAST_COND]')) as JS from information_schema.optimizer_trace; - +--enable_view_protocol --echo # --echo # Check if not being able to infer anything for the first MAX_KEY @@ -200,10 +209,13 @@ let $query_tbl= $query_tbl) and col$N_LAST_COND>1; #echo $query_tbl; evalp $query_tbl; +#Enable after fix MDEV-32034 +--disable_view_protocol select json_detailed(json_extract(trace,'$**.selectivity_for_columns')) as JS from information_schema.optimizer_trace; +--enable_view_protocol set optimizer_trace=@trace_tmp; drop table t1; diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 5fafaad8754..d010f01be56 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -338,7 +338,10 @@ CREATE TABLE `t1` ( SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; -- error ER_BAD_FIELD_ERROR SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; +#Enable after fix MDEV-31937 +--disable_ps2_protocol SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; +--enable_ps2_protocol INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); -- error ER_SUBQUERY_NO_1_ROW EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); @@ -2998,10 +3001,13 @@ SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test FROM t1 WHERE t1.d=0 GROUP BY a; +# Enable after fix MDEV-32038 +--disable_ps2_protocol SELECT tt.a, (SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a) LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test FROM t1 as tt; +--enable_ps2_protocol SELECT tt.a, (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a) diff --git a/mysql-test/main/temp_table_symlink.test b/mysql-test/main/temp_table_symlink.test index ea5f1dfa4de..a0be38d9073 100644 --- a/mysql-test/main/temp_table_symlink.test +++ b/mysql-test/main/temp_table_symlink.test @@ -23,8 +23,10 @@ error 1,1030; create temporary table t2 (a int); error 1,1030; create temporary table t3 (a int) engine=Aria; +--disable_view_protocol error 1,1030; select * from information_schema.columns where table_schema='test'; +--enable_view_protocol flush tables; select * from d1; From 243dee741542dee949fdeb027b8a7d10fdee95c3 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 24 Jun 2024 09:17:26 +1000 Subject: [PATCH 62/85] MDEV-34437: handle error on getaddrinfo When getaddrinfo returns and error, the contents of ai are invalid so we cannot continue based on their data structures. In the previous branch of the if statement, we abort there if there is an error so for consistency we abort here too. The test case fixes the port number to UINTMAX32 for both an enumberated bind-address and the default bind-address covering the two calls to getaddrinfo. Review thanks Sanja. --- .../main/bad_startup_options_debug.result | 7 ++++ .../main/bad_startup_options_debug.test | 34 +++++++++++++++++++ sql/mysqld.cc | 8 +++++ 3 files changed, 49 insertions(+) create mode 100644 mysql-test/main/bad_startup_options_debug.result create mode 100644 mysql-test/main/bad_startup_options_debug.test diff --git a/mysql-test/main/bad_startup_options_debug.result b/mysql-test/main/bad_startup_options_debug.result new file mode 100644 index 00000000000..626d9337d2b --- /dev/null +++ b/mysql-test/main/bad_startup_options_debug.result @@ -0,0 +1,7 @@ +# +# MDEV-34437 SIGSEGV in vio_get_normalized_ip when using extra-port +# +FOUND 1 /\[ERROR\] Can't create IP socket: Servname not supported/ in errorlog.err +FOUND 1 /\[ERROR\] Can't create IP socket: Servname not supported/ in errorlog.err +# restart +# End of 10.11 tests diff --git a/mysql-test/main/bad_startup_options_debug.test b/mysql-test/main/bad_startup_options_debug.test new file mode 100644 index 00000000000..c43124eba39 --- /dev/null +++ b/mysql-test/main/bad_startup_options_debug.test @@ -0,0 +1,34 @@ +# mysqld refuses to run as root normally. +--source include/not_as_root.inc +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/linux.inc + +--source include/shutdown_mysqld.inc + +# Try to start the server, with bad values for some options. +# Make sure, the starts fails, and expected message is in the error log + +--let errorlog=$MYSQL_TMP_DIR/errorlog.err +--let SEARCH_FILE=$errorlog + +--echo # +--echo # MDEV-34437 SIGSEGV in vio_get_normalized_ip when using extra-port +--echo # + +# getaddrinfo failure by fixing port to invalid value +--error 1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --debug='d,sabotage_port_number' --log-error=$errorlog +--let SEARCH_PATTERN=\[ERROR\] Can't create IP socket: Servname not supported +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + +--error 1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --debug='d,sabotage_port_number' --bind-address=0.0.0.0 --log-error=$errorlog +--let SEARCH_PATTERN=\[ERROR\] Can't create IP socket: Servname not supported +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + +--source include/start_mysqld.inc + +--echo # End of 10.11 tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 890fe8cf87e..d1d32fc77fe 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2329,6 +2329,7 @@ static void activate_tcp_port(uint port, else real_bind_addr_str= my_bind_addr_str; + DBUG_EXECUTE_IF("sabotage_port_number", port= UINT_MAX32;); my_snprintf(port_buf, NI_MAXSERV, "%d", port); if (real_bind_addr_str && *real_bind_addr_str) @@ -2372,6 +2373,13 @@ static void activate_tcp_port(uint port, else { error= getaddrinfo(real_bind_addr_str, port_buf, &hints, &ai); + if (unlikely(error != 0)) + { + sql_print_error("%s: %s", ER_DEFAULT(ER_IPSOCK_ERROR), + gai_strerror(error)); + unireg_abort(1); /* purecov: tested */ + } + head= ai; } From d8c9c5ead656c12730bfebc8edbf339089f3aae2 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 28 Jun 2024 18:41:05 +0300 Subject: [PATCH 63/85] MDEV-34491 Setting log_slow_admin="" at startup should be converted to log_slow_admin=ALL We have an issue if a user have the following in a configuration file: log_slow_filter="" # Log everything to slow query log log_queries_not_using_indexes=ON This set log_slow_filter to 'not_using_index' which disables slow_query_logging of most queries. In effect, on should never use log_slow_filter="" in config files but instead use log_slow_filter=ALL. Fixed by changing log_slow_filter="" that comes either from a configuration file or from the command line, when starting to the server, to log_slow_filter=ALL. A warning will be printed when this happens. Other things: - One can now use =ALL for any 'set' variable to set all options at once. (backported from 10.6) --- mysql-test/main/log_slow_filter.opt | 4 ++++ mysql-test/main/log_slow_filter.result | 8 +++++++ mysql-test/main/log_slow_filter.test | 7 ++++++ mysql-test/main/mysqld--help.result | 8 +++---- .../sys_vars/r/sysvars_server_embedded.result | 2 +- .../r/sysvars_server_notembedded.result | 2 +- mysys/my_getopt.c | 22 ++++++++++++------- sql/mysqld.cc | 8 +++++++ sql/mysqld.h | 1 + sql/sys_vars.cc | 5 +++-- sql/sys_vars.inl | 11 ++++++++++ 11 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 mysql-test/main/log_slow_filter.opt create mode 100644 mysql-test/main/log_slow_filter.result create mode 100644 mysql-test/main/log_slow_filter.test diff --git a/mysql-test/main/log_slow_filter.opt b/mysql-test/main/log_slow_filter.opt new file mode 100644 index 00000000000..3cadc343ed8 --- /dev/null +++ b/mysql-test/main/log_slow_filter.opt @@ -0,0 +1,4 @@ +--log-slow-filter= --log_queries_not_using_indexes=0 + + + diff --git a/mysql-test/main/log_slow_filter.result b/mysql-test/main/log_slow_filter.result new file mode 100644 index 00000000000..0d785ec7e98 --- /dev/null +++ b/mysql-test/main/log_slow_filter.result @@ -0,0 +1,8 @@ +call mtr.add_suppression("log_slow_filter=\"\" changed to log_slow_filter=ALL"); +show variables like "log_slow_filter"; +Variable_name Value +log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk +set @@log_slow_filter="all"; +show variables like "log_slow_filter"; +Variable_name Value +log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,not_using_index,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk diff --git a/mysql-test/main/log_slow_filter.test b/mysql-test/main/log_slow_filter.test new file mode 100644 index 00000000000..d677e37fece --- /dev/null +++ b/mysql-test/main/log_slow_filter.test @@ -0,0 +1,7 @@ +# Test setting log_slow_filter to empty in config files + +call mtr.add_suppression("log_slow_filter=\"\" changed to log_slow_filter=ALL"); + +show variables like "log_slow_filter"; +set @@log_slow_filter="all"; +show variables like "log_slow_filter"; diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 1a2a740cb77..43377506eba 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -496,10 +496,10 @@ The following specify which files/extra groups are read (specified before remain combination of: admin, call, slave, sp --log-slow-filter=name Log only certain types of queries to the slow log. If - variable empty alll kind of queries are logged. All - types are bound by slow_query_time, except - 'not_using_index' which is always logged if enabled. Any - combination of: admin, filesort, filesort_on_disk, + variable empty all kind of queries are logged. All types + are bound by slow_query_time, except 'not_using_index' + which is always logged if enabled. Any combination of: + admin, filesort, filesort_on_disk, filesort_priority_queue, full_join, full_scan, not_using_index, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index fd3fa8dae8d..f7aea1f9f3c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1675,7 +1675,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_FILTER VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT Log only certain types of queries to the slow log. If variable empty alll kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled +VARIABLE_COMMENT Log only certain types of queries to the slow log. If variable empty all kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 5b13b35425e..35734466470 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1815,7 +1815,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_FILTER VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT Log only certain types of queries to the slow log. If variable empty alll kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled +VARIABLE_COMMENT Log only certain types of queries to the slow log. If variable empty all kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index bed80d3efe2..40cc17d0c22 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -802,15 +802,21 @@ static int setval(const struct my_option *opts, void *value, char *argument, *((ulonglong*)value)= find_typeset(argument, opts->typelib, &err); if (err) { - /* Accept an integer representation of the set */ - char *endptr; - ulonglong arg= (ulonglong) strtol(argument, &endptr, 10); - if (*endptr || (arg >> 1) >= (1ULL << (opts->typelib->count-1))) + /* Check if option 'all' is used (to set all bits) */ + if (!my_strcasecmp(&my_charset_latin1, argument, "all")) + *(ulonglong*) value= ((1ULL << opts->typelib->count) - 1); + else { - res= EXIT_ARGUMENT_INVALID; - goto ret; - }; - *(ulonglong*)value= arg; + /* Accept an integer representation of the set */ + char *endptr; + ulonglong arg= (ulonglong) strtol(argument, &endptr, 10); + if (*endptr || (arg >> 1) >= (1ULL << (opts->typelib->count-1))) + { + res= EXIT_ARGUMENT_INVALID; + goto ret; + }; + *(ulonglong*)value= arg; + } err= 0; } break; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a9960400c17..3eb9e7830c3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8294,6 +8294,14 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, if (argument == NULL) /* no argument */ log_error_file_ptr= const_cast(""); break; + case OPT_LOG_SLOW_FILTER: + if (argument == NULL || *argument == 0) + { + /* By default log_slow_filter_has all values except QPLAN_NOT_USING_INDEX */ + global_system_variables.log_slow_filter= opt->def_value | QPLAN_NOT_USING_INDEX; + sql_print_warning("log_slow_filter=\"\" changed to log_slow_filter=ALL"); + } + break; case OPT_IGNORE_DB_DIRECTORY: opt_ignore_db_dirs= NULL; // will be set in ignore_db_dirs_process_additions if (*argument == 0) diff --git a/sql/mysqld.h b/sql/mysqld.h index 15febb1e15d..0624c68e9bd 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -789,6 +789,7 @@ enum options_mysqld OPT_KEY_CACHE_CHANGED_BLOCKS_HASH_SIZE, OPT_LOG_BASENAME, OPT_LOG_ERROR, + OPT_LOG_SLOW_FILTER, OPT_LOWER_CASE_TABLE_NAMES, OPT_PLUGIN_LOAD, OPT_PLUGIN_LOAD_ADD, diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index beab81bf462..b7866d3d5fa 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -6280,8 +6280,9 @@ static const char *log_slow_filter_names[]= static Sys_var_set Sys_log_slow_filter( "log_slow_filter", - "Log only certain types of queries to the slow log. If variable empty alll kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled", - SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG), + "Log only certain types of queries to the slow log. If variable empty all kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled", + SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG, + OPT_LOG_SLOW_FILTER), log_slow_filter_names, /* by default we log all queries except 'not_using_index' */ DEFAULT(my_set_bits(array_elements(log_slow_filter_names)-1) & diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl index f42923a0565..0c106777a3e 100644 --- a/sql/sys_vars.inl +++ b/sql/sys_vars.inl @@ -1379,6 +1379,10 @@ public: Backing store: ulonglong */ + +static const LEX_CSTRING all_clex_str= {STRING_WITH_LEN("all")}; + + class Sys_var_set: public Sys_var_typelib { public: @@ -1438,6 +1442,13 @@ public: var->save_result.ulonglong_value= find_set(&typelib, res->ptr(), res->length(), NULL, &error, &error_len, ¬_used); + if (error_len && + !my_charset_latin1.strnncollsp(res->ptr(), res->length(), + all_clex_str.str, all_clex_str.length)) + { + var->save_result.ulonglong_value= ((1ULL << (typelib.count)) -1); + error_len= 0; + } /* note, we only issue an error if error_len > 0. That is even while empty (zero-length) values are considered From 2739b5f5f85cea81556a8678206342c9758bce28 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 29 Jun 2024 10:41:04 +0300 Subject: [PATCH 64/85] MDEV-34494 Add server_uid global variable and add it to error log at startup The feedback plugin server_uid variable and the calculate_server_uid() function is moved from feedback/utils.cc to sql/mysqld.cc server_uid is added as a global variable (shown in 'show variables') and is written to the error log on server startup together with server version and server commit id. --- mysql-test/main/mysqld--help.test | 2 +- .../sys_vars/r/sysvars_server_embedded.result | 10 +++++ .../r/sysvars_server_notembedded.result | 10 +++++ plugin/feedback/feedback.cc | 11 +---- plugin/feedback/feedback.h | 3 +- plugin/feedback/sender_thread.cc | 2 +- plugin/feedback/utils.cc | 27 ------------ sql/mysqld.cc | 41 ++++++++++++++++++- sql/mysqld.h | 2 + sql/sys_vars.cc | 8 ++++ 10 files changed, 73 insertions(+), 43 deletions(-) diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index f918670d319..971983fd66c 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -27,7 +27,7 @@ perl; large-files-support lower-case-file-system system-time-zone collation-server character-set-server log-tc-size table-cache table-open-cache table-open-cache-instances max-connections - tls-version version.*/; + server-uid tls-version version.*/; # Plugins which may or may not be there: @plugins=qw/innodb archive blackhole federated partition s3 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index f7aea1f9f3c..67c9b40ea2d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -3072,6 +3072,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SERVER_UID +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Automatically calculated server unique id hash +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME SKIP_EXTERNAL_LOCKING VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 35734466470..ea1dd7af53b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -3522,6 +3522,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SERVER_UID +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Automatically calculated server unique id hash +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME SESSION_TRACK_SCHEMA VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index c1794f0987e..619b17499dc 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -26,10 +26,8 @@ namespace feedback { ulong debug_startup_interval, debug_first_interval, debug_interval; #endif -char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here - /* backing store for system variables */ -static char *server_uid= server_uid_buf, *url, *http_proxy; +static char *url, *http_proxy; char *user_info; ulong send_timeout, send_retry_wait; @@ -254,9 +252,6 @@ static int init(void *p) PSI_register(cond); PSI_register(thread); - if (calculate_server_uid(server_uid_buf)) - return 1; - prepare_linux_info(); #ifndef DBUG_OFF @@ -362,9 +357,6 @@ static int free(void *p) #define DEFAULT_PROTO "http://" #endif -static MYSQL_SYSVAR_STR(server_uid, server_uid, - PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT, - "Automatically calculated server unique id hash.", NULL, NULL, 0); static MYSQL_SYSVAR_STR(user_info, user_info, PLUGIN_VAR_READONLY | PLUGIN_VAR_RQCMDARG, "User specified string that will be included in the feedback report.", @@ -395,7 +387,6 @@ static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval, #endif static struct st_mysql_sys_var* settings[] = { - MYSQL_SYSVAR(server_uid), MYSQL_SYSVAR(user_info), MYSQL_SYSVAR(url), MYSQL_SYSVAR(send_timeout), diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h index 6021eb85860..30ad1203ae7 100644 --- a/plugin/feedback/feedback.h +++ b/plugin/feedback/feedback.h @@ -25,8 +25,7 @@ int fill_misc_data(THD *thd, TABLE_LIST *tables); int fill_linux_info(THD *thd, TABLE_LIST *tables); int fill_collation_statistics(THD *thd, TABLE_LIST *tables); -static const int SERVER_UID_SIZE= 29; -extern char server_uid_buf[SERVER_UID_SIZE+1], *user_info; +extern char *user_info; int calculate_server_uid(char *); int prepare_linux_info(); diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 74dc5e6ac6e..68aaa4c5dc7 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -183,7 +183,7 @@ static void send_report(const char *when) str.length(0); str.append(STRING_WITH_LEN("FEEDBACK_SERVER_UID")); str.append('\t'); - str.append(server_uid_buf); + str.append(server_uid); str.append('\n'); str.append(STRING_WITH_LEN("FEEDBACK_WHEN")); str.append('\t'); diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc index e362446204f..c5d83794c52 100644 --- a/plugin/feedback/utils.cc +++ b/plugin/feedback/utils.cc @@ -412,31 +412,4 @@ int fill_collation_statistics(THD *thd, TABLE_LIST *tables) } return 0; }; - -/** - calculates the server unique identifier - - UID is a base64 encoded SHA1 hash of the MAC address of one of - the interfaces, and the tcp port that the server is listening on -*/ -int calculate_server_uid(char *dest) -{ - uchar rawbuf[2 + 6]; - uchar shabuf[MY_SHA1_HASH_SIZE]; - - int2store(rawbuf, mysqld_port); - if (my_gethwaddr(rawbuf + 2)) - { - sql_print_error("feedback plugin: failed to retrieve the MAC address"); - return 1; - } - - my_sha1((uint8*) shabuf, (char*) rawbuf, sizeof(rawbuf)); - - assert(my_base64_needed_encoded_length(sizeof(shabuf)) <= SERVER_UID_SIZE); - my_base64_encode(shabuf, sizeof(shabuf), dest); - - return 0; -} - } // namespace feedback diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3eb9e7830c3..7aa90bf357b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -352,6 +352,8 @@ LEX_STRING opt_init_connect, opt_init_slave; static DYNAMIC_ARRAY all_options; static longlong start_memory_used; +char server_uid[SERVER_UID_SIZE+1]; // server uid will be written here + /* Global variables */ bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0; @@ -1130,6 +1132,8 @@ PSI_file_key key_file_map; PSI_statement_info stmt_info_new_packet; #endif +static int calculate_server_uid(char *dest); + #ifndef EMBEDDED_LIBRARY void net_before_header_psi(struct st_net *net, void *thd, size_t /* unused: count */) { @@ -3872,6 +3876,9 @@ static int init_common_variables() if (IS_SYSVAR_AUTOSIZE(&server_version_ptr)) set_server_version(server_version, sizeof(server_version)); + if (calculate_server_uid(server_uid)) + strmov(server_uid, "unknown"); + mysql_real_data_home_len= uint(strlen(mysql_real_data_home)); sf_leaking_memory= 0; // no memory leaks from now on @@ -4735,8 +4742,10 @@ static int init_server_components() first in error log, for troubleshooting and debugging purposes */ if (!opt_help) - sql_print_information("Starting MariaDB %s source revision %s as process %lu", - server_version, SOURCE_REVISION, (ulong) getpid()); + sql_print_information("Starting MariaDB %s source revision %s " + "server_uid %s as process %lu", + server_version, SOURCE_REVISION, server_uid, + (ulong) getpid()); #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE /* @@ -9849,3 +9858,31 @@ my_thread_id next_thread_id(void) mysql_mutex_unlock(&LOCK_thread_id); return retval; } + + +/** + calculates the server unique identifier + + UID is a base64 encoded SHA1 hash of the MAC address of one of + the interfaces, and the tcp port that the server is listening on +*/ + +static int calculate_server_uid(char *dest) +{ + uchar rawbuf[2 + 6]; + uchar shabuf[MY_SHA1_HASH_SIZE]; + + int2store(rawbuf, mysqld_port); + if (my_gethwaddr(rawbuf + 2)) + { + sql_print_error("feedback plugin: failed to retrieve the MAC address"); + return 1; + } + + my_sha1((uint8*) shabuf, (char*) rawbuf, sizeof(rawbuf)); + + assert(my_base64_needed_encoded_length(sizeof(shabuf)) <= SERVER_UID_SIZE); + my_base64_encode(shabuf, sizeof(shabuf), dest); + + return 0; +} diff --git a/sql/mysqld.h b/sql/mysqld.h index 0624c68e9bd..bb6d32fdee6 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -957,6 +957,8 @@ extern my_bool opt_mysql56_temporal_format, strict_password_validation; extern ulong binlog_checksum_options; extern bool max_user_connections_checking; extern ulong opt_binlog_dbug_fsync_sleep; +static const int SERVER_UID_SIZE= 29; +extern char server_uid[SERVER_UID_SIZE+1]; extern uint volatile global_disable_checkpoint; extern my_bool opt_help; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index b7866d3d5fa..2a6d0a52cfd 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3273,6 +3273,14 @@ Sys_server_id( VALID_RANGE(1, UINT_MAX32), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_server_id), ON_UPDATE(fix_server_id)); +char *server_uid_ptr= &server_uid[0]; + +static Sys_var_charptr Sys_server_uid( + "server_uid", "Automatically calculated server unique id hash", + READ_ONLY GLOBAL_VAR(server_uid_ptr), + CMD_LINE_HELP_ONLY, + DEFAULT(server_uid)); + static Sys_var_on_access_global Sys_slave_compressed_protocol( From 47fa576d67131f585662e3a6cca5bda48edb4bee Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Sat, 3 Feb 2024 06:40:06 +0100 Subject: [PATCH 65/85] MDEV-34164 Server crashes during OPTIMIZE/REPAIR for InnoDB temporary tables Caused by: 5d37cac7 MDEV-33348 ALTER TABLE lock waiting stages are indistinguishable. In that commit, progress reporting was moved to mysql_alter_table from copy_data_between_tables. The temporary table case wasn't taken into the consideration, where the execution of mysql_alter_table ends earlier than usual, by the 'end_temporary' label. There, thd_progress_end has been missing. Fix: Add missing thd_progress_end() call in mysql_alter_table. --- mysql-test/main/alter_table_online.result | 31 +++++++++++++++++++++++ mysql-test/main/alter_table_online.test | 21 +++++++++++++++ sql/sql_table.cc | 1 + 3 files changed, 53 insertions(+) diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result index fb5f2abf984..dddcce31a41 100644 --- a/mysql-test/main/alter_table_online.result +++ b/mysql-test/main/alter_table_online.result @@ -260,4 +260,35 @@ rollback; connection default; drop table t1; disconnect con2; +# MDEV-34164 Server crashes when executing OPTIMIZE or REPAIR TABLE for InnoDB temporary tables +create temporary table t1 (i int) engine=innodb; +create table t2 (i int) engine=aria ; +optimize table t1,t2; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +test.t2 optimize status Table is already up to date +drop table t1,t2; +create temporary table t1 (f int) engine=innodb; +create temporary table t2 (f int) engine=innodb; +optimize local table t1,t2; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +drop table t1,t2; +set @save_sql_mode = @@sql_mode; +set sql_mode= ''; +create temporary table t (c decimal zerofill,c2 int zerofill,c3 char binary,key(c)) engine=innodb; +insert into t values (1,1,1); +set session enforce_storage_engine=aria; +optimize no_write_to_binlog table t; +Table Op Msg_type Msg_text +test.t optimize note Table does not support optimize, doing recreate + analyze instead +test.t optimize status OK +Warnings: +Note 1266 Using storage engine Aria for table 't' +drop table t; +set sql_mode= @save_sql_mode; # End of 11.2 tests diff --git a/mysql-test/main/alter_table_online.test b/mysql-test/main/alter_table_online.test index 4d8f831186f..7843c90efd1 100644 --- a/mysql-test/main/alter_table_online.test +++ b/mysql-test/main/alter_table_online.test @@ -282,4 +282,25 @@ drop table t1; --disconnect con2 --enable_view_protocol + +--echo # MDEV-34164 Server crashes when executing OPTIMIZE or REPAIR TABLE for InnoDB temporary tables +create temporary table t1 (i int) engine=innodb; +create table t2 (i int) engine=aria ; +optimize table t1,t2; +drop table t1,t2; + +create temporary table t1 (f int) engine=innodb; +create temporary table t2 (f int) engine=innodb; +optimize local table t1,t2; +drop table t1,t2; + +set @save_sql_mode = @@sql_mode; +set sql_mode= ''; +create temporary table t (c decimal zerofill,c2 int zerofill,c3 char binary,key(c)) engine=innodb; +insert into t values (1,1,1); +set session enforce_storage_engine=aria; +optimize no_write_to_binlog table t; +drop table t; +set sql_mode= @save_sql_mode; + --echo # End of 11.2 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 34b4a5dd29e..59fe1790479 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11835,6 +11835,7 @@ end_temporary: thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF; + thd_progress_end(thd); *recreate_info= Recreate_info(copied, deleted); thd->my_ok_with_recreate_info(*recreate_info, (ulong) thd->get_stmt_da()-> From e012407397c65df62f9d62577849a80959962fa9 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Tue, 2 Jul 2024 18:40:11 +0700 Subject: [PATCH 66/85] MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 The memory leak happened on second execution of a prepared statement that runs UPDATE statement with correlated subquery in right hand side of the SET clause. In this case, invocation of the method table->stat_records() could return the zero value that results in going into the 'if' branch that handles impossible where condition. The issue is that this condition branch missed saving of leaf tables that has to be performed as first condition optimization activity. Later the PS statement memory root is marked as read only on finishing first time execution of the prepared statement. Next time the same statement is executed it hits the assertion on attempt to allocate a memory on the PS memory root marked as read only. This memory allocation takes place by the sequence of the following invocations: Prepared_statement::execute mysql_execute_command Sql_cmd_dml::execute Sql_cmd_update::execute_inner Sql_cmd_update::update_single_table st_select_lex::save_leaf_tables List::push_back To fix the issue, add the flag SELECT_LEX::leaf_tables_saved to control whether the method SELECT_LEX::save_leaf_tables() has to be called or it has been already invoked and no more invocation required. Similar issue could take place on running the DELETE statement with the LIMIT clause in PS/SP mode. The reason of memory leak is the same as for UPDATE case and be fixed in the same way. --- mysql-test/main/ps_mem_leaks.result | 30 ++++++++++++++++++++++++++ mysql-test/main/ps_mem_leaks.test | 33 +++++++++++++++++++++++++++++ sql/sql_delete.cc | 10 +++++++-- sql/sql_insert.cc | 4 ++-- sql/sql_lex.cc | 1 + sql/sql_lex.h | 4 ++++ sql/sql_select.cc | 4 +++- sql/sql_update.cc | 10 +++++++-- 8 files changed, 89 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index e647c89b740..ebbccb71c6b 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -118,3 +118,33 @@ a DEALLOCATE PREPARE stmt; DROP TABLE t1; # End of 10.6 tests +# +# MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +# +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +id value +1 1 +2 1 +3 NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +# Memory leak also could take place on running the DELETE statement +# with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); +CREATE PROCEDURE p1(p1 INT) +DELETE FROM t1 LIMIT p1; +CALL p1(0); +CALL p1(1); +CALL p1(2); +# Clean up +DROP TABLE t1; +DROP PROCEDURE p1; +# End of 10.11 tests diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index 16a46596c94..75381e13116 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -134,3 +134,36 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; --echo # End of 10.6 tests + +--echo # +--echo # MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +--echo # +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); + +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +--echo # Memory leak also could take place on running the DELETE statement +--echo # with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); + +CREATE PROCEDURE p1(p1 INT) + DELETE FROM t1 LIMIT p1; + +CALL p1(0); +CALL p1(1); +CALL p1(2); + +--echo # Clean up +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # End of 10.11 tests diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index dcafd6286b0..b7b3b79bbb6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -530,6 +530,12 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd) if (thd->binlog_for_noop_dml(transactional_table)) DBUG_RETURN(1); + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd, 0); DBUG_RETURN(0); // Nothing to delete } @@ -902,10 +908,10 @@ cleanup: query_cache_invalidate3(thd, table_list, 1); } - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } delete deltempfile; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index e16ac1c1007..0d06f4f7d3d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1377,10 +1377,10 @@ values_loop_end: ::my_ok(thd, info.copied + info.deleted + updated, id, buff); } thd->abort_on_warning= 0; - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } my_free(readbuff); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e25e25fa09e..6d1aa6dcd56 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3028,6 +3028,7 @@ void st_select_lex::init_query() first_natural_join_processing= 1; first_cond_optimization= 1; first_rownum_optimization= true; + leaf_tables_saved= false; no_wrap_view_item= 0; exclude_from_table_unique_test= 0; in_tvc= 0; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 21b855f204d..fb9622ece08 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1286,6 +1286,10 @@ public: from the method JOIN::optimize_inner. */ bool first_rownum_optimization:1; + /** + Flag to guard against double initialization of leaf tables list + */ + bool leaf_tables_saved:1; /* do not wrap view fields with Item_ref */ bool no_wrap_view_item:1; /* exclude this select from check of unique_table() */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7bc10f42bae..880adb1f073 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2299,12 +2299,14 @@ JOIN::optimize_inner() add_table_function_dependencies(join_list, table_map(-1)); - if (thd->is_error() || select_lex->save_leaf_tables(thd)) + if (thd->is_error() || + (!select_lex->leaf_tables_saved && select_lex->save_leaf_tables(thd))) { if (arena) thd->restore_active_arena(arena, &backup); DBUG_RETURN(1); } + select_lex->leaf_tables_saved= true; build_bitmap_for_nested_joins(join_list, 0); sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 0667d12a9e0..a1eede2087e 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -497,6 +497,12 @@ bool Sql_cmd_update::update_single_table(THD *thd) if (thd->binlog_for_noop_dml(transactional_table)) DBUG_RETURN(1); + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd); // No matching records DBUG_RETURN(0); } @@ -1251,10 +1257,10 @@ update_end: } thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ thd->abort_on_warning= 0; - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } ((multi_update *)result)->set_found(found); ((multi_update *)result)->set_updated(updated); From 25c6e3e4b7ac4381b319555af786a018c336b386 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 1 Jul 2024 14:09:04 +1000 Subject: [PATCH 67/85] MDEV-34502 InnoDB debug mode build - asserts with Valgrind Valgrind looks as the assertions as examining uninitalized values. As the assertions are tested in other Debug builds we know it isn't all invalid. Account for Valgrind by removing the assertion under the WITH_VALGRIND=1 compulation. --- storage/innobase/include/mach0data.inl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/innobase/include/mach0data.inl b/storage/innobase/include/mach0data.inl index bfccf611991..94bf4326069 100644 --- a/storage/innobase/include/mach0data.inl +++ b/storage/innobase/include/mach0data.inl @@ -38,7 +38,9 @@ mach_write_to_1( byte* b, /*!< in: pointer to byte where to store */ ulint n) /*!< in: ulint integer to be stored, >= 0, < 256 */ { +#ifndef HAVE_valgrind ut_ad((n & ~0xFFUL) == 0); +#endif b[0] = (byte) n; } @@ -55,7 +57,9 @@ mach_write_to_2( byte* b, /*!< in: pointer to two bytes where to store */ ulint n) /*!< in: ulint integer to be stored */ { +#ifndef HAVE_valgrind ut_ad((n & ~0xFFFFUL) == 0); +#endif b[0] = (byte)(n >> 8); b[1] = (byte)(n); From c91ec6a5c1a33f8d01449aff35edfc0cbbf4147e Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 12 Apr 2024 18:59:59 +0300 Subject: [PATCH 68/85] Added Lock_time_ms and Table_catalog columns to metadata_lock_info If compiled for debugging, LOCK_DURATION is also filled in. --- mysql-test/main/create_or_replace.result | 175 +++++++++--------- mysql-test/main/create_or_replace.test | 43 ++--- .../metadata_lock_info/metadata_lock_info.cc | 49 +++-- .../r/global_read_lock.result | 14 +- .../r/table_metadata_lock.result | 14 +- .../metadata_lock_info/r/user_lock.result | 14 +- .../t/global_read_lock.test | 6 +- .../t/table_metadata_lock.test | 6 +- .../metadata_lock_info/t/user_lock.test | 6 +- sql/mdl.cc | 5 + sql/mdl.h | 22 ++- sql/mysqld.cc | 6 +- sql/mysqld.h | 1 + 13 files changed, 199 insertions(+), 162 deletions(-) diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index 4bc0afe91d5..71dad47f7a1 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -261,83 +261,90 @@ create table test.t1 (i int) engine=myisam; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; InnoDB 0 transactions not purged -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 create or replace table test.t1; ERROR 42000: A table must have at least 1 column show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2; ERROR 42000: A table must have at least 1 column -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME create table t1 (i int); drop table t1; create table test.t1 (i int); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME create table t1 (i int); drop table t1; create table test.t1 (i int) engine=innodb; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 unlock tables; drop table test.t1,mysqltest2.t2; create table test.t1 (i int) engine=aria transactional=1 checksum=1; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysqltest2 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock mysqltest2 t2 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 unlock tables; drop table t1; create table test.t1 (i int); @@ -348,19 +355,19 @@ drop table test.t1; # create table t1 (i int); lock table t1 write; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a; ERROR 22001: Data too long for column 'a' at row 1 show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME create table t1 (i int); drop table t1; # @@ -447,37 +454,37 @@ drop view t1; # create table t1 (a int); lock table t1 write, t2 read; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 -# MDL_SHARED_READ NULL Table metadata lock test t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 +MDL_SHARED_READ Table metadata lock test t2 create or replace table t1 (i int); -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 -# MDL_SHARED_READ NULL Table metadata lock test t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 +MDL_SHARED_READ Table metadata lock test t2 create or replace table t1 like t2; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 -# MDL_SHARED_READ NULL Table metadata lock test t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 +MDL_SHARED_READ Table metadata lock test t2 create or replace table t1 select 1 as f1; -select * from information_schema.metadata_lock_info; -THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_BACKUP_DDL NULL Backup lock -# MDL_BACKUP_DML NULL Backup lock -# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 -# MDL_SHARED_READ NULL Table metadata lock test t2 +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 +MDL_SHARED_READ Table metadata lock test t2 drop table t1; unlock tables; # diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index 7c83f3e27a6..05af75b61b7 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -217,58 +217,51 @@ create table test.t1 (i int) engine=myisam; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --source ../suite/innodb/include/wait_all_purged.inc ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table test.t1; show tables; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table mysqltest2.t2; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; create table test.t1 (i int); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; show tables; ---replace_column 1 # +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; create table test.t1 (i int) engine=innodb; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; unlock tables; drop table test.t1,mysqltest2.t2; create table test.t1 (i int) engine=aria transactional=1 checksum=1; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; unlock tables; drop table t1; @@ -282,15 +275,13 @@ drop table test.t1; --echo # create table t1 (i int); lock table t1 write; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; --error ER_DATA_TOO_LONG create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a; show tables; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; --enable_view_protocol @@ -366,22 +357,18 @@ drop view t1; create table t1 (a int); lock table t1 write, t2 read; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create or replace table t1 (i int); ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create or replace table t1 like t2; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; create or replace table t1 select 1 as f1; ---replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select LOCK_MODE,LOCK_TYPE, TABLE_SCHEMA,TABLE_NAME from information_schema.metadata_lock_info; drop table t1; unlock tables; diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index a85048de47f..7421a9c85df 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -32,14 +32,25 @@ static const LEX_STRING metadata_lock_info_lock_name[] = { { C_STRING_WITH_LEN("User lock") }, }; + +#ifndef DBUG_OFF +static const LEX_STRING duration_name[] = { + { C_STRING_WITH_LEN("statement") }, + { C_STRING_WITH_LEN("transaction") }, + { C_STRING_WITH_LEN("explicit") }, +}; +#endif + namespace Show { static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] = { Column("THREAD_ID", ULonglong(20), NOT_NULL, "thread_id"), - Column("LOCK_MODE", Varchar(24), NULLABLE, "lock_mode"), - Column("LOCK_DURATION", Varchar(30), NULLABLE, "lock_duration"), - Column("LOCK_TYPE", Varchar(33), NULLABLE, "lock_type"), + Column("LOCK_MODE", Varchar(24), NOT_NULL, "lock_mode"), + Column("LOCK_DURATION", Varchar(33), NULLABLE, "lock_duration"), + Column("LOCK_TIME_MS", ULonglong(8), NULLABLE, "lock_time_ms"), + Column("LOCK_TYPE", Varchar(33), NOT_NULL, "lock_type"), + Column("TABLE_CATALOG", Name(), NULLABLE, "table_catalog"), Column("TABLE_SCHEMA", Name(), NULLABLE, "table_schema"), Column("TABLE_NAME", Name(), NULLABLE, "table_name"), CEnd() @@ -71,17 +82,31 @@ int i_s_metadata_lock_info_fill_row( table->field[0]->store((longlong) mdl_ctx->get_thread_id(), TRUE); table->field[1]->set_notnull(); table->field[1]->store(mdl_ticket->get_type_name(), system_charset_info); +#ifndef DBUG_OFF + table->field[2]->set_notnull(); + table->field[2]->store( &duration_name[mdl_ticket->m_duration], + system_charset_info); +#else table->field[2]->set_null(); - table->field[3]->set_notnull(); - table->field[3]->store( - metadata_lock_info_lock_name[(int) mdl_namespace].str, - metadata_lock_info_lock_name[(int) mdl_namespace].length, - system_charset_info); +#endif + if (!mdl_ticket->m_time) + table->field[3]->set_null(); + else + { + ulonglong now= microsecond_interval_timer(); + table->field[3]->set_notnull(); + table->field[3]->store((now - mdl_ticket->m_time) / 1000, TRUE); + } table->field[4]->set_notnull(); - table->field[4]->store(mdl_key->db_name(), - mdl_key->db_name_length(), system_charset_info); + table->field[4]->store(&metadata_lock_info_lock_name[(int) mdl_namespace], + system_charset_info); table->field[5]->set_notnull(); - table->field[5]->store(mdl_key->name(), + table->field[5]->store(STRING_WITH_LEN("def"), system_charset_info); + table->field[6]->set_notnull(); + table->field[6]->store(mdl_key->db_name(), + mdl_key->db_name_length(), system_charset_info); + table->field[7]->set_notnull(); + table->field[7]->store(mdl_key->name(), mdl_key->name_length(), system_charset_info); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); @@ -112,6 +137,7 @@ static int i_s_metadata_lock_info_init( schema->fields_info = Show::i_s_metadata_lock_info_fields_info; schema->fill_table = i_s_metadata_lock_info_fill_table; schema->idx_field1 = 0; + metadata_lock_info_plugin_loaded= 1; DBUG_RETURN(0); } @@ -119,6 +145,7 @@ static int i_s_metadata_lock_info_deinit( void *p ) { DBUG_ENTER("i_s_metadata_lock_info_deinit"); + metadata_lock_info_plugin_loaded= 0; DBUG_RETURN(0); } diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result index 12afd5010cc..f5843c6b445 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result @@ -1,9 +1,9 @@ -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name FLUSH TABLES WITH READ LOCK; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name -MDL_BACKUP_FTWRL2 NULL Backup lock +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name +MDL_BACKUP_FTWRL2 Backup lock UNLOCK TABLES; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/table_metadata_lock.result b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/table_metadata_lock.result index 1b76b9e8222..5f704e54edd 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/table_metadata_lock.result +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/table_metadata_lock.result @@ -1,13 +1,13 @@ CREATE TABLE IF NOT EXISTS t1(a int); BEGIN; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name SELECT * FROM t1; a -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name -MDL_SHARED_READ NULL Table metadata lock test t1 +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name +MDL_SHARED_READ Table metadata lock test t1 ROLLBACK; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name DROP TABLE t1; diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/user_lock.result b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/user_lock.result index 34d238cb43b..a0c938950aa 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/user_lock.result +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/user_lock.result @@ -1,13 +1,13 @@ -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name SELECT GET_LOCK('LOCK1',0); GET_LOCK('LOCK1',0) 1 -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name -MDL_SHARED_NO_WRITE NULL User lock LOCK1 +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name +MDL_SHARED_NO_WRITE User lock LOCK1 SELECT RELEASE_LOCK('LOCK1'); RELEASE_LOCK('LOCK1') 1 -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; -lock_mode lock_duration lock_type table_schema table_name +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +lock_mode lock_type table_schema table_name diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/global_read_lock.test b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/global_read_lock.test index 103050e3fb8..d9950b3ad75 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/global_read_lock.test +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/global_read_lock.test @@ -1,6 +1,6 @@ -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; FLUSH TABLES WITH READ LOCK; --sorted_result -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; UNLOCK TABLES; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/table_metadata_lock.test b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/table_metadata_lock.test index 3451dff039d..b415e190994 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/table_metadata_lock.test +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/table_metadata_lock.test @@ -1,8 +1,8 @@ CREATE TABLE IF NOT EXISTS t1(a int); BEGIN; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; SELECT * FROM t1; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; ROLLBACK; -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; DROP TABLE t1; diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/user_lock.test b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/user_lock.test index 85dec3dcf75..b651185531e 100644 --- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/user_lock.test +++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/t/user_lock.test @@ -1,5 +1,5 @@ -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; SELECT GET_LOCK('LOCK1',0); -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; SELECT RELEASE_LOCK('LOCK1'); -SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; +SELECT lock_mode, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info; diff --git a/sql/mdl.cc b/sql/mdl.cc index edf116c5bbb..faccd1c9476 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -2130,6 +2130,8 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request, if (lock->can_grant_lock(mdl_request->type, this, false)) { + if (metadata_lock_info_plugin_loaded) + ticket->m_time= microsecond_interval_timer(); lock->m_granted.add_ticket(ticket); mysql_prlock_unlock(&lock->m_rwlock); @@ -2201,6 +2203,7 @@ MDL_context::clone_ticket(MDL_request *mdl_request) DBUG_ASSERT(mdl_request->ticket->has_stronger_or_equal_type(ticket->m_type)); ticket->m_lock= mdl_request->ticket->m_lock; + ticket->m_time= mdl_request->ticket->m_time; mdl_request->ticket= ticket; mysql_prlock_wrlock(&ticket->m_lock->m_rwlock); @@ -2344,6 +2347,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) } #endif /* WITH_WSREP */ + if (metadata_lock_info_plugin_loaded) + ticket->m_time= microsecond_interval_timer(); lock->m_waiting.add_ticket(ticket); /* diff --git a/sql/mdl.h b/sql/mdl.h index fad81ce9249..f37bd469bbc 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -699,7 +699,17 @@ public: */ MDL_ticket *next_in_context; MDL_ticket **prev_in_context; + +#ifndef DBUG_OFF + /** + Duration of lock represented by this ticket. + Context public. Debug-only. + */ public: + enum_mdl_duration m_duration; +#endif + ulonglong m_time; + #ifdef WITH_WSREP void wsrep_report(bool debug) const; #endif /* WITH_WSREP */ @@ -741,10 +751,12 @@ private: , enum_mdl_duration duration_arg #endif ) - : m_type(type_arg), + : #ifndef DBUG_OFF m_duration(duration_arg), #endif + m_time(0), + m_type(type_arg), m_ctx(ctx_arg), m_lock(NULL), m_psi(NULL) @@ -764,13 +776,7 @@ private: private: /** Type of metadata lock. Externally accessible. */ enum enum_mdl_type m_type; -#ifndef DBUG_OFF - /** - Duration of lock represented by this ticket. - Context private. Debug-only. - */ - enum_mdl_duration m_duration; -#endif + /** Context of the owner of the metadata lock ticket. Externally accessible. */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d1d32fc77fe..80bc7494008 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -761,7 +761,11 @@ char *opt_relay_logname = 0, *opt_relaylog_index_name=0; char *opt_logname, *opt_slow_logname, *opt_bin_logname; char *opt_binlog_index_name=0; - +/* + Flag if the METADATA_LOCK_INFO is used. In this case we store the time + when we take a MDL lock. +*/ +bool metadata_lock_info_plugin_loaded= 0; /* Static variables */ diff --git a/sql/mysqld.h b/sql/mysqld.h index 749c0bd1860..46ce3f8816d 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -143,6 +143,7 @@ extern my_bool opt_old_style_user_limits, trust_function_creators; extern uint opt_crash_binlog_innodb; extern const char *shared_memory_base_name; extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port; +extern MYSQL_PLUGIN_IMPORT bool metadata_lock_info_plugin_loaded; extern my_bool opt_enable_shared_memory; extern ulong opt_replicate_events_marked_for_skip; extern char *default_tz_name; From a4ef05d0d5e9aeb5c919af88db2879a19092259a Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 3 Jul 2024 12:01:28 +0200 Subject: [PATCH 69/85] Fix compiler errors --- sql/sql_partition_admin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_partition_admin.h b/sql/sql_partition_admin.h index eee021b5fb4..2a8e37e87a0 100644 --- a/sql/sql_partition_admin.h +++ b/sql/sql_partition_admin.h @@ -32,12 +32,12 @@ public: {} /* Override SQLCOM_*, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const + virtual enum_sql_command sql_command_code() const override { return SQLCOM_ALTER_TABLE; } - bool execute(THD *thd); + bool execute(THD *thd) override; }; From 73ad436e16c3ac022a2f1c477eac0e9a7e702707 Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Wed, 3 Jul 2024 11:07:13 +0530 Subject: [PATCH 70/85] MDEV-34458 wait_for_read in buf_page_get_low hurts performance The performance regression seen while loading BP is caused by the deadlock fix given in MDEV-33543. The area of impact is wider but is more visible when BP is being loaded initially via DMLs. Specifically the response time could be impacted in DML doing pessimistic operation on index(split/merge) and the leaf pages are not found in buffer pool. It is more likely to occur with small BP size. The origin of the issue dates back to MDEV-30400 that introduced btr_cur_t::search_leaf() replacing btr_cur_search_to_nth_level() for leaf page searches. In btr_latch_prev, we use RW_NO_LATCH to get the previous page fixed in BP without latching. When the page is not in BP, we try to acquire and wait for S latch violating the latching order. This deadlock was analyzed in MDEV-33543 and fixed by using the already present wait logic in buf_page_get_gen() instead of waiting for latch. The wait logic is inferior to usual S latch wait and is simply a repeated sleep 100 of micro-sec (The actual sleep time could be more depending on platforms). The bug was seen with "change-buffering" code path and the idea was that this path should be less exercised. The judgement was not correct and the path is actually quite frequent and does impact performance when pages are not in BP and being loaded by DML expanding/shrinking large data. Fix: While trying to get a page with RW_NO_LATCH and we are attempting "out of order" latch, return from buf_page_get_gen immediately instead of waiting and follow the ordered latching path. --- storage/innobase/btr/btr0btr.cc | 2 +- storage/innobase/btr/btr0cur.cc | 20 ++++++++++++++----- storage/innobase/buf/buf0buf.cc | 31 ++++++++++++++++++++---------- storage/innobase/include/buf0buf.h | 14 ++++++++++++-- storage/innobase/row/row0import.cc | 2 +- 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 93ad4b671c8..e386c162ed9 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1262,7 +1262,7 @@ void btr_drop_temporary_table(const dict_table_t &table) { if (buf_block_t *block= buf_page_get_low({SRV_TMP_SPACE_ID, index->page}, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, - nullptr, false)) + nullptr, false, nullptr)) { btr_free_but_not_root(block, MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index cff9e664c5d..fcfd98ab197 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -971,12 +971,21 @@ static int btr_latch_prev(buf_block_t *block, page_id_t page_id, buffer-fixes on both blocks will prevent eviction. */ retry: - buf_block_t *prev= buf_page_get_gen(page_id, zip_size, RW_NO_LATCH, nullptr, - BUF_GET, mtr, err, false); - if (UNIV_UNLIKELY(!prev)) - return 0; - + /* Pass no_wait pointer to ensure that we don't wait on the current page + latch while holding the next page latch to avoid latch ordering violation. */ + bool no_wait= false; int ret= 1; + + buf_block_t *prev= buf_page_get_gen(page_id, zip_size, RW_NO_LATCH, nullptr, + BUF_GET, mtr, err, false, &no_wait); + if (UNIV_UNLIKELY(!prev)) + { + /* Check if we had to return because we couldn't wait on latch. */ + if (no_wait) + goto ordered_latch; + return 0; + } + static_assert(MTR_MEMO_PAGE_S_FIX == mtr_memo_type_t(BTR_SEARCH_LEAF), ""); static_assert(MTR_MEMO_PAGE_X_FIX == mtr_memo_type_t(BTR_MODIFY_LEAF), ""); @@ -996,6 +1005,7 @@ static int btr_latch_prev(buf_block_t *block, page_id_t page_id, { ut_ad(mtr->at_savepoint(mtr->get_savepoint() - 1)->page.id() == page_id); mtr->release_last_page(); +ordered_latch: if (rw_latch == RW_S_LATCH) block->page.lock.s_unlock(); else diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 8fa8b92470b..61941592fab 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2416,6 +2416,9 @@ BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH while reading the page from file then it makes sure that it does merging of change buffer changes while reading the page from file. +@param[in,out] no_wait If not NULL on input, then we must not +wait for current page latch. On output, the value is set to true if we had to +return because we could not wait on page latch. @return pointer to the block or NULL */ TRANSACTIONAL_TARGET buf_block_t* @@ -2427,7 +2430,8 @@ buf_page_get_low( ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge) + bool allow_ibuf_merge, + bool* no_wait) { unsigned access_time; ulint retries = 0; @@ -2584,14 +2588,17 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - if (rw_latch != RW_NO_LATCH) { + if (!no_wait) { block->page.lock.s_lock(); } else if (!block->page.lock.s_lock_try()) { - /* For RW_NO_LATCH, we should not try to acquire S or X - latch directly as we could be violating the latching - order resulting in deadlock. Instead we try latching the - page and retry in case of a failure. */ - goto wait_for_read; + ut_ad(rw_latch == RW_NO_LATCH); + /* We should not wait trying to acquire S latch for + current page while holding latch for the next page. + It would violate the latching order resulting in + possible deadlock. Caller must handle the failure. */ + block->page.unfix(); + *no_wait= true; + return nullptr; } state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX @@ -2647,7 +2654,6 @@ free_unfixed_block: if (UNIV_UNLIKELY(!block->page.frame)) { if (!block->page.lock.x_lock_try()) { wait_for_unzip: -wait_for_read: /* The page is being read or written, or another thread is executing buf_zip_decompress() in buf_page_get_low() on it. */ @@ -2936,6 +2942,9 @@ BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge while reading the pages from file. +@param[in,out] no_wait If not NULL on input, then we must not +wait for current page latch. On output, the value is set to true if we had to +return because we could not wait on page latch. @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -2946,12 +2955,14 @@ buf_page_get_gen( ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge) + bool allow_ibuf_merge, + bool* no_wait) { buf_block_t *block= recv_sys.recover(page_id); if (UNIV_LIKELY(!block)) return buf_page_get_low(page_id, zip_size, rw_latch, - guess, mode, mtr, err, allow_ibuf_merge); + guess, mode, mtr, err, allow_ibuf_merge, + no_wait); else if (UNIV_UNLIKELY(block == reinterpret_cast(-1))) { corrupted: diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index d403fe12430..be614ce2fa2 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -209,6 +209,9 @@ BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge while reading the pages from file. +@param[in,out] no_wait If not NULL on input, then we must not +wait for current page latch. On output, the value is set to true if we had to +return because we could not wait on page latch. @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -219,7 +222,8 @@ buf_page_get_gen( ulint mode, mtr_t* mtr, dberr_t* err = NULL, - bool allow_ibuf_merge = false) + bool allow_ibuf_merge = false, + bool* no_wait = nullptr) MY_ATTRIBUTE((nonnull(6), warn_unused_result)); /** This is the low level function used to get access to a database page. @@ -236,6 +240,11 @@ BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH while reading the page from file then it makes sure that it does merging of change buffer changes while reading the page from file. +@param[in] holds_next_page_latch True if caller holds next page latch. +We must not wait for current page latch. +@param[in,out] no_wait If not NULL on input, then we must not +wait for current page latch. On output, the value is set to true if we had to +return because we could not wait on page latch. @return pointer to the block or NULL */ buf_block_t* buf_page_get_low( @@ -246,7 +255,8 @@ buf_page_get_low( ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge); + bool allow_ibuf_merge, + bool* no_wait); /** Initialize a page in the buffer pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 0eda905decc..eecfac18017 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2165,7 +2165,7 @@ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW we no longer evict the pages on DISCARD TABLESPACE. */ buf_page_get_low(block->page.id(), get_zip_size(), RW_NO_LATCH, nullptr, BUF_PEEK_IF_IN_POOL, - nullptr, nullptr, false); + nullptr, nullptr, false, nullptr); uint16_t page_type; From d58975bbef24283184a3a7c48bb70acd7debdfe5 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Wed, 3 Jul 2024 14:10:01 -0600 Subject: [PATCH 71/85] MDEV-9159: Bring back assert in semisync_master.cc In 10.0 there was an assert to ensure that there were semi sync clients before removing one, but it was removed in 10.1. This patch adds the assertion back. --- sql/semisync_master.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index f22d3fc4016..e7d7fa80251 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -571,6 +571,7 @@ void Repl_semi_sync_master::add_slave() void Repl_semi_sync_master::remove_slave() { lock(); + DBUG_ASSERT(rpl_semi_sync_master_clients > 0); if (!(--rpl_semi_sync_master_clients) && !rpl_semi_sync_master_wait_no_slave) { /* From f6989d1767ade3486af35246a8ad5be50507ca10 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 2 Jul 2024 17:59:59 +0400 Subject: [PATCH 72/85] MDEV-10865 COLLATE keyword doesn't work in PREPARE query Fixing applying the COLLATE clause to a parameter caused an error error: COLLATION '...' is not valid for CHARACTER SET 'binary' Fix: - Changing the collation derivation for a non-prepared Item_param to DERIVATION_IGNORABLE. - Allowing to apply any COLLATE clause to expressions with DERIVATION_IGNORABLE. This includes: 1. A non-prepared Item_param 2. An explicit NULL 3. Expressions derived from #1 and #2 For example: SELECT ? COLLATE utf8mb_unicode_ci; SELECT NULL COLLATE utf8mb_unicode_ci; SELECT CONCAT(?) COLLATE utf8mb_unicode_ci; SELECT CONCAT(NULL) COLLATE utf8mb_unicode_ci - Additional change: preserving the collation of an expression when the expression gets assigned to a PS parameter and evaluates to SQL NULL. Before this change, the collation of the parameter was erroneously set to &my_charset_binary. - Additional change: removing the multiplication to mbmaxlen from the fix_char_length_ulonglong() argument, because the multiplication already happens inside fix_char_length_ulonglong(). This fixes a too large column size created for a COLLATE clause. --- mysql-test/main/ctype_collate_context.result | 100 +++++++++++++++++++ mysql-test/main/ctype_collate_context.test | 100 +++++++++++++++++++ mysql-test/main/ctype_utf32.result | 85 ++++++++++++++++ mysql-test/main/ctype_utf32.test | 76 ++++++++++++++ mysql-test/main/ctype_utf8mb4.result | 82 +++++++++++---- mysql-test/main/ctype_utf8mb4.test | 71 +++++++++---- sql/item.cc | 10 +- sql/item.h | 27 ++++- sql/item_strfunc.cc | 36 +++++-- sql/sql_type.cc | 82 +++++++++++++++ sql/sql_type.h | 6 ++ 11 files changed, 626 insertions(+), 49 deletions(-) diff --git a/mysql-test/main/ctype_collate_context.result b/mysql-test/main/ctype_collate_context.result index c924f11d9e2..4a6c86f2d9b 100644 --- a/mysql-test/main/ctype_collate_context.result +++ b/mysql-test/main/ctype_collate_context.result @@ -3716,3 +3716,103 @@ DROP PROCEDURE p; # # End of 10.9 tests # +# +# Start of 10.11 tests +# +# +# MDEV-10865 COLLATE keyword doesn't work in PREPARE query +# +SET NAMES utf8mb4; +# +# A context collation and an explicit NULL +# +SELECT NULL COLLATE uca1400_ai_ci; +ERROR HY000: 'NULL' is not allowed in this context +SELECT CONCAT(NULL) COLLATE uca1400_ai_ci; +ERROR HY000: 'NULL' is not allowed in this context +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT NULL COLLATE uca1400_ai_ci AS c1'; +ERROR HY000: 'NULL' is not allowed in this context +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE uca1400_ai_ci AS c1'; +ERROR HY000: 'NULL' is not allowed in this context +# +# A context collation and a parameter bound to NULL +# +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING NULL; +ERROR HY000: 'NULL' is not allowed in this context +EXECUTE stmt USING CONCAT(NULL); +ERROR HY000: 'NULL' is not allowed in this context +EXECUTE stmt USING NULL COLLATE uca1400_ai_ci; +ERROR HY000: 'NULL' is not allowed in this context +EXECUTE stmt USING CONCAT(NULL) COLLATE uca1400_ai_ci; +ERROR HY000: 'NULL' is not allowed in this context +# +# A context collation and CONVERT(NULL USING ...) +# +EXECUTE stmt USING CONVERT(NULL USING utf8mb4); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +EXECUTE stmt USING CONVERT(NULL USING utf8mb4) COLLATE uca1400_ai_ci; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +EXECUTE stmt USING CONVERT(NULL USING binary); +ERROR 42000: COLLATION 'uca1400_ai_ci' is not valid for CHARACTER SET 'binary' +EXECUTE stmt USING CONVERT(NULL USING latin1); +ERROR 42000: COLLATION 'uca1400_ai_ci' is not valid for CHARACTER SET 'latin1' +# +# A context collation and an expression with a parameter +# whose character does not get resolved when bound to a not-NULL value +# +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT LEFT(NULL,?) COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING NULL; +ERROR HY000: 'NULL' is not allowed in this context +# +# A context collation and an expression with a parameter +# whose character set gets resolved when bound to a not-NULL value +# +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING _binary'test'; +ERROR 42000: COLLATION 'uca1400_ai_ci' is not valid for CHARACTER SET 'binary' +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 'test' COLLATE utf8mb4_bin; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING _latin1'test' COLLATE latin1_bin; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/ctype_collate_context.test b/mysql-test/main/ctype_collate_context.test index 95a46f2d830..168f5234cf0 100644 --- a/mysql-test/main/ctype_collate_context.test +++ b/mysql-test/main/ctype_collate_context.test @@ -401,3 +401,103 @@ DROP PROCEDURE p; --echo # --echo # End of 10.9 tests --echo # + +--echo # +--echo # Start of 10.11 tests +--echo # + +--echo # +--echo # MDEV-10865 COLLATE keyword doesn't work in PREPARE query +--echo # + +SET NAMES utf8mb4; + +--echo # +--echo # A context collation and an explicit NULL +--echo # + +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +SELECT NULL COLLATE uca1400_ai_ci; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +SELECT CONCAT(NULL) COLLATE uca1400_ai_ci; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT NULL COLLATE uca1400_ai_ci AS c1'; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE uca1400_ai_ci AS c1'; + + +--echo # +--echo # A context collation and a parameter bound to NULL +--echo # + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +EXECUTE stmt USING NULL; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +EXECUTE stmt USING CONCAT(NULL); +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +EXECUTE stmt USING NULL COLLATE uca1400_ai_ci; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +EXECUTE stmt USING CONCAT(NULL) COLLATE uca1400_ai_ci; + +--echo # +--echo # A context collation and CONVERT(NULL USING ...) +--echo # + +EXECUTE stmt USING CONVERT(NULL USING utf8mb4); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE stmt USING CONVERT(NULL USING utf8mb4) COLLATE uca1400_ai_ci; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING CONVERT(NULL USING binary); + +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING CONVERT(NULL USING latin1); + +--echo # +--echo # A context collation and an expression with a parameter +--echo # whose character does not get resolved when bound to a not-NULL value +--echo # + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT LEFT(NULL,?) COLLATE uca1400_ai_ci AS c1'; +--error ER_NOT_ALLOWED_IN_THIS_CONTEXT +EXECUTE stmt USING NULL; + + +--echo # +--echo # A context collation and an expression with a parameter +--echo # whose character set gets resolved when bound to a not-NULL value +--echo # + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING _binary'test'; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING 'test' COLLATE utf8mb4_bin; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE uca1400_ai_ci AS c1'; +EXECUTE stmt USING _latin1'test' COLLATE latin1_bin; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index f9523a783ea..75ec9019da7 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -3024,3 +3024,88 @@ HEX(DATE_FORMAT(TIME'11:22:33',@format)) # # End of 10.4 tests # +# +# Start of 10.11 tests +# +# +# MDEV-10865 COLLATE keyword doesn't work in PREPARE query +# +# +# The collation is not applicable to the PS parameter +# +SET NAMES utf8mb4; +CREATE TABLE t1 ( +c1 varchar(500) COLLATE utf32_unicode_ci NOT NULL +); +INSERT INTO t1 VALUES ('jj'); +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf32_unicode_ci'; +EXECUTE stmt USING 'jj'; +ERROR 42000: COLLATION 'utf32_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +ERROR 42000: COLLATION 'utf32_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +ERROR 42000: COLLATION 'utf32_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' +CREATE TABLE t1 AS SELECT NULL COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# The collation is applicable to the PS parameter +# +SET NAMES utf8mb4, collation_connection=utf32_general_ci; +CREATE TABLE t1 ( +c1 varchar(500) COLLATE utf32_unicode_ci NOT NULL +); +INSERT INTO t1 VALUES ('jj'); +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf32_unicode_ci'; +EXECUTE stmt USING 'jj'; +c1 +jj +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 AS SELECT NULL COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET NAMES utf8mb4; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index bcbc3b14691..e5310dd5c7f 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -1167,4 +1167,80 @@ SELECT HEX(DATE_FORMAT(TIME'11:22:33',@format)); --echo # End of 10.4 tests --echo # +--echo # +--echo # Start of 10.11 tests +--echo # + +--echo # +--echo # MDEV-10865 COLLATE keyword doesn't work in PREPARE query +--echo # + +--echo # +--echo # The collation is not applicable to the PS parameter +--echo # + +SET NAMES utf8mb4; +CREATE TABLE t1 ( + c1 varchar(500) COLLATE utf32_unicode_ci NOT NULL +); +INSERT INTO t1 VALUES ('jj'); +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf32_unicode_ci'; +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING 'jj'; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf32_unicode_ci AS c1'; +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING 'test'; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf32_unicode_ci AS c1'; +--error ER_COLLATION_CHARSET_MISMATCH +EXECUTE stmt USING 'test'; + +CREATE TABLE t1 AS SELECT NULL COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The collation is applicable to the PS parameter +--echo # + +SET NAMES utf8mb4, collation_connection=utf32_general_ci; +CREATE TABLE t1 ( + c1 varchar(500) COLLATE utf32_unicode_ci NOT NULL +); +INSERT INTO t1 VALUES ('jj'); +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf32_unicode_ci'; +EXECUTE stmt USING 'jj'; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf32_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT NULL COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf32_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +SET NAMES utf8mb4; + +--echo # +--echo # End of 10.11 tests +--echo # + --enable_service_connection diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 26e8784e4f1..591ddf2cd9e 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -4182,24 +4182,6 @@ DROP TABLE t1; # End of 10.2 tests # # -# Start of 10.5 tests -# -# -# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error -# -SET NAMES utf8mb4; -SELECT 1 COLLATE utf8mb4_general_ci; -1 COLLATE utf8mb4_general_ci -1 -SELECT 1 COLLATE utf8mb4_bin; -1 COLLATE utf8mb4_bin -1 -SELECT 1 COLLATE latin1_swedish_ci; -ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' -# -# End of 10.5 tests -# -# # Start of 10.6 tests # # @@ -4227,3 +4209,67 @@ DROP TABLE t1; # # End of 10.6 tests # +# +# Start of 10.11 tests +# +# +# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error +# +SET NAMES utf8mb4; +SELECT 1 COLLATE utf8mb4_general_ci; +1 COLLATE utf8mb4_general_ci +1 +SELECT 1 COLLATE utf8mb4_bin; +1 COLLATE utf8mb4_bin +1 +SELECT 1 COLLATE latin1_swedish_ci; +ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' +# +# MDEV-10865 COLLATE keyword doesn't work in PREPARE query +# +SET NAMES utf8mb4; +CREATE TABLE t1 ( +c1 varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL +) CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES ('jj'); +SELECT * FROM t1 WHERE c1 LIKE 'jj' COLLATE utf8mb4_unicode_ci; +c1 +jj +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf8mb4_unicode_ci'; +EXECUTE stmt USING 'jj'; +c1 +jj +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf8mb4_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf8mb4_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 AS SELECT NULL COLLATE utf8mb4_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf8mb4_unicode_ci AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test index 46a9c14dec0..b412a755d6d 100644 --- a/mysql-test/main/ctype_utf8mb4.test +++ b/mysql-test/main/ctype_utf8mb4.test @@ -2068,25 +2068,6 @@ DROP TABLE t1; --echo # End of 10.2 tests --echo # - ---echo # ---echo # Start of 10.5 tests ---echo # - ---echo # ---echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error ---echo # - -SET NAMES utf8mb4; -SELECT 1 COLLATE utf8mb4_general_ci; -SELECT 1 COLLATE utf8mb4_bin; ---error ER_COLLATION_CHARSET_MISMATCH -SELECT 1 COLLATE latin1_swedish_ci; - ---echo # ---echo # End of 10.5 tests ---echo # - --echo # --echo # Start of 10.6 tests --echo # @@ -2112,3 +2093,55 @@ DROP TABLE t1; --echo # --echo # End of 10.6 tests --echo # + + +--echo # +--echo # Start of 10.11 tests +--echo # + +--echo # +--echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error +--echo # + +SET NAMES utf8mb4; +SELECT 1 COLLATE utf8mb4_general_ci; +SELECT 1 COLLATE utf8mb4_bin; +--error ER_COLLATION_CHARSET_MISMATCH +SELECT 1 COLLATE latin1_swedish_ci; + +--echo # +--echo # MDEV-10865 COLLATE keyword doesn't work in PREPARE query +--echo # + +SET NAMES utf8mb4; +CREATE TABLE t1 ( + c1 varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL +) CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES ('jj'); +SELECT * FROM t1 WHERE c1 LIKE 'jj' COLLATE utf8mb4_unicode_ci; +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1 LIKE ? COLLATE utf8mb4_unicode_ci'; +EXECUTE stmt USING 'jj'; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? COLLATE utf8mb4_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT CONCAT(?) COLLATE utf8mb4_unicode_ci AS c1'; +EXECUTE stmt USING 'test'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT NULL COLLATE utf8mb4_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT CONCAT(NULL) COLLATE utf8mb4_unicode_ci AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/sql/item.cc b/sql/item.cc index 2be91c68818..488e24c3497 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4119,6 +4119,7 @@ Item_param::Item_param(THD *thd, const LEX_CSTRING *name_arg, */ set_maybe_null(); with_flags= with_flags | item_with_t::PARAM; + collation= DTCollation(&my_charset_bin, DERIVATION_IGNORABLE); } @@ -4174,7 +4175,7 @@ void Item_param::sync_clones() } -void Item_param::set_null() +void Item_param::set_null(const DTCollation &c) { DBUG_ENTER("Item_param::set_null"); /* @@ -4189,6 +4190,7 @@ void Item_param::set_null() */ max_length= 0; decimals= 0; + collation= c; state= NULL_VALUE; DBUG_VOID_RETURN; } @@ -4447,7 +4449,7 @@ bool Item_param::set_from_item(THD *thd, Item *item) longlong val= item->val_int(); if (item->null_value) { - set_null(); + set_null(DTCollation_numeric()); DBUG_RETURN(false); } else @@ -4465,7 +4467,7 @@ bool Item_param::set_from_item(THD *thd, Item *item) DBUG_RETURN(set_value(thd, item, &tmp, h)); } else - set_null(); + set_null_string(item->collation); DBUG_RETURN(0); } @@ -5048,7 +5050,7 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) if (arg->save_in_value(thd, &tmp) || set_value(thd, arg, &tmp, arg->type_handler())) { - set_null(); + set_null_string(arg->collation); return false; } /* It is wrapper => other set_* shoud set null_value */ diff --git a/sql/item.h b/sql/item.h index 566255840fc..dfb540cf1d4 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4234,7 +4234,32 @@ public: void set_default(); void set_ignore(); - void set_null(); + void set_null(const DTCollation &c); + void set_null_string(const DTCollation &c) + { + /* + We need to distinguish explicit NULL (marked by DERIVATION_IGNORABLE) + from other item types: + + - These statements should give an error, because + the character set of the bound parameter is not known: + EXECUTE IMMEDIATE "SELECT ? COLLATE utf8mb4_bin" USING NULL; + EXECUTE IMMEDIATE "SELECT ? COLLATE utf8mb4_bin" USING CONCAT(NULL); + + - These statements should return a good result, because + the character set of the bound parameter is known: + EXECUTE IMMEDIATE "SELECT ? COLLATE utf8mb4_bin" + USING CONVERT(NULL USING utf8mb4); + EXECUTE IMMEDIATE "SELECT ? COLLATE utf8mb4_bin" + USING CAST(NULL AS CHAR CHARACTER SET utf8mb4); + */ + set_null(DTCollation(c.collation, MY_MAX(c.derivation, + DERIVATION_COERCIBLE))); + } + void set_null() + { + set_null(DTCollation(&my_charset_bin, DERIVATION_IGNORABLE)); + } void set_int(longlong i, uint32 max_length_arg); void set_double(double i); void set_decimal(const char *str, ulong length); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 2a9c14e7145..33b5f716ea8 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3880,21 +3880,43 @@ String *Item_func_set_collation::val_str(String *str) str=args[0]->val_str(str); if ((null_value=args[0]->null_value)) return 0; + /* + Let SCS be the character set of the source - args[0]. + Let TCS be the character set of the target - i.e. the character set + of the collation specified in the COLLATE clause. + + It's OK to return SQL NULL if SCS is not equal to TCS. + This is possible on the explicit NULL or expressions derived from + the explicit NULL: + SELECT NULL COLLATE utf8mb4_general_ci; + SELECT COALESCE(NULL) COLLATE utf8mb4_general_ci; + + But for a non-NULL result SCS and TCS must be compatible: + 1. Either SCS==TCS + 2. Or SCS can be can be reinterpeted to TCS. + This scenario is possible when args[0] is numeric and TCS->mbmaxlen==1. + + If SCS and TCS are not compatible here, then something went wrong during + fix_fields(), e.g. an Item_func_conv_charset was not added two wrap args[0]. + */ + DBUG_ASSERT(my_charset_same(args[0]->collation.collation, + collation.collation) || + (args[0]->collation.repertoire == MY_REPERTOIRE_ASCII && + !(collation.collation->state & MY_CS_NONASCII))); str->set_charset(collation.collation); return str; } bool Item_func_set_collation::fix_length_and_dec(THD *thd) { - if (agg_arg_charsets_for_string_result(collation, args, 1)) + if (agg_arg_charsets_for_string_result(collation, args, 1) || + collation.merge_collation(m_set_collation, + args[0]->collation.repertoire, + with_param() && + thd->lex->is_ps_or_view_context_analysis())) return true; - Lex_exact_charset_opt_extended_collate cl(collation.collation, true); - if (cl.merge_collation_override(m_set_collation)) - return true; - collation.set(cl.collation().charset_info(), DERIVATION_EXPLICIT, - args[0]->collation.repertoire); ulonglong max_char_length= (ulonglong) args[0]->max_char_length(); - fix_char_length_ulonglong(max_char_length * collation.collation->mbmaxlen); + fix_char_length_ulonglong(max_char_length); return FALSE; } diff --git a/sql/sql_type.cc b/sql/sql_type.cc index b1911c79e14..e914549b931 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -33,6 +33,88 @@ const DTCollation &DTCollation_numeric::singleton() return tmp; } + +bool +DTCollation::merge_charset_and_collation(CHARSET_INFO *cs, + const Lex_extended_collation_st &cl, + my_repertoire_t repertoire) +{ + Lex_exact_charset_opt_extended_collate cscl(cs, true); + if (cscl.merge_collation_override(cl)) + return true; + set(cscl.collation().charset_info(), DERIVATION_EXPLICIT, repertoire); + return false; +} + + +bool DTCollation::merge_collation(const Lex_extended_collation_st &cl, + my_repertoire_t repertoire, + bool allow_ignorable_with_context_collation) +{ + if (derivation != DERIVATION_IGNORABLE) + { + // A known character set + an extended collation + return merge_charset_and_collation(collation, cl, repertoire); + } + + if (cl.type() == Lex_extended_collation::TYPE_EXACT) + { + /* + An unknown character set + an exact collation. + Just use this exact collation. + Examples: + - Expressions derived from an explicit NULL: + SELECT NULL COLLATE utf8mb4_general_ci; + SELECT CONCAT(NULL) COLLATE utf8mb4_general_ci; + Any collation is applicable to an explicit NULL. + + - Expressions with PS parameters (at PREPARE time, not bound yet) + SELECT ? COLLATE utf8mb4_general_ci; + SELECT CONCAT(?) COLLATE utf8mb4_general_ci; + The collation will be checked for applicability to the + character set of the actual bound parameter at the EXECUTE time. + We're now in PREPARE: let's assume it will be applicable. + */ + set(cl.charset_info(), DERIVATION_EXPLICIT, repertoire); + return false; + } + + // An unknown character set + a contextually typed collation + if (allow_ignorable_with_context_collation) + { + /* + Expressions with non-bound PS parameters, PREPARE time. + SELECT ? COLLATE uca1400_ai_ci; + SELECT CONCAT(?) COLLATE uca1400_ai_ci; + There is a chance the character set of the actual bound parameter + will be known at the EXECUTE time (unless an explicit NULL is bound). + + For now let's use utf8mb4 to resolve collations like uca1400_ai_ci. + The real character set of the actual bound parameter expression will be + later used to resolve the collation again, during the EXECUTE time. + */ + return merge_charset_and_collation(&my_charset_utf8mb4_general_ci, + cl, repertoire); + } + + /* + Expressions with an unknown character set: + - Either without PS parameters at all: + SELECT NULL COLLATE uca1400_ai_ci; + SELECT CONCAT(NULL) COLLATE uca1400_ai_ci; + - Or with PS parameters bound to NULL at EXECUTE time: + EXECUTE IMMEDIATE + 'SELECT ? COLLATE uca1400_ai_ci' USING NULL; + EXECUTE IMMEDIATE + 'SELECT CONCAT(?) COLLATE uca1400_ai_ci' USING NULL; + EXECUTE IMMEDIATE + 'SELECT ? COLLATE uca1400_ai_ci' USING CONCAT(NULL); + */ + my_error(ER_NOT_ALLOWED_IN_THIS_CONTEXT, MYF(0), "NULL"); + return true; +} + + Named_type_handler type_handler_row("row"); Named_type_handler type_handler_null("null"); diff --git a/sql/sql_type.h b/sql/sql_type.h index 374f35ca753..ea736f92ae7 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -3076,6 +3076,12 @@ public: bool aggregate(const DTCollation &dt, uint flags= 0); bool set(DTCollation &dt1, DTCollation &dt2, uint flags= 0) { set(dt1); return aggregate(dt2, flags); } + bool merge_charset_and_collation(CHARSET_INFO *cs, + const Lex_extended_collation_st &cl, + my_repertoire_t repertoire); + bool merge_collation(const Lex_extended_collation_st &cl, + my_repertoire_t repertoire, + bool allow_ignorable_with_context_collation); const char *derivation_name() const { switch(derivation) From 8ed3c375929b449ef8556cfa0c49a35707d59b84 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 4 Jul 2024 09:27:30 +0200 Subject: [PATCH 73/85] Make PROTECT_STATEMENT_MEMROOT default for version less then 11.2 --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e72ee4b917..cc34e04b98d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,13 +191,20 @@ ELSE() SET (SKIP_COMPONENTS "N-O-N-E") ENDIF() -OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF) + +IF("${MYSQL_NO_DASH_VERSION}" VERSION_LESS 11.2) + SET(MEMPROTECT_DEFAULT ON) +ELSE() + SET(MEMPROTECT_DEFAULT OFF) +ENDIF() + +OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" +${MEMPROTECT_DEFAULT}) # # Enable protection of statement's memory root after first SP/PS execution. # Can be switched on only for debug build. # -OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" OFF) IF (WITH_PROTECT_STATEMENT_MEMROOT) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT") From 6cb896a639d15efb13a72de8e7302d515ec90033 Mon Sep 17 00:00:00 2001 From: Galina Shalygina Date: Tue, 18 Jun 2024 19:40:05 +0200 Subject: [PATCH 74/85] MDEV-29363: Constant subquery causing a crash in pushdown optimization The crash is caused by the attempt to refix the constant subquery during pushdown from HAVING into WHERE optimization. Every condition that is going to be pushed into WHERE clause is first cleaned up, then refixed. Constant subqueries are not cleaned or refixed because they will remain the same after refixing, so this complicated procedure can be omitted for them (introduced in MDEV-21184). Constant subqueries are marked with flag IMMUTABLE_FL, that helps to miss the cleanup stage for them. Also they are marked as fixed, so refixing is also not done for them. Because of the multiple equality propagation several references to the same constant subquery can exist in the condition that is going to be pushed into WHERE. Before this patch, the problem appeared in the following way. After the first reference to the constant subquery is processed, the flag IMMUTABLE_FL for the constant subquery is disabled. So, when the second reference to this constant subquery is processed, the flag is already disabled and the subquery goes through the procedure of cleaning and refixing. That causes a crash. To solve this problem, IMMUTABLE_FL should be disabled only after all references to the constant subquery are processed, so after the whole condition that is going to be pushed is cleaned up and refixed. Approved by Igor Babaev --- mysql-test/main/having_cond_pushdown.result | 111 ++++++++++++++++++++ mysql-test/main/having_cond_pushdown.test | 61 +++++++++++ sql/item.cc | 11 +- sql/item.h | 1 + sql/sql_lex.cc | 13 +++ 5 files changed, 194 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 1afed563fcb..e5e99fe2381 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -4982,3 +4982,114 @@ a 0 DROP TABLE t1; End of 10.4 tests +# +# MDEV-29363: Constant subquery causing a crash in pushdown optimization +# +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (3, 3, 4), (NULL, NULL, 2); +EXPLAIN FORMAT=JSON SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.b, t1.c", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = (subquery#2) and (t1.b = (subquery#2) or t1.c = (subquery#2))" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); +a b c +3 3 4 +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a,b +HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = (subquery#2) and (1 or (subquery#2) > t1.b)" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a FROM t1 GROUP BY a,b +HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); +a +3 +DROP TABLE t1; +# +# MDEV-32424: Pushdown: server crashes at JOIN::save_explain_data() +# (fixed by the patch for MDEV-29363) +# +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (1, 1, 3), (3, 2, 3); +SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and a IN (b, c); +a b c +1 1 3 +DROP TABLE t1; +# +# MDEV-32293: Pushdown: server crashes at check_simple_equality() +# (fixed by the patch for MDEV-29363) +# +CREATE VIEW v1 AS SELECT 1 AS a; +SELECT * FROM v1 GROUP BY a HAVING a = 'b' AND a = (a IS NULL); +a +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'b' +DROP VIEW v1; +# +# MDEV-32304: Pushdown: server crashes at Item_field::used_tables() +# (fixed by the patch for MDEV-29363) +# +CREATE VIEW v1 AS SELECT 1 AS a; +SELECT * FROM v1 +GROUP BY a HAVING a = (a IS NULL OR a IS NULL); +a +DROP VIEW v1; +End of 10.5 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 57f70152375..f2812fb14f2 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1498,3 +1498,64 @@ SELECT a FROM t1 GROUP BY a HAVING NOT a; DROP TABLE t1; --echo End of 10.4 tests + +--echo # +--echo # MDEV-29363: Constant subquery causing a crash in pushdown optimization +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (3, 3, 4), (NULL, NULL, 2); + +let $q= +SELECT a,b,c FROM t1 GROUP BY a,b,c + HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +let $q= +SELECT a FROM t1 GROUP BY a,b + HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +DROP TABLE t1; + +--echo # +--echo # MDEV-32424: Pushdown: server crashes at JOIN::save_explain_data() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (1, 1, 3), (3, 2, 3); + +SELECT a,b,c FROM t1 GROUP BY a,b,c + HAVING a = (SELECT MIN(b) AS min_b FROM t1) and a IN (b, c); + +DROP TABLE t1; + +--echo # +--echo # MDEV-32293: Pushdown: server crashes at check_simple_equality() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE VIEW v1 AS SELECT 1 AS a; + +SELECT * FROM v1 GROUP BY a HAVING a = 'b' AND a = (a IS NULL); + +DROP VIEW v1; + +--echo # +--echo # MDEV-32304: Pushdown: server crashes at Item_field::used_tables() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE VIEW v1 AS SELECT 1 AS a; + +SELECT * FROM v1 + GROUP BY a HAVING a = (a IS NULL OR a IS NULL); + +DROP VIEW v1; + +--echo End of 10.5 tests diff --git a/sql/item.cc b/sql/item.cc index be923fe7bae..55960ab8739 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -11085,8 +11085,13 @@ bool Item::cleanup_excluding_immutables_processor (void *arg) if (!(get_extraction_flag() == IMMUTABLE_FL)) return cleanup_processor(arg); else - { - clear_extraction_flag(); return false; - } +} + + +bool Item::remove_immutable_flag_processor (void *arg) +{ + if (get_extraction_flag() == IMMUTABLE_FL) + clear_extraction_flag(); + return false; } diff --git a/sql/item.h b/sql/item.h index 389c2da4cf4..73c775a849d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1990,6 +1990,7 @@ public: virtual bool change_context_processor(void *arg) { return 0; } virtual bool reset_query_id_processor(void *arg) { return 0; } virtual bool is_expensive_processor(void *arg) { return 0; } + bool remove_immutable_flag_processor (void *arg); // FIXME reduce the number of "add field to bitmap" processors virtual bool add_field_to_set_processor(void *arg) { return 0; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b669925a263..e114d6de5e1 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -11338,6 +11338,19 @@ Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having) goto exit; } } + + /* + Remove IMMUTABLE_FL only after all of the elements of the condition are processed. + */ + it.rewind(); + while ((item=it++)) + { + if (item->walk(&Item::remove_immutable_flag_processor, 0, STOP_PTR)) + { + attach_to_conds.empty(); + goto exit; + } + } exit: thd->lex->current_select= save_curr_select; return having; From 513c82704118f11f4c757cbba264da4174fcee9d Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Mon, 27 May 2024 17:00:12 +0300 Subject: [PATCH 75/85] MDEV-34190: r_engine_stats.pages_read_count is unrealistically low The symptoms were: take a server with no activity and a table that's not in the buffer pool. Run a query that reads the whole table and observe that r_engine_stats.pages_read_count shows about 2% of the table was read. Who reads the rest? The cause was that page prefetching done inside InnoDB was not counted. This counts page prefetch requests made in buf_read_ahead_random() and buf_read_ahead_linear() and makes them visible in: - ANALYZE: r_engine_stats.pages_prefetch_read_count - Slow Query Log: Pages_prefetched: This patch intentionally doesn't attempt to count the time to read the prefetched pages: * there's no obvious place where one can do it * prefetch reads may be done in parallel (right?), it is not clear how to count the time in this case. --- mysql-test/include/log_slow_grep.inc | 2 +- .../main/analyze_stmt_prefetch_count.opt | 1 + .../main/analyze_stmt_prefetch_count.result | 60 +++++++++++++++ .../main/analyze_stmt_prefetch_count.test | 77 +++++++++++++++++++ mysql-test/main/log_slow_innodb.result | 6 +- sql/ha_handler_stats.h | 9 +++ sql/log.cc | 2 + sql/sql_explain.cc | 2 + storage/innobase/buf/buf0rea.cc | 2 + storage/innobase/include/mariadb_stats.h | 6 ++ 10 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 mysql-test/main/analyze_stmt_prefetch_count.opt create mode 100644 mysql-test/main/analyze_stmt_prefetch_count.result create mode 100644 mysql-test/main/analyze_stmt_prefetch_count.test diff --git a/mysql-test/include/log_slow_grep.inc b/mysql-test/include/log_slow_grep.inc index db82f3cb8fb..28717e18123 100644 --- a/mysql-test/include/log_slow_grep.inc +++ b/mysql-test/include/log_slow_grep.inc @@ -22,7 +22,7 @@ # InnoDB/Engines --let log_expected_matches = $log_slow_verbosity_innodb_expected_matches ---let grep_pattern = ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+\$ +--let grep_pattern = ^# Pages_accessed: \d+ Pages_read: \d+ Pages_prefetched: \d+ Pages_updated: \d+ Old_rows_read: \d+\$ --source include/log_grep.inc --let grep_pattern = ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+\$ diff --git a/mysql-test/main/analyze_stmt_prefetch_count.opt b/mysql-test/main/analyze_stmt_prefetch_count.opt new file mode 100644 index 00000000000..c33354be63a --- /dev/null +++ b/mysql-test/main/analyze_stmt_prefetch_count.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=32M --innodb_buffer_pool_dump_at_shutdown=off --innodb_buffer_pool_load_at_startup=off --innodb-stats-persistent=1 --innodb-stats-auto-recalc=off diff --git a/mysql-test/main/analyze_stmt_prefetch_count.result b/mysql-test/main/analyze_stmt_prefetch_count.result new file mode 100644 index 00000000000..34c9085b49e --- /dev/null +++ b/mysql-test/main/analyze_stmt_prefetch_count.result @@ -0,0 +1,60 @@ +create table t1 ( +a varchar(255), +b varchar(255), +c varchar(255), +d varchar(255), +primary key(a,b,c,d) +) engine=innodb; +SET unique_checks=0, foreign_key_checks= 0; +begin; +insert into t1 select +repeat(uuid(), 7), +repeat(uuid(), 7), +repeat(uuid(), 7), +repeat(uuid(), 7) +from seq_1_to_16384; +insert into t1 values ('z','z','z','z'); +commit; +# Restart the server to make sure we have an empty InnoDB Buffer Pool +# (in the test's .opt file we've disabled buffer pool saving/loading +# and also tried to disable any background activity) +SET GLOBAL innodb_fast_shutdown=0; +# restart +set @innodb_pages_read0= +(select variable_value +from information_schema.session_status +where variable_name like 'innodb_pages_read'); +set @js='$analyze_output'; +set @js=json_extract(@js, '$.query_block.table.r_engine_stats'); +set @pages_accessed= cast(json_value(@js,'$.pages_accessed') as INT); +set @pages_read_count= cast(json_value(@js,'$.pages_read_count') as INT); +set @pages_prefetch_read_count= cast(json_value(@js,'$.pages_prefetch_read_count') as INT); +select @pages_accessed > 1000 and @pages_accessed < 1500; +@pages_accessed > 1000 and @pages_accessed < 1500 +1 +set @total_read = (@pages_read_count + @pages_prefetch_read_count); +select @pages_accessed*0.75 < @total_read, @total_read < @pages_accessed*1.25; +@pages_accessed*0.75 < @total_read @total_read < @pages_accessed*1.25 +1 1 +set @innodb_pages_read1= +(select variable_value +from information_schema.session_status +where variable_name like 'innodb_pages_read'); +set @innodb_pages_read_incr= (@innodb_pages_read1 - @innodb_pages_read0); +select @innodb_pages_read_incr > 1000, @innodb_pages_read_incr < 1500; +@innodb_pages_read_incr > 1000 @innodb_pages_read_incr < 1500 +1 1 +set @js='$analyze_output'; +set @js=json_extract(@js, '$.query_block.table.r_engine_stats'); +# This must just print pages_accessed. No page reads or prefetch reads, +# because the previous query has read all the needed pages into the +# buffer pool, which is set to be large enough to accomodate the whole +# table. +select @js; +@js +{"pages_accessed": NUMBER} +set @pages_accessed2= cast(json_value(@js,'$.pages_accessed') as INT); +select @pages_accessed2 = @pages_accessed; +@pages_accessed2 = @pages_accessed +1 +drop table t1; diff --git a/mysql-test/main/analyze_stmt_prefetch_count.test b/mysql-test/main/analyze_stmt_prefetch_count.test new file mode 100644 index 00000000000..ad6bac4763c --- /dev/null +++ b/mysql-test/main/analyze_stmt_prefetch_count.test @@ -0,0 +1,77 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + + +# Each row is 1K. +create table t1 ( + a varchar(255), + b varchar(255), + c varchar(255), + d varchar(255), + primary key(a,b,c,d) +) engine=innodb; + +# The data size is 16K * 1K = 16M +# 16M / (page_size=16K) = 1K pages. +SET unique_checks=0, foreign_key_checks= 0; +begin; +insert into t1 select + repeat(uuid(), 7), + repeat(uuid(), 7), + repeat(uuid(), 7), + repeat(uuid(), 7) +from seq_1_to_16384; +insert into t1 values ('z','z','z','z'); +commit; + +--echo # Restart the server to make sure we have an empty InnoDB Buffer Pool +--echo # (in the test's .opt file we've disabled buffer pool saving/loading +--echo # and also tried to disable any background activity) +SET GLOBAL innodb_fast_shutdown=0; +--source include/restart_mysqld.inc + +set @innodb_pages_read0= + (select variable_value + from information_schema.session_status + where variable_name like 'innodb_pages_read'); + +let $analyze_output= `analyze format=json +select * from t1 force index (PRIMARY) order by a,b,c,d`; +evalp set @js='$analyze_output'; + +set @js=json_extract(@js, '$.query_block.table.r_engine_stats'); +#select @js; +set @pages_accessed= cast(json_value(@js,'$.pages_accessed') as INT); +set @pages_read_count= cast(json_value(@js,'$.pages_read_count') as INT); +set @pages_prefetch_read_count= cast(json_value(@js,'$.pages_prefetch_read_count') as INT); + +select @pages_accessed > 1000 and @pages_accessed < 1500; + +set @total_read = (@pages_read_count + @pages_prefetch_read_count); + +select @pages_accessed*0.75 < @total_read, @total_read < @pages_accessed*1.25; + +set @innodb_pages_read1= + (select variable_value + from information_schema.session_status + where variable_name like 'innodb_pages_read'); + +set @innodb_pages_read_incr= (@innodb_pages_read1 - @innodb_pages_read0); + +select @innodb_pages_read_incr > 1000, @innodb_pages_read_incr < 1500; + +let $analyze_output= `analyze format=json +select * from t1 force index (PRIMARY) order by a,b,c,d`; +evalp set @js='$analyze_output'; +set @js=json_extract(@js, '$.query_block.table.r_engine_stats'); + +--echo # This must just print pages_accessed. No page reads or prefetch reads, +--echo # because the previous query has read all the needed pages into the +--echo # buffer pool, which is set to be large enough to accomodate the whole +--echo # table. +--replace_regex /[0-9]+/NUMBER/ +select @js; +set @pages_accessed2= cast(json_value(@js,'$.pages_accessed') as INT); + +select @pages_accessed2 = @pages_accessed; +drop table t1; diff --git a/mysql-test/main/log_slow_innodb.result b/mysql-test/main/log_slow_innodb.result index 11a6f2c32c0..9cf898c73fa 100644 --- a/mysql-test/main/log_slow_innodb.result +++ b/mysql-test/main/log_slow_innodb.result @@ -23,7 +23,7 @@ UPDATE t1 set b=b+1 where a=1 or a=999; [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 -[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ expected_matches: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_prefetched: \d+ Pages_updated: \d+ Old_rows_read: \d+$ expected_matches: 2 [log_grep.inc] found expected match count: 2 [log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+$ expected_matches: 2 [log_grep.inc] found expected match count: 2 @@ -47,7 +47,7 @@ SELECT 1; [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 -[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_prefetched: \d+ Pages_updated: \d+ Old_rows_read: \d+$ [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+$ [log_grep.inc] lines: 0 @@ -85,7 +85,7 @@ INSERT INTO t1 VALUE(1000) pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_3 --source include/log_slow_start.inc -INSERT INTO t1 VALUE(1000) pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+$ +INSERT INTO t1 VALUE(1000) pattern: ^# Pages_accessed: \d+ Pages_read: \d+ Pages_prefetched: \d+ Pages_updated: \d+ Old_rows_read: \d+$ [log_grep.inc] lines: 0 [log_grep.inc] file: log_slow_innodb-verbosity_3 --source include/log_slow_start.inc diff --git a/sql/ha_handler_stats.h b/sql/ha_handler_stats.h index 60ae5deedbe..362a19dab0b 100644 --- a/sql/ha_handler_stats.h +++ b/sql/ha_handler_stats.h @@ -30,6 +30,15 @@ public: /* Time spent reading pages, in timer_tracker_frequency() units */ ulonglong pages_read_time; + /* + Number of pages that we've requested to prefetch while running the query. + Note that we don't know: + - how much time was spent reading these pages (and how to count the time + if reading was done in parallel) + - whether the pages were read by "us" or somebody else... + */ + ulonglong pages_prefetched; + ulonglong undo_records_read; /* Time spent in engine, in timer_tracker_frequency() units */ diff --git a/sql/log.cc b/sql/log.cc index 9b2249825a5..28954992a9a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3283,10 +3283,12 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, if (my_b_printf(&log_file, "# Pages_accessed: %lu Pages_read: %lu " + "Pages_prefetched: %lu " "Pages_updated: %lu Old_rows_read: %lu\n" "# Pages_read_time: %s Engine_time: %s\n", (ulong) stats->pages_accessed, (ulong) stats->pages_read_count, + (ulong) stats->pages_prefetched, (ulong) stats->pages_updated, (ulong) stats->undo_records_read, query_time_buff, lock_time_buff)) diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index c84a3a00a8f..764d5dd8cef 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -1727,6 +1727,8 @@ static void trace_engine_stats(handler *file, Json_writer *writer) if (hs->pages_read_time) writer->add_member("pages_read_time_ms"). add_double(hs->pages_read_time * 1000. / timer_tracker_frequency()); + if (hs->pages_prefetched) + writer->add_member("pages_prefetch_read_count").add_ull(hs->pages_prefetched); if (hs->undo_records_read) writer->add_member("old_rows_read").add_ull(hs->undo_records_read); writer->end_object(); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 1c1e1150635..7279497e14c 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -427,6 +427,7 @@ read_ahead: if (count) { + mariadb_increment_pages_prefetched(count); DBUG_PRINT("ib_buf", ("random read-ahead %zu pages from %s: %u", count, space->chain.start->name, low.page_no())); @@ -671,6 +672,7 @@ failed: if (count) { + mariadb_increment_pages_prefetched(count); DBUG_PRINT("ib_buf", ("random read-ahead %zu pages from %s: %u", count, space->chain.start->name, new_low.page_no())); diff --git a/storage/innobase/include/mariadb_stats.h b/storage/innobase/include/mariadb_stats.h index 3a2790d02f0..838955461e8 100644 --- a/storage/innobase/include/mariadb_stats.h +++ b/storage/innobase/include/mariadb_stats.h @@ -79,6 +79,12 @@ inline void mariadb_increment_undo_records_read() stats->undo_records_read++; } +inline void mariadb_increment_pages_prefetched(ulint n_pages) +{ + if (ha_handler_stats *stats= mariadb_stats) + stats->pages_prefetched += n_pages; +} + /* The following has to be identical code as measure() in sql_analyze_stmt.h From e40d232ad656bf14d4b2a045c995b303e909a14e Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 21 Jun 2024 12:30:02 +0300 Subject: [PATCH 76/85] Stabilize analyze_engine_stats2.test --- mysql-test/main/analyze_engine_stats2.opt | 2 +- mysql-test/main/analyze_engine_stats2.result | 33 +++----------------- mysql-test/main/analyze_engine_stats2.test | 9 +++--- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/mysql-test/main/analyze_engine_stats2.opt b/mysql-test/main/analyze_engine_stats2.opt index a5bb9a93636..c33354be63a 100644 --- a/mysql-test/main/analyze_engine_stats2.opt +++ b/mysql-test/main/analyze_engine_stats2.opt @@ -1 +1 @@ ---innodb_buffer_pool_dump_at_shutdown=off --innodb_buffer_pool_load_at_startup=off --innodb-stats-persistent=1 --innodb-stats-auto-recalc=off +--innodb-buffer-pool-size=32M --innodb_buffer_pool_dump_at_shutdown=off --innodb_buffer_pool_load_at_startup=off --innodb-stats-persistent=1 --innodb-stats-auto-recalc=off diff --git a/mysql-test/main/analyze_engine_stats2.result b/mysql-test/main/analyze_engine_stats2.result index 3ba9895dd39..1452e23a991 100644 --- a/mysql-test/main/analyze_engine_stats2.result +++ b/mysql-test/main/analyze_engine_stats2.result @@ -8,45 +8,20 @@ c varchar(255), d varchar(255), primary key(a,b,c,d) ) engine=innodb; +SET unique_checks=0, foreign_key_checks= 0; +begin; insert into t1 select repeat(uuid(), 7), repeat(uuid(), 7), repeat(uuid(), 7), repeat(uuid(), 7) from seq_1_to_16384; +commit; +SET GLOBAL innodb_fast_shutdown=0; # restart set log_slow_verbosity='engine'; set long_query_time=0.0; set @js='$analyze_output'; -select @js; -@js -{ - "query_block": { - "select_id": 1, - "r_loops": 1, - "r_total_time_ms": "REPLACED", - "table": { - "table_name": "t1", - "access_type": "index", - "key": "PRIMARY", - "key_length": "1028", - "used_key_parts": ["a", "b", "c", "d"], - "r_loops": 1, - "rows": 1, - "r_rows": 16384, - "r_table_time_ms": "REPLACED", - "r_other_time_ms": "REPLACED", - "r_engine_stats": { - "pages_accessed": "REPLACED", - "pages_read_count": "REPLACED", - "pages_read_time_ms": "REPLACED" - }, - "filtered": 100, - "r_filtered": 100, - "using_index": true - } - } -} set @pages_read_time_ms= (select json_value(@js,'$.query_block.table.r_engine_stats.pages_read_time_ms')); diff --git a/mysql-test/main/analyze_engine_stats2.test b/mysql-test/main/analyze_engine_stats2.test index 1a811f6d9e0..526b1806c20 100644 --- a/mysql-test/main/analyze_engine_stats2.test +++ b/mysql-test/main/analyze_engine_stats2.test @@ -18,6 +18,9 @@ create table t1 ( primary key(a,b,c,d) ) engine=innodb; +SET unique_checks=0, foreign_key_checks= 0; +begin; + # The data size is 160K * 1K = 160M # 16M / (page_size=16K) = 1K pages. insert into t1 select @@ -26,7 +29,9 @@ insert into t1 select repeat(uuid(), 7), repeat(uuid(), 7) from seq_1_to_16384; +commit; +SET GLOBAL innodb_fast_shutdown=0; source include/restart_mysqld.inc; set log_slow_verbosity='engine'; set long_query_time=0.0; @@ -35,10 +40,6 @@ let $analyze_output= `analyze format=json select * from t1 force index (PRIMARY) order by a desc, b desc, c desc, d desc`; evalp set @js='$analyze_output'; -# Print it out for user-friendlines ---replace_regex /("(r_[a-z_]*_time_ms|pages[^"]*)": )[^, \n]*/\1"REPLACED"/ -select @js; - set @pages_read_time_ms= (select json_value(@js,'$.query_block.table.r_engine_stats.pages_read_time_ms')); From 9e8546e2bda81c2c97acb1e9f973ff466a82dca7 Mon Sep 17 00:00:00 2001 From: Hugo Wen Date: Sat, 11 Mar 2023 00:27:42 +0000 Subject: [PATCH 77/85] Fix a stack overflow in pinbox allocator MariaDB supports a "wait-free concurrent allocator based on pinning addresses". In `lf_pinbox_real_free()` it tries to sort the pinned addresses for better performance to use binary search during "real free". `alloca()` was used to allocate stack memory and copy addresses. To prevent a stack overflow when allocating the stack memory the function checks if there's enough stack space. However, the available stack size was calculated inaccurately which eventually caused database crash due to stack overflow. The crash was seen on MariaDB 10.6.11 but the same code defect exists on all MariaDB versions. A similar issue happened previously and the fix in fc2c1e43 was to add a `ALLOCA_SAFETY_MARGIN` which is 8192 bytes. However, that safety margin is not enough during high connection workloads. MySQL also had a similar issue and the fix https://github.com/mysql/mysql-server/commit/b086fda was to remove the use of `alloca` and replace qsort approach by a linear scan through all pointers (pins) owned by each thread. This commit is mostly the same as it is the only way to solve this issue as: 1. Frame sizes in different architecture can be different. 2. Number of active (non-null) pinned addresses varies, so the frame size for the recursive sorting function `msort_with_tmp` is also hard to predict. 3. Allocating big memory blocks in stack doesn't seem to be a very good practice. For further details see the mentioned commit in MySQL and the inline comments. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysys/lf_alloc-pin.c | 185 ++++++++++++++----------------------------- 1 file changed, 61 insertions(+), 124 deletions(-) diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 8726349daa4..ae2991fc11c 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -103,12 +103,6 @@ #include #include "my_cpu.h" -/* - when using alloca() leave at least that many bytes of the stack - - for functions we might be calling from within this stack frame -*/ -#define ALLOCA_SAFETY_MARGIN 8192 - #define LF_PINBOX_MAX_PINS 65536 static void lf_pinbox_real_free(LF_PINS *pins); @@ -239,26 +233,21 @@ void lf_pinbox_put_pins(LF_PINS *pins) } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver, (int32*) &top_ver, top_ver-pins->link+nr+LF_PINBOX_MAX_PINS)); - return; } -static int ptr_cmp(const void *pa, const void *pb) +/* + Get the next pointer in the purgatory list. + Note that next_node is not used to avoid the extra volatile. +*/ +#define pnext_node(P, X) (*((void **)(((char *)(X)) + (P)->free_ptr_offset))) + +static inline void add_to_purgatory(LF_PINS *pins, void *addr) { - const void *const*a= pa; - const void *const*b= pb; - return *a < *b ? -1 : *a == *b ? 0 : 1; + pnext_node(pins->pinbox, addr)= pins->purgatory; + pins->purgatory= addr; + pins->purgatory_count++; } -#define add_to_purgatory(PINS, ADDR) \ - do \ - { \ - my_atomic_storeptr_explicit( \ - (void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset), \ - (PINS)->purgatory, MY_MEMORY_ORDER_RELEASE); \ - (PINS)->purgatory= (ADDR); \ - (PINS)->purgatory_count++; \ - } while (0) - /* Free an object allocated via pinbox allocator @@ -276,139 +265,87 @@ void lf_pinbox_free(LF_PINS *pins, void *addr) lf_pinbox_real_free(pins);); } -struct st_harvester { - void **granary; - int npins; +struct st_match_and_save_arg { + LF_PINS *pins; + LF_PINBOX *pinbox; + void *old_purgatory; }; /* - callback forlf_dynarray_iterate: - scan all pins of all threads and accumulate all pins + Callback for lf_dynarray_iterate: + Scan all pins of all threads, for each active (non-null) pin, + scan the current thread's purgatory. If present there, move it + to a new purgatory. At the end, the old purgatory will contain + pointers not pinned by any thread. */ -static int harvest_pins(void *e, void *h) +static int match_and_save(void *e, void *a) { LF_PINS *el= e; - struct st_harvester *hv= h; + struct st_match_and_save_arg *arg= a; + int i; - LF_PINS *el_end= el+MY_MIN(hv->npins, LF_DYNARRAY_LEVEL_LENGTH); + LF_PINS *el_end= el + LF_DYNARRAY_LEVEL_LENGTH; for (; el < el_end; el++) { for (i= 0; i < LF_PINBOX_PINS; i++) { void *p= my_atomic_loadptr((void **)&el->pin[i]); if (p) - *hv->granary++= p; + { + void *cur= arg->old_purgatory; + void **list_prev= &arg->old_purgatory; + while (cur) + { + void *next= pnext_node(arg->pinbox, cur); + + if (p == cur) + { + /* pinned - keeping */ + add_to_purgatory(arg->pins, cur); + /* unlink from old purgatory */ + *list_prev= next; + } + else + list_prev= (void **)((char *)cur+arg->pinbox->free_ptr_offset); + cur= next; + } + if (!arg->old_purgatory) + return 1; + } } } - /* - hv->npins may become negative below, but it means that - we're on the last dynarray page and harvest_pins() won't be - called again. We don't bother to make hv->npins() correct - (that is 0) in this case. - */ - hv->npins-= LF_DYNARRAY_LEVEL_LENGTH; return 0; } -/* - callback forlf_dynarray_iterate: - scan all pins of all threads and see if addr is present there -*/ -static int match_pins(void *e, void *addr) -{ - LF_PINS *el= e; - int i; - LF_PINS *el_end= el+LF_DYNARRAY_LEVEL_LENGTH; - for (; el < el_end; el++) - for (i= 0; i < LF_PINBOX_PINS; i++) - if (my_atomic_loadptr((void **)&el->pin[i]) == addr) - return 1; - return 0; -} - -#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) -#define anext_node(X) next_node(&allocator->pinbox, (X)) - /* Scan the purgatory and free everything that can be freed */ static void lf_pinbox_real_free(LF_PINS *pins) { - int npins; - void *list; - void **addr= NULL; - void *first= NULL, *last= NULL; - struct st_my_thread_var *var= my_thread_var; - void *stack_ends_here= var ? var->stack_ends_here : NULL; LF_PINBOX *pinbox= pins->pinbox; - npins= pinbox->pins_in_array+1; - -#ifdef HAVE_ALLOCA - if (stack_ends_here != NULL) - { - int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins; - /* create a sorted list of pinned addresses, to speed up searches */ - if (available_stack_size(&pinbox, stack_ends_here) > - alloca_size + ALLOCA_SAFETY_MARGIN) - { - struct st_harvester hv; - addr= (void **) alloca(alloca_size); - hv.granary= addr; - hv.npins= npins; - /* scan the dynarray and accumulate all pinned addresses */ - lf_dynarray_iterate(&pinbox->pinarray, harvest_pins, &hv); - - npins= (int)(hv.granary-addr); - /* and sort them */ - if (npins) - qsort(addr, npins, sizeof(void *), ptr_cmp); - } - } -#endif - - list= pins->purgatory; - pins->purgatory= 0; + /* Store info about current purgatory. */ + struct st_match_and_save_arg arg = {pins, pinbox, pins->purgatory}; + /* Reset purgatory. */ + pins->purgatory= NULL; pins->purgatory_count= 0; - while (list) + + + lf_dynarray_iterate(&pinbox->pinarray, match_and_save, &arg); + + if (arg.old_purgatory) { - void *cur= list; - list= *(void **)((char *)cur+pinbox->free_ptr_offset); - if (npins) - { - if (addr) /* use binary search */ - { - void **a, **b, **c; - for (a= addr, b= addr+npins-1, c= a+(b-a)/2; (b-a) > 1; c= a+(b-a)/2) - if (cur == *c) - a= b= c; - else if (cur > *c) - a= c; - else - b= c; - if (cur == *a || cur == *b) - goto found; - } - else /* no alloca - no cookie. linear search here */ - { - if (lf_dynarray_iterate(&pinbox->pinarray, match_pins, cur)) - goto found; - } - } - /* not pinned - freeing */ - if (last) - last= next_node(pinbox, last)= (uchar *)cur; - else - first= last= (uchar *)cur; - continue; -found: - /* pinned - keeping */ - add_to_purgatory(pins, cur); + /* Some objects in the old purgatory were not pinned, free them. */ + void *last= arg.old_purgatory; + while (pnext_node(pinbox, last)) + last= pnext_node(pinbox, last); + pinbox->free_func(arg.old_purgatory, last, pinbox->free_func_arg); } - if (last) - pinbox->free_func(first, last, pinbox->free_func_arg); } +#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) +#define anext_node(X) next_node(&allocator->pinbox, (X)) + /* lock-free memory allocator for fixed-size objects */ /* From 834c013b640ef3fe793eff162db468f9b5261bb3 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 5 Jul 2024 15:26:05 +0530 Subject: [PATCH 78/85] MDEV-34519 innodb_log_checkpoint_now crashes when innodb_read_only is enabled During read only mode, InnoDB doesn't allow checkpoint to happen. So InnoDB should throw the warning when InnoDB tries to force the checkpoint when innodb_read_only = 1 or innodb_force_recovery = 6. --- .../suite/innodb/r/log_file_overwrite.result | 13 +++++ .../suite/innodb/t/log_file_overwrite.test | 14 +++++ storage/innobase/handler/ha_innodb.cc | 54 ++++++++++++------- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/innodb/r/log_file_overwrite.result b/mysql-test/suite/innodb/r/log_file_overwrite.result index 5f1f38784f6..58aa4a32bdb 100644 --- a/mysql-test/suite/innodb/r/log_file_overwrite.result +++ b/mysql-test/suite/innodb/r/log_file_overwrite.result @@ -5,4 +5,17 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 TEXT)ENGINE=InnoDB; INSERT INTO t1 SELECT seq, repeat('a', 4000) FROM seq_1_to_1800; # restart: --debug_dbug=+d,before_final_redo_apply --innodb_log_file_size=8M # restart: --innodb_log_file_size=10M +# +# MDEV-34519 innodb_log_checkpoint_now crashes when +# innodb_read_only is enabled +# +# restart: --innodb-force-recovery=6 +SET GLOBAL innodb_log_checkpoint_now=1; +Warnings: +Warning 138 InnoDB doesn't force checkpoint when innodb-force-recovery=6. +# restart: --innodb-read-only=1 +SET GLOBAL innodb_log_checkpoint_now=1; +Warnings: +Warning 138 InnoDB doesn't force checkpoint when innodb-read-only=1. +# restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_file_overwrite.test b/mysql-test/suite/innodb/t/log_file_overwrite.test index 209f21c67cd..b6ee84a169c 100644 --- a/mysql-test/suite/innodb/t/log_file_overwrite.test +++ b/mysql-test/suite/innodb/t/log_file_overwrite.test @@ -14,4 +14,18 @@ let $shutdown_timeout=0; let $restart_parameters=--innodb_log_file_size=10M; let $shutdown_timeout=; --source include/restart_mysqld.inc + +--echo # +--echo # MDEV-34519 innodb_log_checkpoint_now crashes when +--echo # innodb_read_only is enabled +--echo # +--let $restart_parameters=--innodb-force-recovery=6 +--source include/restart_mysqld.inc +SET GLOBAL innodb_log_checkpoint_now=1; +--let $restart_parameters=--innodb-read-only=1 +--source include/restart_mysqld.inc +SET GLOBAL innodb_log_checkpoint_now=1; +let $restart_parameters=; +--source include/restart_mysqld.inc + DROP TABLE t1; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cd460b20c1a..69ad47b8ac3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18378,28 +18378,42 @@ wait_background_drop_list_empty(THD*, st_mysql_sys_var*, void*, const void*) Force innodb to checkpoint. */ static void -checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save) +checkpoint_now_set(THD* thd, st_mysql_sys_var*, void*, const void* save) { - if (*(my_bool*) save) { - mysql_mutex_unlock(&LOCK_global_system_variables); - - lsn_t lsn; - - while (log_sys.last_checkpoint_lsn.load( - std::memory_order_acquire) - + SIZE_OF_FILE_CHECKPOINT - + log_sys.framing_size() - < (lsn= log_sys.get_lsn(std::memory_order_acquire))) { - log_make_checkpoint(); - log_sys.log.flush(); - } - - if (dberr_t err = fil_write_flushed_lsn(lsn)) { - ib::warn() << "Checkpoint set failed " << err; - } - - mysql_mutex_lock(&LOCK_global_system_variables); + if (!*(my_bool*) save) { + return; } + + if (srv_read_only_mode) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + "InnoDB doesn't force checkpoint " + "when %s", + (srv_force_recovery + == SRV_FORCE_NO_LOG_REDO) + ? "innodb-force-recovery=6." + : "innodb-read-only=1."); + return; + } + + mysql_mutex_unlock(&LOCK_global_system_variables); + + lsn_t lsn; + + while (log_sys.last_checkpoint_lsn.load( + std::memory_order_acquire) + + SIZE_OF_FILE_CHECKPOINT + + log_sys.framing_size() + < (lsn= log_sys.get_lsn(std::memory_order_acquire))) { + log_make_checkpoint(); + log_sys.log.flush(); + } + + if (dberr_t err = fil_write_flushed_lsn(lsn)) { + ib::warn() << "Checkpoint set failed " << err; + } + + mysql_mutex_lock(&LOCK_global_system_variables); } /****************************************************************//** From cbc1898e82bc5e6abfc89411328c3a2f00d2646d Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Wed, 9 Jun 2021 11:03:03 -0600 Subject: [PATCH 79/85] MDEV-25607: Auto-generated DELETE from HEAP table can break replication The special logic used by the memory storage engine to keep slaves in sync with the master on a restart can break replication. In particular, after a restart, the master writes DELETE statements in the binlog for each MEMORY-based table so the slave can empty its data. If the DELETE is not executable, e.g. due to invalid triggers, the slave will error and fail, whereas the master will never see the problem. Instead of DELETE statements, use TRUNCATE to keep slaves in-sync with the master, thereby bypassing triggers. Reviewed By: =========== Kristian Nielsen Andrei Elkin --- mysql-test/suite/rpl/r/rpl_mdev382.result | 2 +- ...l_memory_engine_truncate_on_restart.result | 39 +++++++++ ...rpl_memory_engine_truncate_on_restart.test | 82 +++++++++++++++++++ sql/sql_base.cc | 2 +- 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result create mode 100644 mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index d5947343967..a16d234b601 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -355,7 +355,7 @@ a` show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Gtid 1 # GTID #-#-# -master-bin.000002 # Query 1 # DELETE FROM `db1``; select 'oops!'`.`t``1` +master-bin.000002 # Query 1 # TRUNCATE TABLE `db1``; select 'oops!'`.`t``1` connection slave; include/start_slave.inc connection master; diff --git a/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result b/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result new file mode 100644 index 00000000000..11543e711f9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result @@ -0,0 +1,39 @@ +include/master-slave.inc +[connection master] +connection master; +create table t (val int) engine=MEMORY; +# DELETE trigger should never be activated +create trigger tr after delete on t for each row update t2 set val = 1; +insert into t values (1),(2); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Check pre-restart values +include/diff_tables.inc [master:test.t,slave:test.t] +# Restarting master should empty master and slave `t` +connection master; +include/rpl_restart_server.inc [server_number=1] +connection master; +# Validating MEMORY table on master is empty after restart +# MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +include/assert_grep.inc [Query to truncate the MEMORY table should be the contents of the new event] +# Ensuring slave MEMORY table is empty +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:test.t,slave:test.t] +# Ensure new events replicate correctly +connection master; +insert into t values (3),(4); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Validate values on slave, after master restart, do not include those inserted previously +include/diff_tables.inc [master:test.t,slave:test.t] +# +# Cleanup +connection master; +drop table t; +include/rpl_end.inc +# End of rpl_memory_engine_truncate_on_restart.test diff --git a/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test b/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test new file mode 100644 index 00000000000..a6e0b39ca85 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test @@ -0,0 +1,82 @@ +# +# This test ensures that a table with engine=memory is kept consistent with +# the slave when the master restarts. That is, when the master is restarted, it +# should binlog a new TRUNCATE TABLE command for tables with MEMORY engines, +# such that after the slave executes these events, its MEMORY-engine tables +# should be empty. +# +# References: +# MDEV-25607: Auto-generated DELETE from HEAP table can break replication +# +--source include/master-slave.inc + +--connection master +create table t (val int) engine=MEMORY; + +-- echo # DELETE trigger should never be activated +create trigger tr after delete on t for each row update t2 set val = 1; + +insert into t values (1),(2); +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc + +-- echo # Check pre-restart values +--let $diff_tables= master:test.t,slave:test.t +--source include/diff_tables.inc + +--echo # Restarting master should empty master and slave `t` +--connection master +--let $seq_no_before_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")` +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +--connection master +--echo # Validating MEMORY table on master is empty after restart +--let $table_size= `select count(*) from t` +if ($table_size) +{ + --echo # MEMORY table is not empty + --die MEMORY table is not empty +} +--let $seq_no_after_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")` +if ($seq_no_before_restart == $seq_no_after_restart) +{ + --echo # Event to empty MEMORY table was not binlogged + --die Event to empty MEMORY table was not binlogged +} + +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $datadir=`select @@datadir` +--let assert_file= $MYSQLTEST_VARDIR/tmp/binlog_decoded.out +--echo # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +--exec $MYSQL_BINLOG $datadir/$binlog_file --result-file=$assert_file + +--let assert_text= Query to truncate the MEMORY table should be the contents of the new event +--let assert_count= 1 +--let assert_select= TRUNCATE TABLE +--source include/assert_grep.inc + +--echo # Ensuring slave MEMORY table is empty +--connection master +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc +--source include/diff_tables.inc + +--echo # Ensure new events replicate correctly +--connection master +insert into t values (3),(4); +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # Validate values on slave, after master restart, do not include those inserted previously +--source include/diff_tables.inc + +--echo # +--echo # Cleanup +--connection master +drop table t; +--source include/rpl_end.inc +--echo # End of rpl_memory_engine_truncate_on_restart.test diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 14bcaf86423..8738f181d77 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2993,7 +2993,7 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) String query(query_buf, sizeof(query_buf), system_charset_info); query.length(0); - query.append("DELETE FROM "); + query.append("TRUNCATE TABLE "); append_identifier(thd, &query, &share->db); query.append("."); append_identifier(thd, &query, &share->table_name); From eb4458e9935534a543baeb8f532b0d5fd1fe0a2b Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Thu, 29 Feb 2024 11:51:09 -0700 Subject: [PATCH 80/85] MDEV-33465: an option to enable semisync recovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current semi-sync binlog fail-over recovery process uses rpl_semi_sync_slave_enabled==TRUE as its condition to truncate a primary server’s binlog, as it is anticipating the server to re-join a replication topology as a replica. However, for servers configured with both rpl_semi_sync_master_enabled=1 and rpl_semi_sync_slave_enabled=1, if a primary is just re-started (i.e. retaining its role as master), it can truncate its binlog to drop transactions which its replica(s) has already received and executed. If this happens, when the replica reconnects, its gtid_slave_pos can be ahead of the recovered primary’s gtid_binlog_pos, resulting in an error state where the replica’s state is ahead of the primary’s. This patch changes the condition for semi-sync recovery to truncate the binlog to instead use the configuration variable --init-rpl-role, when set to SLAVE. This allows for both rpl_semi_sync_master_enabled and rpl_semi_sync_slave_enabled to be set for a primary that is restarted, and no transactions will be lost, so long as --init-rpl-role is not set to SLAVE. Reviewed By: ============ Sergei Golubchik --- .../suite/binlog/r/binlog_truncate_active_log.result | 8 ++++---- .../suite/binlog/r/binlog_truncate_multi_engine.result | 10 +++++----- .../suite/binlog/r/binlog_truncate_multi_log.result | 2 +- .../suite/binlog/t/binlog_truncate_active_log.inc | 2 +- .../suite/binlog/t/binlog_truncate_active_log.test | 2 +- .../suite/binlog/t/binlog_truncate_multi_engine.test | 6 +++--- .../suite/binlog/t/binlog_truncate_multi_log.test | 2 +- .../binlog/t/binlog_truncate_multi_log_unsafe.test | 2 +- mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result | 6 +++--- mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc | 2 +- sql/log.cc | 3 ++- sql/mysqld.cc | 2 +- 12 files changed, 24 insertions(+), 23 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result index 85d37534c0b..53cfb9577d7 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result @@ -40,7 +40,7 @@ disconnect master1; disconnect master2; disconnect master3; disconnect master4; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-7/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc @@ -104,7 +104,7 @@ disconnect master1; disconnect master2; disconnect master3; disconnect master4; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-11/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc @@ -173,7 +173,7 @@ disconnect master1; disconnect master2; disconnect master3; disconnect master4; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-15/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc @@ -248,7 +248,7 @@ disconnect master1; disconnect master2; disconnect master3; disconnect master4; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-21/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result index 8425e0ad17a..4ace60ab39e 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result @@ -31,9 +31,9 @@ Log_name File_size master-bin.000001 # master-bin.000002 # master-bin.000003 # -# restart the server with --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +# restart the server with --init-rpl-role=SLAVE --sync-binlog=1 # the server is restarted -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 connection default; # # *** Summary: 1 row should be present in both tables; binlog is truncated; number of binlogs at reconnect - 3: @@ -98,7 +98,7 @@ INSERT INTO t2 VALUES (2, REPEAT("x", 4100)); INSERT INTO t1 VALUES (2, REPEAT("x", 4100)); COMMIT; connection default; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 connection default; # # *** Summary: 2 rows should be present in both tables; no binlog truncation; one extra binlog file compare with A; number of binlogs at reconnect - 4: @@ -155,9 +155,9 @@ Log_name File_size master-bin.000001 # master-bin.000002 # master-bin.000003 # -# restart the server with --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +# restart the server with --init-rpl-role=SLAVE --sync-binlog=1 # the server is restarted -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 connection default; # # *** Summary: 2 rows should be present in both tables; no binlog truncation; the same # of binlog files as in B; number of binlogs at reconnect - 4: diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result index 271e3c50b19..7d128c71941 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result @@ -42,7 +42,7 @@ connection default; disconnect master1; disconnect master2; disconnect master3; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 FOUND 1 /truncated binlog file:.*master.*000002/ in mysqld.1.err "One record should be present in table" SELECT * FROM ti; diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc index 68ac752725e..050e4ad8665 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc @@ -42,7 +42,7 @@ SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; # # Server restart # ---let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +--let $restart_parameters= --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 --source include/start_mysqld.inc # Check error log for a successful truncate message. diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test index 7c63a853da6..e288aa47660 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test @@ -36,7 +36,7 @@ CREATE TABLE tm (f INT) ENGINE=Aria; # Using 'debug_sync' hold 'query1' execution after 'query1' is flushed and # synced to binary log but not yet committed. In an another connection hold # 'query2' execution after 'query2' is flushed and synced to binlog. -# Crash and restart server with --rpl-semi-sync-slave-enabled=1 +# Crash and restart server with --init-rpl-role=SLAVE # # During recovery of binary log 'query1' status is checked with InnoDB engine, # it will be in prepared but not yet commited. All transactions starting from diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test index 12b0a743916..244bba2bc9b 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test @@ -28,7 +28,7 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=rocksdb; # The transaction is killed along with the server after that. --let $shutdown_timeout=0 --let $debug_sync_action = "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR signal_no_signal" ---let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +--let $restart_parameters = --init-rpl-role=SLAVE --sync-binlog=1 --let $test_outcome= 1 row should be present in both tables; binlog is truncated; number of binlogs at reconnect - 3 --source binlog_truncate_multi_engine.inc --echo Proof of the truncated binlog file is readable (two transactions must be seen): @@ -41,7 +41,7 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=rocksdb; --let $debug_sync_action = "" # Both debug_sync and debug-dbug are required to make sure Engines remember the commit state # debug_sync alone will not help. ---let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +--let $restart_parameters = --init-rpl-role=SLAVE --sync-binlog=1 --let $test_outcome= 2 rows should be present in both tables; no binlog truncation; one extra binlog file compare with A; number of binlogs at reconnect - 4 --source binlog_truncate_multi_engine.inc @@ -50,7 +50,7 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=rocksdb; --let $debug_sync_action = "commit_after_run_commit_ordered SIGNAL con1_ready" # Hold off after both engines have committed. The server is shut down. --let $shutdown_timeout= ---let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +--let $restart_parameters = --init-rpl-role=SLAVE --sync-binlog=1 --let $test_outcome= 2 rows should be present in both tables; no binlog truncation; the same # of binlog files as in B; number of binlogs at reconnect - 4 --source binlog_truncate_multi_engine.inc diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test index 079c79b2984..18aa2ff060a 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test @@ -63,7 +63,7 @@ SELECT @@global.gtid_binlog_state; # # Server restart # ---let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +--let $restart_parameters= --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3 --source include/start_mysqld.inc # Check error log for a successful truncate message. diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test index 5a5cc66742b..07f4e6a23dd 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test @@ -92,7 +92,7 @@ SELECT @@global.gtid_binlog_state; # --echo # Failed restart as the semisync slave --error 1 ---exec $MYSQLD_LAST_CMD --rpl-semi-sync-slave-enabled=1 >> $MYSQLTEST_VARDIR/log/mysqld.1.err 2>&1 +--exec $MYSQLD_LAST_CMD --init-rpl-role=SLAVE >> $MYSQLTEST_VARDIR/log/mysqld.1.err 2>&1 --echo # Normal restart --source include/start_mysqld.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result index 49fdb485c50..b6f3bf3c293 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result @@ -50,7 +50,7 @@ on slave must be 2 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-1-4 -# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE connection server_1; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. @@ -136,7 +136,7 @@ on slave must be 5 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-2-7 -# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE connection server_2; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. @@ -221,7 +221,7 @@ on slave must be 7 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-1-9 -# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE connection server_1; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc index bb705d390ac..7ebeeb9f7ee 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc @@ -74,7 +74,7 @@ source include/wait_for_slave_param.inc; SELECT @@GLOBAL.gtid_current_pos; ---let $restart_parameters=--skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 +--let $restart_parameters=--skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE --let $allow_rpl_inited=1 --source include/start_mysqld.inc --connection server_$server_to_crash diff --git a/sql/log.cc b/sql/log.cc index 28954992a9a..425ec9421d4 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -40,6 +40,7 @@ #include "sql_audit.h" #include "mysqld.h" #include "ddl_log.h" +#include "repl_failsafe.h" #include #include // For test_if_number @@ -11025,7 +11026,7 @@ Recovery_context::Recovery_context() : prev_event_pos(0), last_gtid_standalone(false), last_gtid_valid(false), last_gtid_no2pc(false), last_gtid_engines(0), - do_truncate(global_rpl_semi_sync_slave_enabled), + do_truncate(rpl_status == RPL_IDLE_SLAVE), truncate_validated(false), truncate_reset_done(false), truncate_set_in_1st(false), id_binlog(MAX_binlog_id), checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF), gtid_maybe_to_truncate(NULL) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e3c37d0baad..177dcca8f69 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6627,7 +6627,7 @@ struct my_option my_long_options[]= #ifdef HAVE_REPLICATION {"init-rpl-role", 0, "Set the replication role", &rpl_status, &rpl_status, &rpl_role_typelib, - GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + GET_ENUM, REQUIRED_ARG, RPL_AUTH_MASTER, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ {"memlock", 0, "Lock mysqld in memory.", &locked_in_memory, &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, From 33964984ad69379abb01d1a2fb0f5a285a58f906 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 7 Jul 2024 12:06:19 +0300 Subject: [PATCH 81/85] MDEV-34522 Index for (specific) Aria table is created as corrupted The issue was that when repairing an Aria table of row format PAGE and the data file was bigger the 4G, the data file length was cut short because of wrong parameters to MY_ALIGN(). The effect was that ALTER TABLE, OPTIMIZE TABLE or REPAIR TABLE would fail on these tables, possibly corrupting them. The MDEV also exposed a bug where error state was not propagated properly to the upper level if the number of rows in the table changed. --- storage/maria/ha_maria.cc | 5 +++++ storage/maria/ma_check.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index fae1cdcd816..c583ef496f0 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1778,6 +1778,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) _ma_check_print_warning(param, "Number of rows changed from %s to %s", llstr(rows, llbuff), llstr(file->state->records, llbuff2)); + /* + ma_check_print_warning() may generate an error in case of creating keys + for ALTER TABLE. In this case we should signal an error. + */ + error= thd->is_error(); } } else diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 0017a045bbf..0c80b58d7e3 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2507,7 +2507,7 @@ static int initialize_variables_for_repair(HA_CHECK *param, *info->state= info->s->state.state; if (share->data_file_type == BLOCK_RECORD) share->state.state.data_file_length= MY_ALIGN(sort_info->filelength, - share->block_size); + (my_off_t) share->block_size); else share->state.state.data_file_length= sort_info->filelength; return 0; From 72ceae73148224981c3db14a530427eaf9848a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 8 Jul 2024 10:23:52 +0300 Subject: [PATCH 82/85] MDEV-34510: UBSAN: overflow on adding an unsigned offset crc32_avx512(): Explicitly cast ssize_t(size) to make it clear that we are indeed applying a negative offset to a pointer. --- mysys/crc32/crc32c_x86.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mysys/crc32/crc32c_x86.cc b/mysys/crc32/crc32c_x86.cc index 6d9169f9384..0a4fd9db812 100644 --- a/mysys/crc32/crc32c_x86.cc +++ b/mysys/crc32/crc32c_x86.cc @@ -264,7 +264,8 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, c4 = xor3_512(c4, _mm512_clmulepi64_epi128(l1, b384, 0x10), extract512_128<3>(l1)); - __m256i c2 = _mm512_castsi512_si256(_mm512_shuffle_i64x2(c4, c4, 0b01001110)); + __m256i c2 = + _mm512_castsi512_si256(_mm512_shuffle_i64x2(c4, c4, 0b01001110)); c2 = xor256(c2, _mm512_castsi512_si256(c4)); crc_out = xor128(_mm256_extracti64x2_epi64(c2, 1), _mm256_castsi256_si128(c2)); @@ -289,7 +290,8 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, xor3_512(_mm512_clmulepi64_epi128(lo, b384, 1), _mm512_clmulepi64_epi128(lo, b384, 0x10), extract512_128<3>(lo)); - crc512 = xor512(crc512, _mm512_shuffle_i64x2(crc512, crc512, 0b01001110)); + crc512 = + xor512(crc512, _mm512_shuffle_i64x2(crc512, crc512, 0b01001110)); const __m256i crc256 = _mm512_castsi512_si256(crc512); crc_out = xor128(_mm256_extracti64x2_epi64(crc256, 1), _mm256_castsi256_si128(crc256)); @@ -318,7 +320,7 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, size += 16; if (size) { get_last_two_xmms: - const __m128i crc2 = crc_out, d = load128(buf + (size - 16)); + const __m128i crc2 = crc_out, d = load128(buf + ssize_t(size) - 16); __m128i S = load128(reinterpret_cast(shuffle128) + size); crc_out = _mm_shuffle_epi8(crc_out, S); S = xor128(S, _mm_set1_epi32(0x80808080)); From 215fab68dbe03d4e397d5b63f852ac711324becf Mon Sep 17 00:00:00 2001 From: Anson Chung Date: Mon, 13 May 2024 22:19:38 +0000 Subject: [PATCH 83/85] Perform simple fixes for cppcheck findings Rectify cases of mismatched brackets and address possible cases of division by zero by checking if the denominator is zero before dividing. No functional changes were made. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysys/crc32/crc32_arm64.c | 2 +- mysys/my_rdtsc.c | 14 +++++++++++--- sql/sql_parse.cc | 2 +- storage/maria/ha_s3.cc | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c index 6588606a015..0ed671b61e1 100644 --- a/mysys/crc32/crc32_arm64.c +++ b/mysys/crc32/crc32_arm64.c @@ -37,7 +37,7 @@ my_crc32_t crc32c_aarch64_available(void) static unsigned long getauxval(unsigned int key) { unsigned long val; - if (elf_aux_info(key, (void *)&val, (int)sizeof(val) != 0) + if (elf_aux_info(key, (void *)&val, (int)sizeof(val) != 0)) return 0ul; return val; } diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 1503a5db442..39ec599cf91 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -349,7 +349,9 @@ static ulonglong my_timer_init_frequency(MY_TIMER_INFO *mti) } time4= my_timer_cycles() - mti->cycles.overhead; time4-= mti->microseconds.overhead; - return (mti->microseconds.frequency * (time4 - time1)) / (time3 - time2); + ulonglong denominator = time3 - time2; + if (denominator == 0) denominator = 1; + return (mti->microseconds.frequency * (time4 - time1)) / denominator; } /* @@ -612,8 +614,10 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); + ulonglong denominator = time4 - time1; + if (denominator == 0) denominator = 1; mti->milliseconds.frequency= - (mti->cycles.frequency * (time3 - time2)) / (time4 - time1); + (mti->cycles.frequency * (time3 - time2)) / denominator; } /* @@ -641,8 +645,12 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); + ulonglong denominator = time4 - time1; + if (denominator == 0) { + denominator = 1; + } mti->ticks.frequency= - (mti->cycles.frequency * (time3 - time2)) / (time4 - time1); + (mti->cycles.frequency * (time3 - time2)) / denominator; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 561aca11e20..e0180b035d4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2737,8 +2737,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, DBUG_RETURN(1); lex->query_tables_last= query_tables_last; break; -#endif } +#endif case SCH_PROFILES: /* Mark this current profiling record to be discarded. We don't diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index b75481b3fc2..a9f71ce533c 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -549,6 +549,7 @@ int ha_s3::create(const char *name, TABLE *table_arg, s3_deinit(s3_client); if (error) maria_delete_table_files(name, 1, 0); + } else #endif /* MOVE_TABLE_TO_S3 */ { From df35072c8d26ab2ecd2b48c2897075d2f0906753 Mon Sep 17 00:00:00 2001 From: Anson Chung Date: Sat, 11 May 2024 00:37:05 +0000 Subject: [PATCH 84/85] Refactor GitLab cppcheck and update SAST ignorelists Line numbers had to be removed from the ignorelists in order to be diffed against since locations of the same findings can differ across runs. Therefore preprocessing has to be done on the CI findings so that it can be compared to the ignorelist and new findings can be outputted. However, since line numbers have to be removed, a situation occurs where it is difficult to reference the location of findings in code given the output of the CI job. To lessen this pain, change the cppcheck template to include code snippets which make it easier to reference where in the code the finding is referring to, even in the absence of line numbers. Ignorelisting works as before since locations of the finding may change but not the code it is referring to. Furthermore, due to the innate difficulty in maintaining ignorelists across branches and triaging new findings, allow failure as to not have constantly failing pipelines as a result of a new findings that have not been addressed yet. Lastly, update SAST ignorelists to match the newly refactored cppcheck job and the current state of the codebase. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- .gitlab-ci.yml | 54 ++- mysys/my_rdtsc.c | 17 +- tests/code_quality/cppcheck_ignorelist.txt | 336 +++++------------- tests/code_quality/flawfinder_ignorelist.json | 252 +++++++++++-- 4 files changed, 355 insertions(+), 304 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2798bf166c8..7c6f5c2e9ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -426,7 +426,8 @@ fedora install: - installed-database.sql - upgraded-database.sql -cppcheck: +cppcheck: + allow_failure: true stage: sast needs: [] variables: @@ -434,33 +435,57 @@ cppcheck: GIT_SUBMODULE_STRATEGY: normal script: - yum install -y cppcheck diffutils - # --template: use a single-line template + # --template: output format # --force: check large directories without warning # -i: ignore this directory when scanning + # -I: include path, reduces false positives + # related to inability to resolve symbols # -j: run multiple cppcheck threads # Use newline to escape colon in yaml - > - cppcheck --template="{file}:{line}: {severity}: {message}" --force + cppcheck --template="{file}:{line}\n{code}\n{severity}: {message}" --force --check-level=exhaustive client dbug extra include libmariadb libmysqld libservices mysql-test mysys mysys_ssl pcre plugin strings tests unittest vio wsrep-lib sql sql-common storage -istorage/mroonga -istorage/tokudb -istorage/spider -istorage/rocksdb -iextra/ -ilibmariadb/ -istorage/columnstore - --output-file=cppcheck.txt -j $(nproc) - # Parallel jobs may output findings in an nondeterministic order. Sort to match ignorelist. - - cat cppcheck.txt | sort > cppcheck_sorted.txt - # Remove line numbers for diff - - sed 's/:[^:]*:/:/' cppcheck_sorted.txt > cppcheck_sorted_no_line_numbers.txt + -Iinclude -Istorage/innobase/include + --output-file=initial-cppcheck_output.txt -j $(nproc) + # when including {code} in the cppcheck template, some more pre-processing needs to be done + # + # sample cppcheck finding: : + # foo.bar() + # ^ + # : + # + # 1. remove all lines with "^" + # 2. merge every 3 lines into 1 so it can be sorted (example: foo.bar() : ) + # 3. sort to match ignorelist since parallel jobs may output findings in an nondeterministic order + # 4. remove findings likely to be false positives (i.e, "unknown macros") + # 5. remove line numbers for diffing against ignorelist + - | + cat initial-cppcheck_output.txt | grep -v '\^$' > preprocessed-cppcheck_circumflex_removed.txt + cat preprocessed-cppcheck_circumflex_removed.txt | awk 'NR%3==1 {printf "%s", (NR==1) ? "" : "\n"; printf "%s", $0} NR%3!=1 {printf " %s", $0}' > preprocessed-cppcheck_oneline.txt + cat preprocessed-cppcheck_oneline.txt | sort > preprocessed-cppcheck_sorted.txt + cat preprocessed-cppcheck_sorted.txt | grep -v "There is an unknown macro here somewhere" > results-cppcheck_all_findings.txt + sed 's/:[0-9]\+//' results-cppcheck_all_findings.txt > preprocessed_final-cppcheck_no_line_nums.txt # Only print new issues not found in ignore list - echo "Problems found in ignore list that were not discovered by cppcheck (may have been fixed)." - - diff --changed-group-format='%>' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt || true + - diff --changed-group-format='%>' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt || true - echo "Problems found by cppcheck that were not in ignore list." - - diff --changed-group-format='%<' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt > lines_not_ignored.txt || true - - cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt + - diff --changed-group-format='%<' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt > results-cppcheck_new_findings.txt || true + - cat results-cppcheck_new_findings.txt && test ! -s results-cppcheck_new_findings.txt artifacts: when: always paths: - - cppcheck_sorted.txt + # save all steps of pre-processing in-case it ever breaks + - initial-cppcheck_output.txt + - preprocessed-cppcheck_circumflex_removed.txt + - preprocessed-cppcheck_sorted.txt + - preprocessed_final-cppcheck_no_line_nums.txt + - results-cppcheck_all_findings.txt + - results-cppcheck_new_findings.txt flawfinder: + allow_failure: true stage: sast needs: [] variables: @@ -482,11 +507,12 @@ flawfinder: - echo "Problems found in ignore list that were not discovered by flawfinder (may have been fixed)." - diff --changed-group-format='%>' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json || true - echo "Problems found by flawfinder that were not in ignore list." - - diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > lines_not_ignored.txt || true - - cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt + - diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > flawfinder_new_findings.txt || true + - cat flawfinder_new_findings.txt && test ! -s flawfinder_new_findings.txt artifacts: when: always paths: + - flawfinder_new_findings.txt - flawfinder-all-vulnerabilities.html - flawfinder-min-level5.json diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 39ec599cf91..bbb53c8ed37 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -338,7 +338,7 @@ static ulonglong my_timer_init_resolution(ulonglong (*this_timer)(void), static ulonglong my_timer_init_frequency(MY_TIMER_INFO *mti) { int i; - ulonglong time1, time2, time3, time4; + ulonglong time1, time2, time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_microseconds(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -349,8 +349,7 @@ static ulonglong my_timer_init_frequency(MY_TIMER_INFO *mti) } time4= my_timer_cycles() - mti->cycles.overhead; time4-= mti->microseconds.overhead; - ulonglong denominator = time3 - time2; - if (denominator == 0) denominator = 1; + denominator = ((time3 - time2) == 0) ? 1 : time3 - time2; return (mti->microseconds.frequency * (time4 - time1)) / denominator; } @@ -604,7 +603,7 @@ void my_timer_init(MY_TIMER_INFO *mti) && mti->microseconds.routine && mti->cycles.routine) { - ulonglong time3, time4; + ulonglong time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_milliseconds(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -614,8 +613,7 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); - ulonglong denominator = time4 - time1; - if (denominator == 0) denominator = 1; + denominator = ((time4 - time1) == 0) ? 1 : time4 - time1; mti->milliseconds.frequency= (mti->cycles.frequency * (time3 - time2)) / denominator; } @@ -631,7 +629,7 @@ void my_timer_init(MY_TIMER_INFO *mti) && mti->microseconds.routine && mti->cycles.routine) { - ulonglong time3, time4; + ulonglong time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_ticks(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -645,10 +643,7 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); - ulonglong denominator = time4 - time1; - if (denominator == 0) { - denominator = 1; - } + denominator = ((time4 - time1) == 0) ? 1 : time4 - time1; mti->ticks.frequency= (mti->cycles.frequency * (time3 - time2)) / denominator; } diff --git a/tests/code_quality/cppcheck_ignorelist.txt b/tests/code_quality/cppcheck_ignorelist.txt index 268bf8108d4..79ee4af563a 100644 --- a/tests/code_quality/cppcheck_ignorelist.txt +++ b/tests/code_quality/cppcheck_ignorelist.txt @@ -1,251 +1,85 @@ -client/mysql.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysql_upgrade.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqladmin.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlbinlog.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlcheck.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlimport.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlshow.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqltest.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -dbug/tests.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -lexyy.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -mysql-test/lib/My/SafeProcess/safe_process_win.cc: error: Uninitialized variable: message_text -mysys/mf_keycache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_fopen.c: error: Return value of allocation function 'freopen' is not stored. -mysys/my_getsystime.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_pread.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_rename.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_winfile.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_write.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -mysys/thr_lock.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_TABLE_WAIT_VARIABLES is a macro then please configure it. -mysys/tree.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -pcre/pcrecpp.cc: warning: Uninitialized variable: kmat -pcre/pcrecpp.h: error: syntax error -pcre/pcregrep.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/audit_null/audit_null.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_ed25519/server_ed25519.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/auth_0x0100.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/dialog_examples.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/qa_auth_interface.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/qa_auth_server.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/test_plugin.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_gssapi/server_plugin.cc: error: syntax error -plugin/auth_gssapi/sspi.h: error: #include nested too deeply -plugin/auth_pam/auth_pam.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_pam/auth_pam_v1.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_pipe/auth_pipe.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_socket/auth_socket.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/aws_key_management/aws_key_management_plugin.cc: error: syntax error -plugin/cracklib_password_check/cracklib_password_check.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/daemon_example/daemon_example.cc: error: syntax error -plugin/debug_key_management/debug_key_management_plugin.cc: error: syntax error -plugin/disks/information_schema_disks.cc: error: syntax error -plugin/example_key_management/example_key_management_plugin.cc: error: syntax error -plugin/feedback/feedback.cc: error: syntax error -plugin/file_key_management/file_key_management_plugin.cc: error: syntax error -plugin/fulltext/plugin_example.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/handler_socket/handlersocket/handlersocket.cpp: error: syntax error -plugin/locale_info/locale_info.cc: error: syntax error -plugin/metadata_lock_info/metadata_lock_info.cc: error: syntax error -plugin/metadata_lock_info/metadata_lock_info.cc: error: syntax error -plugin/qc_info/qc_info.cc: error: syntax error -plugin/query_response_time/plugin.cc: error: syntax error -plugin/query_response_time/query_response_time.cc: error: Array 'm_count[41]' accessed at index 43, which is out of bounds. -plugin/query_response_time/query_response_time.cc: error: Array 'm_total[41]' accessed at index 43, which is out of bounds. -plugin/server_audit/server_audit.c: error: Uninitialized variable: &tm_time -plugin/server_audit/server_audit.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/server_audit/server_audit.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/server_audit/server_audit.c: error: Uninitialized variable: &tm_time -plugin/simple_password_check/simple_password_check.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/sql_errlog/sql_errlog.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/sql_errlog/sql_errlog.c: error: Uninitialized variable: &t -plugin/user_variables/user_variables.cc: error: syntax error -plugin/userstat/userstat.cc: error: syntax error -plugin/versioning/versioning.cc: error: syntax error -plugin/wsrep_info/plugin.cc: error: syntax error -sql-common/client.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql/debug_sync.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE is a macro then please configure it. -sql/gcalc_slicescan.cc: warning: Possible null pointer dereference: first_bottom_point -sql/gen_lex_hash.cc: error: Common realloc mistake: 'hash_map' nulled but not freed upon failure -sql/handler.h: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/log.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/log_event.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/log_event_old.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/net_serv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/protocol.h: error: syntax error -sql/rpl_utility.h: error: There is an unknown macro here somewhere. Configuration is required. If CPP_UNNAMED_NS_START is a macro then please configure it. -sql/semisync_slave.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/sql_select.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/sql_string.cc: warning: Iterators to containers from different expressions 'to' and 'from' are used together. -sql/table.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/winservice.c: error: Resource leak: mysql_upgrade_info -sql/wsrep_thd.h: error: failed to expand 'wsrep_create_appliers', Wrong number of parameters for macro 'wsrep_create_appliers'. -storage/archive/azio.c: error: Syntax Error: AST broken, 'if' doesn't have two operands. -storage/archive/ha_archive.cc: error: syntax error -storage/blackhole/ha_blackhole.cc: error: syntax error -storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp: error: Found a exit path from function with non-void return type that has missing return statement -storage/cassandra/ha_cassandra.cc: error: syntax error -storage/connect/connect.cc: error: Uninitialized variable: lg -storage/connect/domdoc.cpp: error: syntax error -storage/connect/ha_connect.cc: error: syntax error -storage/connect/myconn.cpp: error: Unmatched '{'. Configuration: 'ALPHA;MYSQL_PREPARED_STATEMENTS'. -storage/connect/myconn.cpp: error: Unmatched '{'. Configuration: 'MYSQL_PREPARED_STATEMENTS'. -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/plugutil.cpp: error: Width 255 given in format string (no. 2) is larger than destination buffer 'stmsg[200]', use %199[^\"] to prevent overflowing it. -storage/connect/plugutil.cpp: error: Width 255 given in format string (no. 1) is larger than destination buffer 'stmsg[200]', use %199[^\"] to prevent overflowing it. -storage/connect/tabjson.cpp: warning: Possible null pointer dereference: Val -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/taboccur.cpp: warning: Uninitialized variable: *pcrp -storage/connect/unzip.c: warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file -storage/connect/value.cpp: error: Signed integer overflow for expression 'n*126230400'. -storage/connect/zip.c: warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file -storage/csv/ha_tina.cc: error: syntax error -storage/example/ha_example.cc: error: syntax error -storage/federated/ha_federated.cc: error: syntax error -storage/heap/ha_heap.cc: error: syntax error -storage/innobase/btr/btr0btr.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/btr/btr0cur.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/btr/btr0defragment.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/btr/btr0sea.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/buf/buf0buf.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/buf/buf0dump.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/buf/buf0flu.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/buf/buf0lru.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0crea.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/dict/dict0dict.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0load.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/dict/dict0stats.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0stats_bg.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/fil/fil0crypt.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/fil/fil0fil.cc: error: syntax error -storage/innobase/fsp/fsp0file.cc: error: Resource leak: file -storage/innobase/fsp/fsp0fsp.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/fts/fts0fts.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/fts/fts0opt.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/fts/fts0que.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/gis/gis0rtree.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/gis/gis0sea.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/handler/ha_innodb.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/handler/handler0alter.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/handler/i_s.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/ibuf/ibuf0ibuf.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/ibuf/ibuf0ibuf.cc: error: failed to expand 'ibuf_bitmap_page_get_bits', Wrong number of parameters for macro 'ibuf_bitmap_page_get_bits'. -storage/innobase/lock/lock0lock.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/lock/lock0wait.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/lock/lock0wait.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/log/log0log.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/log/log0recv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/os/os0file.cc: error: syntax error -storage/innobase/page/page0page.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/page/page0zip.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/pars/pars0pars.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0ftsort.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0import.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0ins.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0log.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/row/row0merge.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/row/row0mysql.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0quiesce.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0sel.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0umod.cc: error: There is an unknown macro here somewhere. Configuration is required. If ut_d is a macro then please configure it. -storage/innobase/row/row0upd.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0vers.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/srv/srv0conc.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ALIGNED is a macro then please configure it. -storage/innobase/srv/srv0srv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/srv/srv0start.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/trx/trx0i_s.cc: error: Array 'table_cache->chunks[39]' accessed at index 39, which is out of bounds. -storage/innobase/trx/trx0i_s.cc: error: Array 'table_cache->chunks[39]' accessed at index 39, which is out of bounds. -storage/innobase/trx/trx0purge.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0rec.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0roll.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/trx/trx0trx.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0undo.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ha_maria.cc: error: syntax error -storage/maria/ma_bitmap.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_blockrec.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_check.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_checkpoint.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_ft_parser.c: error: Address of local auto-variable assigned to a function parameter. -storage/maria/ma_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_loghandler.c: warning: Uninitialized variable: data->current_offset -storage/maria/ma_open.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_pagecache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_pagecache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_range.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_recovery_util.c: error: va_start() or va_copy() called subsequently on 'args' without va_end() in between. -storage/maria/ma_rkey.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_rt_index.c: error: failed to expand 'rt_PAGE_END', Wrong number of parameters for macro 'rt_PAGE_END'. -storage/maria/ma_search.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_sp_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_update.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_update.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_write.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_write.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/maria_pack.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/ft_parser.c: error: Address of local auto-variable assigned to a function parameter. -storage/myisam/ha_myisam.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_check.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_close.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/myisam/mi_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_locking.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_open.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/myisam/mi_range.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_rkey.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_search.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_update.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_write.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/myisampack.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisammrg/ha_myisammrg.cc: error: syntax error -storage/oqgraph/ha_oqgraph.cc: error: syntax error -storage/perfschema/ha_perfschema.cc: error: syntax error -storage/perfschema/pfs_instr.h: error: Uninitialized variable: m_has_io_stats -storage/perfschema/pfs_instr.h: error: Uninitialized variable: m_has_lock_stats -storage/perfschema/pfs_instr_class.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ALIGNED is a macro then please configure it. -storage/perfschema/table_accounts.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_events_waits.cc: error: Uninitialized struct member: wait.m_wait_class -storage/perfschema/table_events_waits.cc: error: Uninitialized variable: wait -storage/perfschema/table_events_waits.cc: error: Uninitialized struct member: wait.m_wait_class -storage/perfschema/table_ews_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_ews_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_ews_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_hosts.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_setup_actors.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_threads.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_users.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/sequence/sequence.cc: error: syntax error -storage/test_sql_discovery/test_sql_discovery.cc: error: syntax error -strings/decimal.c: warning: Possible null pointer dereference: to -strings/dump_map.c: error: Array 'fromstat[256]' accessed at index 256, which is out of bounds. -tests/mysql_client_fw.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -tests/thread_test.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -unittest/mysys/dynstring-t.c: error: syntax error -unittest/mysys/queues-t.c: error: Uninitialized variable: i -unittest/mysys/waiting_threads-t.c: error: Uninitialized variable: m -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -vio/viosocket.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_SOCKET_WAIT_VARIABLES is a macro then please configure it. -vio/viosocket.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_SOCKET_WAIT_VARIABLES is a macro then please configure it. -vio/viosslfactories.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -vio/viotest-sslconnect.cc: error: Memory pointed to by 'vio' is freed twice. -vio/viotest-sslconnect.cc: error: Memory pointed to by 'ssl_connector' is freed twice. -wsrep-lib/src/server_state.cpp: error: syntax error: keyword 'try' is not allowed in global scope -wsrep-lib/src/thread_service_v1.cpp: error: Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow. If there is no current exception this calls std::terminate(). More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object +client/mysqlbinlog.cc ev->output_buf.copy(e->output_buf); warning: Possible null pointer dereference: e +client/mysqldump.c return buff; warning: Uninitialized variable: buff +client/mysqldump.c return buff; warning: Uninitialized variable: buff +include/my_global.h #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" error: #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" +include/my_global.h #error WHAT? sizeof(long long) < 8 ??? error: #error WHAT? sizeof(long long) < 8 ??? +include/mysql/psi/mysql_socket.h result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); error: syntax error +include/mysql/psi/mysql_socket.h result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); error: syntax error +include/mysql/psi/psi.h #error "You must include my_global.h in the code for the build to be correct." error: #error "You must include my_global.h in the code for the build to be correct." +mysql-test/lib/My/SafeProcess/safe_process_win.cc |FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_err , 0, (LPSTR)&message_text, error: Uninitialized variable: message_text +mysys/file_logger.c *l_perm= new_log; error: Uninitialized struct member: new_log.lock +mysys/ma_dyncol.c float8get(store_it_here->x.double_value, data); error: Uninitialized variable: def_temp +mysys/mf_loadpath.c strmake(to, from, FN_REFLEN-1); warning: Uninitialized variable: from +mysys/my_compare.c mi_float4get(f_1,a); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float4get(f_2,b); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float8get(d_1,a); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float8get(d_2,b); error: Uninitialized variable: def_temp +mysys/my_symlink2.c create_link= (linkname && strcmp(abs_linkname,filename)); error: Uninitialized variable: abs_linkname +plugin/sql_errlog/sql_errlog.c (void) localtime_r(&event_time, &t); error: Uninitialized variable: &t +sql-common/client_plugin.c bzero(&unused, sizeof unused); error: va_list 'unused' used before va_start() was called. +sql-common/client_plugin.c plugin= add_plugin(mysql, plugin, 0, 0, unused); error: va_list 'unused' used before va_start() was called. +sql/gen_lex_hash.cc hash_map= (char*)realloc((char*)hash_map,size_hash_map); error: Common realloc mistake: 'hash_map' nulled but not freed upon failure +sql/my_apc.cc apc_calls->prev= qe; error: Non-local variable 'apc_calls->prev' will use pointer to local variable 'apc_request'. +sql/my_apc.cc apc_calls= qe; error: Non-local variable 'apc_calls' will use pointer to local variable 'apc_request'. +sql/sql_string.cc memcpy(dots, STRING_WITH_LEN("...\0")); error: failed to expand 'memcpy', Wrong number of parameters for macro 'memcpy'. +storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp printf("get_count\n"); error: Found an exit path from function with non-void return type that has missing return statement +storage/connect/connect.cc rcb= valp->SetValue_char(kp, (int)lg); error: Uninitialized variable: lg +storage/connect/connect.cc rcb= valp->SetValue_char((char*)p, (int)lg); error: Uninitialized variable: lg +storage/connect/macutil.cpp #error This is WINDOWS only DLL error: #error This is WINDOWS only DLL +storage/connect/tabjson.cpp Val->SetValue(jsp); warning: Possible null pointer dereference: Val +storage/connect/tabmac.cpp #error This is a WINDOWS only table type error: #error This is a WINDOWS only table type +storage/connect/taboccur.cpp for (i = 0, pcrp = &qrp->Colresp; (crp = *pcrp); ) { warning: Uninitialized variable: *pcrp +storage/connect/tabwmi.cpp #error This is a WINDOWS only table type error: #error This is a WINDOWS only table type +storage/connect/unzip.c us.z_filefunc = *pzlib_filefunc64_32_def; warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file +storage/connect/value.cpp if ((t -= (n * FOURYEARS)) > 2000000000) error: Signed integer overflow for expression 'n*126230400'. +storage/connect/zip.c ziinit.z_filefunc = *pzlib_filefunc64_32_def; warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file +storage/federated/ha_federated.cc DBUG_RETURN(retval); error: Uninitialized variable: retval +storage/federatedx/federatedx_pushdown.cc ha_federatedx *h= (ha_federatedx *) table->file; warning: Possible null pointer dereference: table +storage/federatedx/federatedx_pushdown.cc share= get_share(table->s->table_name.str, table); warning: Possible null pointer dereference: table +storage/heap/hp_hash.c float4get(nr, pos); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float8get(nr, pos); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_create.c DBUG_RETURN(my_pwrite(file, buf, sizeof(buf), error: Uninitialized variable: trid_buff +storage/maria/ma_dbug.c mi_float4get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_dbug.c mi_float8get(d_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_ft_parser.c param->mysql_ftparam= &my_param; error: Address of local auto-variable assigned to a function parameter. +storage/maria/ma_key.c float4get(nr,pos); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float8get(nr,pos); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_locking.c write_error= (int) my_pwrite(share->kfile.file, buff, sizeof(buff), error: Uninitialized variable: buff +storage/maria/ma_locking.c (void) my_pwrite(share->kfile.file, buff, sizeof(buff), error: Uninitialized variable: buff +storage/maria/ma_loghandler.c if (! --fc_ptr->counter) warning: Uninitialized variable: fc_ptr +storage/maria/ma_loghandler.c (offset < data->current_offset && warning: Uninitialized variable: data->current_offset +storage/maria/ma_open.c float8get(state->rec_per_key_part[i], ptr); ptr+= 8; error: Uninitialized variable: def_temp +storage/maria/ma_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/maria/ma_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/maria/ma_recovery_util.c va_start(args, format); error: va_start() or va_copy() called subsequently on 'args' without va_end() in between. +storage/maria/ma_search.c if (flag == 0) warning: Uninitialized variable: flag +storage/maria/ma_write.c key->data= key_buff; error: Address of local auto-variable assigned to a function parameter. +storage/maria/tablockman.c mysql_mutex_init(& lm->pool_mutex, MY_MUTEX_INIT_FAST); error: failed to expand 'mysql_mutex_init', Wrong number of parameters for macro 'mysql_mutex_init'. +storage/myisam/ft_parser.c param->mysql_ftparam= &my_param; error: Address of local auto-variable assigned to a function parameter. +storage/myisam/mi_dbug.c mi_float4get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_dbug.c mi_float8get(d_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float4get(nr,pos); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float8get(nr,pos); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_locking.c write_error= (mysql_file_pwrite(share->kfile, buff, sizeof(buff), error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_search.c if (flag == 0) warning: Uninitialized variable: flag +storage/perfschema/pfs_global.cc return NULL; error: Memory leak: ptr +storage/sequence/sequence.cc maria_declare_plugin(sequence) error: syntax error +strings/decimal.c sanity(to); warning: Possible null pointer dereference: to +strings/dump_map.c if (fromstat[i]) error: Array 'fromstat[256]' accessed at index 256, which is out of bounds. +unittest/mytap/tap.c memset(&ap, 0, sizeof(ap)); error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c vemit_tap(pass, NULL, ap); error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c memset((char*) &ap, 0, sizeof(ap)); /* Keep compiler happy */ error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c vemit_tap(1, NULL, ap); error: va_list 'ap' used before va_start() was called. +vio/viotest-sslconnect.cc delete vio; error: Memory pointed to by 'vio' is freed twice. +vio/viotest-sslconnect.cc delete ssl_connector; error: Memory pointed to by 'ssl_connector' is freed twice. +wsrep-lib/src/server_state.cpp try error: syntax error: keyword 'try' is not allowed in global scope +wsrep-lib/src/thread_service_v1.cpp throw; // Implementation broke the contract and returned. error: Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow. If there is no current exception this calls std::terminate(). More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object diff --git a/tests/code_quality/flawfinder_ignorelist.json b/tests/code_quality/flawfinder_ignorelist.json index 7b598689693..8c5646153f2 100644 --- a/tests/code_quality/flawfinder_ignorelist.json +++ b/tests/code_quality/flawfinder_ignorelist.json @@ -158,6 +158,62 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/writeengine/shared/we_typeext.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 16, + "endColumn": 67, + "snippet": { + "text": " if (fs.chown(fileName.c_str(), uid, gid, funcErrno) == -1)" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "16bbd2ed7b8f86182e8f66980ee23b9e0dfe63a9330b7c16a2c2b81a3e8a9377" + }, + "rank": 1.0 + }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 18, + "endColumn": 51, + "snippet": { + "text": " if ((ret = ::chown(objectName, p_uid, p_gid)))" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "1882617c363794bedb3e70a4a3be704a3ee928778709b75f971e91ffc7a224b6" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -214,6 +270,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 22, + "endColumn": 51, + "snippet": { + "text": "int PosixFileSystem::chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "357c9645f4ff806e824ffc5714887bbfaafe92c4387521d0dec855875c0c21e5" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -270,6 +354,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1035", + "level": "error", + "message": { + "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./sql/signal_handler.cc", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 13, + "endColumn": 68, + "snippet": { + "text": " if ((len= readlink(\"/proc/self/cwd\", buff, sizeof(buff)-1)) >= 0)" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "4c4d621e451a67f86c3e999e9dd3ceb2639bf4f63b0a946b7836b01d752ca557" + }, + "rank": 1.0 + }, { "ruleId": "FF1010", "level": "error", @@ -298,6 +410,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1035", + "level": "error", + "message": { + "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/primitives/blockcache/fsutils.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 27, + "endColumn": 79, + "snippet": { + "text": " ssize_t realnamelen = readlink(path.string().c_str(), realname, PATH_MAX);" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "52b685022ce9db6c7c332217d74745fc48b65e3e00f2cfdbde8f858d28b8aa9f" + }, + "rank": 1.0 + }, { "ruleId": "FF1035", "level": "error", @@ -354,6 +494,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/IDBFileSystem.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 17, + "endColumn": 46, + "snippet": { + "text": " virtual int chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "9d9d3ce8ec5fe165af2a81280b5f9cccf73ba9fbb388bc2ffff6abdbdeb37458" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -410,34 +578,6 @@ }, "rank": 1.0 }, - { - "ruleId": "FF1035", - "level": "error", - "message": { - "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." - }, - "locations": [ - { - "physicalLocation": { - "artifactLocation": { - "uri": "./sql/signal_handler.cc", - "uriBaseId": "SRCROOT" - }, - "region": { - "startColumn": 13, - "endColumn": 66, - "snippet": { - "text": " if ((len= readlink(\"/proc/self/cwd\", buff, sizeof(buff))) >= 0)" - } - } - } - } - ], - "fingerprints": { - "contextHash/v1": "b55a5f3db29b1ce25e12f94e4ea344ed7fb0e63a230cf6b6deb42c28de924457" - }, - "rank": 1.0 - }, { "ruleId": "FF1033", "level": "error", @@ -605,6 +745,62 @@ "contextHash/v1": "e307b1923cc852324e3050b3e4423be7ac4d1d64af274b70b897a85b1cde815f" }, "rank": 1.0 + }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 9, + "endColumn": 38, + "snippet": { + "text": " int chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "edadf52c51b65383fbcdec8fcf70136a279635c3c98024e456b364d81f9605f7" + }, + "rank": 1.0 + }, + { + "ruleId": "FF1033", + "level": "error", + "message": { + "text": "race/chmod:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/versioning/BRM/oidserver.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 13, + "endColumn": 93, + "snippet": { + "text": " chmod(fFilename.c_str(), 0664); // XXXPAT: override umask at least for testing" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "fab02b6c6609db1b8bb60e7d58130b030d12cced8cf09f8b6ae499171f612a7b" + }, + "rank": 1.0 } ], "externalPropertyFileReferences": { From d1e5fa891705dba309d09d9e66f09765bc5e11a7 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 11 Jun 2024 13:49:08 +0400 Subject: [PATCH 85/85] MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled my_like_range*() can create longer keys than Field::char_length(). This caused warnings during print_range(). Fix: Suppressing warnings in print_range(). --- mysql-test/main/opt_trace.result | 28 +++++++++++++++++++++++++ mysql-test/main/opt_trace.test | 35 ++++++++++++++++++++++++++++++++ sql/opt_range.cc | 1 + 3 files changed, 64 insertions(+) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 71494123fba..f252d7e37a1 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -9280,5 +9280,33 @@ select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace; QUERY LENGTH(trace)>1 insert into t2 select * from t1 where a<= b and a>4 1 drop table t1, t2; +# +# MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled +# +SET @@optimizer_trace='enabled=on'; +CREATE TABLE t1 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) CHARSET=utf8mb4; +CREATE TABLE t2 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) CHARSET=utf8mb4; +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); +INSERT IGNORE INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States'), +('IB','North America'), +('GO','South America'); +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%'; +DROP TABLE t1, t2; # End of 10.5 tests set optimizer_trace='enabled=off'; diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 9ff74f15921..49580a4654e 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -971,5 +971,40 @@ select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace; drop table t1, t2; +--echo # +--echo # MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled +--echo # + +SET @@optimizer_trace='enabled=on'; + +CREATE TABLE t1 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) CHARSET=utf8mb4; + +CREATE TABLE t2 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) CHARSET=utf8mb4; + +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); + +INSERT IGNORE INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States'), +('IB','North America'), +('GO','South America'); + +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%'; +DROP TABLE t1, t2; + --echo # End of 10.5 tests set optimizer_trace='enabled=off'; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 10e1d5cd19a..ac3b2d6f339 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -16453,6 +16453,7 @@ static void print_range(String *out, const KEY_PART_INFO *key_part, KEY_MULTI_RANGE *range, uint n_key_parts) { + Check_level_instant_set check_field(current_thd, CHECK_FIELD_IGNORE); uint flag= range->range_flag; String key_name; key_name.set_charset(system_charset_info);