![]() |
TerraLib 4.1
|
00001 /* Copyright (c) 1999, 2001, Oracle Corporation. All rights reserved. */ 00002 00003 /* 00004 NAME 00005 ocixad.h - OCI eXtensible Access Driver (for external tables) 00006 00007 DESCRIPTION 00008 Provides handles for XAD support. 00009 00010 RELATED DOCUMENTS 00011 External Tables Design specification (external_tab_ds.doc) 00012 00013 EXPORT FUNCTION(S) 00014 00015 INTERNAL FUNCTION(S) 00016 00017 EXAMPLES 00018 00019 NOTES 00020 Currently these interfaces are for Oracle internal use only. 00021 00022 MODIFIED (MM/DD/YY) 00023 cmlim 08/10/01 - date cache: add XADSESSION attrs: DCACHE_SIZE 00024 abrumm 04/18/01 - define interface method signatures in OCIXAD 00025 abrumm 02/20/01 - add attributes for ACCESS_PARM_TYPE 00026 abrumm 01/18/01 - more OCI_ATTR_XADSESSION attributes 00027 abrumm 10/09/00 - use oratypes.h, not s.h 00028 abrumm 03/30/00 - external table support 00029 abrumm 03/30/00 - Creation 00030 00031 */ 00032 00033 #ifndef OCIXAD_ORACLE 00034 #define OCIXAD_ORACLE 00035 00036 #ifndef ORATYPES 00037 #include <oratypes.h> 00038 #endif 00039 00040 #ifndef OCIDFN 00041 #include <ocidfn.h> 00042 #endif 00043 00044 #ifndef OCI_ORACLE 00045 #include <oci.h> 00046 #endif 00047 00048 #ifndef OCIEXTP_ORACLE 00049 #include <ociextp.h> 00050 #endif 00051 00052 /*--------------------------------------------------------------------------- 00053 PUBLIC TYPES AND CONSTANTS 00054 ---------------------------------------------------------------------------*/ 00055 00056 /*----- Handles and descriptors for access driver operations (OCIXAD*) -----*/ 00057 typedef struct OCIXADSession OCIXADSession; /* session handle */ 00058 typedef struct OCIXADTable OCIXADTable; /* table handle */ 00059 typedef struct OCIXADField OCIXADField; /* field handle */ 00060 typedef struct OCIXADGranule OCIXADGranule; /* granule handle */ 00061 00062 /*---------------- Access Driver method interface signatures ----------------*/ 00063 00064 /* Each of the following access driver methods are logically member functions 00065 * of the OCIXADSession handle. As such, the first argument to the method is 00066 * the OCIXADSession handle (i.e. "this"). 00067 * 00068 * An access driver writer must provide these entry points at configure 00069 * time via the OCIXADMethodEntry structure. 00070 */ 00071 00072 typedef sword (*OCIXADMethodOpen)(OCIXADSession *xadses, 00073 OCIExtProcContext *withCtx, 00074 OCIXADTable *xadtbl, 00075 OCILobLocator *accessParm); 00076 00077 typedef sword (*OCIXADMethodFetchInit)(OCIXADSession *xadses, 00078 OCIExtProcContext *withCtx, 00079 OCIXADTable *xadtbl, 00080 OCINumber *gnum, ub4 maxRowCnt); 00081 00082 typedef sword (*OCIXADMethodFetch)(OCIXADSession *xadses, 00083 OCIExtProcContext *withCtx, 00084 OCIXADTable *xadtbl, void *opaqueCtx, 00085 ub4 rowCnt, sb4 rejctLmt, 00086 sb4 *rejctCntp); 00087 00088 typedef void (*OCIXADMethodPopulateInit)(OCIXADSession *xadses, 00089 OCIExtProcContext *withCtx); 00090 00091 typedef void (*OCIXADMethodPopulate)(OCIXADSession *xadses, 00092 OCIExtProcContext *withCtx); 00093 00094 typedef void (*OCIXADMethodPopulateTerm)(OCIXADSession *xadses, 00095 OCIExtProcContext *withCtx); 00096 00097 typedef sword (*OCIXADMethodClose)(OCIXADSession *xadses, 00098 OCIExtProcContext *withCtx, 00099 OCIXADTable *xadtbl); 00100 00101 typedef void (*OCIXADMethodErrorCallback)(OCIXADSession *xadses, 00102 OCIExtProcContext *withCtx, 00103 void *opaqueCtx, OCIError *errhp, 00104 ub4 rowidx, ub2 colIdx); 00105 00106 /* Access Driver Method Entry points provided at "configure" time. */ 00107 struct OCIXADMethodEntry 00108 { 00109 ub4 Version_OCIXADMethodEntry; 00110 #define OCIXAD_METHOD_ENTRY_VERSION_1 100 00111 #define OCIXAD_METHOD_ENTRY_VERSION_CUR OCIXAD_METHOD_ENTRY_VERSION_1 00112 00113 OCIXADMethodOpen Open_OCIXADMethodEntry; 00114 OCIXADMethodFetchInit FetchInit_OCIXADMethodEntry; 00115 OCIXADMethodFetch Fetch_OCIXADMethodEntry; 00116 OCIXADMethodPopulateInit PopulateInit_OCIXADMethodEntry; 00117 OCIXADMethodPopulate Populate_OCIXADMethodEntry; 00118 OCIXADMethodPopulateTerm PopulateTerm_OCIXADMethodEntry; 00119 OCIXADMethodClose Close_OCIXADMethodEntry; 00120 OCIXADMethodErrorCallback ErrorCallback_OCIXADMethodEntry; 00121 }; 00122 typedef struct OCIXADMethodEntry OCIXADMethodEntry; 00123 00124 /* Each access driver type (e.g. "ORACLE_LOADER") must provide a 00125 * configure function (currently via the kpxdconf[] array). 00126 * The configure function must set the 00127 * OCI_ATTR_XADSESSION_METHOD_ENTRY_POINTS attribute of the passed in 00128 * 'hndl' argument. The OCI_ATTR_XADSESSION_METHOD_ENTRY_POINTS attribute 00129 * is a pointer to an OCIXADMethodEntry structure. 00130 */ 00131 typedef sword (*OCIXADConfig)(OraText *driverType, /* driver type name */ 00132 void *hndl, /* OCIXADSession handle */ 00133 ub4 hndlType, /* handle type */ 00134 OCIError *errhp); /* OCI error handle */ 00135 00136 /* Granule handle client callback prototypes for external tables. 00137 * The granulesPerSrc vector is allocated with numsrc_kpxg entries. 00138 * The access drivers granule info method (if present) should populate 00139 * each entry of the granulesPerSrc vector with the number of granules 00140 * for the corresponding source number. 00141 */ 00142 typedef void (*OCIXADMethodGranuleInfo)(OCIXADGranule *xadgran, 00143 OCIExtProcContext *withCtx, 00144 ub4 *granulesPerSrc); 00145 00146 /*------------------------------ OCIXADSession ------------------------------*/ 00147 /*----- Defines for OCIXADSession Attributes -----*/ 00148 #define OCI_ATTR_XADSESSION_TABLE 1 00149 #define OCI_ATTR_XADSESSION_LOCATIONS 2 00150 #define OCI_ATTR_XADSESSION_NAMES 2 /* synonym for locations */ 00151 #define OCI_ATTR_XADSESSION_DIRECTORIES 3 00152 #define OCI_ATTR_XADSESSION_GRANULE 4 00153 #define OCI_ATTR_XADSESSION_OPCODE 5 00154 #define OCI_ATTR_XADSESSION_CALLERID 6 00155 #define OCI_ATTR_XADSESSION_GRANULESIZE 7 00156 #define OCI_ATTR_XADSESSION_DATAMODE 8 00157 #define OCI_ATTR_XADSESSION_AGENT_NUMBER 9 00158 #define OCI_ATTR_XADSESSION_OPAQUECTX 10 00159 00160 /*----- OCIXADSession virtual methods (methods as attributes) -----*/ 00161 #define OCI_ATTR_XADSESSION_METHOD_ENTRY_POINTS 11 00162 /* type for GET, SET */ 00163 /* (OCIXADMethodEntry **, OCIXADMethodEntry *) */ 00164 00165 /* more OCIXADSession Attributes (numbering starts after entry points) */ 00166 /* type for GET, SET */ 00167 #define OCI_ATTR_XADSESSION_DEFAULT_DIRECTORY 12 /* (text **, text *) */ 00168 #define OCI_ATTR_XADSESSION_DRIVER_TYPE 13 /* (text **, text *) */ 00169 #define OCI_ATTR_XADSESSION_SAMPLE_TYPE 14 /* (ub4 *, ub4 *) */ 00170 #define OCI_ATTR_XADSESSION_SAMPLE_PERCENT 15 /* (ub4 *, ub4 *) */ 00171 #define OCI_ATTR_XADSESSION_ACCESS_PARM_TYPE 16 /* (ub1 *, ub1 *) */ 00172 #define OCI_ATTR_XADSESSION_DCACHE_SIZE 17 /* (ub4 *, ub4 *) */ 00173 #define OCI_ATTR_XADSESSION_DCACHE_NUM 18 /* (ub4 *), n/a ) */ 00174 #define OCI_ATTR_XADSESSION_DCACHE_DISABLE 19 /* (ub1 *), n/a ) */ 00175 #define OCI_ATTR_XADSESSION_DCACHE_HITS 20 /* (ub4 *), n/a ) */ 00176 #define OCI_ATTR_XADSESSION_DCACHE_MISSES 21 /* (ub4 *), n/a ) */ 00177 00178 00179 /*----- Values for OCI_ATTR_XADSESSION_OPCODE -----*/ 00180 #define OCI_XADSESSION_OPCODE_FETCH 1 00181 #define OCI_XADSESSION_OPCODE_POPULATE 2 00182 00183 /*----- Values for OCI_ATTR_XADSESSION_CALLERID -----*/ 00184 #define OCI_XADSESSION_CALLERID_QC 1 /* query coordinator */ 00185 #define OCI_XADSESSION_CALLERID_SHADOW 2 00186 #define OCI_XADSESSION_CALLERID_SLAVE 3 00187 00188 /*----- Values for OCI_ATTR_XADSESSION_DATAMODE -----*/ 00189 #define OCI_XADSESSION_DATAMODE_STREAM 1 00190 #define OCI_XADSESSION_DATAMODE_FIELD 2 00191 00192 /*----- Values for OCI_ATTR_XADSESSION_SAMPLE_TYPE -----*/ 00193 #define OCI_XADSESSION_SAMPLE_NONE 0 /* not sampling */ 00194 #define OCI_XADSESSION_SAMPLE_ROW 1 /* row level sampling */ 00195 #define OCI_XADSESSION_SAMPLE_BLOCK 2 /* block level sampling */ 00196 00197 /*----- Values for OCI_ATTR_XADSESSION_ACCESS_PARM_TYPE -----*/ 00198 #define OCI_XADSESSION_ACCESS_PARM_TYPE_CLOB 1 /* accessParm is CLOB */ 00199 #define OCI_XADSESSION_ACCESS_PARM_TYPE_BLOB 2 /* accessParm is BLOB */ 00200 00201 /*------------------------------- OCIXADTable -------------------------------*/ 00202 /*----- Defines for OCIXADTable Attributes -----*/ 00203 #define OCI_ATTR_XADTABLE_SESSION 1 00204 #define OCI_ATTR_XADTABLE_NAME 2 00205 #define OCI_ATTR_XADTABLE_COLUMNS 3 00206 #define OCI_ATTR_XADTABLE_REF_COLUMNS 4 00207 #define OCI_ATTR_XADTABLE_FIELDS 5 00208 #define OCI_ATTR_XADTABLE_NUM_FIELDS 6 00209 #define OCI_ATTR_XADTABLE_OPAQUECTX 7 00210 #define OCI_ATTR_XADTABLE_NUM_COLS 8 00211 #define OCI_ATTR_XADTABLE_NUM_REF_COLS 9 00212 #define OCI_ATTR_XADTABLE_SCHEMA 10 00213 00214 /*------------------------------- OCIXADField -------------------------------*/ 00215 /*----- Defines for OCIXADField Attributes -----*/ 00216 #define OCI_ATTR_XADFIELD_COLUMN_NUM 1 00217 #define OCI_ATTR_XADFIELD_DATA_TYPE 2 00218 #define OCI_ATTR_XADFIELD_PRECISION 3 00219 #define OCI_ATTR_XADFIELD_SCALE 4 00220 #define OCI_ATTR_XADFIELD_CHARSET_ID 5 00221 #define OCI_ATTR_XADFIELD_FORMAT_MASK 6 00222 #define OCI_ATTR_XADFIELD_ADDR 7 00223 #define OCI_ATTR_XADFIELD_LENGTH 8 00224 #define OCI_ATTR_XADFIELD_ISNULL 9 00225 #define OCI_ATTR_XADFIELD_ISPARTIAL 10 00226 #define OCI_ATTR_XADFIELD_OPAQUECTX 11 00227 00228 /*------------------------------ OCIXADGranule ------------------------------*/ 00229 /*----- Defines for OCIXADGranule Attributes -----*/ 00230 #define OCI_ATTR_XADGRANULE_NUM_GRANULES 1 00231 #define OCI_ATTR_XADGRANULE_NUM_SRC 2 00232 #define OCI_ATTR_XADGRANULE_INTRA_SRC_CONCURRENCY 3 00233 #define OCI_ATTR_XADGRANULE_OPAQUECTX 4 00234 00235 /*----- OCIXADGranule virtual methods (methods as attributes) -----*/ 00236 #define OCI_ATTR_XADGRANULE_INFO_METHOD 5 00237 00238 00239 /*--------------------------------------------------------------------------- 00240 PRIVATE TYPES AND CONSTANTS 00241 ---------------------------------------------------------------------------*/ 00242 /* NONE */ 00243 00244 /*--------------------------------------------------------------------------- 00245 EXPORT FUNCTIONS 00246 ---------------------------------------------------------------------------*/ 00247 00248 /*-------------------------- OCIXADSession Methods --------------------------*/ 00249 /* NONE */ 00250 00251 /*--------------------------- OCIXADTable Methods ---------------------------*/ 00252 /* 00253 NAME 00254 OCIXADTableSetRowValues 00255 00256 DESCRIPTION 00257 To set the individual column values for a row by iterating through the 00258 OCIXADField handle vector which is attached to the passed in OCIXADTable 00259 handle. The OCIXADTableSetRowValues method is called once for complete 00260 rows, multiple times for pieced rows. 00261 The column array row index is returned as an OUT parameter (*rowIdxp). 00262 00263 RETURNS 00264 OCI_SUCCESS: all column array entries set. 00265 OCI_CONTINUE: a partial Field was encountered. 00266 OCI_ERROR: a partial field encountered for a column which 00267 does not allow partial fields (partials are only allowed 00268 for LOB and LONG columns). 00269 NOTES 00270 */ 00271 sword 00272 #if defined(__STDC__) || defined(__cplusplus) 00273 OCIXADTableSetRowValues(OCIXADTable *tblhp, ub4 *rowIdxp,OCIError *errhp); 00274 #else 00275 OCIXADTableSetRowValues(/*_ OCIXADTable *tblhp, ub4 *rowIdxp , 00276 OCIError *errhp _*/); 00277 #endif 00278 00279 00280 /*--------------------------- OCIXADField Methods ---------------------------*/ 00281 /* 00282 NAME 00283 OCIXADFieldSet 00284 00285 DESCRIPTION 00286 Sets run-time (data dependent) attributes of the OCIXADField handle. 00287 00288 RETURNS 00289 OCI_SUCCESS: Field attributes successfully set. 00290 OCI_ERROR: Invalid combination of flags, 00291 or NULL addr value for a non-NULL field, 00292 or length of zero for a non-NULL field, 00293 NOTES 00294 Basically for convenience and efficiency, so the application does 00295 not have to do four OCIAttrSet calls to set these attributes. 00296 */ 00297 sword 00298 #if defined(__STDC__) || defined(__cplusplus) 00299 OCIXADFieldSet(OCIXADField *fldhp, ub1 *addr, ub4 length, ub1 isnull, 00300 ub1 ispartial); 00301 #else 00302 OCIXADFieldSet(/*_ OCIXADField *fldhp, ub1 *addr, ub4 length, ub1 isnull, 00303 ub1 ispartial _*/); 00304 #endif 00305 00306 /*-------------------------- OCIXADGranule Methods --------------------------*/ 00307 /* NONE */ 00308 00309 00310 /*--------------------------------------------------------------------------- 00311 INTERNAL FUNCTIONS 00312 ---------------------------------------------------------------------------*/ 00313 /* NONE */ 00314 00315 00316 #endif /* OCIXAD_ORACLE */