summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-05-18 15:04:50 +0200
committerSergei Golubchik <serg@mariadb.org>2022-05-19 14:07:55 +0200
commitbf2bdd1a1a112c3bbdf53da7a663a59fafa62c7d (patch)
tree615e56754c44190551cea0381494b675108b6ae9 /sql/sql_lex.h
parent5dba54bfef31d91c082362065cd091086e20ee9a (diff)
parentb7ffccf49b5563d3078359bddf438c9d20674513 (diff)
downloadmariadb-git-bf2bdd1a1a112c3bbdf53da7a663a59fafa62c7d.tar.gz
Merge branch '10.8' into 10.9mariadb-10.9.1
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index a6e7546d38c..a4dcfbbf99f 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2047,8 +2047,7 @@ public:
@retval nonzero if the statement is a row injection
*/
inline bool is_stmt_row_injection() const {
- return binlog_stmt_flags &
- (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
+ return binlog_stmt_flags & (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
}
/**
@@ -2058,8 +2057,7 @@ public:
*/
inline void set_stmt_row_injection() {
DBUG_ENTER("set_stmt_row_injection");
- binlog_stmt_flags|=
- (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
+ binlog_stmt_flags|= (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
DBUG_VOID_RETURN;
}
@@ -2335,7 +2333,7 @@ private:
The statement is a row injection (i.e., either a BINLOG
statement or a row event executed by the slave SQL thread).
*/
- BINLOG_STMT_TYPE_ROW_INJECTION = 0,
+ BINLOG_STMT_TYPE_ROW_INJECTION = BINLOG_STMT_UNSAFE_COUNT,
/** The last element of this enumeration type. */
BINLOG_STMT_TYPE_COUNT
@@ -2349,8 +2347,8 @@ private:
- The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of
unsafeness that the current statement has.
- - The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement
- is of some special type.
+ - The next BINLOG_STMT_TYPE_COUNT-BINLOG_STMT_TYPE_COUNT bits indicate if
+ the statement is of some special type.
This must be a member of LEX, not of THD: each stored procedure
needs to remember its unsafeness state between calls and each
@@ -3309,6 +3307,12 @@ public:
List<Name_resolution_context> context_stack;
SELECT_LEX *select_stack[MAX_SELECT_NESTING + 1];
uint select_stack_top;
+ /*
+ Usually this is set to 0, but for INSERT/REPLACE SELECT it is set to 1.
+ When parsing such statements the pointer to the most outer select is placed
+ into the second element of select_stack rather than into the first.
+ */
+ uint select_stack_outer_barrier;
SQL_I_List<ORDER> proc_list;
SQL_I_List<TABLE_LIST> auxiliary_table_list, save_list;
@@ -3752,6 +3756,17 @@ public:
bool copy_db_to(LEX_CSTRING *to);
+ void inc_select_stack_outer_barrier()
+ {
+ select_stack_outer_barrier++;
+ }
+
+ SELECT_LEX *parser_current_outer_select()
+ {
+ return select_stack_top - 1 == select_stack_outer_barrier ?
+ 0 : select_stack[select_stack_top - 2];
+ }
+
Name_resolution_context *current_context()
{
return context_stack.head();
@@ -4529,6 +4544,29 @@ public:
return create_info.vers_info;
}
+ /* The list of history-generating DML commands */
+ bool vers_history_generating() const
+ {
+ switch (sql_command)
+ {
+ case SQLCOM_DELETE:
+ return !vers_conditions.delete_history;
+ case SQLCOM_UPDATE:
+ case SQLCOM_UPDATE_MULTI:
+ case SQLCOM_DELETE_MULTI:
+ case SQLCOM_REPLACE:
+ case SQLCOM_REPLACE_SELECT:
+ return true;
+ case SQLCOM_INSERT:
+ case SQLCOM_INSERT_SELECT:
+ return duplicates == DUP_UPDATE;
+ case SQLCOM_LOAD:
+ return duplicates == DUP_REPLACE;
+ default:
+ return false;
+ }
+ }
+
int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end)
{
if (lex_string_cmp(system_charset_info, &start, &end) == 0)