Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  ps_in_func-rollback.result   Sprache: Lisp

 

#
# MDEV-39518 Allow prepared statements in stored functions in assignment right hand
#
#
# A statement inside a function with PS ends the way a statement inside
# a stored procedure does, so it also honours a rollback requested by
# the engine, at the end of that statement.
#
# The server is started with --innodb-rollback-on-timeout, so the lock
# wait timeout in f1() below makes InnoDB request a rollback of the
# whole transaction while the function is running. This is the only
# way into the transaction_rollback_request branch of
# sp_lex_keeper::reset_lex_and_exec_core().
#
CREATE TABLE t1 (id INT PRIMARY KEY, a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1);
CREATE FUNCTION f1() RETURNS INT
BEGIN
DECLARE v INT DEFAULT 0;
EXECUTE IMMEDIATE 'SELECT 1 INTO @x';
SET v= (SELECT a FROM t1 WHERE id=1 FOR UPDATE);
RETURN v;
END;
$$
CREATE PROCEDURE p1()
BEGIN
DECLARE r INT;
SET r= f1();
END;
$$
connect  c2,localhost,root,,;
BEGIN;
SELECT a FROM t1 WHERE id=1 FOR UPDATE;
a
1
connection default;
BEGIN;
INSERT INTO t2 VALUES (1);
CALL p1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# The caller's transaction was rolled back, its row is gone.
SELECT @@in_transaction;
@@in_transaction
0
SELECT COUNT(*) FROM t2;
COUNT(*)
0
# The caller also released its metadata locks. If the rollback had
# been done inside the function, restore_sub_statement_state() would
# have brought OPTION_BEGIN back and the connection would hold the
# locks of every statement it runs from now on.
connect  c3,localhost,root,,;
SET SESSION lock_wait_timeout=5;
ALTER TABLE t2 COMMENT 'altered';
disconnect c3;
connection default;
connection c2;
COMMIT;
disconnect c2;
connection default;
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP TABLE t1, t2;
# End of 13.1 tests

Messung V0.5 in Prozent
C=50 H=100 G=79

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-10-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126438
#Domains=1867298