*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 * * XTS726.PCO * WRITTEN BY: Nickos Backalidis * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * Flagging - Full SQL - cursor with FOR UPDATE and ORDER BY * * REFERENCES * 13.1 -- <declare cursor> * 13.9 -- <update statement: positioned> * 13.10 -- <update statement: searched> * 13.9 SR.4 * F#37 -- Intermediate SQL Flagging * * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 04/12/95: * Change values returned from table CL_STANDARD * (JIM > MORRIS) * * QA Status: QA CHECK * * Revised by DWF 1/31/96 * Removed status checks after cursor definition * Fixed char string lengths * Fixed misinterpretations of SQL-92 * Harmonized printfs with executed statements * Corrected expected results ****************************************************************
01 SQL-COD PIC S9(9) DISPLAY05 ALPNUM XOCCURS36TIMESjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
PROCEDUREDIVISION.
P0.
MOVE"CTS1 "TO uid CALL"AUTHID"USING uid MOVE"not logged in,not TO uidx EXECSQLSELECT USER INTO :uidx FROM CTS1.ECCO END-EXEC SQLCODETO SQL-COD EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD if (uid NOT = uidx) java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 10
CALL "AUTHID uid
- " " ,java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 46 STOPRUN END-IF MOVE0TO errcnt
EXEC SQ WORKEND-EXEC DISPLAY "59-yte IDjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
TEd " *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME RUN DISPLAY"Date run YYMMDD errcnt
***************** BEGIN TEST7026 *****************
g
DISPLAY" DISPLAY " #java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
- " ORDER BY" DISPLAY"References" DISPLAY" 13.1 -- <declare ACCEPT THE-TIME FROM TIME " .9 - <update statement: positioned> " DISPLAY" 13.10 -- <update statement: searched> " DISPLAY" 13.9 SR.4 MOVE 37- IntermediateFlagging" DISPLAY" - - - - - - - - - - - - - - - - - - -"
*Subtest 1
*Initialise error reporting variables COMPUTESQLCODE = -1 MOVE"131 -<eclare cursor>java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
*use table CL_STANDARD from the standard schema *Use Valid Intermediate SQL & declare a cursor *for UPDATE only DISPLAY"Valid Intermediate SQL syntax:" DISPLAY"DECLARE ALPHADISPLAY " - - - - - DISPLAY*Initialise error reporting variables DISPLAY"FROM CL_STANDARD " " =1004AND =''java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 DISPLAY"FOR UPDATE OF COL_CH1, COL_NUM2java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0 EXECSQL DECLARE *for UPDATE only
COL_CH1, DISPLAY "DECLARE SELECTCOL_NUM1" WHERE1004AND' FOR UPDATE "FROM CL_STANDARD "
*initialise host variables MOVE"xxxxxxxxxx"TO c_ch1 "xxxxxxxxxx" Oc_ch2 MOVE0TO c_num1 MOVE0TO c_num2 DISPLAYDISPLAY"OPEN ALPHA;"
-" :_ch2" EXECSQL FETCH ALPHA MOVESQLCODETO SQL-COD END-EXEC SQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"Values of the columns BEFORE java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 39 DISPLAY"COL_NUM1 = ", c_num1, " COL_CH1 = ", c_ch1 DISPLAY"COL_NUM2 = ", c_num2, " COL_CH2 = ", c_ch2 DISPLAY" "
*use an <update statement:positioned and modify row *that satisfies the <search condition> of the query DISPLAY"UPDATE CL_STANDARD" DISPLAYMOVESQLCODETOSQL-COD DISPLAY"WHERE Values columnsBEFORE the UPDATE:java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
CL_STANDARD SET COL_CH1 = "java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 WHERE CURRENT OF ALPHA END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY""
*use a <select statement: single row> and check that *the row has been successfully modified DISPLAY"SELECT COL_NUM1,COL_CH1,COL_NUM2,COL_CH2" DISPLAY"INTO :c_num1, :c_ch1, c_num2, c_ch2" DISPLAY"FROM CL_STANDARD" DISPLAY"WHERE COL_NUM1 = 1004;" EXECSQLSELECT COL_NUM1,COL_CH1,COL_NUM2,java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 39 INTO :c_num1,:c_ch1,:c_num2,:c_ch2
CL_STANDARD WHERE COL_NUM1 = 1004END-EXEC MOVESQLCODETO SQL-COD *use a <select statement: single row> and check that PERFORMCHCKOK DISPLAY"Values of the row after the UPDATE :" DISPLAY"COL_NUM1 should be 1004; it is ", " CL_STANDARD" DISPLAY C shouldbeELLIE is" ,"java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 DISPLAY"COL_NUM2 should be 4014; it is CL_STANDARD DISPLAY"COL_CH2 MOVE SQLCODE TO if (c_num1 NOT =
c_num2 NOT = 4014) then MOVE0TO flag END-IF if (c_ch2 NOT = "PARGA") then 0TOjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 END-IF DISPLAY" "
*restore CL_STANDARD in its original state DISPLAY"ROLLBACK WORK;" SQL WORKEND-EXEC MOVESQLCODETO SQL-COD
DISPLAY" OVE 0TO java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
*Subtest 2 DISPLAY"FULL SQL SYNTAX:" DISPLAY"DECLARE BETA CURSOR FOR SELECT" DISPLAY"COL_NUM1 DISPLAYWHERECOL_NUM1 =1001 PERFORMCHCKOK EXEC DECLAREBETA FORSELECT
COL_NUM1,COL_CH1,COL_NUM2 FROM CL_STANDARD WHERE COL_NUM1 = 1001 ORDERBY COL_NUM2 DESC FOR UPDATE " SQL SYNTAX:"
DISPLAY"FETCH EXEC SQLOPEN BETA END-EXEC EXECSQL FETCH BETAINTO:,c_ch1c_num2END-EXEC MOVESQLCODETO SQL-COD "java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 *initialise host variables DISPLAY"OL_CH1 beMARIA it is " ," " DISPLAY"COL_NUM2 should be 4001 it is ", c_num2, " " if (c_num1 NOT = 1001OR0TOc_num1
c_num2 NOT = 4001)then MOVEEXECSQLFETCHBETA cnum1:,c_num2 END-IF DISPLAY" "
DISPLAY"UPDATE CL_STANDARD " DISPLAYSET = TAKIS" DISPLAY"WHERE CURRENT OF BETA;" EXECSQL UPDATE CL_STANDARD SET COL_CH1 = 'TAKIS' WHERE CURRENT OF BETA END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK
if (c_num1NOT=1001OR c_ch1 NOT = "ARIA OR
*close cursor and record results
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 19 EXECSQLCLOSE BETA END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY""
*restore CL_STANDARD in its original state
DISPLAY"ROLLBACK WORK;" EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAYDISPLAY""
if ( flag = *close cursor and record results DISPLAY" xts726. ** pass * " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES'7026'p,P' java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
MOVE SQLCODE DISPLAYSQLextensionCURSORFORUPDATEANDORDERBY DISPLAY"has executed successfully" DISPLAY"Vendor must demonstrate Intermediate Flagger
- " WARNING" else
xts726.pco *** NOGO *** " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES('7026','NOGO','PCO') END-EXEC MOVESQLCODETO SQL-COD DISPLAY"Vendor does not supportjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY"Intermediate SQL extension " DISPLAY"Support for CURSOR WITH ORDER BY & UPDATE is not
- " required" END-IF
*BAK : Check again in order to insert a third option for fail *DWF: ???
DISPLAY"============================= has executedsuccessfully"
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD
***************** END TEST7026 ******************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOPjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
* **** 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( = 00000 NORMSQ = SQLSTATEjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 then DISPLAY"Valid implementation-defined SQLSTATE accepted." 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.
0TO
MOVE3 norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table VARYING1 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 MOVETONORMSQ END-IF
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z
if (NORMSQX =()then
orm1 java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 53
END-IF END-PERFORM
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0 if (NORMSQX(norm1) = ALPNUM(norm2)) *valid characters are 0-9, A-Z MOVE"0"TO NORMSQX(norm1)
(n) )
*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
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.