*Copyright 1995 National Computing Centre Limited *and Computer Logic R&D S.A *on behalf of the CTS5 SQL2 Project. *All rights reserved. *The CTS5 SQL2 Project is sponsored by the European Community. * *The National Computing Centre Limited and Computer Logic R&D *have given permission to NIST to distribute this program *over the World Wide Web in order to promote SQL standards. *DISCLAIMER: *This program was reviewed by employees of NIST for *conformance to the SQL standards. *NIST assumes no responsibility for any party's use of *this program.
**************************************************************** * * COMMENT SECTION * * SQL VALIDATION TEST SUITE V6.0 * * XTS716.PCO * WRITTEN BY: Manolis Megaloikonomou * REVIEWED BY: Nickos Backalidis * * SET SESSION AUTHORIZATION to current auth-id. * * REFERENCES * 16.4 -- <set session authorization identifier statement> * 16.4 GR.1 * 16.4 LR.2a -- Raised. Entry SQL restriction that * prohibits the use of any <set session * authorization identifier statement>. * 6.2 -- <value specification> and <target specification> * 6.2 SR.3 * 6.2 GR.9 * 6.2 LR.2c -- Raised. Entry SQL restriction which * prohibits the specification of CURRENT_USER, * SYSTEM_USER or SESSION_USER in a * <general value specification>. * F#1 -- Dynamic SQL. * F#32 -- User authorization. * * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 01/12/95 * * QA Status: QA Check * * Revised by DWF 1/23/96 * Removed status code checks after cursor definition. * Removed violations of 16.4 GR.1. ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01SQLCODEPIC S9( * F#1 -- Dynamic SQL. 01 SQLSTATE PIC X(5). 01 uid PIC X(18). 01 uidx PIC X(18). * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test 01 coun PIC S9(9) DISPLAYSIGNLEADINGSEPARATE* Cleanups and fixes by V. Kogakis 01/12/95 01 xuser PIC* 01 sqlsm2 PIC X(31). EXECSQLEND DECLARE SECTIONEND-EXEC
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 01 norm2 PIC S9(9) DISPLAYSIGNLEADING 01 coun PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
ALPNUM-TABLE VALUEIS "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ". 05 ALPNUM PIC X OCCURS36 TIMES. 01 NORMSQ. 05 NORMSQXPIC X OCCURS5. 01PICS9()DISPLAYSIGNLEADINGSEPARATE *date_time declaration 01 TO-DAY PIC9(6). 01THE-TIME PIC (). 01 flag PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 SQL-COD 05 ALPNUM XOCCURS36 .
PROCEDUREDIVISION.
P0.
MOVE"CTS1 "TO uid CALL"AUTHID"USING uid MOVE"not *date_time declaration EXEC (
() LEADINGSEPARATE EXEC java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE if (uid. "User "uid" java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 72
- " connected" STOPRUN END-IF MOVE0TO errcnt
DISPLAY"SQL Test Suite, V6.0, Embedded COBOL SQLCODE DISPLAY "59-byte ID" DISPLAY"TEd Version #" *date_time print FROMjava.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
THE-TIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME
******************** BEGIN TEST7016 *******************
MOVE DISPLAY" TEST7016 " "SET AUTHORIZATION to auth-id.java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 DISPLAY" References:" DISPLAY" 16.4 -- <set session DISPLAY " Version #
- "" DISPLAY" 16.4 GR.1" DISPLAY16. 2a- . SQLrestriction
- " that" DISPLAY" prohibits the use of any <set
- " session" DISPLAY" authorization java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
- " DISPLAY "" DISPLAY" 6.2 -- <value specification> and <target
- " DISPLAY"16-<session identifier DISPLAY" 6.2 SR . .1 DISPLAY"62GR." DISPLAY" 6.2 LR.2c -- Raised. Entry SQL restriction
- " which" DISPLAY" prohibits the specification of
- " CURRENT_USER," DISPLAY - session"
- "a" DISPLAY" <general value specification>."
statement." DISPLAY" F -- User authorization.java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
- - - ---"
*Preserve the original authorization identifier CTS1 into *a host variable with padded leading and trailing spaces. MOVE" CTS1 "TO xuser DISPLAY"=',xuser, "'"
*Ensure that the current authorization has access rights *to table STAFF. MOVE99TO coun
DISPLAY< value." EXECSQLSELECTCOUNT(*) INTO :coun FROM CTS1. F1 -Dynamic" END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"Coun should be 5; its value is ", coun if ( coun NOT = 5 ) then MOVE0MOVE" CTS1 "TO xuser END-IF DISPLAY" "
DISPLAY"COMMIT WORK;" EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO PERFORM CHCKOK DISPLAY" "
*Change the session authorization identifier to the *value of host variable xuser DISPLAY"SETSESSIONAUTHORIZATION :xuser;" EXECSQLSET SESSION AUTHORIZATION :xuser END-EXEC MOVESQLCODETO PERFORM CHCKOK DISPLAY" "
*Check for SELECT access rights in STAFF table MOVE99TO coun DISPLAY"SELECT COUNT(*) INTO :java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0 EXECSQLSELECTCOUNT(*) INTO :coun FROM CTS1.STAFF END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"Coun should be 5; its value is "" if ( coun MOVE0TO flag END-IF DISPLAY" "
DISPLAY"SET SESSION AUTHORIZATION java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 25 EXECSQLSET SESSION java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVESQLCODETO java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
DISPLAY" "
MOVE99TO coun MOVE"SELECT COUNT(*) FROM CTS1.STAFF"TO sqlsm2 DISPLAY"sqlsm2 "",sqlsm2,""" DISPLAY"PREPARE S FROM :sqlsm2;" EXECSQL PREPARE S FROM :sqlsm2 DISPLAY"Coun should be 5;its value is ", MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"DECLARE;java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 EXECSQL DECLARE ALPHA CURSOR FOR S END-EXEC
AY" ALPHA; EXECSQLOPEN ALPHA java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 25 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"FETCH ALPHA INTO :coun;" EXECSQL FETCH ALPHA INTO : DISPLAY"" MOVESQLCODE PERFORM CHCKOK DISPLAY"Coun should be 5; its value is ", coun if ( coun NOT = 5 ) " *) CTS1."sqlsm2 MOVE0TO flag END-IF DISPLAY"
" WORK;java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 EXECSQLROLLBACK WORK java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 MOVESQLCODETOSQL-COD PERFORM CHCKOK DISPLAY" "
if ( flag = 1 )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY" xts716.pco *** pass *** " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES('7016','pass',' MOVESQLCODETO SQL-COD else DISPLAY" xts716.pco *** fail *** " EXECSQLINSERTINTO CTS1TESTREPORT
VALUES('7016','fail','PCO') END-EXEC
COMPUTE errcnt = errcnt + 1 END-IF
DISPLAY"================ EXEC SQLCLOSE END-EXEC
EXECSQL WORK MOVESQLCODETO ******************** END TEST7016 ********************
**** 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 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY SQLSTATE should00000;itsvalue , PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS ifSNOT= 0ORNORMSQ NOT="00000)then MOVE0TO flag END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY" pco * fail **" END-IF
.
.
*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 > ******************** END TEST7016 ******************** if (NORMSQX(norm1) = STOP . MOVE"0cedures for PERFORM statements 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 SQLCODE=0 NORMSQNOT=00000) GOTO EXIT-NOSUBCLASS END-IFif(ORMSQ "00000"AND NORMSQ NOT=SQLSTATE
MOVE4 norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING if (NORMSQX(norm1) = java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0 MOVE"0"*implementation-defined subclasses with the 000 value END-IF END-PERFORM
MOVE NORMSQ *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING*valid subclass begins with 5-9, I-Z, end of ALPNUM table 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)
if (NO = )then 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.