**************************************************************** * * COMMENT SECTION * * DATE 1994/9/19 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. * * DML137.PCO * WRITTEN BY: David W. Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests <drop behavior> in non-dynamic SQL. This * is the non-dynamic version of DML138. * * REFERENCES * FIPS PUB 127-2 14.1 Transitional SQL * ANSI SQL-1992 * ****************************************************************
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
01 *
01 SQLSTATE PIC* WRITTEN BY: David W. Flater
0 *
0 * EXEC* REFERENCES
01 norm1 PIC S9( * ANSI SQL-1992
01 norm2 PIC S9(9) DISPLAYSIGN****************************************************************
0 VALUEjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 "3ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
05 ALPNUM1uid X18)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
01 NORMSQ1 uidx X(18)
05 NORMSQXEXECS END DECLARE END-EXEC
1 PIC(9) DISPLAYSIGNLEADINGSEPARATE. *date_time declaration
1 TO-DAY (6)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
01 PIC 9(8). "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ"".
01 0NORMSQ05 PIC X OCCURSTIMES
PROCEDUREDIVISION
P0.
OVEFLATERTO CALL"AUTHID"USING1 THE-TIME PIC(8) MOVEnotinnotTO
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVETO SQL-COD EXECSQL WORK END-EXEC MOVE SQLCODE TO SQL-COD if (uid NOT = uidx) then DISPLAY"ERROR: User ", uid " expected. User ", uidx "
- " connected" STOPRUN END-IF MOVE 0 TO errcnt
DISPLAY "SQL Test Suite, V6.0, Embedded COBOL, dml137.pco" 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 TEST0697 ******************* MOVE 1 TO flagP0
DISPLAY"TEST0697 " DISPLAY"Erratum: drop behavior, constraints (static)" DISPLAY"References:" DISPLAY" COR2 11 CALL"" USING uid
- "not loggedin, not"TOjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 DISPLAY" F 3--Basic " DISPLAY" 11.2 FT.2 -- " DISPLAY" 11.18 -- "
SQLCODE SQL-COD
COMPUTE SQLCODE = -1
OVE"TO SQLSTATE
DISPLAY"CREATE TABLE UNDROPPABLE (" DISPLAY" C1 INT PRIMARY KEY NOT NULL);" EXECif(uid = uidxthen
C1 INT PRIMARY KEYNOTDISPLAYERRORUser uid expected,uidx
SQLCODE SQL-COD PERFORMCHCKOK DISPLAY" "
DISPLAYEND-IF EXECSQLCOMMIT END-EXEC
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
RM DISPLAY" "
DISPLAY"CREATE TABLE DROPPABLE (" DISPLAY" C1 INT PRIMARY KEY NOT NULL REFERENCES
- " UNDROPPABLE," DISPLAY" C2 INT "5-byte" DISPLAY"TEdVersion #"
C1 INT PRIMARYACCEPT TO-DAY DATE ACCEPT THE-TIME TIME MOVESQLCODE SQL-COD PERFORMjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY" "
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0 EXECSQLDISPLAY": drop behavior, constraints (static)"
OVE TO SQL-COD PERFORMCHCKOK DISPLAY RESTRICTed DISPLAY" # 3- Basic manipulationjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
*The following violates 11.18 SR.4 since the view WCOV exists. *If it is rejected at compile time, save the error and TEd it ou
DISPLAY java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECSQLMOVExxxxx SQLSTATE MOVE"CREATE TABLE UNDROPPABLE (" DISPLAY" NOT NULL)" DISPLAY"SQLSTATE should be 42000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if(SQLCODENOT <0ORNOT = 400") then MOVE 0 TO flag END-IF
SQLCODETO then DISPLAY " implementation-defined SQLSTATE." END-IF DISPLAY" "
DISPLAY" WORK;"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVETO SQL-COD PERFORM DISPLAY" "
*The following violates 11.18 SR.4 since DROPPABLE has a referen *constraint defined on UNDROPPABLE. *If it is rejected at compile time, save the error and TEd it ou
DISPLAY"EXECSQL TABLE DROPPABLE ( EXECSQLDROP UNDROPPABLERESTRICT END-EXEC MOVE SQLCODE TO
OVE TO java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 MOVETO PERFORM CHCKOK if (SQLCODE NOT <0 ORN NOT = "42000")then
flag END-IF if (NORMSQ = "42000"AND NORMSQ NOT = SQLSTATE *If it is rejected at compile time, save the error and TEd it ou then DISPLAY"alid implementation-defined " END-IF DISPLAY" "
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD
ERFORM DISPLAY" "
*The following is affected by the erratum. It should succeed.
DISPLAY 0 TO EXECSQL COMMITif(NORMSQ"200"AND NORMSQ NOT = ) MOVE SQLCODEDISPLAY"Valid implementation-defined accepted END-IF DISPLAY" "
*The following is affected by the erratum. It should succeed. *Referential constraint from DROPPABLE is gone now.
DISPLAY"DROP EXECSQL DROP TABLE UNDROPPABLE RESTRICT END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"COMMIT WORK;" EXEC*constraint defined on UNDROPPABLE. MOVE SQLCODE TO SQL-COD
ERFORM DISPLAY" "
if ( flag OVE TO SQL-COD DISPLAY" *** pass *** " INSERT HU
VALUES " should be 4200; itsvalue is ", SQLSTATE MOVESQLCODE SQL-COD else DISPLAY" dml137.pco *** fail *** EXECSQLINSERTif(NORMSQ"400 AND NORMSQ NOT = SQLSTATE)
VALUES('097''fail','') END-EXEC MOVESQLCODE SQL-COD COMPUTE errcntEND-IF END-IFDISPLAY""
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXECSQLMOVE SQLCODE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 MOVETO SQL-COD ******************** END TEST0697 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 RUN.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
. DISPLAY"SQLCODE should be 0; java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECSQL COMMIT END-EXEC if ( NOT =0ORNORMSQ = "0000" java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 MOVE0 TO flag END-IF if (NORMSQ = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 then DISPLAY"Valid implementation-definedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 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.
MOVEDISPLAY" "
MOVE 3 TO EXEC SQL COMMIT WORK END-EXEC *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORM ARYING FROM 14 BY 1UNTIL > 36 if (NORMSQX(norm1) = ALPNUM CHCKOK MOVE"0"TO NORMSQX(norm1 DISPLAY = 1 ) then INSERTINTO.TESTREPORT
*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) ifDISPLAYdml137fail TOjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 END-IF
MOVE 4 TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYINGCOMPUTEerrcnt + 1
(NORMSQXnorm1) = ALPNUM(norm2) MOVE"0"TO
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 17
ND-PERFORM
MOVE 5 TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 if (NORMSQX(norm1 =ALPNUM)) then MOVE"0 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
(1 =""AND()= "") java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 MOVE"0"TO NORMSQX( ERFORM THRUEXIT-NOSUBCLASS 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.