* Standard COBOL (file "MPB008.SCO") calling SQL * procedures in file "MPB008.MCO". * STANDARD COBOL (file "MPB008.SCO")
**************************************************************** * * COMMENT SECTION * * DATE 1992/07/31 STANDARD COBOL LANGUAGE * NIST SQL VALIDATION TEST SUITE V6.0 * DISCLAIMER: * This program was written by employees of NIST to test SQL * implementations for conformance to the SQL standards. * NIST assumes no responsibility for any party's use of * this program. * * MPB008.SCO * WRITTEN BY: David W. Flater * * THIS PROGRAM IS PART B OF A TWO-PART PROGRAM(A & B) THAT * TESTS THE CONCURRENCY OF SQL * * REFERENCES * ANSI SQL-1992 * 4.28 SQL-transactions * ****************************************************************
if (knum = 0) then DISPLAY" PLEASE start program MPA008!!! " GOTO P105 END-IF
.
P106. MOVE 0 TO code1 * EXEC SQL INSERT INTO MP8_NEXTKEY (KEYNUM,AUTHOR) * VALUES(2, 'B'); CALL"SUB4"USINGSQLCODE MOVESQLCODETO SQL-COD if (SQLCODENOT = 0) then MOVE 1 TO code1 END-IF * EXEC SQL COMMIT WORK; CALL"SUB5"USINGSQLCODE MOVESQLCODETO SQL-COD if (SQLCODENOT = 0) then MOVE 1 TO code1 END-IF if (code1 NOT = 0) then * EXEC SQL ROLLBACK WORK; CALL"SUB6"USINGSQLCODE MOVESQLCODETO SQL-COD DISPLAY"Retrying synchronization logic." GOTO P106 END-IF
*YES, we are in sync!
DISPLAY"Transaction B Starts!! " *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME DISPLAY" " DISPLAY"IF this test lasts too long, DEADLOCK" DISPLAY"has taken place, STOP this test!"
DISPLAY" " DISPLAY"This part of the test loops continuously trying
- " to" DISPLAY"insert a duplicate row into MP8_AA. If it
- " succeeds," DISPLAY"there has been a serializability or unique
- " constraint" DISPLAY"failure." DISPLAY" "
.
P101. DISPLAY"INSERT INTO MP8_AA VALUES (3,'B');" * EXEC SQL INSERT INTO MP8_AA VALUES (3,'B'); CALL"SUB7"USINGSQLCODE MOVESQLCODETO SQL-COD if (SQLCODE < 0) then GOTO P120 END-IF
DISPLAY"COMMIT WORK;" * EXEC SQL COMMIT WORK; CALL"SUB8"USINGSQLCODE MOVESQLCODETO SQL-COD if (SQLCODENOT < 0) then GOTO P166 END-IF
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.