Tang Cheng | 03c0b0a | 2015-01-12 11:19:45 +0800 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * $Header: sql2oci.h 08-may-2002.12:13:40 apopat Exp $ |
| 4 | */ |
| 5 | |
| 6 | /* Copyright (c) 1996, 2002, Oracle Corporation. All rights reserved. */ |
| 7 | |
| 8 | /* NOTE: See 'header_template.doc' in the 'doc' dve under the 'forms' |
| 9 | directory for the header file template that includes instructions. |
| 10 | */ |
| 11 | |
| 12 | /* |
| 13 | NAME |
| 14 | sql2oci.h - SQLLIB functions for V8 OCI interoperability |
| 15 | |
| 16 | DESCRIPTION |
| 17 | This file contains SQLLIB functions to obtain OCI environment handle |
| 18 | and OCI service context in a Pro*c program. |
| 19 | |
| 20 | RELATED DOCUMENTS |
| 21 | |
| 22 | INSPECTION STATUS |
| 23 | Inspection date: |
| 24 | Inspection status: |
| 25 | Estimated increasing cost defects per page: |
| 26 | Rule sets: |
| 27 | |
| 28 | ACCEPTANCE REVIEW STATUS |
| 29 | Review date: |
| 30 | Review status: |
| 31 | Reviewers: |
| 32 | |
| 33 | PUBLIC FUNCTION(S) |
| 34 | SQLEnvGet() |
| 35 | SQLSvcCtxGet() |
| 36 | |
| 37 | PRIVATE FUNCTION(S) |
| 38 | NONE |
| 39 | |
| 40 | EXAMPLES |
| 41 | |
| 42 | NOTES |
| 43 | <other useful comments, qualifications, etc.> |
| 44 | |
| 45 | MODIFIED (MM/DD/YY) |
| 46 | apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 |
| 47 | apopat 07/31/99 - [707588] TAB to blanks for OCCS |
| 48 | apopat 04/06/99 - [563753] Allowing prototypes for C++ |
| 49 | lvbcheng 06/23/98 - Add SQLRowidGet |
| 50 | sylin 02/25/98 - [600216] Add C++ support |
| 51 | lvbcheng 05/13/97 - Desupport wrappers |
| 52 | lvbcheng 01/13/97 - fix non-ANSI SQLNumberFromFloat error |
| 53 | lvbcheng 01/03/97 - test |
| 54 | lvbcheng 01/03/97 - Revert back to OCINumber * |
| 55 | lvbcheng 12/12/96 - Finalize |
| 56 | lvbcheng 12/06/96 - test |
| 57 | lvbcheng 12/06/96 - test |
| 58 | lvbcheng 12/05/96 - Add default context code |
| 59 | lvbcheng 12/05/96 - Add connection to sqlcpr.h and sql[a|k]pr.h |
| 60 | lvbcheng 12/05/96 - Remove merge conflicts |
| 61 | lvbcheng 12/02/96 - Change Interface of sql2oci wrappers |
| 62 | lvbcheng 10/21/96 - Add OCINumber set procedures |
| 63 | lvbcheng 10/21/96 - Add vstr wrappers |
| 64 | jbasu 08/02/96 - Remove private include files |
| 65 | jbasu 07/05/96 - [8.0] SQLSvcCtxGet() enhancements |
| 66 | jbasu 06/04/96 - Support for V80 objects |
| 67 | jbasu 06/04/96 - Creation |
| 68 | |
| 69 | */ |
| 70 | |
| 71 | #ifndef SQL2OCI_ORACLE |
| 72 | # define SQL2OCI_ORACLE |
| 73 | |
| 74 | #ifndef OCI_ORACLE |
| 75 | # include <oci.h> |
| 76 | #endif /* OCI_ORACLE */ |
| 77 | |
| 78 | #ifndef ORL_ORACLE |
| 79 | # include <orl.h> |
| 80 | #endif /* ORL_ORACLE */ |
| 81 | |
| 82 | #ifndef SQLCPR_ORACLE |
| 83 | # include <sqlcpr.h> |
| 84 | #endif /* SQLCPR_ORACLE */ |
| 85 | |
| 86 | #if defined (__STDC__) || defined (__cplusplus) |
| 87 | |
| 88 | /* --------------------- */ |
| 89 | /* Includes for ANSI C */ |
| 90 | /* --------------------- */ |
| 91 | #ifdef __cplusplus |
| 92 | extern "C" { |
| 93 | #endif |
| 94 | |
| 95 | #ifndef SQLAPR_ORACLE |
| 96 | # include <sqlapr.h> |
| 97 | #endif /* SQLAPR_ORACLE */ |
| 98 | |
| 99 | /* Get Procedures for OCI Env and Svc Ctx */ |
| 100 | |
| 101 | extern sword SQLEnvGet(dvoid *rctx, OCIEnv **oeh); |
| 102 | |
| 103 | extern sword SQLSvcCtxGet(dvoid *rctx, text *dbname, sb4 dbnamelen, |
| 104 | OCISvcCtx **svc); |
| 105 | |
| 106 | #ifdef __cplusplus |
| 107 | } |
| 108 | #endif |
| 109 | |
| 110 | #else /* k&r style - non-ANSI code */ |
| 111 | |
| 112 | /* -------------------- */ |
| 113 | /* Includes for K&R C */ |
| 114 | /* -------------------- */ |
| 115 | |
| 116 | #ifndef SQLKPR_ORACLE |
| 117 | # include <sqlkpr.h> |
| 118 | #endif /* SQLKPR_ORACLE */ |
| 119 | |
| 120 | /* ------------------------------------ */ |
| 121 | /* Get rowid of last exec sql statement */ |
| 122 | /* ------------------------------------ */ |
| 123 | |
| 124 | void SQLRowidGet(/*_ dvoid *rctx, OCIRowid **urid _*/); |
| 125 | |
| 126 | /* |
| 127 | NAME: SQLRowidGet - SQLLIB Rowid Get |
| 128 | |
| 129 | PARAMETERS: |
| 130 | rctx (IN): pointer to a sqllib runtime context |
| 131 | urid (OUT): pointer to an allocated rowid descriptor |
| 132 | |
| 133 | DESCRIPTION: |
| 134 | Sets urid to be the rowid of the last row inserted, |
| 135 | updated or selected |
| 136 | |
| 137 | */ |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | /* ------------------------------------------- */ |
| 146 | /* Get 8.0 OCI environment handle from SQLLIB */ |
| 147 | /* ------------------------------------------- */ |
| 148 | |
| 149 | sword SQLEnvGet(/*_ dvoid *rctx, OCIEnv **oeh _*/); |
| 150 | /* |
| 151 | NAME: SQLEnvGet - SQLLIB Get Environment from the Runtime Context |
| 152 | |
| 153 | PARAMETERS: |
| 154 | rctx (IN): pointer to a sqllib runtime context |
| 155 | oeh (IN/OUT): OCIEnv ptr |
| 156 | |
| 157 | DESCRIPTION: |
| 158 | Sets oeh to the OCIEnv corresponding to the runtime context. |
| 159 | |
| 160 | RETURNS: |
| 161 | status - SQL_SUCCESS on success, SQL_ERROR on failure. |
| 162 | |
| 163 | */ |
| 164 | |
| 165 | /* ---------------------------------------------- */ |
| 166 | |
| 167 | /* Get 8.0 OCI Service Context for a database connection in Pro*C */ |
| 168 | |
| 169 | /* non-threaded, no Pro*C runtime context */ |
| 170 | sword SQLSvcCtxGet(/*_ dvoid *rctx, text *dbname, sb4 dbnamelen, |
| 171 | OCISvcCtx **svc _*/); |
| 172 | /* |
| 173 | NAME: SQLSvcCtxGet - SQLLIB Service Context Get |
| 174 | |
| 175 | PARAMETERS: |
| 176 | rctx (IN): pointer to a sqllib runtime context |
| 177 | dbname (IN): buffer containing the "logical" name for this connection. |
| 178 | dbnamelen (IN): length of the dbname buffer |
| 179 | svc (IN/OUT): address of an OCISvcCtx ptr |
| 180 | |
| 181 | DESCRIPTION: |
| 182 | Sets svc to the OCI Service Context corresponding to the runtime context. |
| 183 | |
| 184 | RETURNS: |
| 185 | status - SQL_SUCCESS on success, SQL_ERROR on failure. |
| 186 | |
| 187 | NOTES: |
| 188 | 'dbname' is the buffer containing the "logical" name for this connection. |
| 189 | This would be the same identifier used in an AT clause in an embedded |
| 190 | SQL statement. |
| 191 | |
| 192 | 'dbnamelen' is the length of buffer containing dbname. |
| 193 | |
| 194 | If dbname is a NULL ptr or dbnamelen is 0, then the "default" database |
| 195 | connection is assumed (as in a SQL statement with no AT clause). |
| 196 | |
| 197 | A value of -1 for dbnamelen can be used to indicate that dbname |
| 198 | is a NULL-terminated string. |
| 199 | |
| 200 | */ |
| 201 | |
| 202 | #endif /* k&r style - non-ANSI code */ |
| 203 | |
| 204 | #endif /* SQL2OCI_ORACLE */ |