*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 * * XTS725.PCO * WRITTEN BY: Nickos Backalidis * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * Flagging, Full SQL INSENSITIVE cursor * * REFERENCES * 13.1 -- <declare cursor> * 13.2 -- <open statement> * 13.3 -- GR.3.e.i * F#79 -- Insensitive cursors * 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 in the values of rows inserted in the table * * QA Status: QA check * * Revised by DWF 1/30/96 * Removed status checks after cursor definition * Fixed char string lengths ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01SQLCODEPIC S9(9) COMP. 01 SQLSTATEPIC X(5). 01 uid PICX18) 01 uidxPICX(18) CONFIGURATIONSECTION. 01 c_num2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 c_ch1 PIC X(10). 01 c_ch2 PIC X(10). EXECSQLEND DECLARE SECTIONEND-EXEC 01 norm1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. PIC () DISPLAYLEADINGSEPARATE. 01 ALPNUM-TABLE "01234java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 21 05 ALPNUM PIC X OCCURS36*on behalf of the CTS5 SQL2 Project. *The CTS5 SQL2 Project is sponsored by the European Community. 05 NORMSQX PIC X OCCURS5 TIMES. *The National Computing Centre Limited and Computer Logic R&D *date_time declaration 01 TO-DAY *over the World Wide Web in order to promote SQL standards. 01 THE-TIME PIC9(8). 01 flag PIC S9(9) DISPLAYSIGNLEADING*conformance to the SQL standards.
*Use standard schema table CTS1.CL_STANDARD *declare an insensitive cursor based on columns of *CTS1.CL_STANDARD "DECLARECLCURS INSENSITIVE CURSOR" DISPLAY"FOR SELECT COL_NUM1,COL_CH1,COL_NUM2,java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 29
FROMCL_STANDARD DISPLAY"ORDER BY COL_NUM1 EADING . EXEC DECLARECLCURS CURSOR FORSELECT COL_NUM1,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 ORDERBY COL_NUM1 DESC END-EXEC
DISPLAY"OPEN CLCURS;" EXECSQLOPEN not logged,notTO MOVESQLCODETO SQL-COD PERFORM CHCKOK MOVETO
*NOW insert a row in CL_STANDARD
MOVE SQLCODE
VALUES1005'',,')"
DISPLAY "RROR:User ,uid,"expected.User" ,"
VALUES,KEVIN,005'' MOVESQLCODETO SQL-COD
CHCKOK DISPLAY" "
*use a select <statement: single row> and determine *that the row was inserted and is visible DISPLAY" *date_time print "INTO :_num1, :c_ch1,:, :_ch2 java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 DISPLAY FCL_STANDARDWHERECOL_NUM1=1005;java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 EXECSQL COL_NUM1,OL_CH1COL_NUM2,COL_CH2 INTO :c_num1, :c_ch1 FROM CL_STANDARD WHEREMOVETO flag
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 36 PERFORM Flagging - SQLINSENSITIVEjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 " be ; it is :" DISPLAY" 13.2 -<open statement>" DISPLAY"COL_NUM2 should be 4005; it is : ", c_num2 DISPLAY" java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 65 if (c_num1DISPLAY--- ------- --- ---- *Initialise error reporting variables 0TOflag END-IFMOVE"" SQLSTATE if (c_ch2 NOT = "XIOS MOVE0TO flag *CTS1.CL_STANDARD DISPLAY""
*now start fetching rows from CL_STANDARD DISPLAY F :c_num1,:_,:_,
- " :c_ch2;" EXECINTO:_,:,:c_num2, :_h2 END-EXEC MOVE CL_STANDARD PERFORM CHCKOK *since the cursor is declared insensitive with cursor *specification ORDER BY DESC the last row will be *returned first however if the inserted row is visible *through the cursor then record a NOGO PERFORM DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAY"should be 4004 itis " c_num2, "" DISPLAY"COL_CH2 should "1005''4005'XIOS'; *check if the inserted row is visible through *the cursor proceed if not record a NOGO if it is if (c_num1 NOT = 1004OR c_ch1 NOT = "MORRIS"OR
CHCKOK MOVE0TOflag END-IF if (c_ch2 NOT = ""TO MOVE0TOTOc_num1 END-IF
java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0
*fetch second row DISPLAY"FETCH CLCURS INTO : EXEC SQL SELECT COL_NUM1,COL_CH1,COL_CH2 INTOc, c_ch1 c_num2,c_ch2
URS :,:_,: c_ch2 END-EXEC MOVESQLCODE SQL-COD PERFORM CHCKOK
be 1003;itis" c_num1, "" DISPLAY"COL_CH1 should be GEORGE; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4003; it is ", c_num2, " " DISPLAY"COL_CH2 should be ARTA; it is ", c_ch2, " " if(c_num1 NOT=1003OR c_ch1 NOT= "EORGE"
c_num2 NOT C shouldbeXIOS is:,c_ch2 MOVE0TO flag END-IF if (_ch2NOT ARTA)then MOVE0TO flag END-IF DISPLAY" "
*fetch third row DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 END-EXEC MOVESQLCODETO SQL-COD PERFORM DISPLAY"COL_NUM1 should be 1002; it is " c_num1, " " DISPLAY"COL_CH1 should be MAKIS; it is ", c_ch1, " " "COL_NUM2 be ; it is " c_num2,"" DISPLAY"COL_CH2 DISPLAY "" if (c_num1 NOT = ""TO c_ch1
c_num2 NOT = 4002) then0TOc_num1
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0 END-IF if (c_ch2 NOT = "HANIA" ) then MOVE0TO flag
DISPLAY
*re-initialise host variables
xxxxxxxxxx TOc_ch1 MOVE" *since the cursor is declared insensitive with cursor MOVE0TO c_num1 MOVE0TO c_num2
*fetch fourth row
:c_num1, :c_ch1 :_um2
- " :c_ch2;" EXEC AY "COL_CH1 should be MORRISit is " c_ch1, " " END-EXEC MOVETOjava.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36 PERFORM CHCKOK *check if the inserted row is visible through
should 1001;is"c_num1 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"should be ; it is " c_ch1 " " DISPLAY"COL_NUM2 should be 0TO
COL_CH2 RHODES " ,"" if (c_num1 NOT = MOVE0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
c_num2 MOVE"
if (c_ch2 NOT 0 MOVE0TO MOVE 0 TO flag END-IF
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*re-initialise host variables MOVE"OL_NUM1 1003 is " c_num1 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 " MOVE0TO c_num1 MOVE0TO c_num2
*fetch fifth row DISPLAY"DISPLAY "OL_CH2 be;it" , "
- if( NOT=1003""OR EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 END-EXEC MOVESQLCODETO SQL-COD
CKOK
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
MOVE 0 DISPLAYC 4000 it ,c_num2 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= N"OR
c_num2 NOT = 4000 java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 MOVE*fetch third row END-IF if (c_ch2 NOT = "ATHENS") then
EXEC SQL FETCH :_num1,:_h1,:c_num2 :c_ch2 END-IF DISPLAY""
*end fetches *close the cursor and open it again. If the vendor *supports the extension then the inserted row should be *now visible through the cursor
DISPLAY"CLOSE CLCURS;" EXEC"should be 4002;itis " , " TO PERFORM CHCKOK DISPLAY"
*open the cursor again DISPLAY" MOVE 0 flag EXECSQLOPEN CLCURS END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*now fetch and check if the inserted row is visible *initialise host variables MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx DISPLAY "" " MOVE0TO c_num1 MOVE0TO c_num2
DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, c_num2 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK *since the cursor is declared insensitive with cursor *specification ORDER BY DESC the last row will be *returned first DISPLAY"OL_NUM1 be 1005 it ", _num1 DISPLAY CHCKOK
COL_NUM2 be;it ,java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 69 DISPLAYCOL_NUM24001is ,java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 *check if the inserted row is visible through the cursor *proceed if not record a NOGO if it is ifc =1005 ="
c_num2 NOT = 4005) then 0TO END-IF ifc_ch2 ="")then MOVE0TO flag END-IF DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*fetch remaining 5 rows, initialising before the host variables MOVE"xxxxxxxxxx"TO c_ch1 " *re-initialise host variables MOVE0 java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 39 MOVE0 c_num2 DISPLAY"FETCH *fetch fifth row
-":;" EXECSQL FETCH CLCURS INTO :c_num1, FETCH CLCURS INTO:_,:, c_num2, :c_ch2 END-EXEC MOVESQLCODETOPERFORMCHCKOK PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1004; it is ", c_num1, " " DISPLAY"COL_CH1 DISPLAY "COL_CH1 shouldbeNICKOS; t is", c_ch1, " " DISPLAY"COL_NUM2 should be 4004; it DISPLAY "COL_NUM2 should be 4000; it is,"" " PARGA;it is" c_ch2 "
= =""java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
MOVE flag MOVE0TO flag END-IF if (c_ch2 0TOflag MOVE0TO flag END-IF DISPLAY" "
*4 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2
DISPLAYCLOSE" MOVE0TO EXEC SQL CLOSE C END-EXEC DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
- " EXECSQL FETCH CLCURS INTO :c_num1,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 END-EXEC MOVESQLCODE SQL-COD PERFORMTO SQL-COD
*since the cursor is declared insensitive with cursor
*returned first
should 4003is" , java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 DISPLAY"should ARTA;itis ""java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 if( NOT=1003 c_ch1 "EORGE"OR
c_num2 NOT = 4003) DISPLAY "COL_CH2 should it" MOVE0TOifcNOT"KEVIN java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 END-IF if (c_ch2 NOT = "ARTA") then MOVE0TO flag
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 DISPLAY" "
*3 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 MOVE0TO DISPLAY"FETCH CLCURS INTO :c_num1,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1002; it is ", c_num1, " " DISPLAY"COL_CH1 CHCKOK DISPLAY"COL_NUM2 should be 4002; it is ", c_num2, " " "COL_CH2 should be ;itis ,c_ch2, "java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 if (c_num1 NOT = 1002OR c_ch1 NOT = "MAKIS"OR
c_num2 NOT = 4002) if(_um1NOT = 1004NOT = MORRIS" MOVE0TO flag
if (c_ch2 NOT = "HANIA") MOVE0TO flag
DISPLAY" "
*2 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TOMOVE"xxxxxxxxxx"TO c_ch1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS :c_num1, :,:,
- " :c_ch2;" SQLFETCHCLCURSINTO:, :_ch1 :,: END-EXEC
SQL-COD PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1001; it is ", c_num1, " DISPLAY"FETCH CLCURSINTO:c_num1, :c_ch1, :c_num2, DISPLAY"COL_CH1 should be MARIA; itis,c_ch1, java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"COL_NUM2 should be 4001; it is ", c_num2, " " DISPLAY"COL_CH2 should be RHODES; it is ", c_ch2 PERFORM CHCKOK if"COL_NUM1 be 1003 it " c_num1, java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
c_num2 NOT = 4001) then DISPLAYjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 69 END-IF if (c_ch2 NOT = "RHODES") if (c_ch2 NOT = "RHODES") then MOVE0TO END-IF DISPLAY" "
*1 remaining MOVE" c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE c_num1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS MOVE""TO
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, : EXEC SQL FETCH CLCURS INTO :c_num1, :c_ch1 END-EXEC MOVESQLCODETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1000; it is "SQLCODE DISPLAY C shouldbeNICKOSit", c_ch1 " DISPLAY"COL_NUM2 " be ; ,c_ch1 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"COL_CH2 should be ATHENS it is (_ =1002OR NOT = " if(NOT=1000ORc_ch1 ""OR
c_num2 NOT = 4000) then MOVE0TO flag END-IF if (c_ch2 if (c_ch2 NOT)then MOVE0TOflag END-IF DISPLAY" "
*end fetches *now close the cursor DISPLAY"CLOSE CLCURS;" EXECSQLCLOSE CLCURS END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*restore table CL_STANDARD in its original state DISPLAY"ROLLBACK WORK;END-EXEC
WORKjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 SQLCODE SQL-COD PERFORM CHCKOK DISPLAY"
*record results
if ( flag = 1 ) then DISPLAY" SPLAY "COL_CH2should be; it " c_ch2 "
SQL INTO .ESTREPORT
VALUES('7025', NOT =4001) then MOVESQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 19
- " successfully DISPLAY0
- " else DISPLAY" xts725.pcojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECSQLINSERT"xxxxxxxxx"TOc_ch2
VALUES('7025','NOGO','PCO' 0 MOVETOjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 DISPLAY"Vendor does not support EXEC SQL FETCH CLCURS INTO :c_num1, :c_ch1 c_ch2 DISPLAY"Intermediate SQL extension " DISPLAY" PERFORM
DISPLAY======================="
*BAK : Check again in order to insert a third option for fail *DWF: ???
EXECSQLCOMMIT WORK END-EXEC MOVETOSQL-COD
******************** END TEST7025 ********************
**** 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; java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 25 DISPLAY"SQLSTATE should be 00000 ose the cursor PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 0OR java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 36 MOVE0TO flag END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." 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.
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
norm2 FROMBY1UNTIL >36 if (NORMSQX(norm1) = ALPNUM(norm2)) java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 21 MOVE"0"TO NORMSQX(norm1) END-IF
*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 END-IF
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM1*DWF: ??? ifSQL WORKEND-EXEC MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM1BY1UNTIL if (NORMSQX(norm1) .
(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
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.