blob: d73258c339e7ed641c39d3ad73974f0be26d2be0 [file] [log] [blame]
Tang Cheng31b95252014-10-23 09:22:35 +08001/*
2 *
3 */
4
5/* Copyright (c) 1998, 2005, Oracle. All rights reserved. */
6
7/*
8 NAME
9 oci8dp.h - OCI: Direct Path API interface prototypes.
10
11 DESCRIPTION
12 Public types, constants, and interfaces to the direct path API.
13
14 RELATED DOCUMENTS
15
16 NOTES
17 This file is not directly included by the application, this file
18 is included by "oci.h", which the application should include.
19
20 MODIFIED (MM/DD/YY)
21 dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup
22 rphillip 02/27/04 - Add OCI_DIRPATH_COL_ERROR
23 srseshad 03/12/03 - convert oci public api to ansi
24 msakayed 10/28/02 - Bug #2643907: add OCI_ATTR_DIRPATH_SKIPINDEX_METHOD
25 cmlim 04/13/01 - remove OCIDirPathStreamToStream - not used by dpapi
26 cmlim 04/02/01 - OCI_DIRPATH_EXPR_OPQ_SQL_FN to OCI_DIRPATH_EXPR_SQL
27 ebatbout 01/22/01 - PARTIAL value for OCIDirPathDataSave action parameter
28 cmlim 07/20/00 - support opaques/sql strings in 8.2 dpapi
29 cmlim 08/14/00 - support refs in 8.2 dpapi
30 cmlim 04/17/00 - add defines for OCIDirPathFuncCtx handle & OCI_ATTR_D
31 whe 09/01/99 - 976457:check __cplusplus for C++ code
32 abrumm 04/16/99 - dpapi: more attributes
33 abrumm 02/26/99 - add defines for DataSave action
34 abrumm 10/04/98 - clen must be a ub4
35 abrumm 05/27/98 - add column array flag values
36 abrumm 05/12/98 - direct path api support
37 abrumm 03/31/98 - OCI direct path interface support
38 abrumm 03/18/98 - Creation
39
40*/
41
42#ifndef OCI8DP_ORACLE
43# define OCI8DP_ORACLE
44
45#ifndef ORATYPES
46#include <oratypes.h>
47#endif
48
49#ifndef OCIDFN
50#include <ocidfn.h>
51#endif
52
53#ifndef OCI_ORACLE
54#include <oci.h>
55#endif
56
57
58/*---------------------------------------------------------------------------
59 PUBLIC TYPES AND CONSTANTS
60 ---------------------------------------------------------------------------*/
61
62/*----- Handles and descriptors for direct path operations (OCIDirPath*) ----*/
63
64typedef struct OCIDirPathCtx OCIDirPathCtx; /* context */
65typedef struct OCIDirPathFuncCtx OCIDirPathFuncCtx; /* function context */
66typedef struct OCIDirPathColArray OCIDirPathColArray; /* column array */
67typedef struct OCIDirPathStream OCIDirPathStream; /* stream */
68typedef struct OCIDirPathDesc OCIDirPathDesc; /* direct path descriptor */
69
70 /*----- Defines for Direct Path Options -----*/
71
72 /* values for OCI_ATTR_DIRPATH_MODE attribute */
73#define OCI_DIRPATH_LOAD 1 /* direct path load operation */
74#define OCI_DIRPATH_UNLOAD 2 /* direct path unload operation */
75#define OCI_DIRPATH_CONVERT 3 /* direct path convert only operation */
76
77 /*----- values for OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD attribute -----*/
78#define OCI_DIRPATH_INDEX_MAINT_SINGLE_ROW 1
79
80/* Note that there are two attributes dealing with index maintenance -
81 * OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD and OCI_ATTR_DIRPATH_SKIPINDEX_METHOD.
82 * OCI_ATTR_DIRPATH_SKIPINDEX_METHOD exists to isolate the behavior for
83 * skipping index maintenance since maintenance of unusable indexes is
84 * orthogonal to that of single row insertion.
85 * For backwards compatibility we still allow users to specify skip
86 * methods in OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD so make sure the
87 * enumerations for the two attributes are distinct.
88 */
89 /*----- values for OCI_ATTR_DIRPATH_SKIPINDEX_METHOD attribute -----*/
90#define OCI_DIRPATH_INDEX_MAINT_SKIP_UNUSABLE 2
91#define OCI_DIRPATH_INDEX_MAINT_DONT_SKIP_UNUSABLE 3
92#define OCI_DIRPATH_INDEX_MAINT_SKIP_ALL 4
93
94 /* values for OCI_ATTR_STATE attribute of OCIDirPathCtx */
95#define OCI_DIRPATH_NORMAL 1 /* can accept rows, last row complete */
96#define OCI_DIRPATH_PARTIAL 2 /* last row was partial */
97#define OCI_DIRPATH_NOT_PREPARED 3 /* direct path context is not prepared */
98
99 /*----- values for cflg argument to OCIDirpathColArrayEntrySet -----*/
100#define OCI_DIRPATH_COL_COMPLETE 0 /* column data is complete */
101#define OCI_DIRPATH_COL_NULL 1 /* column is null */
102#define OCI_DIRPATH_COL_PARTIAL 2 /* column data is partial */
103#define OCI_DIRPATH_COL_ERROR 3 /* column error, ignore row */
104 /*----- values for action parameter to OCIDirPathDataSave -----*/
105#define OCI_DIRPATH_DATASAVE_SAVEONLY 0 /* data save point only */
106#define OCI_DIRPATH_DATASAVE_FINISH 1 /* execute finishing logic */
107/* save portion of input data (before space error occurred) and finish */
108#define OCI_DIRPATH_DATASAVE_PARTIAL 2
109
110 /*- OCI_ATTR_DIRPATH_EXPR_TYPE values (describes OCI_ATTR_NAME expr type) -*/
111#define OCI_DIRPATH_EXPR_OBJ_CONSTR 1 /* NAME is an object constructor */
112#define OCI_DIRPATH_EXPR_SQL 2 /* NAME is an opaque or sql function */
113#define OCI_DIRPATH_EXPR_REF_TBLNAME 3 /* NAME is table name if ref is scoped*/
114
115
116/*---------------------------------------------------------------------------
117 PUBLIC FUNCTIONS
118 ---------------------------------------------------------------------------*/
119
120/*------------------------ OCIDirPathCtx Operations -------------------------*/
121
122/*
123 NAME
124 OCIDirPathAbort - OCI: Abort a direct path operation.
125
126 DESCRIPTION
127 Aborts a direct path operation. Upon successful completion
128 the direct path context is no longer valid.
129
130 RETURNS
131 An OCI error code, Oracle errors are returned via the error handle.
132 NOTES
133 */
134sword
135OCIDirPathAbort( OCIDirPathCtx *dpctx, OCIError *errhp );
136
137/*
138 NAME
139 OCIDirPathDataSave - OCI: Execute a data save point.
140
141 DESCRIPTION
142 Successful return of this function indicates that a data save
143 point has been executed.
144
145 RETURNS
146 An OCI error code, Oracle errors are returned via the error handle.
147 NOTES
148 */
149sword
150OCIDirPathDataSave( OCIDirPathCtx *dpctx, OCIError *errhp, ub4 action );
151
152/*
153 NAME
154 OCIDirPathFinish - OCI: Finish a direct path operation.
155
156 DESCRIPTION
157 Finishes a direct path operation.
158
159 RETURNS
160 An OCI error code, Oracle errors are returned via the error handle.
161 NOTES
162 */
163sword
164OCIDirPathFinish( OCIDirPathCtx *dpctx, OCIError *errhp );
165
166/*
167 NAME
168 OCIDirPathFlushRow - OCI: Flush a partial row from the server.
169
170 DESCRIPTION
171 Flushes a partially loaded row from the server.
172
173 RETURNS
174 An OCI error code, Oracle errors are returned via the error handle.
175 NOTES
176 */
177sword
178OCIDirPathFlushRow( OCIDirPathCtx *dpctx, OCIError *errhp );
179
180/*
181 NAME
182 OCIDirPathPrepare - OCI: Prepare a direct path operation.
183
184 DESCRIPTION
185 Prepares a table/partition for a direct path operation.
186
187 RETURNS
188 An OCI error code, Oracle errors are returned via the error handle.
189 NOTES
190 */
191sword
192OCIDirPathPrepare( OCIDirPathCtx *dpctx, OCISvcCtx *svchp,
193 OCIError *errhp );
194
195/*
196 NAME
197 OCIDirPathLoadStream - OCI: Load a direct path stream.
198
199 DESCRIPTION
200 Load a direct path stream to the object associated with
201 the direct path context.
202
203 RETURNS
204 An OCI error code, Oracle errors are returned via the error handle.
205 NOTES
206 */
207sword
208OCIDirPathLoadStream( OCIDirPathCtx *dpctx, OCIDirPathStream *dpstr,
209 OCIError *errhp );
210
211
212/*---------------------- OCIDirPathColArray Operations ----------------------*/
213
214/*
215 NAME
216 OCIDirPathColArrayEntryGet - OCI: Get column array entry.
217
218 DESCRIPTION
219 Column array function which is used to get a specified entry in
220 a column array.
221
222 RETURNS
223 An OCI error code, Oracle errors are returned via the error handle.
224 NOTES
225 */
226sword
227OCIDirPathColArrayEntryGet( OCIDirPathColArray *dpca, OCIError *errhp,
228 ub4 rownum, ub2 colIdx, ub1 **cvalpp, ub4 *clenp,
229 ub1 *cflgp );
230
231/*
232 NAME
233 OCIDirPathColArrayEntrySet - OCI: Set column array entry.
234
235 DESCRIPTION
236 Column array function which is used to set a specified entry in
237 a column array.
238
239 RETURNS
240 An OCI error code, Oracle errors are returned via the error handle.
241 NOTES
242 */
243sword
244OCIDirPathColArrayEntrySet( OCIDirPathColArray *dpca, OCIError *errhp,
245 ub4 rownum, ub2 colIdx, ub1 *cvalp, ub4 clen,
246 ub1 cflg );
247
248/*
249 NAME
250 OCIDirPathColArrayRowGet - OCI: Get column array row pointers.
251
252 DESCRIPTION
253 Column array function which is used to get the base row pointers
254 for a specified row in a column array.
255 To be used in lieu of OCIDirPathColArrayEntryGet() and
256 OCIDirPathColArrayEntrySet().
257
258 RETURNS
259 An OCI error code, Oracle errors are returned via the error handle.
260 NOTES
261 */
262sword
263OCIDirPathColArrayRowGet( OCIDirPathColArray *dpca, OCIError *errhp,
264 ub4 rownum, ub1 ***cvalppp, ub4 **clenpp,
265 ub1 **cflgpp );
266
267/*
268 NAME
269 OCIDirPathColArrayReset - OCI: Reset Column Array State
270
271 DESCRIPTION
272 Function which resets the column array state.
273
274 RETURNS
275 An OCI error code, Oracle errors are returned via the error handle.
276 NOTES
277 Resetting the column array state is necessary when piecing in a large
278 column and an error occurs in the middle of loading the column.
279 */
280sword
281OCIDirPathColArrayReset( OCIDirPathColArray *dpca, OCIError *errhp );
282
283/*
284 NAME
285 OCIDirPathColArrayToStream - OCI: Convert Column Array to Stream Format.
286
287 DESCRIPTION
288 Convert from column array format to stream format which is suitable
289 for loading via OCIDirPathLoadStream().
290
291 RETURNS
292 An OCI error code, Oracle errors are returned via the error handle.
293 NOTES
294 */
295sword
296OCIDirPathColArrayToStream( OCIDirPathColArray *dpca, OCIDirPathCtx *dpctx,
297 OCIDirPathStream *dpstr, OCIError *errhp,
298 ub4 rowcnt, ub4 rowoff );
299
300
301
302/*----------------------- OCIDirPathStream Operations -----------------------*/
303
304/*
305 NAME
306 OCIDirPathStreamReset - OCI:
307
308 DESCRIPTION
309
310 RETURNS
311 An OCI error code, Oracle errors are returned via the error handle.
312 NOTES
313 */
314sword
315OCIDirPathStreamReset( OCIDirPathStream *dpstr, OCIError *errhp );
316
317#endif /* OCI8DP_ORACLE */