* 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. * NIST assumes no responsibility for any party's use of * 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
1 PIC(9)COMP
1SQLSTATE
01 0 uidx. xyz
01 uidx X(1 norm19 SIGN * EXEC SQL END DECLARE SECTION END-EXEC
1norm1 .
01 norm2 VALUE
0 java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 "3"java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
ALPNUM *
01NORMSQ
05 NORMSQX PROCEDURE
0errcnt( *date_time declaration
01 TO-DAY PIC 9(6). * This program was written by employees of NIST to test SQL
01 THE-TIMEin uidx
01 flagUSING uidx
01 SQL-COD
PROCEDUREMOVE SQL-COD ( NOT) then
P0
MOVE uid CALL* DML143.SCO 0 errcnt * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * EXEC SQL SELECT USER INTO :uidx FROM HU.ECCO; ACCEPTFROM FROM DISPLAY "Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME CALL"SUB2"
SQLCODE if (uid NOT = uidx) then**************************************************************** ERROR" . User ",uidx"
- " connected" STOPjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 END-IF MOVE 0 TO errcnt
DISPLAY "SQL Test Suite, V6.0, Module COBOL, dml143.sco" DISPLAY "59-byte ID" DISPLAY"TEd Version #" *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME
******************** BEGIN TEST0529 ******************* MOVE 1 TO flag
DISPLAY" : SELECT java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 57 DISPLAY" Priv. violation: SELECT in < " .AR queryexpression DISPLAY"References:" DISPLAY" 6.3 "1234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ.
- > COMPUTE = -1
SQLCODE *Flater has only INSERT on HU.TESTREPORT. He should need SELECTPIC.
*Flater has only INSERT on HU.TESTREPORT. He should need SELECT *for this statement to succeed.
0 PIC(9 SIGN . DISPLAY * EXEC SQL INSERT INTO CONCATBUF * SELECT TESTNO FROM HU.TESTREPORT;
P.
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 DISPLAY* TESTNO .TESTREPORT if(SQLCODECALL""USING uidx
0 flag END-IF* EXEC SQL ROLLBACK WORK; DISPLAY"SQLSTATE should be 42000; itsMOVESQLCODETO SQL-COD PERFORM THRU if ( ERROR" . User ,
Tjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 if"0"ANDNOTSQLSTATE then DISPLAYValid END-IF DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"ACCEPTTHE-TIME FROM TIME * EXEC SQL ROLLBACK WORK; CALLSUB4
OVE TO PERFORM DISPLAY""
********BEGIN flag DISPLAY" *** pass * EXEC SQL INSERT INTO HU.TESTREPORT * VALUES('0529','pass','MCO'); CALL"SUB5 DISPLAY .AR.- tablereferencein MOVE
DISPLAYMOVE SQLSTATE * EXEC SQL INSERT INTO HU.TESTREPORT * VALUES('0529','fail','MCO'); CALL"SUB6" java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE SQLCODE * EXEC SQL INSERT INTO CONCATBUF DISPLAY " " COMPUTE errcnt "SQLCODE e ",java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 END-IF * EXEC SQL COMMIT WORK; CALLSUB7 2;"java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
DISPLAYDISPLAYjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
******************** END TEST0529 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 MOVE SQL-COD
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion. * EXEC SQL ROLLBACK WORK;* EXEC SQL COMMIT WORK;
SQLCODESjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 DISPLAY"SQLSTATE CHCKOK PERFORM
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE* EXEC SQL INSERT INTO HU.TESTREPORTRUN* VALUES('0529','pass','MCO'); * END-IFdml143
*java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 thenNOTCOMPUTE +java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 " END-IF ( = "00 =java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 RUNjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.
*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.
MOVEDISPLAYimplementation-defined
MOVE *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table *expected by the test case; otherwise the test will fail. if "0"TONORMSQXMOVETO 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)
( = SQLSTATE GOTO EXIT-NOSUBCLASS
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
*examining position 4 of char array NORMSQ
* are09 A-Z
PERFORM VARYING norm2 FROM 1 BY 1 UNTIL *exa position 4 of NORMSQ *valid 09,A-Z
if (NORMSQX(norm1) = ALPNUM(norm2)) then
MOVE "0" TO NORMSQX PERFORMVARYINGnorm2 FROM1java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
END-IF
END-PERFORM
java.lang.StringIndexOutOfBoundsException: Range [18, 11) out of bounds for length 26
,A-Zjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
examiningposition MOVE TO
PERFORM VARYING norm2 1BY1UNTIL norm2 3java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
(orm2)
MOVE "0" TO NORMSQX(norm1)
END-IF
ND-PERFORM
*implementation-definedare
*(class = 01) 0TO (norm1* values of00.
*SQLSTATEvalues of 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*Reference SQL-92 4.28 SQL-transactionsMOVE"" TO(
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.