* Standard COBOL (file "YTS759.SCO") calling SQL * procedures in file "YTS759.MCO".
*Copyright 1996 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 * * YTS759.SCO * WRITTEN BY: Susan Watters * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * * This routine Tests GRANT USAGE on a domain * * * REFERENCES * 11.36 <grant statement> * 10.3 <privileges> * 11.21 <domain definition> * 11.3 <table definition> * 11.4 <column definition> * F#25 Domain definition * F#3 Basic schema manipulation * F#32 User authorization * * DATE LAST ALTERED 02.01.96 CTS5 Hand-over Test * * QA Status: Full FC * * Revised by DWF 1996-03-05 * Added rollback after authid * Cleanup * Removed EXEC SQL from inside printfs * Drop tables that are created * Fixed schema references ****************************************************************
DISPLAY"This test attempts to change session
- " authorizations. Because" DISPLAY"authorizations are implementation-defined, this
- " test may need" DISPLAY"modification. The following actions may help to
- " pass the test:" DISPLAY" -- Change the initial authid to an authid with
- " DBA privileges" DISPLAY" -- Insert code to work around
- " implementation-defined" DISPLAY" authentication mechanisms (e.g. to reconnect
- " with a" DISPLAY" different authid)." DISPLAY"It might not be possible to change the session
- " authorization," DISPLAY"as explained in 16.4 GR.4. In this case, the
- " restrictions that" DISPLAY"render it impossible should be documented and the
- " test assumed" DISPLAY"to be passed."
DISPLAY"GRANT USAGE ON emp_nos TO CTS2" DISPLAY"WITH GRANT OPTION" * EXEC SQL GRANT USAGE ON emp_nos TO CTS2 WITH GRANT OPTION * ; CALL"SUB5"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD
DISPLAY"GRANT USAGE ON CTS1.emp_nos TO CTS3" * EXEC SQL GRANT USAGE ON CTS1.emp_nos TO CTS3; CALL"SUB12"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO emp VALUES (2,'pratt')" * EXEC SQL INSERT INTO emp VALUES (2, 'pratt'); CALL"SUB19"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
MOVE 5 TO emp_ck DISPLAY"SELECT col1 INTO :emp_ck FROM emp;" * EXEC SQL SELECT col1 INTO :emp_ck FROM emp; CALL"SUB20"USING SQLCODE SQLSTATE emp_ck MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"emp_ck should be 2; its value is ", emp_ck if (emp_ck NOT = 2) then MOVE 0 TO flag END-IF
* EXEC SQL COMMIT WORK; CALL"SUB32"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD ******************** END TEST7509 ********************
**** 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 ", SQL-COD DISPLAY"SQLSTATE should be 00000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODE NOT = 0 OR NORMSQ NOT = "00000") then MOVE 0 TO 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
MOVE 3 TO norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYING norm2 FROM 14 BY 1 UNTIL 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 END-IF
MOVE 4 TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM 1 BY 1 UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVE 5 TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM 1 BY 1 UNTIL norm2 > 36 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) = "1") then MOVE"0"TO NORMSQX(2) END-IF
.
EXIT-NOSUBCLASS. EXIT.
¤ 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.0.19Bemerkung:
(vorverarbeitet)
¤
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 ist noch experimentell.