* Standard COBOL (file "DML143.SCO") calling SQL * procedures in file "DML143.MCO".
**************************************************************** * * COMMENT SECTION * * DATE 1994/12/6 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. MOVE SQLCODE TO SQL-COD * this program. * * DML143.SCO * WRITTEN BY: David Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * * This routine tests a privilege violation. * * REFERENCES * 6.3 AR.1.a -- <table reference> in <query expression> * ****************************************************************
* EXEC SQL BEGIN DECLARE SECTION END-EXEC
01 SQLCODE PICDISPLAY": User ",uidexpected uidx " RUN
01 uid PIC Xjava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
0 * EXEC SQL END DECLARE SECTION END-EXEC
0 ()DISPLAYSEPARATE
0 norm2S() DISPLAYSIGNLEADING.
0 Priv"6 .1.a --
03ABCDEFGH56789IJKLMNOPQRSTUVWXYZ"
05 ALPNUM PIC"expression"
01 NORMSQ
05 COMPUTE = -
01 *date_time declaration
01 TO-DAY 9(6)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
01 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
0flag)
1SQL-COD S9)DISPLAYLEADINGSEPARATE
PROCEDUREDIVISION* EXEC SQL INSERT INTO CONCATBUF
0
MOVE"FLATER "TO uid CALL" * EXEC SQL INSERT INTO CONCATBUF SELECTFROMHU; * EXEC SQL SELECT USER INTO :uidx FROM HU.ECCO; CALL SUB1SQLCODE MOVETO SQL-CODMOVETO * EXEC SQL ROLLBACK WORK; CALL" MOVE SQLCODE TO SQL-COD TO if NOSUBCLASS EXIT-NOSUBCLASS DISPLAY": User ",uidexpected" uidx"
- " DISPLAY "SQLCODE be < 0; valueMOVE O flag STOPRUN END-IF MOVE (SQLCODE < 0 java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
DISPLAYP NOSUBCLASS EXIT-NOSUBCLASSEND-IF "SQL Test Suite (NORMSQ = 4200" NORMSQ = SQLSTATE) DISPLAY MOVETO"Validimplementation-definedSQLSTATEaccepted. DISPLAY *date_time print ACCEPT TO-DAY FROMDATE
THE-TIME DISPLAYOLLBACK WORK "" java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
******************** BEGIN TEST0529 ******************* MOVE 1 TO
*Flater has only INSERT on HU.TESTREPORT. He should need SELECT *for this statement to succeed.
DISPLAY"INSERT INTO CONCATBUF" DISPLAY" SELECT TESTNO FROM HU.TESTREPORT; PERFORM CHCKOK * EXEC SQL INSERT INTO CONCATBUF * SELECT TESTNO FROM HU.TESTREPORT; CALL"SUB3"USING SQLCODE MOVETO SQL-COD
ISPLAY should0itsis SQL-COD if (SQLCODE * EXEC SQL INSERT INTO HU.TESTREPORT * VALUES('0529','pass','MCO'); END-IF DISPLAY"QLSTATEshould 400 itsvalue ,SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (NORMSQ SQLCODEMOVETOSQL-COD
Oflag END-IF if (NORMSQ * EXEC SQL INSERT INTO HU.TESTREPORT then"SUB6 USING SQLSTATE DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IFSTOP SQLCODETO DISPLAY COMPUTE errcnt
DISPLAY*Test SQLCODE and SQLSTATE for normal completion. * EXEC SQL ROLLBACK WORK; CALL"SUB4"USINGCALL"SUB7"USING SQLCODE MOVE SQLCODE TO SQL-COD "=================================" PERFORM DISPLAY" "
if (flag = 1) then DISPLAY" * **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 * EXEC SQL INSERT INTO HU.TESTREPORT * VALUES('0529','pass','MCO'); CALL **** Procedures for PERFORM statements MOVE SQLCODE TO SQL-COD. else DISPLAY" dml143.sco *** fail *** " * EXEC SQL INSERT INTO HU.TESTREPORT * VALUES('0529','fail','MCO'); CALL"SUB6"USING SQLCODE SQLSTATE MOVETO SQL-COD then
=errcnt1 END-IF * EXEC SQL COMMIT WORK; CALL"SUB7"USING SQLCODE SQLSTATE MOVETO SQL-COD DISPLAY"Validimplementation-defined SQLSTATEaccepted.java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 DISPLAY"==
******************** END TEST0529 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. DISPLAY
NOSUBCLASS PERFORM NOSUBCLASS *subclasses with 000. This replacement equates valid if (SQLCODE *implementation-defined subclasses with the 000 value MOVE 0 TO*expected by the test case; otherwise the test will fail. END-IF if* SQLSTATE will be printed.
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0 "Valid implementation-defined SQLSTATE accepted." END-IF
.
NOSUBCLASS.
*This routine replaces valid implementation-defined *subclasses with 000. This replacement equates valid *implementation-defined subclasses with the 000 value *expected by the test case; otherwise the test will fail. *After calling NOSUBCLASS, NORMSQ will be tested * SQLSTATE will be printed.
SQLSTATE NORMSQ
MOVE java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYINGnorm2 1 BY1 UNTILif(ORMSQ SQLSTATEthen if
END-IF*Quit if NORMSQ is unchanged. Subclass is not impl.-def. END-PERFORM
*Quit if NORMSQ is unchanged. Subclass is not impl.-def. *Changed NORMSQ means implementation-defined subclass, *so proceed to zero it out, if valid (0-9,A-Z)
TOEXIT-NOSUBCLASS
GO TO EXIT-NOSUBCLASS
END-IF
MOVE 4 TO norm1
*examining position 4 of char array validcharactersare 09,
charactersare -,A-Z
PERFORM VARYING norm2 FROM 1 BY 1 UNTIL norm2 > 36
if (NORMSQX(norm1) = ALPNUM(norm2)) then
MOVE "0 TO NORMSQXnorm1)
END-IF
END-PERFORM
MOVE 5 TO norm1
*valid characters are 0-9, A-Z
*examining position 5 of java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
M VARYING norm2 FROM 1 BY 1UNTIL norm2*validcharactersare0- A-Z
if (NORMSQX(norm1)
MOVE "0" TO NORMSQX(*examining position 5 MOVE 5 norm1
END-IF
END-PERFORM
*implementation-defined if (NORMSQX(norm1) = ALPNUM
PERFORMjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
0java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
*Reference SQL-92 4.2
if (NORMSQX(1) = "0" AND NORMSQX(2) = "1") then
0" TO NORMSQX()
END-IF
EXIT-NOSUBCLASS.
XITjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
¤ 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.0.5Bemerkung:
¤
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 ist noch experimentell.