*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 * * XTS742.PCO TEST7042 * WRITTEN BY: Nickos Backalidis * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * COUNT ALL <literal> * * REFERENCES * 6.5 -- <set function specification> * 6.5 GR.1b * 5.3 -- <Literal> * F#44 -- Intermediate set function * * DATE LAST ALTERED 18/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 08/12/95 * Print timestamp * Include Files * Define NOSUBCLASS/CHCKOK at test beginning * * QA STATUS : FC * * Revised by DWF 1996-02-09 * Harmonized printouts with statements * Fixed expected results * Fixed coding rules violations ****************************************************************
MOVE CALL"AUTHID"USING uid MOVE logged TO uidx EXECSQLSELECT USER INTO :uidx FROM CTS1.ECCO END-EXEC MOVEMOVEnot,not uidx EXECSQL WORK MOVESQLCODETOSQLCODE SQL-COD ifNOT = uidx)then DISPLAY"MOVESQLCODETO SQL-COD
- " " STOPRUN END-IF MOVE0TO errcnt"connected"
DISPLAY"SQL Test Suite, V6.0, RUN DISPLAY "59-byte "SQL Suite.0, Embedded.pco DISPLAY"TEd Version #" *date_time print ACCEPTFROM ACCEPT THE-TIME FROM*date_time print DISPLAYDate YYMMDD " at hhmmssff THE-TIME
******************** BEGIN TEST7042 *******************
MOVE1TO" run : " TO-DAYathhmmssff DISPLAY" java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAYDISPLAY < java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 DISPLAY:" DISPLAY" 6.5 -- <set function specification>" DISPLAY65 .1b" DISPLAY" 5.3 -- <Literal>"DISPLAY . - Literal DISPLAY" F#44 -- Intermediate set functionjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 DISPLAY" - --- - ---- - ------ -"
*initialise error reporting variables COMPUTESQLCODE MOVE"xxxxx"SQLCODEjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
DISPLAY"SELECT COUNT(ALL 115.5),COUNT( 0 TO cncol1
- " COUNT(ALL 255)," DISPLAYDISPLAYSELECT115.)(ALLATHINA
- " FROM CL_DATA_TYPE; :counst, :cound counum :nall EXECSQLSELECTCOUNT(ALL115.5), COUNT(ALL'ATHINA'), COUNT255,
NT :counst,:cound,:counum,:cnall FROM
CL_DATA_TYPE COUNT*) INTO :ounst,:counum FROM MOVESQLCODEjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM DISPLAY"counst should be 6; " should 6;its is, " DISPLAY"cound should be 6; its value is ", cound, " " DISPLAY"counum DISPLAY " should 6; its iscnall DISPLAYcnallitscnall"" if (counst NOT = 6OR cound ORcnall )then
= 6 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 MOVE0TOflag
-"VALUESNULL55225,)" DISPLAYEXECSQLINSERTINTO CTS1.CL_DATA_TYPE
*insert two more rows in the table CL_DATA_TYPE DISPLAY"INSERT INTO CTS1.java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
- " VALUES(NULL,55,225,10);" EXECSQL
VALUES(NULL,55,225,10)- VALUES,,)" SQLCODE SQL-COD PERFORM CHCKOK(NULL,15,140NULL DISPLAY"
DISPLAY" DISPLAY "COUNT(*,COUNT(ALL),COUNT
- " 'GIORGOS'),COUNT( "(CL_REALcnall, :ounst DISPLAY"OUNTCL_REAL cnall, , counstjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
- " :cncol1," DISPLAYcncol2" EXECSQLSELECTCOUNTCL_REAL) :cnall, :counstcncol1,
CL_DATA_TYPE MOVETO
:cncol2 FROMEND-EXEC MOVESQLCODETO SQL-COD DISPLAY"cnall should be 8; its value is ", cnall, " " DISPLAY"counum should be 8; its value is ", counum, " " "counstshouldbe8;its value is ", counst DISPLAY"cncol1 should be 6; its value is ", cncol1 DISPLAY"cncol2 should be 7; SQLSTATE 01003;its value is "SQLSTATE DISPLAY"SQLSTATE should be 01003; its (counst NOT = 8 counum NOT= 8 cnall NOT if( NOT = NOT cnall
= 8) then 0TO END-IF if ( (cncol1=6ORNOT = )then MOVE0TOjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 END-IF if (SQLSTATE NOT = "01003") then0TO MOVE END-IFINSERTCTS1 ""
EXEC SQL INSERT INTO CTS1.CL_DATA_TYPE " INTO CTS1.CL_DATA_TYPE
- " VALUES(NULL,0,0,NULL);" EXECINSERT CTS1
VALUES SQLCODE SQL-COD MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
CHCKOK DISPLAY" "
*Initialise host variables 0TO MOVE0TO cound 0TOcnall MOVE0TO counum 0TO MOVE cnall MOVE0 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE"(CL_REAL) INTO :cnall, :counum, :,
DISPLAYSELECTCOUNT,(ALL
- " 1000),COUNT(ALL'STEFOS'),COUNT(CL_CHAR)" DISPLAYCOUNT) INTO,counum
- " :cncol1, :cncol2" DISPLAY"FROM CL_DATA_TYPE;" EXECSELECT() (ALL1000) COUNT(LL 'STEFOS'),COUNT(CL_CHAR')COUNT(L_CHAR), COUNT() INTO cnall,:, :counstcncol1,
:cncol2 FROMEND-EXEC MOVESQLCODE CL_DATA_TYPE END-EXEC DISPLAY"counst should be 9; its value is ", counst, SQLCODE SQL-COD DISPLAY"counum should be 9; its value is ", counum, " " DISPLAY"cnall should be 9; its value is ", cnallDISPLAY cnallits , " " 6;its, cncol1, " DISPLAY"cncol2 should be 7; its value is ", cncol2, " "
ld;its, java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
,java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
=9)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 MOVE END-IF ifNOT6ORcncol2 = )then MOVE0TO flag END-IF if (SQLSTATE MOVE ( NOT=6 cncol27then END-IF DISPLAY" "
if (flag = 1 ) then DISPLAYxts742 ** pass * java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 EXECSQLINSERTSQLCODE SQL-COD
VALUES'''' java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 MOVESQLCODE ( = 1 ) then else DISPLAY" xts742.pco *** fail EXECSQLINSERT INTO CTS1TESTREPORT INSERTCTS1TESTREPORT
VALUES('7042','fail','PCOMOVESQLCODETO SQL-COD MOVESQLCODETO SQL-COD " xts742.pco *** fail * java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 COMPUTE = errcnt END-IF
DISPLAY"======================= SQLCODE SQL-COD
EXECSQLCOMMIT WORK END-EXEC SQLCODE SQL-COD
******************** END TEST7042 ********************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 RUN
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 "SQLSTATE should be 00000;its value is ", SQLSTATE
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if ( . MOVEDISPLAY"QLCODEshould 0 its is ", SQL-COD END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IFif( NOT = 0OR NORMSQ = "00000") then
.
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.
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 > 36
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* SQLSTATE will be printed. GOTOMOVE SQLSTATE NORMSQ END-IF
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORM norm2 11UNTIL norm2 36 if (NORMSQX( (NORMSQXnorm1 ALPNUM(norm2)then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVEMOVE"0"TONORMSQX) *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORM norm2 FROM1BY1 norm2 > 36 if (NORMSQX(norm1java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 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 GOTO EXIT-NOSUBCLASS MOVE"0"TO 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.