**************************************************************** * * COMMENT SECTION * * DATE 1994/5/17 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.
* DML117.PCO * WRITTEN BY: David W. Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests FIPS feature 19. * This is the non-dynamic version of DML118.PC. * * REFERENCES * FIPS PUB 127-2 14.1 Transitional SQL * ANSI SQL-1992 * ****************************************************************
EXECSQL BEGIN * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE
01 SQLCODE * This routine tests FIPS feature 19.
01 *
01 uid * FIPS PUB 127-2 14.1 Transitional SQL
01 uidx PIC X(18).
01 int1 PIC S9(9) DISPLAY****************************************************************
E SQLENDSECTIONEND-EXEC
01 norm1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 norm2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 ALPNUM-TABLE VALUEIS "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
05 ALPNUM PIC X OCCURS 36 TIMES.
01 NORMSQ.
05 NORMSQX PIC X OCCURS 5 TIMES.
01 errcnt PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. *date_time declaration
01 TO-DAY PIC 9(6).
01 THE-TIME PIC 9(8).
01 flag PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
0 SQL-COD PICS9DISPLAYLEADINGSEPARATE
PROCEDUREDIVISION.
P0.
MOVE"FLATER "TO uid CALL"" USING uid "not in, not" uidx EXECSELECTINTO : FROM HU END-EXEC
1norm1 S99 SIGNSEPARATE. EXECSQL1 norm2 PIC (9) DISPLAYSIGNS. MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 if (uid = uidx then DISPLAY"ERROR: 01 errcnt PIC S9(9) DISPLAYSIGNLEADING SEPARATEjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
- " connected" STOPPIC S9(9) DISPLAYSIGNLEADINGSEPARATE. END-IF MOVETO errcnt
DISPLAY "SQL Test Suite,V60,EmbeddedCOBOL dml117." DISPLAY
eID DISPLAY"TEd Version CALL"" USING uid *date_time print ACCEPT TO-DAY SQL USER :uidx.ECCOjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME
******************** BEGIN TEST0645 ******************* MOVE 1 TOSQL WORK
COMPUTE SQLCODE = -1 MOVE "SQL Te Suite.0, COBOL, dml117"
*Simulate a tiny OS with hard quotas (ick!)
DISPLAY"CREATE TABLEjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 23 ACCEPTFROMTIMEDISPLAYDate :"TO-DAY"at:" DISPLAY 1, DISPLAY DISPLAY" DISPLAY " Feature9 delete actions (static)" DISPLAY" DISPLAY " FIPS PUB1721.1 Transitional SQL features ".LR2" DISPLAY" (FILE_QUOTA IS NULL OR FILE_QUOTA >=
- " FILE_USAGE) "- -- - -java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 EXECjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)
NAAMCHAR
LUSER_ID,
FILE_QUOTA "FILE_QUOTAINT"
FILE_USAGE FILE_USAGEjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
CHECK ))"
(FILE_QUOTA ISNULLSQL TABLE ( END-EXEC MOVETO SQL-COD PERFORM CHCKOK DISPLAY" "
INT, EXEC COMMIT ORK MOVE SQLCODE TO CHECK > java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*When you delete a user, all his/her files are also deleted
ISPLAYCREATELUSER_DATA DISPLAY" FOREIGNKEY LUSER_ID LUSERS java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
, DISPLAY" PRIMARYMOVESQLCODE TO SQL-COD DISPLAY" FILE_NAME CHAR (8) NOT NULL," DISPLAY" LUSER_ID CHCKOK DISPLAY" LUSER_DATA CHAR java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SQL TABLE (
FOREIGN"DELETECASCADE"
,
PRIMARY (ILE_NAME, LUSER_ID,
FILE_NAME CHAR DISPLAY" FILE_NAMECHAR () NOTNULL"
,
LUSER_DATA CHAR (30)) END-EXEC MOVE SQLCODE TO SQL-COD PERFORM SQL TABLE LUSER_DATA
DISPLAY"CREATE TABLE CHAR (30) END-EXEC DISPLAY ,
CHCKOK DISPLAY" (LUSER_ACTION INSERT =
- " 'ACCVIO'" DISPLAY" OR LUSER_ACTION = 'DELETE'))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECSQL TABLE (
ACTION_KEY SQLCODE SQL-COD
LUSER_ACTION (6) NULL "" OR LUSER_ACTION = 'DELETE')) END-EXEC
PERFORM DISPLAY" "
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK " CHAR (6 NULL," MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
P java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 ""
*This table ostensibly separates UID's that have been valid at s *time in history from those that have always been invalid.
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 EXECSQL COMMIT WORK *time in history from those that have always been invalid. MOVE SQLCODE CREATE ALL_USER_IDS INT) END-EXEC DISPLAY" "
*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 ( PERFORMCHCKOK DISPLAY" FOREIGN KEY (LUSER_ID) REFERENCES LUSERS ON
- " DELETE SET NULL," DISPLAY" LUSER_ID INT,java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 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 (
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 NULL
USER_ID,
SAVED_LUSER_ID "DELETESETNULL"
REFERENCES ALL_USER_IDS (LUSER_ID) ONDELETENO ACTION,
ACTION_KEY DEFAULT NULL
REFERENCES AUDIT_CODES ON"SAVED_LUSER_IDINTNOTNULL" MOVE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM CHCKOKDISPLAY INT java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"COMMIT FOREIGN KEY (LUSER_ID) REFERENCESLUSERSONDELETESET EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO INT PERFORMCHCKOK DISPLAY" "
*Initialize audit codes
INT 0 NOTjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 SQL VALUES) END-EXEC MOVETO PERFORM CHCKOK" DISPLAY" "
DISPLAY"INSERT INTOjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SQL VALUES',2 END-EXEC SQLCODE MOVETO PERFORM CHCKOK DISPLAY" "
EXECINSERT LUSERS (' ,0java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 EXECSQLINSERT LUSERSVALUES'Kibo, , ,1 END-EXEC MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
" java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"INSERT INTO ALL_USER_IDS VALUES (0);" EXECMOVETO MOVETO
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAY" "
DISPLAY"INSERT SQL INTO ALL_USER_IDS VALUES (1
SQLCODE SQL-COD MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*Root hated Kibo only slightly less than BIFF
INSERT VALUES'ROOT1'" DISPLAY" 0, 'BIFF is a SQL INSERTINTO VALUES (2) END-EXEC MOVETO SQL-COD
0, 'BIFF is a total MOVESQLCODE SQL-COD PERFORM DISPLAY" "
DISPLAY " 0 'Kibowastesdiskspace';" EXECSQL"0 ' is a total loser);"
0, 'Kibo wastes disk space') END-EXEC MOVE SQLCODE TO SQL-COD PERFORMCHCKOK
,' is a total loser) END-EXEC
DISPLAY"INSERT INTO SQLCODE TO SQL-COD EXECSQLINTO VALUES(,0 1 END-EXECDISPLAY" " MOVE SQLCODE TO SQL-COD PERFORM CHCKOK INSERTLUSER_DATA'" DISPLAY" "
DISPLAY"INSERT INTO AUDIT_RECORDS VALUES (2, DISPLAY "" EXECSQLINSERT
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 MOVE SQLCODETO PERFORM CHCKOK DISPLAY" "
*Jealous BIFF (no quota) decided to hack Kibo's account
MOVE 0 TO CHCKOK
.
P199.
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0 INTOAUDIT_RECORDS,1,0java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 EXECSQLINTO AUDIT_RECORDS (0, 0,1) MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" " COMPUTEint1 = int1 if (int1 NOT > PERFORM GOTO P199 END-IF
*Finally he succeeded and overwrote Kibo's file with garbage
DISPLAY"INSERT INTO AUDIT_RECORDS VALUES (2, 2, 0);" EXECSQLINSERTINTO SQLCODE SQL-COD END-EXEC MOVE SQLCODE TO CHCKOK PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO AUDIT_RECORDS 0 TOint1 EXECSQLINSERTINTO AUDIT_RECORDS VALUES. END-EXEC MOVE PERFORMSQLINTO VALUES1 ,0java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 DISPLAY"
DISPLAY"INSERT INTO LUSER_DATA VALUES ('HAHA',"
,IG0T'" EXECSQLINSERTINTO LUSER_DATA QL INTO VALUES2 )
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 MOVE SQLCODE
CHCKOK DISPLAY" "
*This angered root, who instantly disbursed group punishment...
DISPLAY"DELETE FROM LUSERS" DISPLAY" WHERE NAAM <> 'root';" EXECPERFORM MOVE PERFORM DISPLAY""
COMPUTE int1java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 21 DISPLAY"SELECT COUNT(*) INTO :int1" " ROM ;" EXECSQL (java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 END-EXEC, !) END-EXEC MOVESQLCODE SQL-COD PERFORM " if (int1 NOT = 2) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0 MOVE0 TO END-IF
COMPUTE int1 = -1 DISPLAY"SELECT COUNT(*) INTO :int1" DISPLAY" FROM LUSERS;" SQLCOUNT* :int1 LUSERS java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 MOVE"" PERFORM CHCKOK DISPLAYint1 ;its" java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 if (int1 NOT = 1) then MOVE 0 TO flagEXECSELECT(*)INTOFROM java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 END-IF
COMPUTE int1 = -1 DISPLAY"SELECT COUNT " should 2; its is" DISPLAY ; EXECMOVE flag END-EXEC MOVE SQLCODE TO DISPLAY "SELECT COUNT int1 PERFORM CHCKOK DISPLAY"int1 should SQLCODE TO SQL-COD
(int1 1) then MOVE 0 TO flag END-IF
COMPUTE int1 = -1 DISPLAY" COUNT(*) NTO :" DISPLAY" FROM AUDIT_RECORDS OVE0TO flag
E SQLSELECT* :int1AUDIT_RECORDS
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVETO PERFORMFROM" DISPLAYint11;its value" java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 ifNOT=1) then MOVE 0 TO flag END-IF
COMPUTEDISPLAY" should be 1;itsvalue ",int1 DISPLAYSELECT*INTO DISPLAY" FROM AUDIT_RECORDS 0 TO flag
- ;java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 EXECSQLCOUNT*)INTOFROM AUDIT_RECORDS
WHERE SAVED_LUSER_ID ISNULLDISPLAY" COUNT(*) INTO :nt1" MOVE SQLCODE TOSQLCOUNT(*) INTOint1 AUDIT_RECORDS
HCKOK DISPLAY"int1 be 0; its value is ", int1 if (int1 MOVESQLCODE SQL-COD MOVE 0 TO flag "int1should be 10; itsvalueis " int1 END-IF
*...and disabled deletes just for good measure.
DISPLAY"DELETE FROM DISPLAY WHERE''" EXECSQLDELETEFROM AUDIT_CODES
WHERE LUSER_ACTION = 'DELETE'END-EXEC
SQLCODE PERFORM CHCKOK ""
COMPUTE int1 = -1 DISPLAY"SELECT - "" DISPLAY" WHERE ACTION_KEY = 2;" SQLCOUNT* :int1 AUDIT_RECORDS
WHERE ACTION_KEY = 2 END-EXEC MOVETO MOVETO DISPLAYint1;its,int1 if (int1 NOT = 0) then MOVE flag END-IF
COMPUTE int1 DISPLAY java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 19
;
E SQL AUDIT_CODES
=DELETE
SQLCODE PERFORM DISPLAY if (int1 = -java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
0 flag END-IF
*See if that "ON DELETE NO ACTION" did what it was supposed to d *It should _not_ allow us to create dangling references.
DISPLAYDELETE; EXECDELETEALL_USER_IDS MOVE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 DISPLAY"SQLCODE should be < 0; its value is ", if int1
MOVE flag END-IF
30 , PERFORM NOSUBCLASS THRU SQLSELECT(* INTOint1 AUDIT_RECORDS if (NORMSQ = "300"then MOVE flag END-IF if (NORMSQ = "23000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
DISPLAY COMMIT EXECEND-IF MOVE SQLCODE *See if that "ON DELETE NO ACTION" did what it was supposed to d PERFORM CHCKOK DISPLAY" "
DISPLAYDROP;
OVE SQLCODE SQL-COD MOVE SQLCODE " should be 0;itsvalueis",SQL-COD PERFORM CHCKOK DISPLAY"
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"DROP TABLE ALL_USER_IDS CASCADE;" EXECSQL 0TO MOVE PERFORMifNORMSQ "30"AND ) DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAYEND-IF SQLEND-EXEC MOVE SQLCODE " WORK;" SQL WORK "
DISPLAY"DROP TABLE AUDIT_CODES CASCADE;" EXEC DROP AUDIT_CODES END-EXEC MOVE SQLCODE TOjava.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 25 PERFORM DISPLAY" "
ISPLAYCOMMIT EXECSQL WORKEjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
SQLCODE SQL-COD EXECSQL DROP TABLE" " MOVE SQLCODE TO SQL-COD PERFORM DISPLAY" "
if (
**pass EXECINSERTINTO.TESTREPORT
('064',pass)END-EXEC MOVE SQLCODE TO else
. * EXECSQL COMMIT
VALUES( java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
SQLCODE COMPUTE errcnt SQLCODE java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36 END-IF
DISPLAY"=============================================EXEC COMMIT WORK END-EXEC
EXEC java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 MOVE SQLCODE ******************** END TEST0645 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOPRUNMOVETOSQL-COD
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
. DISPLAY"SQLCODE
shouldvaluejava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 PERFORM if (SQLCODE NOT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE 0 " ** pass** " END-IF if (ORMSQ "000 ANDNORMSQ NOT ) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF
.
SQLCODE SQL-COD
*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.
OMPUTE = errcnt
MOVE 3 TODISPLAY=========================java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORM norm2 4BY norm2 6 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 END-IF * **** Procedures for PERFORM statements
*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 = SQLSTATE GO ( NOTORNOT="000)then END-IF
MOVE 4 TO norm1 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM 1 BY 1 UNTIL norm2 > *subclasses with 000. This replacement equates valid if (NORMSQX(norm1) = ALPNUM(norm2 *expected by the test case; otherwise the test will fail. MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVETO NORMSQ *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM 1 BY 1 UNTIL norm2 > 36 *valid subclass begins with 5-9, I-Z, end of ALPNUM table if (NORMSQX) = ALPNUM)) then MOVE"0"TO NORMSQX(norm1) END-IF
-
*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 *Changed NORMSQ means implementation-defined subclass, MOVE"0"TO NORMSQX ( = SQLSTATE 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.