IDENTIFICATION java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 PROGRAM-ID. DML118. ENVIRONMENTDIVISION. CONFIGURATIONSECTION. SOURCE-COMPUTER. xyz. OBJECT-COMPUTER. xyz. DATADIVISION. WORKING-STORAGESECTION.
* EMBEDDED COBOL (file "DML118.PCO")
**************************************************************** * * COMMENT SECTION * * DATE 1994/6/2 EMBEDDED 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. * * DML118.PCO * WRITTEN BY: David W. Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests FIPS feature 19. * This is the dynamic version of DML117.PC. * * REFERENCES * FIPS PUB 127-2 14.1 Transitional SQL * ANSI SQL-1992 * ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01SQLCODEPIC (9 COMP 01 SQLSTATE PIC X(5)DISPLAY"" 01 uid PIC X(18). 01 uidx EXEC SQL FROMEND-EXEC
GN LEADING. 01 int2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 dstmt PIC X(50). 01 longst 'SELECT()FROM AUDIT_RECORDS'|
SAVED_LUSER_IDNULL
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 SIGNLEADING . 01 ALPNUM-TABLE VALUEIS "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ". PIC36 . 01 NORMSQ. 05 NORMSQX PIC X OCCURS5 TIMES. 01 errcnt java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0 *date_time declaration 01 TO-DAY PIC9(6). 01java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
PLAYSIGNLEADINGSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
01 SQL-COD PICSQLPREPARE longstEND-EXEC
PROCEDUREDIVISION.
P0.
MOVE"FLATERjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 CALL"AUTHID"USING uid MOVE"not logged in, not"TO uidx EXEC MOVESQLCODETO SQL-COD EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD if (DISPLAY"C11815" DISPLAYEXECSQLOPENC11815
- " MOVE STOPRUN END-IF MOVE0TODISPLAY
DISPLAY COMPUTE=- DISPLAY "59-byte ID" DISPLAY FC11815INTO:int1 *date_time print FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: SQLCODE TO
******************** BEGIN TEST0646 ******************* DISPLAY ishould 0valueis
DISPLAY" TEST0646 "
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
- " (dynamic)" DISPLAY References:" DISPLAY" FIPS PUB 127-2 14.1 Transitional SQL features
- " 16, 19" DISPLAY" 11.8 EXEC SQL CLOSE C11815 END-EXEC DISPLAY" 11.4 LR.2.b" " - -- -- - --- "
COMPUTESQLCODE = -1 MOVE"xxxxx"TOPERFORMjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*The persistent audit records need to be consistent in the *event that a LUSER_ID is recycled after someone is deleted. *The original LUSER_ID is preserved in SAVED_LUSER_ID in case *it is needed.
DISPLAY"CREATE TABLE AUDIT_RECORDS (" DISPLAY" FOREIGN KEY (LUSER_ID) REFERENCES LUSERS ON DELETESET, DISPLAY" LUSER_ID INT," DISPLAY" SAVED_LUSER_ID INT NOT NULL" DISPLAY" REFERENCES ALL_USER_IDS (LUSER_ID) ON DELETE
- " NO ACTION," DISPLAY" ACTION_KEY INT DEFAULT 0 NOT NULL" DISPLAY" REFERENCES AUDIT_CODES ON DELETE SET
- " DEFAULT;" EXECSQL CREATE TABLE AUDIT_RECORDS (
FOREIGN KEY (LUSER_ID) REFERENCES LUSERS ONDELETESET NULL,
LUSER_ID INT,
SAVED_LUSER_ID INT
REFERENCES ALL_USER_IDS (LUSER_ID) ONDELETEDISPLAY""
ACTION_KEY INT DEFAULT 0NOTNULL
REFERENCES AUDIT_CODES ONDELETESETCOMPUTE int1 = -
SQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"dstmt=""INSERT INTO AUDIT_CODES DISPLAY "int1 should be 8; its valueis" int1
- " 'ACCVIO')""" if (int1 NOT =8) then TO dstmt
DISPLAY"EXECUTE IMMEDIATE :dstmt;" EXECSQL EXECUTE IMMEDIATE :dstmt END-EXEC MOVESQLCODETO SQL-CODDISPLAY CLOSEC11816java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
PERFORM CHCKOK
DISPLAY"dstmt=""INSERT INTO AUDIT_CODES VALUES (1,
- " 'INSERT')""" MOVE"INSERT INTO AUDIT_CODES VALUES (1, 'INSERT') " TO DISPLAY
DISPLAY"EXECUTE IMMEDIATE :dstmt;a *See if that "ON DELETE NO ACTION" did what it was supposed to d EXECSQL EXECUTE IMMEDIATE :dstmt END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY" "
DISPLAY"dstmt=""INSERT INTO AUDIT_CODES VALUES (2, """ MOVE"INSERT INTO AUDIT_CODES VALUES (2, 'DELETE') " TO dstmt
PERFORM java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAY" "
*Once upon a time, there were three little users.
DISPLAY"dstmt=""INSERT INTO LUSERS VALUES ('root', 0,
- " NULL MOVE SQLCODE TO SQL-COD MOVE"INSERT INTO java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 TOdstmt
DISPLAY"EXECUTE java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 EXECSQL EXECUTE IMMEDIATE :dstmt END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY" "
DISPLAY"dstmt=""INSERT INTO LUSERS VALUES ('BIFF', 1, 0,
- " 0)""" MOVE"INSERTINTOLUSERS VALUES ('BIFF', 1, 0, 0) " TO dstmt
DISPLAY" if (NORMSQ "" NORMSQ = SQLSTATE)
- " 1)"""
ERTINTO LUSERSVALUES(Kibo,2, 1,1)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 TO dstmt
DISPLAY"EXECUTE IMMEDIATE :dstmt;" EXECSQLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVESQLCODETO SQL-COD
CHCKOK DISPLAY" "
DISPLAY"="INSERTINTO VALUES ()""java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 MOVE"INSERT INTO ALL_USER_IDS VALUES (0) " TO dstmt
EXECPERFORMCHCKOK MOVESQLCODETO SQL-COD EXECDISPLAYCOMMIT java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 30 INSERTINTOLUSER_DATAVALUES('''|java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
, 'Kibo space''java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
) END-EXEC
EXECSQLSELECT ZZ INTO : PERFORMCHCKOK MOVESQLCODETO SQL-COD
DISPLAY"longst=""", longst """"
DISPLAY" IMMEDIATE :ongst;" EXECSQL EXECUTE IMMEDIATE :longst END-EXEC
java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 63
PERFORMMOVESQLCODETOSQL-COD
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
- " 1)""" MOVE"INSERT INTO AUDIT_RECORDS VALUES (0, 0, 1) " TO dstmt
PERFORM
- " 1)"""DISPLAYFC11816 int1" INSERTINTOjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SQL END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*One day, Kibo created a file.
DISPLAYdstmt"INSERT INTO"""TABLELUSER_DATA"
D CASCADEjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 MOVEjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0 TO dstmt
*Jealous BIFF (no quota) decided to hack Kibo's account
MOVE0TO int1
.
P199.
DISPLAY"dstmt=""INSERT INTO AUDIT_RECORDS VALUES (1, 1, "" MOVE"INSERT INTO DISPLAY "" TO dstmt
DISPLAY"EXECUTE MOVE "DROP TABLE LUSERS EXEC java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 TOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
PERFORM CHCKOK DISPLAY" "
COMPUTE int1 = int1 + 1 if njava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 37 GOTO java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 END-IF
*Finally he succeeded and overwrote Kibo's file with garbage
AUDIT_RECORDS(2java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
- " 0)"""
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 TO dstmt
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 48 EXECSQL *java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 72 MOVESQLCODEDISPLAY"
DISPLAY"OMMITWORK; DISPLAY" "
DISPLAYDISPLAY"
- " 2)"""
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
dstmt
DISPLAY java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
- " 1)""" MOVEEXEC MOVEjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 36
PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAYSQLCODEshould0itsvalueis" EXECSQLDELETEFROM CONCATBUF END-EXEC MOVESQLCODETO SQL-COD EXECSQLINSERTINTO CONCATBUF java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 0 'INSERT INTOEXEC EXECUTEIMMEDIATE: java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 29 2,'I PASSW0RD!!'java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
) END-EXEC MOVESQLCODETO SQL-COD EXEC" SQLSTATE. MOVESQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
*This angered root, who instantly disbursed group punishment...
DISPLAY"dstmt=""DELETE FROM LUSERS WHERE NAAM <> 'root'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SQLSTATE EXECUTE:tmt
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DISPLAY"dstmt=""SELECT 0 TOjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 25 MOVE END-PERFORM java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
DISPLAYDISPLAYjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 EXECSQL PREPARE S11811 FROM :dstmt END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY" "
DISPLAY"DECLARE C11811 CURSOR FOR S11811; EXECSQL DECLARE DISPLAY" "
COMPUTEMOVE"ROP END-PERFORM DISPLAY"FETCH C11811 INTO :int1;" EXECSQL dstmt MOVESQLCODETO java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0 PERFORM CHCKOK DISPLAY int1shouldbe2value", int1 if (int1 NOTSQLCODETO MOVE0" java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 END-IF
*(class = 01). These equate to successful completion java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"dstmt=""SELECT COUNTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE"SELECT COUNT(*) FROM LUSERS
-"TO java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
DISPLAY"PREPARE S11812 FROM :dstmt EXECSQL PREPARE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECINSERTINTO.java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
PERFORM CHCKOK COMPUTE +java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
DISPLAY"DECLARE C11812 CURSOR FOR S11812;"DISPLAY"=======================java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 EXECCOMMITWORKEND-EXEC DISPLAY""
******************** END TEST0646 ******************** EXECSQLOPEN C11812 END-EXEC
PERFORM CHCKOK * **** Procedures for PERFORM statements DISPLAY" "
COMPUTE .
F C11812 int1" EXECSQL FETCH C11812 INTO :int1 END-EXEC SQLCODE PERFORM CHCKOK DISPLAY"int1 should be 1 S NOT="" if ( java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 MOVE0TO flag END-IF
DISPLAY" *subclasses with 000. This replacement equates valid MOVE"SELECT COUNT(*) FROM AUDIT_RECORDS *expected by the test case; otherwise the test will fail.
- " "TO dstmt
DISPLAY"PREPARE S11813 FROM :dstmt EXEC PREPARE FROM :stmt MOVESQLCODETO SQL-COD
PERFORM norm2 14BY >java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 EXECSQL DECLARE C11813 CURSOR "" NORMSQX(norm1 DISPLAY" "
COMPUTE int1 = -1 DISPLAY"FETCH C11813 INTO :int1;END-IF EXECSQL FETCH MOVE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORMCHCKOK DISPLAY"int1 should be 12; its value is ", int1 if (int1 NOT = 12) if (NORMSQX(norm1) = ALPN) then MOVE0TOflag END-IF
DISPLAYEND-IF EXECSQLCLOSE C11813 END-EXEC MOVESQLCODETO SQL-COD
MOVE 5 norm1 *examining position 5 of char array NORMSQ
EXECSQLDELETEFROM CONCATBUF END-EXEC
SQLCODE SQL-COD EXECSQLINSERTINTO CONCATBUF VALUESMOVE0TOjava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 39 'SELECT COUNT(*) FROM AUDIT_RECORDS' || ' WHERE LUSER_ID IS NULL'
) END-EXEC MOVESQLCODETO SQL-COD EXECSQLSELECT ZZ INTO :longst FROM java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 0 MOVESQLCODETO SQL-COD
DISPLAY"longst=" java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
DISPLAY"PREPARE S11814 FROM :longst;" EXECSQL PREPARE S11814 FROM :longst END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY" "
DISPLAY"DECLARE C11814 CURSOR FOR S11814;" EXECSQL DECLARE C11814 CURSOR FOR S11814 END-EXEC DISPLAY" "
COMPUTE int1 = -1 DISPLAY"FETCH C11814 INTO :int1;" EXECSQL FETCH C11814 INTO :int1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 10; its value is ", int1 if (int1 NOT = 10) then MOVE0TO flag END-IF
COMPUTE int1 = -1 DISPLAY"FETCH C11815 INTO :int1;" EXECSQL FETCH C11815 INTO :int1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 0; its value is ", int1 if (int1 NOT = 0) then MOVE0TO flag END-IF
EXECSQLDELETEFROM CONCATBUF END-EXEC MOVESQLCODETO SQL-COD EXECSQLINSERTINTO CONCATBUF VALUES ( 'SELECT COUNT(*) FROM AUDIT_RECORDS' || ' WHERE ACTION_KEY = ?'
) END-EXEC MOVESQLCODETO SQL-COD EXECSQLSELECT ZZ INTO :longst FROM CONCATBUF END-EXEC MOVESQLCODETO SQL-COD
DISPLAY"longst=""", longst """"
DISPLAY"PREPARE S11816 FROM :longst;" EXECSQL PREPARE S11816 FROM :longst END-EXEC MOVESQLCODETO SQL-COD
PERFORM CHCKOK DISPLAY" "
DISPLAY"DECLARE C11816 CURSOR FOR S11816;" EXECSQL DECLARE C11816 CURSOR FOR S11816 END-EXEC DISPLAY" "
MOVE2TO int2 DISPLAY"int2 = 2;" DISPLAY"OPEN C11816 USING :int2;" EXECSQLOPEN C11816 USING :int2 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
COMPUTE int1 = -1 DISPLAY"FETCH C11816 INTO :int1;" EXECSQL FETCH C11816 INTO :int1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 0; its value is ", int1 if (int1 NOT = 0) then MOVE0TO flag END-IF
MOVE0TO int2 DISPLAY"int2 = 0;" DISPLAY"OPEN C11816 USING :int2;" EXECSQLOPEN C11816 USING :int2 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
COMPUTE int1 = -1 DISPLAY"FETCH C11816 INTO :int1;" EXECSQL FETCH C11816 INTO :int1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 8; its value is ", int1 if (int1 NOT = 8) then MOVE0TO flag END-IF
DISPLAY"SQLCODE should be < 0; its value is ", SQL-COD if (SQLCODENOT < 0) then MOVE0TO flag END-IF DISPLAY"SQLSTATE should be 23000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (NORMSQ NOT = "23000") then MOVE0TO flag END-IF if (NORMSQ = "23000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD ******************** END TEST0646 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOPRUN.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. DISPLAY"SQLCODE should be 0; its value is ", SQL-COD DISPLAY"SQLSTATE should be 00000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 0OR NORMSQ NOT = "00000") then MOVE0TO flag END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"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.
MOVE SQLSTATE TO NORMSQ
MOVE3TO norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYING norm2 FROM14BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF 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) if (NORMSQ = SQLSTATE) then GOTO EXIT-NOSUBCLASS END-IF
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM1BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM1BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
*implementation-defined subclasses are allowed for warnings *(class = 01). These equate to successful completion *SQLSTATE values of 00000. *Reference SQL-92 4.28 SQL-transactions, paragraph 2
if (NORMSQX(1) = "0"AND NORMSQX(2) = "1") then MOVE"0"TO NORMSQX(2) END-IF
.
EXIT-NOSUBCLASS. EXIT.
Messung V0.5 in Prozent
¤ 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.25Bemerkung:
¤
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.