fix:トランザクション処理の追加

This commit is contained in:
y-ono-r 2022-07-21 10:14:16 +09:00
parent 611acb6a37
commit c62db70d9a

View File

@ -10,10 +10,13 @@ BEGIN
@error_state = RETURNED_SQLSTATE, @error_msg = MESSAGE_TEXT; @error_state = RETURNED_SQLSTATE, @error_msg = MESSAGE_TEXT;
EXECUTE drop_tmp_table_stmt; EXECUTE drop_tmp_table_stmt;
DEALLOCATE PREPARE drop_tmp_table_stmt; DEALLOCATE PREPARE drop_tmp_table_stmt;
ROLLBACK;
SIGNAL SQLSTATE '45000' SIGNAL SQLSTATE '45000'
SET MYSQL_ERRNO = @error_state, MESSAGE_TEXT = @error_msg; SET MYSQL_ERRNO = @error_state, MESSAGE_TEXT = @error_msg;
END; END;
START TRANSACTION;
-- ②-3で利用する一時テーブル削除のSQLを準備 -- ②-3で利用する一時テーブル削除のSQLを準備
-- 例外処理でも利用するため先に記述 -- 例外処理でも利用するため先に記述
SET @drop_tmp_table = ' SET @drop_tmp_table = '
@ -85,4 +88,6 @@ BEGIN
EXECUTE drop_tmp_table_stmt; EXECUTE drop_tmp_table_stmt;
DEALLOCATE PREPARE drop_tmp_table_stmt; DEALLOCATE PREPARE drop_tmp_table_stmt;
COMMIT;
END END