- 07 Apr, 2017 3 commits
-
-
Alexander Barkov authored
-
Alexander Barkov authored
Needed to compile on machines with older bison versions. Adding a new parameter "name_prefix" to RUN_BISON() cmake macro.
-
Alexander Barkov authored
-
- 05 Apr, 2017 37 commits
-
-
Alexander Barkov authored
Parse context frames (sp_pcontext) can have holes in variable run-time offsets, the missing offsets reside on the children contexts in such cases. Example: CREATE PROCEDURE p1() AS x0 INT:=100; -- context 0, position 0, run-time 0 CURSOR cur( p0 INT, -- context 1, position 0, run-time 1 p1 INT -- context 1, position 1, run-time 2 ) IS SELECT p0, p1; x1 INT:=101; -- context 0, position 1, run-time 3 BEGIN ... END; Fixing a few methods to take this into account: - sp_pcontext::find_variable() - sp_pcontext::retrieve_field_definitions() - LEX::sp_variable_declarations_init() - LEX::sp_variable_declarations_finalize() - LEX::sp_variable_declarations_rowtype_finalize() - LEX::sp_variable_declarations_with_ref_finalize() Adding a convenience method: sp_pcontext::get_last_context_variable(uint offset_from_the_end); to access variables from the end, rather than from the beginning. This helps to loop through the context variable array (m_vars) on the fragment that does not have any holes. Additionally, renaming sp_pcontext::find_context_variable() to sp_pcontext::get_context_variable(). This method simply returns the variable by its index. So let's rename to avoid assumptions that some heavy lookup is going on inside.
-
Alexander Barkov authored
Addressing Monty's review suggestions
-
Alexander Barkov authored
Addressing Monty's review suggestions.
-
Alexander Barkov authored
Addressing Monty's review suggestions
-
Alexander Barkov authored
Fixed that the Column_definition::pack_flag member corresponding to ROW-type SP variables and their fields was not properly initialized. This lead to sporadic test failures. Valgrind complained about jumps depending on uninitialized value in VALGRIND builds. This patch makes sure that sp_head::fill_spvar_definition() is always called for ROW variables and their fields. Additionally, fixed that a function with a scalar parameter erroneously acceptes ROWs with one fields. Now an error is returned.
-
Alexander Barkov authored
-
Alexander Barkov authored
An additional test for MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
Based on a contributed patch from Jerome Brauge.
-
Alexander Barkov authored
MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop
-
Alexander Barkov authored
Implementing cursor%ROWTYPE variables, according to the task description. This patch includes a refactoring in how sp_instr_cpush and sp_instr_copen work. This is needed to implement MDEV-10598 later easier, to allow variable declarations go after cursor declarations (which is currently not allowed). Before this patch, sp_instr_cpush worked as a Query_arena associated with the cursor. sp_instr_copen::execute() switched to the sp_instr_cpush's Query_arena when executing the cursor SELECT statement. Now the Query_arena associated with the cursor is stored inside an instance of a new class sp_lex_cursor (a LEX descendand) that contains the cursor SELECT statement. This simplifies the implementation, because: - It's easier to follow the code when everything related to execution of the cursor SELECT statement is stored inside the same sp_lex_cursor object (rather than distributed between LEX and sp_instr_cpush). - It's easier to link an sp_instr_cursor_copy_struct to sp_lex_cursor rather than to sp_instr_cpush. - Also, it allows to perform sp_instr_cursor_copy_struct::exec_core() without having a pointer to sp_instr_cpush, using a pointer to sp_lex_cursor instead. This will be important for MDEV-10598, because sp_instr_cpush will happen *after* sp_instr_cursor_copy_struct. After MDEV-10598 is done, this declaration: DECLARE CURSOR cur IS SELECT * FROM t1; rec cur%ROWTYPE; BEGIN OPEN cur; FETCH cur INTO rec; CLOSE cur; END; will generate about this code: +-----+--------------------------+ | Pos | Instruction | +-----+--------------------------+ | 0 | cursor_copy_struct rec@0 | Points to sp_cursor_lex through m_lex_keeper | 1 | set rec@0 NULL | | 2 | cpush cur@0 | Points to sp_cursor_lex through m_lex_keeper | 3 | copen cur@0 | Points to sp_cursor_lex through m_cursor | 4 | cfetch cur@0 rec@0 | | 5 | cclose cur@0 | | 6 | cpop 1 | +-----+--------------------------+ Notice, "cursor_copy_struct" and "set" will go before "cpush". Instructions at positions 0, 2, 3 point to the same sp_cursor_lex instance.
-
Alexander Barkov authored
-
Alexander Barkov authored
The bug was introduced in the patch for "MDEV-10597 Cursors with parameters". The LEX created in assignment_source_expr was not put into thd->lex->sphead->m_lex (the stack of LEX'es), so syntax error in "expr" caused a wrong memory cleanup in sp_head::~sp_head(). The fix changes the code to use sp_head::push_lex() followed by sp_head::restore_lex(), like it happens in all other similar cases.
-
Alexander Barkov authored
Allowing qualified procedure names to be used without the CALL keyword: BEGIN test.p1(10); test.p2; END; Note: - COMMIT and ROLLBACK cannot be used in a direct assignment anymore: COMMIT:= 10; ROLLBACK:= 10; But as they are reserved keywords in Oracle anyway, this is not a problem. - SHUTDOWN now also cannot be used in direct a direct assignment: SHUTDOWN:=10; If this causes migration problems in the future, the grammar should be modified. Note: Variables with names COMMIT, ROLLBACK and SHUTDOWN can still be assigned with the SET statement, e.g. SET COMMIT=10;
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause
-
Alexander Barkov authored
-
halfspawn authored
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
This is covered in mysql-test/t/variables.test. There is no sense to test this for every individual variables. This is to reduce the coming soon patch for ROW-type routine variables, which will change the error from ER_PARSE_ERROR to a new error "unknown structured variable".
-
Alexander Barkov authored
-
Alexander Barkov authored
Now when sql_mode=ORACLE, the concatenation operator || treats NULLs as empty strings. Based on the contributed patch from Jérôme Brauge.
-
Alexander Barkov authored
This fixes compat/oracle.sp test failure in release builds.
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
Part 2: Moving the part of Sql_condition that contain condition items (such as m_class_origin, m_cursor_name, etc) into a separate class Sql_condition_items. This allows to remove duplicate code in different Sql_condition constructors. Also, introducing new Sql_condition constructors and removing the method Sql_condition::set(). All code sequences that called an Sql_condition constructor followed by Sql_condition::set() are now replaced to the new constructor calls. This gives light performance improvement, as the relevant members are now initialized only one time.
-
Alexander Barkov authored
-
Alexander Barkov authored
-
Alexander Barkov authored
An additional change for "Part 9: EXCEPTION handlers" This construct: EXCEPTION WHEN OTHERS THEN ...; now catches warning-alike conditions, e.g. NO_DATA_FOUND.
-
Alexander Barkov authored
MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters Adding Oracle specific tests
-