Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0 / 0 |
|
100.00% |
0 / 0 |
CRAP | |
0.00% |
0 / 15 |
CREATE PROCEDURE | |
`SEQUENCER_GETSEQUENCE` (IN P_TECHNICALNAME VARCHAR(120)) | |
NOT DETERMINISTIC MODIFIES SQL DATA SQL SECURITY INVOKER | |
BEGIN | |
DECLARE sequence INT DEFAULT 1; | |
START TRANSACTION; | |
IF NOT EXISTS (SELECT SEQ FROM SEQUENCER WHERE TECHNICALNAME = P_TECHNICALNAME) THEN | |
INSERT INTO SEQUENCER (TECHNICALNAME, SEQ) VALUES (P_TECHNICALNAME, 2); | |
SELECT 1; | |
ELSE | |
SELECT @sequence:=SEQUENCER.SEQ FROM SEQUENCER WHERE TECHNICALNAME = P_TECHNICALNAME FOR UPDATE; | |
UPDATE SEQUENCER SET SEQ = @sequence + 1 WHERE TECHNICALNAME = P_TECHNICALNAME; | |
SELECT @sequence; | |
END IF; | |
COMMIT; | |
END |