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