Tang Cheng | 37650ea | 2014-10-20 16:14:41 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * $Header: sqlapr.h 08-may-2002.12:13:40 apopat Exp $ |
| 3 | */ |
| 4 | |
| 5 | /* Copyright (c) 1994, 2002, Oracle Corporation. All rights reserved. */ |
| 6 | /* |
| 7 | NAME |
| 8 | sqlapr.h - SQLlib ANSI PRototypes |
| 9 | DESCRIPTION |
| 10 | Defines ANSI prototypes for externalized SQLLIB functions used in |
| 11 | conjunction with OCI |
| 12 | PUBLIC FUNCTION(S) |
| 13 | sqllda: Get Logon Data Area for connection |
| 14 | sqlld2: Logon Data area form 2 -- with host name |
| 15 | sqlcda: Cursor data area from result set cursor |
| 16 | sqlcur: PCC cursor from cursor data area |
| 17 | |
| 18 | NOTES |
| 19 | |
| 20 | MODIFIED (MM/DD/YY) |
| 21 | apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 |
| 22 | apopat 09/20/00 - [1356099] Clarification on use of sqllda |
| 23 | lvbcheng 01/16/97 - Fix for b2 |
| 24 | jbasu 02/08/95 - Add new prototypes for thread entry pts |
| 25 | jbasu 09/21/94 - Update sqlcda,sqlcur; move sqlrcn,sqlfcn to sqlefn.h |
| 26 | jbasu 09/13/94 - Move XA prototypes to sqlefn.h |
| 27 | jbasu 08/16/94 - use OCI cda_def type from ocidfn.h instead of sqlold |
| 28 | jbasu 08/16/94 - Creation |
| 29 | */ |
| 30 | |
| 31 | #ifndef SQLAPR |
| 32 | # define SQLAPR |
| 33 | |
| 34 | #ifndef OCIDFN |
| 35 | # include <ocidfn.h> |
| 36 | #endif |
| 37 | |
| 38 | #define SQLLDAGetCurrent(arg1, arg2) sqlldat(arg1, arg2) |
| 39 | |
| 40 | void sqllda( Lda_Def *lda ); |
| 41 | /* LDA version 1. Creates an lda for use in OCI programs. |
| 42 | ** Assumes that we are logged on through an embedded SQL statement. |
| 43 | ** The lda is filled in using the connect information from the most |
| 44 | ** recently executed embedded SQL statement. So the ONLY way to use |
| 45 | ** sqllda() is to call sqllda() immediately after the |
| 46 | ** EXEC SQL CONNECT... statement. |
| 47 | */ |
| 48 | |
| 49 | void sqlldat(dvoid *sqluga, Lda_Def *lda ); |
| 50 | /* Thread-safe version of sqllda. Takes an extra parameter sqluga, which |
| 51 | * is the SQLLIB runtime context. |
| 52 | */ |
| 53 | |
| 54 | /* **************************************************************************/ |
| 55 | /* ** SQLLD2 ** "sqlld2" is an extended version of */ |
| 56 | /* the sqllda function used to pass a connection to OCI. */ |
| 57 | /* "sqlld2" can be used at any time to set up an "lda" for use */ |
| 58 | /* by OCI. It does not need to called immediately after a SQL */ |
| 59 | /* statement using the particular connection (typically the */ |
| 60 | /* CONNECT itself). */ |
| 61 | /****************************************************************************/ |
| 62 | |
| 63 | #define SQLDAGetNamed(arg1, arg2, arg3, arg4) sqlld2t(arg1, arg2, arg3, arg4) |
| 64 | |
| 65 | void sqlld2( Lda_Def *lda, text *hname, sb4 *hnamel ); |
| 66 | /* LDa version 2. Creates an lda for use in OCI programs. The difference |
| 67 | ** between sqlld2 and sqllda is that sqlld2 allows specification of |
| 68 | ** the database host name to determine the connection to use in |
| 69 | ** establishing the lda. |
| 70 | ** hname - buffer containing the "logical" name for this connection. This |
| 71 | ** would be the same identifier used in an AT clause in an |
| 72 | ** embedded SQL statement. A null ptr indicates the "default" |
| 73 | ** database used when there is no AT clause in a SQL statement. |
| 74 | ** hnamel - length of buffer containing hname. |
| 75 | */ |
| 76 | |
| 77 | void sqlld2t( dvoid *sqluga, Lda_Def *lda, text *hname, sb4 *hnamel ); |
| 78 | /* Thread-safe version of sqlld2. Takes an extra parameter sqluga, which |
| 79 | * is the SQLLIB runtime context. |
| 80 | */ |
| 81 | |
| 82 | #define SQLCDAFromResultSetCursor(arg1, arg2, arg3, arg4) \ |
| 83 | sqlcdat(arg1, arg2, arg3, arg4) |
| 84 | |
| 85 | void sqlcda( Cda_Def *cda, dvoid *cur, sword *retval ); |
| 86 | /* |
| 87 | * Name: sqlcda() - SQLlib result set cursor to a Cursor Data Area in OCI |
| 88 | * Description: Translates a result set cursor in SQLLIB to a cursor data area |
| 89 | * in OCI. Both of these structs should have been previously |
| 90 | * created/allocated. |
| 91 | * Input : cur - pointer to a result set cursor struct allocated thru Pro* |
| 92 | * Output : cda - pointer to destination cursor data area in OCI |
| 93 | * retval- Return value: 0 if no error,SQLLIB error number otherwise |
| 94 | * |
| 95 | * Notes: 1. In case of an error, the v2_rc and rc fields of the cda are |
| 96 | * populated with the negative and positive error codes respectively. |
| 97 | * 2. The 'rows processed count' in the cda structure is NOT populated |
| 98 | * in this routine. This field is set to the correct value only |
| 99 | * AFTER a fetch is done in OCI using the cda. Same |
| 100 | * comment applies to other cda fields like the function type. |
| 101 | * =========================================================================== |
| 102 | */ |
| 103 | void sqlcdat(dvoid *sqluga, Cda_Def *cda, dvoid *cur, sword *retval ); |
| 104 | /* Thread-safe version of sqlcda(). Takes an extra parameter sqluga, which |
| 105 | * is the SQLLIB runtime context. |
| 106 | */ |
| 107 | |
| 108 | #define SQLCDAToResultSetCursor(SQL_SINGLE_RCTX, arg1, arg2, arg3) \ |
| 109 | sqlcurt(arg1, arg2, arg3, arg4) |
| 110 | |
| 111 | void sqlcur( dvoid *cur, Cda_Def *cda, sword *retval ); |
| 112 | /* |
| 113 | * Name: sqlcur() - SQLlib result set CURsor from an oci cursor data area |
| 114 | * Description: Translates a cursor data area in OCI to a result set cursor |
| 115 | * in SQLLIB. Both of these structs should have been previously |
| 116 | * created/allocated. |
| 117 | * Input : cda - pointer to a cursor data area in OCI |
| 118 | * Output : cur - pointer to a result set cursor struct (previously |
| 119 | * allocated thru PCC) |
| 120 | * retval - Return value: 0 if no error, error code otherwise. |
| 121 | * Notes : The sqlca structure for PCC is NOT updated by this routine. This |
| 122 | * structure gets populated (with error code, rows fetched count etc) |
| 123 | * only AFTER a database operation is performed through PCC using the |
| 124 | * translated cursor. |
| 125 | *============================================================================ |
| 126 | */ |
| 127 | void sqlcurt(dvoid *sqluga, dvoid *cur, Cda_Def *cda, sword *retval ); |
| 128 | /* Thread-safe version of sqlcur(). Takes an extra parameter sqluga, which |
| 129 | * is the SQLLIB runtime context. |
| 130 | */ |
| 131 | |
| 132 | #endif /* SQLAPR */ |