e9d961d...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch introducing the class sp_lex_instr
that encapsulates access to an instance of sp_lex_keeper. Every SP instruction
that does need access to a LEX object on its processing should inherit this class
and implement two abstract methods:
is_invalid(),
invalidate().
These method will be used in subsequent patches to implement recomplilation of
SP instructions on failure.
Currently, the following instructions are derived from the class sp_lex_instr:
sp_instr_stmt,
sp_instr_set,
sp_instr_set_trigger_field,
sp_instr_jump_if_not,
sp_instr_freturn,
sp_instr_cpush,
sp_instr_cursor_copy_struct,
sp_instr_set_case_expr
Additionally, this patch converts the class sp_instr_opt_meta
to the base abstract class (that is, not inhereted from
the class sp_instr).
Every jump SP instruction now must be inhereted directly from
the class sp_instr_opt_meta and additionally from either the class
sp_lex_instr or sp_instr depending on whether this SP instruction
does need access to LEX object or not.
Moreover, the class sp_cursor is no more owner of sp_lex_keeper.
Instead, the virtual method get_lex_keeper() has been added to the
class sp_cursor() that returns nullptr and this method is overriden
in the derived class sp_instr_cpush to provide a pointer to a real
instance of the class sp_lex_keeper.
4655641...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch to change a signature of the virtual
method opt_move() in the base class sp_instr and its derived classes.
The parameterized type of the instuctions list returned in the second
argument is changed from sp_instr to sp_instr_opt_meta since only
jump instructions are placed in this list on returning from
the method call.
9b17f64...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch to move the data member
LEX::trg_table_fields to the class sp_head and rename it as
m_trg_table_fields.
This data member is used for handling OLD/NEW pseudo-rows inside
a trigger body and in order to be able to reparse a trigger body
this must be moved from the struct LEX to the class sp_head.
0ecdbc3...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch to remove the data member
sp_head::m_trg_table_fields and some methods that use it but is not called
anywhere in the source code.
The commit 5f1f2fc0e443f098af24d21f7d1ec1a8166a4030 introduced the
data member sp_head::m_trg_table_fields and the method
Table_triggers_list::is_fields_updated_in_trigger that used this data member.
The method Table_triggers_list::is_fields_updated_in_trigger() is invoked
by the method partition_info::can_prune_insert() also introduced by
the same commit 5f1f2fc0e443f098af24d21f7d1ec1a8166a4030
But the method partition_info::can_prune_insert() is not called anywhere
in the code. Later, the aforementioned methods were removed from
the source code but the data member sp_head::m_trg_table_fields wasn't.
So, remove the data member sp_head::m_trg_table_fields and declaration of
the method is_fields_updated_in_trigger() for purpose of code cleaning up.
e401191...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch to move the sp_instr class and classes derived
from it into the files sp_instr.cc/sp_instr.h
Additionally,
* all occurrences of macroses NULL, FALSE, TRUE have been replaced
with the corresponding C++ keywords nullptr, false, true.
* the keyword override has been added in and the keyword virtual removed
from signatures of every virtual methods implemented in classes derived
from the base class sp_instr.
* trivial destructors like
virtual ~sp_instr_stmt() {}
have been removed for every classes derived from the base class sp_instr
since they are meaningless.
* added the keyword 'final' into declaration of the class sp_lex_keeper
since this class shouldn't have derived classes by design.
* made the function cmp_rqp_locations as static since it is not called
outside the file sp_instr.cc.
* moved the function subst_spvars() into the file sp_instr.cc since this
function is used only by the class sp_instr_stmt that is located
in the file sp_instr.cc.
2a35e9d...
by
Dmitry Shulga <email address hidden>
MDEV-5816: Stored programs: validation of stored program statements
This is the prerequisite patch to make the interface of the class
Reprepare_observer more like the one used by MySQL.
This patch adds the method can_retry() to the class Reprepare_observer
that returns true in case max number of attempts to re-run the failing
statement is not yet reached. To control a number of re-run attempts
already dome the data member m_attempt has been introduced. Doing this way,
we encapsulate activity with incrementing a counter on every statement
run and checking whether it reaches limit or not inside implementation
of the class Reprepare_observer instead duplicating such boiler plate
in every place where controlling for reaching a limit of max number attempts
for re-running failed statement is required.
A cleanup for MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
Changing the error messages in a statement like this:
CREATE DATABASE db1
COLLATE utf8mb4_bin
CHARACTER SET utf8mb4
CHARACTER SET latin1;
from
COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
to a more expected:
Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
In order to do this:
- Adding a new type TYPE_CHARACTER_SET_COLLATE_EXACT into
Lex_exact_charset_extended_collation_attrs_st
- Removing m_had_charset_exact from its descendant class
Lex_extended_charset_extended_collation_attrs_st
Additional cleanup:
- Changing methods in Lex_exact_charset_extended_collation_attrs_st
set_charset(), set_charset_collate_default(), set_charset_collate_binary()
to get Lex_exact_charset instead CHARSET_INFO as a parameter,
to guarantee that the argument is only CHARACTER SET and does not have
any COLLATE clauses yet. This change is not directly related to
the error message change.