oracledb 3.0.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +135 -8
- package/README.md +6 -4
- package/build/Release/oracledb-abi48-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi48-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi48-linux-x64.node +0 -0
- package/build/Release/oracledb-abi48-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi48-win32-x64.node +0 -0
- package/build/Release/oracledb-abi48-win32-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi57-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi57-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi57-linux-x64.node +0 -0
- package/build/Release/oracledb-abi57-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi57-win32-x64.node +0 -0
- package/build/Release/oracledb-abi57-win32-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi64-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi64-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi64-linux-x64.node +0 -0
- package/build/Release/oracledb-abi64-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi64-win32-x64.node +0 -0
- package/build/Release/oracledb-abi64-win32-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi67-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi67-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi67-linux-x64.node +0 -0
- package/build/Release/oracledb-abi67-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-abi67-win32-x64.node +0 -0
- package/build/Release/oracledb-abi67-win32-x64.node-buildinfo.txt +1 -0
- package/lib/connection.js +18 -4
- package/lib/oracledb.js +44 -92
- package/lib/pool.js +36 -2
- package/lib/sodaCollection.js +1 -1
- package/lib/sodaDatabase.js +1 -1
- package/lib/util.js +82 -5
- package/package/README.md +32 -101
- package/package/install.js +139 -0
- package/package/prunebinaries.js +51 -0
- package/package.json +4 -11
- package/binding.gyp +0 -162
- package/lib/rel.txt +0 -1
- package/odpi/.npmignore +0 -4
- package/odpi/LICENSE.md +0 -218
- package/odpi/README.md +0 -61
- package/odpi/embed/README.md +0 -4
- package/odpi/embed/dpi.c +0 -50
- package/odpi/include/dpi.h +0 -1748
- package/odpi/src/dpiConn.c +0 -2089
- package/odpi/src/dpiContext.c +0 -296
- package/odpi/src/dpiData.c +0 -797
- package/odpi/src/dpiDebug.c +0 -184
- package/odpi/src/dpiDeqOptions.c +0 -370
- package/odpi/src/dpiEnqOptions.c +0 -174
- package/odpi/src/dpiEnv.c +0 -189
- package/odpi/src/dpiError.c +0 -204
- package/odpi/src/dpiErrorMessages.h +0 -86
- package/odpi/src/dpiGen.c +0 -303
- package/odpi/src/dpiGlobal.c +0 -292
- package/odpi/src/dpiHandleList.c +0 -117
- package/odpi/src/dpiHandlePool.c +0 -118
- package/odpi/src/dpiImpl.h +0 -1707
- package/odpi/src/dpiLob.c +0 -506
- package/odpi/src/dpiMsgProps.c +0 -386
- package/odpi/src/dpiObject.c +0 -897
- package/odpi/src/dpiObjectAttr.c +0 -115
- package/odpi/src/dpiObjectType.c +0 -326
- package/odpi/src/dpiOci.c +0 -3527
- package/odpi/src/dpiOracleType.c +0 -492
- package/odpi/src/dpiPool.c +0 -549
- package/odpi/src/dpiRowid.c +0 -136
- package/odpi/src/dpiSodaColl.c +0 -685
- package/odpi/src/dpiSodaCollCursor.c +0 -143
- package/odpi/src/dpiSodaDb.c +0 -432
- package/odpi/src/dpiSodaDoc.c +0 -230
- package/odpi/src/dpiSodaDocCursor.c +0 -143
- package/odpi/src/dpiStmt.c +0 -1797
- package/odpi/src/dpiSubscr.c +0 -674
- package/odpi/src/dpiUtils.c +0 -410
- package/odpi/src/dpiVar.c +0 -1794
- package/package/MAKEPKG.BAT +0 -156
- package/package/Makefile +0 -85
- package/package/createpackage.js +0 -186
- package/package/extractpackage.js +0 -76
- package/package/getversion.js +0 -37
- package/package/oracledbinstall.js +0 -497
- package/package/package.json +0 -54
- package/package/util.js +0 -286
- package/src/njsCommon.cpp +0 -1055
- package/src/njsCommon.h +0 -484
- package/src/njsConnection.cpp +0 -2926
- package/src/njsConnection.h +0 -227
- package/src/njsIntLob.cpp +0 -618
- package/src/njsIntLob.h +0 -179
- package/src/njsMessages.cpp +0 -122
- package/src/njsMessages.h +0 -118
- package/src/njsOracle.cpp +0 -1274
- package/src/njsOracle.h +0 -237
- package/src/njsPool.cpp +0 -482
- package/src/njsPool.h +0 -132
- package/src/njsResultSet.cpp +0 -478
- package/src/njsResultSet.h +0 -120
- package/src/njsSodaCollection.cpp +0 -507
- package/src/njsSodaCollection.h +0 -128
- package/src/njsSodaDatabase.cpp +0 -335
- package/src/njsSodaDatabase.h +0 -108
- package/src/njsSodaDocCursor.cpp +0 -203
- package/src/njsSodaDocCursor.h +0 -94
- package/src/njsSodaDocument.cpp +0 -412
- package/src/njsSodaDocument.h +0 -105
- package/src/njsSodaOperation.cpp +0 -557
- package/src/njsSodaOperation.h +0 -123
- package/src/njsSubscription.cpp +0 -388
- package/src/njsSubscription.h +0 -111
- package/src/njsUtils.cpp +0 -158
- package/src/njsUtils.h +0 -68
package/odpi/src/dpiOci.c
DELETED
|
@@ -1,3527 +0,0 @@
|
|
|
1
|
-
//-----------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
|
3
|
-
// This program is free software: you can modify it and/or redistribute it
|
|
4
|
-
// under the terms of:
|
|
5
|
-
//
|
|
6
|
-
// (i) the Universal Permissive License v 1.0 or at your option, any
|
|
7
|
-
// later version (http://oss.oracle.com/licenses/upl); and/or
|
|
8
|
-
//
|
|
9
|
-
// (ii) the Apache License v 2.0. (http://www.apache.org/licenses/LICENSE-2.0)
|
|
10
|
-
//-----------------------------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
//-----------------------------------------------------------------------------
|
|
13
|
-
// dpiOci.c
|
|
14
|
-
// Link to OCI using dynamic linking. The OCI library (11.2+) is loaded
|
|
15
|
-
// dynamically and a function table kept for the functions that are used by
|
|
16
|
-
// DPI. This function table is populated as functions are used and permits use
|
|
17
|
-
// of all versions of OCI from one driver.
|
|
18
|
-
//-----------------------------------------------------------------------------
|
|
19
|
-
|
|
20
|
-
#include "dpiImpl.h"
|
|
21
|
-
|
|
22
|
-
// forward declarations of internal functions only used in this file
|
|
23
|
-
static void *dpiOci__allocateMem(void *unused, size_t size);
|
|
24
|
-
static void dpiOci__freeMem(void *unused, void *ptr);
|
|
25
|
-
static int dpiOci__loadLib(dpiError *error);
|
|
26
|
-
static int dpiOci__loadLibValidate(dpiError *error);
|
|
27
|
-
static int dpiOci__loadSymbol(const char *symbolName, void **symbol,
|
|
28
|
-
dpiError *error);
|
|
29
|
-
static void *dpiOci__reallocMem(void *unused, void *ptr, size_t newSize);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// macro to simplify code for loading each symbol
|
|
33
|
-
#define DPI_OCI_LOAD_SYMBOL(symbolName, symbol) \
|
|
34
|
-
if (!symbol && dpiOci__loadSymbol(symbolName, (void**) &symbol, \
|
|
35
|
-
error) < 0) \
|
|
36
|
-
return DPI_FAILURE;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// typedefs for all OCI functions used by ODPI-C
|
|
40
|
-
typedef int (*dpiOciFnType__aqDeq)(void *svchp, void *errhp,
|
|
41
|
-
const char *queue_name, void *deqopt, void *msgprop, void *payload_tdo,
|
|
42
|
-
void **payload, void **payload_ind, void **msgid, uint32_t flags);
|
|
43
|
-
typedef int (*dpiOciFnType__aqEnq)(void *svchp, void *errhp,
|
|
44
|
-
const char *queue_name, void *enqopt, void *msgprop, void *payload_tdo,
|
|
45
|
-
void **payload, void **payload_ind, void **msgid, uint32_t flags);
|
|
46
|
-
typedef int (*dpiOciFnType__arrayDescriptorAlloc)(const void *parenth,
|
|
47
|
-
void **descpp, const uint32_t type, uint32_t array_size,
|
|
48
|
-
const size_t xtramem_sz, void **usrmempp);
|
|
49
|
-
typedef int (*dpiOciFnType__arrayDescriptorFree)(void **descp,
|
|
50
|
-
const uint32_t type);
|
|
51
|
-
typedef int (*dpiOciFnType__attrGet)(const void *trgthndlp,
|
|
52
|
-
uint32_t trghndltyp, void *attributep, uint32_t *sizep,
|
|
53
|
-
uint32_t attrtype, void *errhp);
|
|
54
|
-
typedef int (*dpiOciFnType__attrSet)(void *trgthndlp, uint32_t trghndltyp,
|
|
55
|
-
void *attributep, uint32_t size, uint32_t attrtype, void *errhp);
|
|
56
|
-
typedef int (*dpiOciFnType__bindByName)(void *stmtp, void **bindp, void *errhp,
|
|
57
|
-
const char *placeholder, int32_t placeh_len, void *valuep,
|
|
58
|
-
int32_t value_sz, uint16_t dty, void *indp, uint16_t *alenp,
|
|
59
|
-
uint16_t *rcodep, uint32_t maxarr_len, uint32_t *curelep,
|
|
60
|
-
uint32_t mode);
|
|
61
|
-
typedef int (*dpiOciFnType__bindByName2)(void *stmtp, void **bindp,
|
|
62
|
-
void *errhp, const char *placeholder, int32_t placeh_len, void *valuep,
|
|
63
|
-
int64_t value_sz, uint16_t dty, void *indp, uint32_t *alenp,
|
|
64
|
-
uint16_t *rcodep, uint32_t maxarr_len, uint32_t *curelep,
|
|
65
|
-
uint32_t mode);
|
|
66
|
-
typedef int (*dpiOciFnType__bindByPos)(void *stmtp, void **bindp, void *errhp,
|
|
67
|
-
uint32_t position, void *valuep, int32_t value_sz, uint16_t dty,
|
|
68
|
-
void *indp, uint16_t *alenp, uint16_t *rcodep, uint32_t maxarr_len,
|
|
69
|
-
uint32_t *curelep, uint32_t mode);
|
|
70
|
-
typedef int (*dpiOciFnType__bindByPos2)(void *stmtp, void **bindp, void *errhp,
|
|
71
|
-
uint32_t position, void *valuep, int64_t value_sz, uint16_t dty,
|
|
72
|
-
void *indp, uint32_t *alenp, uint16_t *rcodep, uint32_t maxarr_len,
|
|
73
|
-
uint32_t *curelep, uint32_t mode);
|
|
74
|
-
typedef int (*dpiOciFnType__bindDynamic)(void *bindp, void *errhp, void *ictxp,
|
|
75
|
-
void *icbfp, void *octxp, void *ocbfp);
|
|
76
|
-
typedef int (*dpiOciFnType__bindObject)(void *bindp, void *errhp,
|
|
77
|
-
const void *type, void **pgvpp, uint32_t *pvszsp, void **indpp,
|
|
78
|
-
uint32_t *indszp);
|
|
79
|
-
typedef int (*dpiOciFnType__break)(void *hndlp, void *errhp);
|
|
80
|
-
typedef void (*dpiOciFnType__clientVersion)(int *major_version,
|
|
81
|
-
int *minor_version, int *update_num, int *patch_num,
|
|
82
|
-
int *port_update_num);
|
|
83
|
-
typedef int (*dpiOciFnType__collAppend)(void *env, void *err, const void *elem,
|
|
84
|
-
const void *elemind, void *coll);
|
|
85
|
-
typedef int (*dpiOciFnType__collAssignElem)(void *env, void *err,
|
|
86
|
-
int32_t index, const void *elem, const void *elemind, void *coll);
|
|
87
|
-
typedef int (*dpiOciFnType__collGetElem)(void *env, void *err,
|
|
88
|
-
const void *coll, int32_t index, int *exists, void **elem,
|
|
89
|
-
void **elemind);
|
|
90
|
-
typedef int (*dpiOciFnType__collSize)(void *env, void *err, const void *coll,
|
|
91
|
-
int32_t *size);
|
|
92
|
-
typedef int (*dpiOciFnType__collTrim)(void *env, void *err, int32_t trim_num,
|
|
93
|
-
void *coll);
|
|
94
|
-
typedef int (*dpiOciFnType__contextGetValue)(void *hdl, void *err,
|
|
95
|
-
const char *key, uint8_t keylen, void **ctx_value);
|
|
96
|
-
typedef int (*dpiOciFnType__contextSetValue)(void *hdl, void *err,
|
|
97
|
-
uint16_t duration, const char *key, uint8_t keylen, void *ctx_value);
|
|
98
|
-
typedef int (*dpiOciFnType__dateTimeConstruct)(void *hndl, void *err,
|
|
99
|
-
void *datetime, int16_t yr, uint8_t mnth, uint8_t dy, uint8_t hr,
|
|
100
|
-
uint8_t mm, uint8_t ss, uint32_t fsec, const char *tz,
|
|
101
|
-
size_t tzLength);
|
|
102
|
-
typedef int (*dpiOciFnType__dateTimeGetDate)(void *hndl, void *err,
|
|
103
|
-
const void *date, int16_t *yr, uint8_t *mnth, uint8_t *dy);
|
|
104
|
-
typedef int (*dpiOciFnType__dateTimeGetTime)(void *hndl, void *err,
|
|
105
|
-
void *datetime, uint8_t *hr, uint8_t *mm, uint8_t *ss, uint32_t *fsec);
|
|
106
|
-
typedef int (*dpiOciFnType__dateTimeGetTimeZoneOffset)(void *hndl, void *err,
|
|
107
|
-
const void *datetime, int8_t *hr, int8_t *mm);
|
|
108
|
-
typedef int (*dpiOciFnType__dateTimeIntervalAdd)(void *hndl, void *err,
|
|
109
|
-
void *datetime, void *inter, void *outdatetime);
|
|
110
|
-
typedef int (*dpiOciFnType__dateTimeSubtract)(void *hndl, void *err,
|
|
111
|
-
void *indate1, void *indate2, void *inter);
|
|
112
|
-
typedef int (*dpiOciFnType__dbShutdown)(void *svchp, void *errhp, void *admhp,
|
|
113
|
-
uint32_t mode);
|
|
114
|
-
typedef int (*dpiOciFnType__dbStartup)(void *svchp, void *errhp, void *admhp,
|
|
115
|
-
uint32_t mode, uint32_t flags);
|
|
116
|
-
typedef int (*dpiOciFnType__defineByPos)(void *stmtp, void **defnp,
|
|
117
|
-
void *errhp, uint32_t position, void *valuep, int32_t value_sz,
|
|
118
|
-
uint16_t dty, void *indp, uint16_t *rlenp, uint16_t *rcodep,
|
|
119
|
-
uint32_t mode);
|
|
120
|
-
typedef int (*dpiOciFnType__defineByPos2)(void *stmtp, void **defnp,
|
|
121
|
-
void *errhp, uint32_t position, void *valuep, uint64_t value_sz,
|
|
122
|
-
uint16_t dty, void *indp, uint32_t *rlenp, uint16_t *rcodep,
|
|
123
|
-
uint32_t mode);
|
|
124
|
-
typedef int (*dpiOciFnType__defineDynamic)(void *defnp, void *errhp,
|
|
125
|
-
void *octxp, void *ocbfp);
|
|
126
|
-
typedef int (*dpiOciFnType__defineObject)(void *defnp, void *errhp,
|
|
127
|
-
const void *type, void **pgvpp, uint32_t *pvszsp, void **indpp,
|
|
128
|
-
uint32_t *indszp);
|
|
129
|
-
typedef int (*dpiOciFnType__describeAny)(void *svchp, void *errhp,
|
|
130
|
-
void *objptr, uint32_t objnm_len, uint8_t objptr_typ,
|
|
131
|
-
uint8_t info_level, uint8_t objtyp, void *dschp);
|
|
132
|
-
typedef int (*dpiOciFnType__descriptorAlloc)(const void *parenth,
|
|
133
|
-
void **descpp, const uint32_t type, const size_t xtramem_sz,
|
|
134
|
-
void **usrmempp);
|
|
135
|
-
typedef int (*dpiOciFnType__descriptorFree)(void *descp, const uint32_t type);
|
|
136
|
-
typedef int (*dpiOciFnType__envNlsCreate)(void **envp, uint32_t mode,
|
|
137
|
-
void *ctxp, void *malocfp, void *ralocfp, void *mfreefp,
|
|
138
|
-
size_t xtramem_sz, void **usrmempp, uint16_t charset,
|
|
139
|
-
uint16_t ncharset);
|
|
140
|
-
typedef int (*dpiOciFnType__errorGet)(void *hndlp, uint32_t recordno,
|
|
141
|
-
char *sqlstate, int32_t *errcodep, char *bufp, uint32_t bufsiz,
|
|
142
|
-
uint32_t type);
|
|
143
|
-
typedef int (*dpiOciFnType__handleAlloc)(const void *parenth, void **hndlpp,
|
|
144
|
-
const uint32_t type, const size_t xtramem_sz, void **usrmempp);
|
|
145
|
-
typedef int (*dpiOciFnType__handleFree)(void *hndlp, const uint32_t type);
|
|
146
|
-
typedef int (*dpiOciFnType__intervalGetDaySecond)(void *hndl, void *err,
|
|
147
|
-
int32_t *dy, int32_t *hr, int32_t *mm, int32_t *ss, int32_t *fsec,
|
|
148
|
-
const void *result);
|
|
149
|
-
typedef int (*dpiOciFnType__intervalGetYearMonth)(void *hndl, void *err,
|
|
150
|
-
int32_t *yr, int32_t *mnth, const void *result);
|
|
151
|
-
typedef int (*dpiOciFnType__intervalSetDaySecond)(void *hndl, void *err,
|
|
152
|
-
int32_t dy, int32_t hr, int32_t mm, int32_t ss, int32_t fsec,
|
|
153
|
-
void *result);
|
|
154
|
-
typedef int (*dpiOciFnType__intervalSetYearMonth)(void *hndl, void *err,
|
|
155
|
-
int32_t yr, int32_t mnth, void *result);
|
|
156
|
-
typedef int (*dpiOciFnType__lobClose)(void *svchp, void *errhp, void *locp);
|
|
157
|
-
typedef int (*dpiOciFnType__lobCreateTemporary)(void *svchp, void *errhp,
|
|
158
|
-
void *locp, uint16_t csid, uint8_t csfrm, uint8_t lobtype, int cache,
|
|
159
|
-
uint16_t duration);
|
|
160
|
-
typedef int (*dpiOciFnType__lobFileExists)(void *svchp, void *errhp,
|
|
161
|
-
void *filep, int *flag);
|
|
162
|
-
typedef int (*dpiOciFnType__lobFileGetName)(void *envhp, void *errhp,
|
|
163
|
-
const void *filep, char *dir_alias, uint16_t *d_length, char *filename,
|
|
164
|
-
uint16_t *f_length);
|
|
165
|
-
typedef int (*dpiOciFnType__lobFileSetName)(void *envhp, void *errhp,
|
|
166
|
-
void **filepp, const char *dir_alias, uint16_t d_length,
|
|
167
|
-
const char *filename, uint16_t f_length);
|
|
168
|
-
typedef int (*dpiOciFnType__lobFreeTemporary)(void *svchp, void *errhp,
|
|
169
|
-
void *locp);
|
|
170
|
-
typedef int (*dpiOciFnType__lobGetChunkSize)(void *svchp, void *errhp,
|
|
171
|
-
void *locp, uint32_t *chunksizep);
|
|
172
|
-
typedef int (*dpiOciFnType__lobGetLength2)(void *svchp, void *errhp,
|
|
173
|
-
void *locp, uint64_t *lenp);
|
|
174
|
-
typedef int (*dpiOciFnType__lobIsOpen)(void *svchp, void *errhp, void *locp,
|
|
175
|
-
int *flag);
|
|
176
|
-
typedef int (*dpiOciFnType__lobIsTemporary)(void *envp, void *errhp,
|
|
177
|
-
void *locp, int *is_temporary);
|
|
178
|
-
typedef int (*dpiOciFnType__lobLocatorAssign)(void *svchp, void *errhp,
|
|
179
|
-
const void *src_locp, void **dst_locpp);
|
|
180
|
-
typedef int (*dpiOciFnType__lobOpen)(void *svchp, void *errhp, void *locp,
|
|
181
|
-
uint8_t mode);
|
|
182
|
-
typedef int (*dpiOciFnType__lobRead2)(void *svchp, void *errhp, void *locp,
|
|
183
|
-
uint64_t *byte_amtp, uint64_t *char_amtp, uint64_t offset, void *bufp,
|
|
184
|
-
uint64_t bufl, uint8_t piece, void *ctxp, void *cbfp, uint16_t csid,
|
|
185
|
-
uint8_t csfrm);
|
|
186
|
-
typedef int (*dpiOciFnType__lobTrim2)(void *svchp, void *errhp, void *locp,
|
|
187
|
-
uint64_t newlen);
|
|
188
|
-
typedef int (*dpiOciFnType__lobWrite2)(void *svchp, void *errhp, void *locp,
|
|
189
|
-
uint64_t *byte_amtp, uint64_t *char_amtp, uint64_t offset, void *bufp,
|
|
190
|
-
uint64_t buflen, uint8_t piece, void *ctxp, void *cbfp, uint16_t csid,
|
|
191
|
-
uint8_t csfrm);
|
|
192
|
-
typedef int (*dpiOciFnType__memoryAlloc)(void *hdl, void *err, void **mem,
|
|
193
|
-
uint16_t dur, uint32_t size, uint32_t flags);
|
|
194
|
-
typedef int (*dpiOciFnType__memoryFree)(void *hdl, void *err, void *mem);
|
|
195
|
-
typedef int (*dpiOciFnType__nlsCharSetConvert)(void *envhp, void *errhp,
|
|
196
|
-
uint16_t dstid, void *dstp, size_t dstlen, uint16_t srcid,
|
|
197
|
-
const void *srcp, size_t srclen, size_t *rsize);
|
|
198
|
-
typedef int (*dpiOciFnType__nlsCharSetIdToName)(void *envhp, char *buf,
|
|
199
|
-
size_t buflen, uint16_t id);
|
|
200
|
-
typedef uint16_t (*dpiOciFnType__nlsCharSetNameToId)(void *envhp,
|
|
201
|
-
const char *name);
|
|
202
|
-
typedef int (*dpiOciFnType__nlsEnvironmentVariableGet)(void *val, size_t size,
|
|
203
|
-
uint16_t item, uint16_t charset, size_t *rsize);
|
|
204
|
-
typedef int (*dpiOciFnType__nlsNameMap)(void *envhp, char *buf, size_t buflen,
|
|
205
|
-
const char *srcbuf, uint32_t flag);
|
|
206
|
-
typedef int (*dpiOciFnType__nlsNumericInfoGet)(void *envhp, void *errhp,
|
|
207
|
-
int32_t *val, uint16_t item);
|
|
208
|
-
typedef int (*dpiOciFnType__numberFromInt)(void *err, const void *inum,
|
|
209
|
-
unsigned int inum_length, unsigned int inum_s_flag, void *number);
|
|
210
|
-
typedef int (*dpiOciFnType__numberFromReal)(void *err, const void *number,
|
|
211
|
-
unsigned int rsl_length, void *rsl);
|
|
212
|
-
typedef int (*dpiOciFnType__numberToInt)(void *err, const void *number,
|
|
213
|
-
unsigned int rsl_length, unsigned int rsl_flag, void *rsl);
|
|
214
|
-
typedef int (*dpiOciFnType__numberToReal)(void *err, const void *number,
|
|
215
|
-
unsigned int rsl_length, void *rsl);
|
|
216
|
-
typedef int (*dpiOciFnType__objectCopy)(void *env, void *err, const void *svc,
|
|
217
|
-
void *source, void *null_source, void *target, void *null_target,
|
|
218
|
-
void *tdo, uint16_t duration, uint8_t option);
|
|
219
|
-
typedef int (*dpiOciFnType__objectFree)(void *env, void *err, void *instance,
|
|
220
|
-
uint16_t flags);
|
|
221
|
-
typedef int (*dpiOciFnType__objectGetAttr)(void *env, void *err,
|
|
222
|
-
void *instance, void *null_struct, void *tdo, const char **names,
|
|
223
|
-
const uint32_t *lengths, const uint32_t name_count,
|
|
224
|
-
const uint32_t *indexes, const uint32_t index_count,
|
|
225
|
-
int16_t *attr_null_status, void **attr_null_struct, void **attr_value,
|
|
226
|
-
void **attr_tdo);
|
|
227
|
-
typedef int (*dpiOciFnType__objectGetInd)(void *env, void *err, void *instance,
|
|
228
|
-
void **null_struct);
|
|
229
|
-
typedef int (*dpiOciFnType__objectNew)(void *env, void *err, const void *svc,
|
|
230
|
-
uint16_t typecode, void *tdo, void *table, uint16_t duration,
|
|
231
|
-
int value, void **instance);
|
|
232
|
-
typedef int (*dpiOciFnType__objectPin)(void *env, void *err, void *object_ref,
|
|
233
|
-
void *corhdl, int pin_option, uint16_t pin_duration, int lock_option,
|
|
234
|
-
void **object);
|
|
235
|
-
typedef int (*dpiOciFnType__objectSetAttr)(void *env, void *err,
|
|
236
|
-
void *instance, void *null_struct, void *tdo, const char **names,
|
|
237
|
-
const uint32_t *lengths, const uint32_t name_count,
|
|
238
|
-
const uint32_t *indexes, const uint32_t index_count,
|
|
239
|
-
const int16_t null_status, const void *attr_null_struct,
|
|
240
|
-
const void *attr_value);
|
|
241
|
-
typedef int (*dpiOciFnType__paramGet)(const void *hndlp, uint32_t htype,
|
|
242
|
-
void *errhp, void **parmdpp, uint32_t pos);
|
|
243
|
-
typedef int (*dpiOciFnType__passwordChange)(void *svchp, void *errhp,
|
|
244
|
-
const char *user_name, uint32_t usernm_len, const char *opasswd,
|
|
245
|
-
uint32_t opasswd_len, const char *npasswd, uint32_t npasswd_len,
|
|
246
|
-
uint32_t mode);
|
|
247
|
-
typedef int (*dpiOciFnType__ping)(void *svchp, void *errhp, uint32_t mode);
|
|
248
|
-
typedef int (*dpiOciFnType__rawAssignBytes)(void *env, void *err,
|
|
249
|
-
const char *rhs, uint32_t rhs_len, void **lhs);
|
|
250
|
-
typedef void *(*dpiOciFnType__rawPtr)(void *env, const void *raw);
|
|
251
|
-
typedef int (*dpiOciFnType__rawResize)(void *env, void *err, uint32_t new_size,
|
|
252
|
-
void **raw);
|
|
253
|
-
typedef uint32_t (*dpiOciFnType__rawSize)(void * env, const void *raw);
|
|
254
|
-
typedef int (*dpiOciFnType__rowidToChar)(void *rowidDesc, char *outbfp,
|
|
255
|
-
uint16_t *outbflp, void *errhp);
|
|
256
|
-
typedef int (*dpiOciFnType__serverAttach)(void *srvhp, void *errhp,
|
|
257
|
-
const char *dblink, int32_t dblink_len, uint32_t mode);
|
|
258
|
-
typedef int (*dpiOciFnType__serverDetach)(void *srvhp, void *errhp,
|
|
259
|
-
uint32_t mode);
|
|
260
|
-
typedef int (*dpiOciFnType__serverRelease)(void *hndlp, void *errhp,
|
|
261
|
-
char *bufp, uint32_t bufsz, uint8_t hndltype, uint32_t *version);
|
|
262
|
-
typedef int (*dpiOciFnType__serverRelease2)(void *hndlp, void *errhp,
|
|
263
|
-
char *bufp, uint32_t bufsz, uint8_t hndltype, uint32_t *version,
|
|
264
|
-
uint32_t mode);
|
|
265
|
-
typedef int (*dpiOciFnType__sessionBegin)(void *svchp, void *errhp,
|
|
266
|
-
void *usrhp, uint32_t credt, uint32_t mode);
|
|
267
|
-
typedef int (*dpiOciFnType__sessionEnd)(void *svchp, void *errhp, void *usrhp,
|
|
268
|
-
uint32_t mode);
|
|
269
|
-
typedef int (*dpiOciFnType__sessionGet)(void *envhp, void *errhp, void **svchp,
|
|
270
|
-
void *authhp, const char *poolName, uint32_t poolName_len,
|
|
271
|
-
const char *tagInfo, uint32_t tagInfo_len, const char **retTagInfo,
|
|
272
|
-
uint32_t *retTagInfo_len, int *found, uint32_t mode);
|
|
273
|
-
typedef int (*dpiOciFnType__sessionPoolCreate)(void *envhp, void *errhp,
|
|
274
|
-
void *spoolhp, char **poolName, uint32_t *poolNameLen,
|
|
275
|
-
const char *connStr, uint32_t connStrLen, uint32_t sessMin,
|
|
276
|
-
uint32_t sessMax, uint32_t sessIncr, const char *userid,
|
|
277
|
-
uint32_t useridLen, const char *password, uint32_t passwordLen,
|
|
278
|
-
uint32_t mode);
|
|
279
|
-
typedef int (*dpiOciFnType__sessionPoolDestroy)(void *spoolhp, void *errhp,
|
|
280
|
-
uint32_t mode);
|
|
281
|
-
typedef int (*dpiOciFnType__sessionRelease)(void *svchp, void *errhp,
|
|
282
|
-
const char *tag, uint32_t tag_len, uint32_t mode);
|
|
283
|
-
typedef int (*dpiOciFnType__shardingKeyColumnAdd)(void *shardingKey,
|
|
284
|
-
void *errhp, void *col, uint32_t colLen, uint16_t colType,
|
|
285
|
-
uint32_t mode);
|
|
286
|
-
typedef int (*dpiOciFnType__sodaCollCreateWithMetadata)(void *svchp,
|
|
287
|
-
const char *collname, uint32_t collnamelen, const char *metadata,
|
|
288
|
-
uint32_t metadatalen, void **collection, void *errhp, uint32_t mode);
|
|
289
|
-
typedef int (*dpiOciFnType__sodaCollDrop)(void *svchp, void *coll,
|
|
290
|
-
int *isDropped, void *errhp, uint32_t mode);
|
|
291
|
-
typedef int (*dpiOciFnType__sodaCollGetNext)(void *svchp, const void *cur,
|
|
292
|
-
void **coll, void *errhp, uint32_t mode);
|
|
293
|
-
typedef int (*dpiOciFnType__sodaCollList)(void *svchp, const char *startname,
|
|
294
|
-
uint32_t stnamelen, void **cur, void *errhp, uint32_t mode);
|
|
295
|
-
typedef int (*dpiOciFnType__sodaCollOpen)(void *svchp, const char *collname,
|
|
296
|
-
uint32_t collnamelen, void **coll, void *errhp, uint32_t mode);
|
|
297
|
-
typedef int (*dpiOciFnType__sodaDataGuideGet)(void *svchp,
|
|
298
|
-
const void *collection, uint32_t docFlags, void **doc, void *errhp,
|
|
299
|
-
uint32_t mode);
|
|
300
|
-
typedef int (*dpiOciFnType__sodaDocCount)(void *svchp, const void *coll,
|
|
301
|
-
const void *optns, uint64_t *numdocs, void *errhp, uint32_t mode);
|
|
302
|
-
typedef int (*dpiOciFnType__sodaDocGetNext)(void *svchp, const void *cur,
|
|
303
|
-
void **doc, void *errhp, uint32_t mode);
|
|
304
|
-
typedef int (*dpiOciFnType__sodaFind)(void *svchp, const void *coll,
|
|
305
|
-
const void *findOptions, uint32_t docFlags, void **cursor,
|
|
306
|
-
void *errhp, uint32_t mode);
|
|
307
|
-
typedef int (*dpiOciFnType__sodaFindOne)(void *svchp, const void *coll,
|
|
308
|
-
const void *findOptions, uint32_t docFlags, void **doc, void *errhp,
|
|
309
|
-
uint32_t mode);
|
|
310
|
-
typedef int (*dpiOciFnType__sodaIndexCreate)(void *svchp, const void *coll,
|
|
311
|
-
const char *indexspec, uint32_t speclen, void *errhp, uint32_t mode);
|
|
312
|
-
typedef int (*dpiOciFnType__sodaIndexDrop)(void *svchp, const char *indexname,
|
|
313
|
-
uint32_t indexnamelen, int *isDropped, void *errhp, uint32_t mode);
|
|
314
|
-
typedef int (*dpiOciFnType__sodaInsert)(void *svchp, void *collection,
|
|
315
|
-
void *document, void *errhp, uint32_t mode);
|
|
316
|
-
typedef int (*dpiOciFnType__sodaInsertAndGet)(void *svchp, void *collection,
|
|
317
|
-
void **document, void *errhp, uint32_t mode);
|
|
318
|
-
typedef int (*dpiOciFnType__sodaOperKeysSet)(const void *operhp,
|
|
319
|
-
const char **keysArray, uint32_t *lengthsArray, uint32_t count,
|
|
320
|
-
void *errhp, uint32_t mode);
|
|
321
|
-
typedef int (*dpiOciFnType__sodaRemove)(void *svchp, const void *coll,
|
|
322
|
-
const void *optns, uint64_t *removeCount, void *errhp, uint32_t mode);
|
|
323
|
-
typedef int (*dpiOciFnType__sodaReplOne)(void *svchp, const void *coll,
|
|
324
|
-
const void *optns, void *document, int *isReplaced, void *errhp,
|
|
325
|
-
uint32_t mode);
|
|
326
|
-
typedef int (*dpiOciFnType__sodaReplOneAndGet)(void *svchp, const void *coll,
|
|
327
|
-
const void *optns, void **document, int *isReplaced, void *errhp,
|
|
328
|
-
uint32_t mode);
|
|
329
|
-
typedef int (*dpiOciFnType__stmtExecute)(void *svchp, void *stmtp, void *errhp,
|
|
330
|
-
uint32_t iters, uint32_t rowoff, const void *snap_in, void *snap_out,
|
|
331
|
-
uint32_t mode);
|
|
332
|
-
typedef int (*dpiOciFnType__stmtFetch2)(void *stmtp, void *errhp,
|
|
333
|
-
uint32_t nrows, uint16_t orientation, int32_t scrollOffset,
|
|
334
|
-
uint32_t mode);
|
|
335
|
-
typedef int (*dpiOciFnType__stmtGetBindInfo)(void *stmtp, void *errhp,
|
|
336
|
-
uint32_t size, uint32_t startloc, int32_t *found, char *bvnp[],
|
|
337
|
-
uint8_t bvnl[], char *invp[], uint8_t inpl[], uint8_t dupl[],
|
|
338
|
-
void **hndl);
|
|
339
|
-
typedef int (*dpiOciFnType__stmtGetNextResult)(void *stmthp, void *errhp,
|
|
340
|
-
void **result, uint32_t *rtype, uint32_t mode);
|
|
341
|
-
typedef int (*dpiOciFnType__stmtPrepare2)(void *svchp, void **stmtp,
|
|
342
|
-
void *errhp, const char *stmt, uint32_t stmt_len, const char *key,
|
|
343
|
-
uint32_t key_len, uint32_t language, uint32_t mode);
|
|
344
|
-
typedef int (*dpiOciFnType__stmtRelease)(void *stmtp, void *errhp,
|
|
345
|
-
const char *key, uint32_t key_len, uint32_t mode);
|
|
346
|
-
typedef int (*dpiOciFnType__stringAssignText)(void *env, void *err,
|
|
347
|
-
const char *rhs, uint32_t rhs_len, void **lhs);
|
|
348
|
-
typedef char *(*dpiOciFnType__stringPtr)(void *env, const void *vs);
|
|
349
|
-
typedef int (*dpiOciFnType__stringResize)(void *env, void *err,
|
|
350
|
-
uint32_t new_size, void **str);
|
|
351
|
-
typedef uint32_t (*dpiOciFnType__stringSize)(void *env, const void *vs);
|
|
352
|
-
typedef int (*dpiOciFnType__subscriptionRegister)(void *svchp,
|
|
353
|
-
void **subscrhpp, uint16_t count, void *errhp, uint32_t mode);
|
|
354
|
-
typedef int (*dpiOciFnType__subscriptionUnRegister)(void *svchp,
|
|
355
|
-
void *subscrhp, void *errhp, uint32_t mode);
|
|
356
|
-
typedef int (*dpiOciFnType__tableDelete)(void *env, void *err, int32_t index,
|
|
357
|
-
void *tbl);
|
|
358
|
-
typedef int (*dpiOciFnType__tableExists)(void *env, void *err, const void *tbl,
|
|
359
|
-
int32_t index, int *exists);
|
|
360
|
-
typedef int (*dpiOciFnType__tableFirst)(void *env, void *err, const void *tbl,
|
|
361
|
-
int32_t *index);
|
|
362
|
-
typedef int (*dpiOciFnType__tableLast)(void *env, void *err, const void *tbl,
|
|
363
|
-
int32_t *index);
|
|
364
|
-
typedef int (*dpiOciFnType__tableNext)(void *env, void *err, int32_t index,
|
|
365
|
-
const void *tbl, int32_t *next_index, int *exists);
|
|
366
|
-
typedef int (*dpiOciFnType__tablePrev)(void *env, void *err, int32_t index,
|
|
367
|
-
const void *tbl, int32_t *prev_index, int *exists);
|
|
368
|
-
typedef int (*dpiOciFnType__tableSize)(void *env, void *err, const void *tbl,
|
|
369
|
-
int32_t *size);
|
|
370
|
-
typedef int (*dpiOciFnType__threadKeyDestroy)(void *hndl, void *err,
|
|
371
|
-
void **key);
|
|
372
|
-
typedef int (*dpiOciFnType__threadKeyGet)(void *hndl, void *err, void *key,
|
|
373
|
-
void **pValue);
|
|
374
|
-
typedef int (*dpiOciFnType__threadKeyInit)(void *hndl, void *err, void **key,
|
|
375
|
-
void *destFn);
|
|
376
|
-
typedef int (*dpiOciFnType__threadKeySet)(void *hndl, void *err, void *key,
|
|
377
|
-
void *value);
|
|
378
|
-
typedef void (*dpiOciFnType__threadProcessInit)(void);
|
|
379
|
-
typedef int (*dpiOciFnType__transCommit)(void *svchp, void *errhp,
|
|
380
|
-
uint32_t flags);
|
|
381
|
-
typedef int (*dpiOciFnType__transPrepare)(void *svchp, void *errhp,
|
|
382
|
-
uint32_t flags);
|
|
383
|
-
typedef int (*dpiOciFnType__transRollback)(void *svchp, void *errhp,
|
|
384
|
-
uint32_t flags);
|
|
385
|
-
typedef int (*dpiOciFnType__transStart)(void *svchp, void *errhp,
|
|
386
|
-
unsigned int timeout, uint32_t flags);
|
|
387
|
-
typedef int (*dpiOciFnType__typeByFullName)(void *env, void *err,
|
|
388
|
-
const void *svc, const char *full_type_name,
|
|
389
|
-
uint32_t full_type_name_length, const char *version_name,
|
|
390
|
-
uint32_t version_name_length, uint16_t pin_duration, int get_option,
|
|
391
|
-
void **tdo);
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
// library handle for dynamically loaded OCI library
|
|
395
|
-
static void *dpiOciLibHandle = NULL;
|
|
396
|
-
|
|
397
|
-
// library names to search
|
|
398
|
-
static const char *dpiOciLibNames[] = {
|
|
399
|
-
#if defined _WIN32 || defined __CYGWIN__
|
|
400
|
-
"oci.dll",
|
|
401
|
-
#elif __APPLE__
|
|
402
|
-
"libclntsh.dylib",
|
|
403
|
-
"libclntsh.dylib.18.1",
|
|
404
|
-
"libclntsh.dylib.12.1",
|
|
405
|
-
"libclntsh.dylib.11.1",
|
|
406
|
-
"libclntsh.dylib.19.1",
|
|
407
|
-
#else
|
|
408
|
-
"libclntsh.so",
|
|
409
|
-
"libclntsh.so.18.1",
|
|
410
|
-
"libclntsh.so.12.1",
|
|
411
|
-
"libclntsh.so.11.1",
|
|
412
|
-
"libclntsh.so.19.1",
|
|
413
|
-
#endif
|
|
414
|
-
NULL
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
// URL fragment to use in load library exception
|
|
418
|
-
#if defined _WIN32 || defined __CYGWIN__
|
|
419
|
-
#define DPI_ERR_LOAD_URL_FRAGMENT "windows"
|
|
420
|
-
#elif __APPLE__
|
|
421
|
-
#define DPI_ERR_LOAD_URL_FRAGMENT "macos"
|
|
422
|
-
#else
|
|
423
|
-
#define DPI_ERR_LOAD_URL_FRAGMENT "linux"
|
|
424
|
-
#endif
|
|
425
|
-
|
|
426
|
-
// version information for loaded OCI library
|
|
427
|
-
static dpiVersionInfo dpiOciLibVersionInfo;
|
|
428
|
-
|
|
429
|
-
// all OCI symbols used by ODPI-C
|
|
430
|
-
static struct {
|
|
431
|
-
dpiOciFnType__aqDeq fnAqDeq;
|
|
432
|
-
dpiOciFnType__aqEnq fnAqEnq;
|
|
433
|
-
dpiOciFnType__arrayDescriptorAlloc fnArrayDescriptorAlloc;
|
|
434
|
-
dpiOciFnType__arrayDescriptorFree fnArrayDescriptorFree;
|
|
435
|
-
dpiOciFnType__attrGet fnAttrGet;
|
|
436
|
-
dpiOciFnType__attrSet fnAttrSet;
|
|
437
|
-
dpiOciFnType__bindByName fnBindByName;
|
|
438
|
-
dpiOciFnType__bindByName2 fnBindByName2;
|
|
439
|
-
dpiOciFnType__bindByPos fnBindByPos;
|
|
440
|
-
dpiOciFnType__bindByPos2 fnBindByPos2;
|
|
441
|
-
dpiOciFnType__bindDynamic fnBindDynamic;
|
|
442
|
-
dpiOciFnType__bindObject fnBindObject;
|
|
443
|
-
dpiOciFnType__break fnBreak;
|
|
444
|
-
dpiOciFnType__clientVersion fnClientVersion;
|
|
445
|
-
dpiOciFnType__collAppend fnCollAppend;
|
|
446
|
-
dpiOciFnType__collAssignElem fnCollAssignElem;
|
|
447
|
-
dpiOciFnType__collGetElem fnCollGetElem;
|
|
448
|
-
dpiOciFnType__collSize fnCollSize;
|
|
449
|
-
dpiOciFnType__collTrim fnCollTrim;
|
|
450
|
-
dpiOciFnType__contextGetValue fnContextGetValue;
|
|
451
|
-
dpiOciFnType__contextSetValue fnContextSetValue;
|
|
452
|
-
dpiOciFnType__dateTimeConstruct fnDateTimeConstruct;
|
|
453
|
-
dpiOciFnType__dateTimeGetDate fnDateTimeGetDate;
|
|
454
|
-
dpiOciFnType__dateTimeGetTime fnDateTimeGetTime;
|
|
455
|
-
dpiOciFnType__dateTimeGetTimeZoneOffset fnDateTimeGetTimeZoneOffset;
|
|
456
|
-
dpiOciFnType__dateTimeIntervalAdd fnDateTimeIntervalAdd;
|
|
457
|
-
dpiOciFnType__dateTimeSubtract fnDateTimeSubtract;
|
|
458
|
-
dpiOciFnType__dbShutdown fnDbShutdown;
|
|
459
|
-
dpiOciFnType__dbStartup fnDbStartup;
|
|
460
|
-
dpiOciFnType__defineByPos fnDefineByPos;
|
|
461
|
-
dpiOciFnType__defineByPos2 fnDefineByPos2;
|
|
462
|
-
dpiOciFnType__defineDynamic fnDefineDynamic;
|
|
463
|
-
dpiOciFnType__defineObject fnDefineObject;
|
|
464
|
-
dpiOciFnType__describeAny fnDescribeAny;
|
|
465
|
-
dpiOciFnType__descriptorAlloc fnDescriptorAlloc;
|
|
466
|
-
dpiOciFnType__descriptorFree fnDescriptorFree;
|
|
467
|
-
dpiOciFnType__envNlsCreate fnEnvNlsCreate;
|
|
468
|
-
dpiOciFnType__errorGet fnErrorGet;
|
|
469
|
-
dpiOciFnType__handleAlloc fnHandleAlloc;
|
|
470
|
-
dpiOciFnType__handleFree fnHandleFree;
|
|
471
|
-
dpiOciFnType__intervalGetDaySecond fnIntervalGetDaySecond;
|
|
472
|
-
dpiOciFnType__intervalGetYearMonth fnIntervalGetYearMonth;
|
|
473
|
-
dpiOciFnType__intervalSetDaySecond fnIntervalSetDaySecond;
|
|
474
|
-
dpiOciFnType__intervalSetYearMonth fnIntervalSetYearMonth;
|
|
475
|
-
dpiOciFnType__lobClose fnLobClose;
|
|
476
|
-
dpiOciFnType__lobCreateTemporary fnLobCreateTemporary;
|
|
477
|
-
dpiOciFnType__lobFileExists fnLobFileExists;
|
|
478
|
-
dpiOciFnType__lobFileGetName fnLobFileGetName;
|
|
479
|
-
dpiOciFnType__lobFileSetName fnLobFileSetName;
|
|
480
|
-
dpiOciFnType__lobFreeTemporary fnLobFreeTemporary;
|
|
481
|
-
dpiOciFnType__lobGetChunkSize fnLobGetChunkSize;
|
|
482
|
-
dpiOciFnType__lobGetLength2 fnLobGetLength2;
|
|
483
|
-
dpiOciFnType__lobIsOpen fnLobIsOpen;
|
|
484
|
-
dpiOciFnType__lobIsTemporary fnLobIsTemporary;
|
|
485
|
-
dpiOciFnType__lobLocatorAssign fnLobLocatorAssign;
|
|
486
|
-
dpiOciFnType__lobOpen fnLobOpen;
|
|
487
|
-
dpiOciFnType__lobRead2 fnLobRead2;
|
|
488
|
-
dpiOciFnType__lobTrim2 fnLobTrim2;
|
|
489
|
-
dpiOciFnType__lobWrite2 fnLobWrite2;
|
|
490
|
-
dpiOciFnType__memoryAlloc fnMemoryAlloc;
|
|
491
|
-
dpiOciFnType__memoryFree fnMemoryFree;
|
|
492
|
-
dpiOciFnType__nlsCharSetConvert fnNlsCharSetConvert;
|
|
493
|
-
dpiOciFnType__nlsCharSetIdToName fnNlsCharSetIdToName;
|
|
494
|
-
dpiOciFnType__nlsCharSetNameToId fnNlsCharSetNameToId;
|
|
495
|
-
dpiOciFnType__nlsEnvironmentVariableGet fnNlsEnvironmentVariableGet;
|
|
496
|
-
dpiOciFnType__nlsNameMap fnNlsNameMap;
|
|
497
|
-
dpiOciFnType__nlsNumericInfoGet fnNlsNumericInfoGet;
|
|
498
|
-
dpiOciFnType__numberFromInt fnNumberFromInt;
|
|
499
|
-
dpiOciFnType__numberFromReal fnNumberFromReal;
|
|
500
|
-
dpiOciFnType__numberToInt fnNumberToInt;
|
|
501
|
-
dpiOciFnType__numberToReal fnNumberToReal;
|
|
502
|
-
dpiOciFnType__objectCopy fnObjectCopy;
|
|
503
|
-
dpiOciFnType__objectFree fnObjectFree;
|
|
504
|
-
dpiOciFnType__objectGetAttr fnObjectGetAttr;
|
|
505
|
-
dpiOciFnType__objectGetInd fnObjectGetInd;
|
|
506
|
-
dpiOciFnType__objectNew fnObjectNew;
|
|
507
|
-
dpiOciFnType__objectPin fnObjectPin;
|
|
508
|
-
dpiOciFnType__objectSetAttr fnObjectSetAttr;
|
|
509
|
-
dpiOciFnType__paramGet fnParamGet;
|
|
510
|
-
dpiOciFnType__passwordChange fnPasswordChange;
|
|
511
|
-
dpiOciFnType__ping fnPing;
|
|
512
|
-
dpiOciFnType__rawAssignBytes fnRawAssignBytes;
|
|
513
|
-
dpiOciFnType__rawPtr fnRawPtr;
|
|
514
|
-
dpiOciFnType__rawResize fnRawResize;
|
|
515
|
-
dpiOciFnType__rawSize fnRawSize;
|
|
516
|
-
dpiOciFnType__rowidToChar fnRowidToChar;
|
|
517
|
-
dpiOciFnType__serverAttach fnServerAttach;
|
|
518
|
-
dpiOciFnType__serverDetach fnServerDetach;
|
|
519
|
-
dpiOciFnType__serverRelease fnServerRelease;
|
|
520
|
-
dpiOciFnType__serverRelease2 fnServerRelease2;
|
|
521
|
-
dpiOciFnType__sessionBegin fnSessionBegin;
|
|
522
|
-
dpiOciFnType__sessionEnd fnSessionEnd;
|
|
523
|
-
dpiOciFnType__sessionGet fnSessionGet;
|
|
524
|
-
dpiOciFnType__sessionPoolCreate fnSessionPoolCreate;
|
|
525
|
-
dpiOciFnType__sessionPoolDestroy fnSessionPoolDestroy;
|
|
526
|
-
dpiOciFnType__sessionRelease fnSessionRelease;
|
|
527
|
-
dpiOciFnType__shardingKeyColumnAdd fnShardingKeyColumnAdd;
|
|
528
|
-
dpiOciFnType__stmtExecute fnStmtExecute;
|
|
529
|
-
dpiOciFnType__sodaCollCreateWithMetadata fnSodaCollCreateWithMetadata;
|
|
530
|
-
dpiOciFnType__sodaCollDrop fnSodaCollDrop;
|
|
531
|
-
dpiOciFnType__sodaCollGetNext fnSodaCollGetNext;
|
|
532
|
-
dpiOciFnType__sodaCollList fnSodaCollList;
|
|
533
|
-
dpiOciFnType__sodaCollOpen fnSodaCollOpen;
|
|
534
|
-
dpiOciFnType__sodaDataGuideGet fnSodaDataGuideGet;
|
|
535
|
-
dpiOciFnType__sodaDocCount fnSodaDocCount;
|
|
536
|
-
dpiOciFnType__sodaDocGetNext fnSodaDocGetNext;
|
|
537
|
-
dpiOciFnType__sodaFind fnSodaFind;
|
|
538
|
-
dpiOciFnType__sodaFindOne fnSodaFindOne;
|
|
539
|
-
dpiOciFnType__sodaIndexCreate fnSodaIndexCreate;
|
|
540
|
-
dpiOciFnType__sodaIndexDrop fnSodaIndexDrop;
|
|
541
|
-
dpiOciFnType__sodaInsert fnSodaInsert;
|
|
542
|
-
dpiOciFnType__sodaInsertAndGet fnSodaInsertAndGet;
|
|
543
|
-
dpiOciFnType__sodaOperKeysSet fnSodaOperKeysSet;
|
|
544
|
-
dpiOciFnType__sodaRemove fnSodaRemove;
|
|
545
|
-
dpiOciFnType__sodaReplOne fnSodaReplOne;
|
|
546
|
-
dpiOciFnType__sodaReplOneAndGet fnSodaReplOneAndGet;
|
|
547
|
-
dpiOciFnType__stmtFetch2 fnStmtFetch2;
|
|
548
|
-
dpiOciFnType__stmtGetBindInfo fnStmtGetBindInfo;
|
|
549
|
-
dpiOciFnType__stmtGetNextResult fnStmtGetNextResult;
|
|
550
|
-
dpiOciFnType__stmtPrepare2 fnStmtPrepare2;
|
|
551
|
-
dpiOciFnType__stmtRelease fnStmtRelease;
|
|
552
|
-
dpiOciFnType__stringAssignText fnStringAssignText;
|
|
553
|
-
dpiOciFnType__stringPtr fnStringPtr;
|
|
554
|
-
dpiOciFnType__stringResize fnStringResize;
|
|
555
|
-
dpiOciFnType__stringSize fnStringSize;
|
|
556
|
-
dpiOciFnType__subscriptionRegister fnSubscriptionRegister;
|
|
557
|
-
dpiOciFnType__subscriptionUnRegister fnSubscriptionUnRegister;
|
|
558
|
-
dpiOciFnType__tableDelete fnTableDelete;
|
|
559
|
-
dpiOciFnType__tableExists fnTableExists;
|
|
560
|
-
dpiOciFnType__tableFirst fnTableFirst;
|
|
561
|
-
dpiOciFnType__tableLast fnTableLast;
|
|
562
|
-
dpiOciFnType__tableNext fnTableNext;
|
|
563
|
-
dpiOciFnType__tablePrev fnTablePrev;
|
|
564
|
-
dpiOciFnType__tableSize fnTableSize;
|
|
565
|
-
dpiOciFnType__threadKeyDestroy fnThreadKeyDestroy;
|
|
566
|
-
dpiOciFnType__threadKeyGet fnThreadKeyGet;
|
|
567
|
-
dpiOciFnType__threadKeyInit fnThreadKeyInit;
|
|
568
|
-
dpiOciFnType__threadKeySet fnThreadKeySet;
|
|
569
|
-
dpiOciFnType__threadProcessInit fnThreadProcessInit;
|
|
570
|
-
dpiOciFnType__transCommit fnTransCommit;
|
|
571
|
-
dpiOciFnType__transPrepare fnTransPrepare;
|
|
572
|
-
dpiOciFnType__transRollback fnTransRollback;
|
|
573
|
-
dpiOciFnType__transStart fnTransStart;
|
|
574
|
-
dpiOciFnType__typeByFullName fnTypeByFullName;
|
|
575
|
-
} dpiOciSymbols;
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
//-----------------------------------------------------------------------------
|
|
579
|
-
// dpiOci__allocateMem() [INTERNAL]
|
|
580
|
-
// Wrapper for OCI allocation of memory, only used when debugging memory
|
|
581
|
-
// allocation.
|
|
582
|
-
//-----------------------------------------------------------------------------
|
|
583
|
-
static void *dpiOci__allocateMem(void *unused, size_t size)
|
|
584
|
-
{
|
|
585
|
-
void *ptr;
|
|
586
|
-
|
|
587
|
-
ptr = malloc(size);
|
|
588
|
-
dpiDebug__print("OCI allocated %u bytes at %p\n", size, ptr);
|
|
589
|
-
return ptr;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
//-----------------------------------------------------------------------------
|
|
594
|
-
// dpiOci__aqDeq() [INTERNAL]
|
|
595
|
-
// Wrapper for OCIAQDeq().
|
|
596
|
-
//-----------------------------------------------------------------------------
|
|
597
|
-
int dpiOci__aqDeq(dpiConn *conn, const char *queueName, void *options,
|
|
598
|
-
void *msgProps, void *payloadType, void **payload, void **payloadInd,
|
|
599
|
-
void **msgId, dpiError *error)
|
|
600
|
-
{
|
|
601
|
-
int status;
|
|
602
|
-
|
|
603
|
-
DPI_OCI_LOAD_SYMBOL("OCIAQDeq", dpiOciSymbols.fnAqDeq)
|
|
604
|
-
status = (*dpiOciSymbols.fnAqDeq)(conn->handle, error->handle, queueName,
|
|
605
|
-
options, msgProps, payloadType, payload, payloadInd, msgId,
|
|
606
|
-
DPI_OCI_DEFAULT);
|
|
607
|
-
return dpiError__check(error, status, conn, "dequeue message");
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
//-----------------------------------------------------------------------------
|
|
612
|
-
// dpiOci__aqEnq() [INTERNAL]
|
|
613
|
-
// Wrapper for OCIAQEnq().
|
|
614
|
-
//-----------------------------------------------------------------------------
|
|
615
|
-
int dpiOci__aqEnq(dpiConn *conn, const char *queueName, void *options,
|
|
616
|
-
void *msgProps, void *payloadType, void **payload, void **payloadInd,
|
|
617
|
-
void **msgId, dpiError *error)
|
|
618
|
-
{
|
|
619
|
-
int status;
|
|
620
|
-
|
|
621
|
-
DPI_OCI_LOAD_SYMBOL("OCIAQEnq", dpiOciSymbols.fnAqEnq)
|
|
622
|
-
status = (*dpiOciSymbols.fnAqEnq)(conn->handle, error->handle, queueName,
|
|
623
|
-
options, msgProps, payloadType, payload, payloadInd, msgId,
|
|
624
|
-
DPI_OCI_DEFAULT);
|
|
625
|
-
return dpiError__check(error, status, conn, "enqueue message");
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
//-----------------------------------------------------------------------------
|
|
630
|
-
// dpiOci__arrayDescriptorAlloc() [INTERNAL]
|
|
631
|
-
// Wrapper for OCIArrayDescriptorAlloc().
|
|
632
|
-
//-----------------------------------------------------------------------------
|
|
633
|
-
int dpiOci__arrayDescriptorAlloc(void *envHandle, void **handle,
|
|
634
|
-
uint32_t handleType, uint32_t arraySize, dpiError *error)
|
|
635
|
-
{
|
|
636
|
-
int status;
|
|
637
|
-
|
|
638
|
-
DPI_OCI_LOAD_SYMBOL("OCIArrayDescriptorAlloc",
|
|
639
|
-
dpiOciSymbols.fnArrayDescriptorAlloc)
|
|
640
|
-
status = (*dpiOciSymbols.fnArrayDescriptorAlloc)(envHandle, handle,
|
|
641
|
-
handleType, arraySize, 0, NULL);
|
|
642
|
-
return dpiError__check(error, status, NULL, "allocate descriptors");
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
//-----------------------------------------------------------------------------
|
|
647
|
-
// dpiOci__arrayDescriptorFree() [INTERNAL]
|
|
648
|
-
// Wrapper for OCIArrayDescriptorFree().
|
|
649
|
-
//-----------------------------------------------------------------------------
|
|
650
|
-
int dpiOci__arrayDescriptorFree(void **handle, uint32_t handleType)
|
|
651
|
-
{
|
|
652
|
-
dpiError *error = NULL;
|
|
653
|
-
int status;
|
|
654
|
-
|
|
655
|
-
DPI_OCI_LOAD_SYMBOL("OCIArrayDescriptorFree",
|
|
656
|
-
dpiOciSymbols.fnArrayDescriptorFree)
|
|
657
|
-
status = (*dpiOciSymbols.fnArrayDescriptorFree)(handle, handleType);
|
|
658
|
-
if (status != DPI_OCI_SUCCESS && dpiDebugLevel & DPI_DEBUG_LEVEL_FREES)
|
|
659
|
-
dpiDebug__print("free array descriptors %p, handleType %d failed\n",
|
|
660
|
-
handle, handleType);
|
|
661
|
-
return DPI_SUCCESS;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
//-----------------------------------------------------------------------------
|
|
666
|
-
// dpiOci__attrGet() [INTERNAL]
|
|
667
|
-
// Wrapper for OCIAttrGet().
|
|
668
|
-
//-----------------------------------------------------------------------------
|
|
669
|
-
int dpiOci__attrGet(const void *handle, uint32_t handleType, void *ptr,
|
|
670
|
-
uint32_t *size, uint32_t attribute, const char *action,
|
|
671
|
-
dpiError *error)
|
|
672
|
-
{
|
|
673
|
-
int status;
|
|
674
|
-
|
|
675
|
-
status = (*dpiOciSymbols.fnAttrGet)(handle, handleType, ptr, size,
|
|
676
|
-
attribute, error->handle);
|
|
677
|
-
if (action)
|
|
678
|
-
return dpiError__check(error, status, NULL, action);
|
|
679
|
-
return DPI_SUCCESS;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
//-----------------------------------------------------------------------------
|
|
684
|
-
// dpiOci__attrSet() [INTERNAL]
|
|
685
|
-
// Wrapper for OCIAttrSet().
|
|
686
|
-
//-----------------------------------------------------------------------------
|
|
687
|
-
int dpiOci__attrSet(void *handle, uint32_t handleType, void *ptr,
|
|
688
|
-
uint32_t size, uint32_t attribute, const char *action, dpiError *error)
|
|
689
|
-
{
|
|
690
|
-
int status;
|
|
691
|
-
|
|
692
|
-
status = (*dpiOciSymbols.fnAttrSet)(handle, handleType, ptr, size,
|
|
693
|
-
attribute, error->handle);
|
|
694
|
-
if (action)
|
|
695
|
-
return dpiError__check(error, status, NULL, action);
|
|
696
|
-
return DPI_SUCCESS;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
//-----------------------------------------------------------------------------
|
|
701
|
-
// dpiOci__bindByName() [INTERNAL]
|
|
702
|
-
// Wrapper for OCIBindByName().
|
|
703
|
-
//-----------------------------------------------------------------------------
|
|
704
|
-
int dpiOci__bindByName(dpiStmt *stmt, void **bindHandle, const char *name,
|
|
705
|
-
int32_t nameLength, int dynamicBind, dpiVar *var, dpiError *error)
|
|
706
|
-
{
|
|
707
|
-
int status;
|
|
708
|
-
|
|
709
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindByName", dpiOciSymbols.fnBindByName)
|
|
710
|
-
status = (*dpiOciSymbols.fnBindByName)(stmt->handle, bindHandle,
|
|
711
|
-
error->handle, name, nameLength,
|
|
712
|
-
(dynamicBind) ? NULL : var->buffer.data.asRaw,
|
|
713
|
-
(var->isDynamic) ? INT_MAX : (int32_t) var->sizeInBytes,
|
|
714
|
-
var->type->oracleType, (dynamicBind) ? NULL :
|
|
715
|
-
var->buffer.indicator,
|
|
716
|
-
(dynamicBind || var->type->sizeInBytes) ? NULL :
|
|
717
|
-
var->buffer.actualLength16,
|
|
718
|
-
(dynamicBind) ? NULL : var->buffer.returnCode,
|
|
719
|
-
(var->isArray) ? var->buffer.maxArraySize : 0,
|
|
720
|
-
(var->isArray) ? &var->buffer.actualArraySize : NULL,
|
|
721
|
-
(dynamicBind) ? DPI_OCI_DATA_AT_EXEC : DPI_OCI_DEFAULT);
|
|
722
|
-
return dpiError__check(error, status, stmt->conn, "bind by name");
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
//-----------------------------------------------------------------------------
|
|
727
|
-
// dpiOci__bindByName2() [INTERNAL]
|
|
728
|
-
// Wrapper for OCIBindByName2().
|
|
729
|
-
//-----------------------------------------------------------------------------
|
|
730
|
-
int dpiOci__bindByName2(dpiStmt *stmt, void **bindHandle, const char *name,
|
|
731
|
-
int32_t nameLength, int dynamicBind, dpiVar *var, dpiError *error)
|
|
732
|
-
{
|
|
733
|
-
int status;
|
|
734
|
-
|
|
735
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindByName2", dpiOciSymbols.fnBindByName2)
|
|
736
|
-
status = (*dpiOciSymbols.fnBindByName2)(stmt->handle, bindHandle,
|
|
737
|
-
error->handle, name, nameLength,
|
|
738
|
-
(dynamicBind) ? NULL : var->buffer.data.asRaw,
|
|
739
|
-
(var->isDynamic) ? INT_MAX : var->sizeInBytes,
|
|
740
|
-
var->type->oracleType, (dynamicBind) ? NULL :
|
|
741
|
-
var->buffer.indicator,
|
|
742
|
-
(dynamicBind || var->type->sizeInBytes) ? NULL :
|
|
743
|
-
var->buffer.actualLength32,
|
|
744
|
-
(dynamicBind) ? NULL : var->buffer.returnCode,
|
|
745
|
-
(var->isArray) ? var->buffer.maxArraySize : 0,
|
|
746
|
-
(var->isArray) ? &var->buffer.actualArraySize : NULL,
|
|
747
|
-
(dynamicBind) ? DPI_OCI_DATA_AT_EXEC : DPI_OCI_DEFAULT);
|
|
748
|
-
return dpiError__check(error, status, stmt->conn, "bind by name");
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
//-----------------------------------------------------------------------------
|
|
753
|
-
// dpiOci__bindByPos() [INTERNAL]
|
|
754
|
-
// Wrapper for OCIBindByPos().
|
|
755
|
-
//-----------------------------------------------------------------------------
|
|
756
|
-
int dpiOci__bindByPos(dpiStmt *stmt, void **bindHandle, uint32_t pos,
|
|
757
|
-
int dynamicBind, dpiVar *var, dpiError *error)
|
|
758
|
-
{
|
|
759
|
-
int status;
|
|
760
|
-
|
|
761
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindByPos", dpiOciSymbols.fnBindByPos)
|
|
762
|
-
status = (*dpiOciSymbols.fnBindByPos)(stmt->handle, bindHandle,
|
|
763
|
-
error->handle, pos, (dynamicBind) ? NULL : var->buffer.data.asRaw,
|
|
764
|
-
(var->isDynamic) ? INT_MAX : (int32_t) var->sizeInBytes,
|
|
765
|
-
var->type->oracleType, (dynamicBind) ? NULL :
|
|
766
|
-
var->buffer.indicator,
|
|
767
|
-
(dynamicBind || var->type->sizeInBytes) ? NULL :
|
|
768
|
-
var->buffer.actualLength16,
|
|
769
|
-
(dynamicBind) ? NULL : var->buffer.returnCode,
|
|
770
|
-
(var->isArray) ? var->buffer.maxArraySize : 0,
|
|
771
|
-
(var->isArray) ? &var->buffer.actualArraySize : NULL,
|
|
772
|
-
(dynamicBind) ? DPI_OCI_DATA_AT_EXEC : DPI_OCI_DEFAULT);
|
|
773
|
-
return dpiError__check(error, status, stmt->conn, "bind by position");
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
//-----------------------------------------------------------------------------
|
|
778
|
-
// dpiOci__bindByPos2() [INTERNAL]
|
|
779
|
-
// Wrapper for OCIBindByPos2().
|
|
780
|
-
//-----------------------------------------------------------------------------
|
|
781
|
-
int dpiOci__bindByPos2(dpiStmt *stmt, void **bindHandle, uint32_t pos,
|
|
782
|
-
int dynamicBind, dpiVar *var, dpiError *error)
|
|
783
|
-
{
|
|
784
|
-
int status;
|
|
785
|
-
|
|
786
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindByPos2", dpiOciSymbols.fnBindByPos2)
|
|
787
|
-
status = (*dpiOciSymbols.fnBindByPos2)(stmt->handle, bindHandle,
|
|
788
|
-
error->handle, pos, (dynamicBind) ? NULL : var->buffer.data.asRaw,
|
|
789
|
-
(var->isDynamic) ? INT_MAX : var->sizeInBytes,
|
|
790
|
-
var->type->oracleType, (dynamicBind) ? NULL :
|
|
791
|
-
var->buffer.indicator,
|
|
792
|
-
(dynamicBind || var->type->sizeInBytes) ? NULL :
|
|
793
|
-
var->buffer.actualLength32,
|
|
794
|
-
(dynamicBind) ? NULL : var->buffer.returnCode,
|
|
795
|
-
(var->isArray) ? var->buffer.maxArraySize : 0,
|
|
796
|
-
(var->isArray) ? &var->buffer.actualArraySize : NULL,
|
|
797
|
-
(dynamicBind) ? DPI_OCI_DATA_AT_EXEC : DPI_OCI_DEFAULT);
|
|
798
|
-
return dpiError__check(error, status, stmt->conn, "bind by position");
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
//-----------------------------------------------------------------------------
|
|
803
|
-
// dpiOci__bindDynamic() [INTERNAL]
|
|
804
|
-
// Wrapper for OCIBindDynamic().
|
|
805
|
-
//-----------------------------------------------------------------------------
|
|
806
|
-
int dpiOci__bindDynamic(dpiVar *var, void *bindHandle, dpiError *error)
|
|
807
|
-
{
|
|
808
|
-
int status;
|
|
809
|
-
|
|
810
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindDynamic", dpiOciSymbols.fnBindDynamic)
|
|
811
|
-
status = (*dpiOciSymbols.fnBindDynamic)(bindHandle, error->handle, var,
|
|
812
|
-
(void*) dpiVar__inBindCallback, var,
|
|
813
|
-
(void*) dpiVar__outBindCallback);
|
|
814
|
-
return dpiError__check(error, status, var->conn, "bind dynamic");
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
//-----------------------------------------------------------------------------
|
|
819
|
-
// dpiOci__bindObject() [INTERNAL]
|
|
820
|
-
// Wrapper for OCIBindObject().
|
|
821
|
-
//-----------------------------------------------------------------------------
|
|
822
|
-
int dpiOci__bindObject(dpiVar *var, void *bindHandle, dpiError *error)
|
|
823
|
-
{
|
|
824
|
-
int status;
|
|
825
|
-
|
|
826
|
-
DPI_OCI_LOAD_SYMBOL("OCIBindObject", dpiOciSymbols.fnBindObject)
|
|
827
|
-
status = (*dpiOciSymbols.fnBindObject)(bindHandle, error->handle,
|
|
828
|
-
var->objectType->tdo, (void**) var->buffer.data.asRaw, 0,
|
|
829
|
-
var->buffer.objectIndicator, 0);
|
|
830
|
-
return dpiError__check(error, status, var->conn, "bind object");
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
//-----------------------------------------------------------------------------
|
|
835
|
-
// dpiOci__break() [INTERNAL]
|
|
836
|
-
// Wrapper for OCIBreak().
|
|
837
|
-
//-----------------------------------------------------------------------------
|
|
838
|
-
int dpiOci__break(dpiConn *conn, dpiError *error)
|
|
839
|
-
{
|
|
840
|
-
int status;
|
|
841
|
-
|
|
842
|
-
DPI_OCI_LOAD_SYMBOL("OCIBreak", dpiOciSymbols.fnBreak)
|
|
843
|
-
status = (*dpiOciSymbols.fnBreak)(conn->handle, error->handle);
|
|
844
|
-
return dpiError__check(error, status, conn, "break execution");
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
//-----------------------------------------------------------------------------
|
|
849
|
-
// dpiOci__clientVersion() [INTERNAL]
|
|
850
|
-
// Set the version information in the context to the OCI client version
|
|
851
|
-
// information that was discovered when the OCI library was loaded.
|
|
852
|
-
//-----------------------------------------------------------------------------
|
|
853
|
-
void dpiOci__clientVersion(dpiContext *context)
|
|
854
|
-
{
|
|
855
|
-
context->versionInfo = &dpiOciLibVersionInfo;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
//-----------------------------------------------------------------------------
|
|
860
|
-
// dpiOci__collAppend() [INTERNAL]
|
|
861
|
-
// Wrapper for OCICollAppend().
|
|
862
|
-
//-----------------------------------------------------------------------------
|
|
863
|
-
int dpiOci__collAppend(dpiConn *conn, const void *elem, const void *elemInd,
|
|
864
|
-
void *coll, dpiError *error)
|
|
865
|
-
{
|
|
866
|
-
int status;
|
|
867
|
-
|
|
868
|
-
DPI_OCI_LOAD_SYMBOL("OCICollAppend", dpiOciSymbols.fnCollAppend)
|
|
869
|
-
status = (*dpiOciSymbols.fnCollAppend)(conn->env->handle, error->handle,
|
|
870
|
-
elem, elemInd, coll);
|
|
871
|
-
return dpiError__check(error, status, conn, "append element");
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
//-----------------------------------------------------------------------------
|
|
876
|
-
// dpiOci__collAssignElem() [INTERNAL]
|
|
877
|
-
// Wrapper for OCICollAssignElem().
|
|
878
|
-
//-----------------------------------------------------------------------------
|
|
879
|
-
int dpiOci__collAssignElem(dpiConn *conn, int32_t index, const void *elem,
|
|
880
|
-
const void *elemInd, void *coll, dpiError *error)
|
|
881
|
-
{
|
|
882
|
-
int status;
|
|
883
|
-
|
|
884
|
-
DPI_OCI_LOAD_SYMBOL("OCICollAssignElem", dpiOciSymbols.fnCollAssignElem)
|
|
885
|
-
status = (*dpiOciSymbols.fnCollAssignElem)(conn->env->handle,
|
|
886
|
-
error->handle, index, elem, elemInd, coll);
|
|
887
|
-
return dpiError__check(error, status, conn, "assign element");
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
//-----------------------------------------------------------------------------
|
|
892
|
-
// dpiOci__collGetElem() [INTERNAL]
|
|
893
|
-
// Wrapper for OCICollGetElem().
|
|
894
|
-
//-----------------------------------------------------------------------------
|
|
895
|
-
int dpiOci__collGetElem(dpiConn *conn, void *coll, int32_t index, int *exists,
|
|
896
|
-
void **elem, void **elemInd, dpiError *error)
|
|
897
|
-
{
|
|
898
|
-
int status;
|
|
899
|
-
|
|
900
|
-
DPI_OCI_LOAD_SYMBOL("OCICollGetElem", dpiOciSymbols.fnCollGetElem)
|
|
901
|
-
status = (*dpiOciSymbols.fnCollGetElem)(conn->env->handle, error->handle,
|
|
902
|
-
coll, index, exists, elem, elemInd);
|
|
903
|
-
return dpiError__check(error, status, conn, "get element");
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
//-----------------------------------------------------------------------------
|
|
908
|
-
// dpiOci__collSize() [INTERNAL]
|
|
909
|
-
// Wrapper for OCICollSize().
|
|
910
|
-
//-----------------------------------------------------------------------------
|
|
911
|
-
int dpiOci__collSize(dpiConn *conn, void *coll, int32_t *size, dpiError *error)
|
|
912
|
-
{
|
|
913
|
-
int status;
|
|
914
|
-
|
|
915
|
-
DPI_OCI_LOAD_SYMBOL("OCICollSize", dpiOciSymbols.fnCollSize)
|
|
916
|
-
status = (*dpiOciSymbols.fnCollSize)(conn->env->handle, error->handle,
|
|
917
|
-
coll, size);
|
|
918
|
-
return dpiError__check(error, status, conn, "get size");
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
//-----------------------------------------------------------------------------
|
|
923
|
-
// dpiOci__collTrim() [INTERNAL]
|
|
924
|
-
// Wrapper for OCICollTrim().
|
|
925
|
-
//-----------------------------------------------------------------------------
|
|
926
|
-
int dpiOci__collTrim(dpiConn *conn, uint32_t numToTrim, void *coll,
|
|
927
|
-
dpiError *error)
|
|
928
|
-
{
|
|
929
|
-
int status;
|
|
930
|
-
|
|
931
|
-
DPI_OCI_LOAD_SYMBOL("OCICollTrim", dpiOciSymbols.fnCollTrim)
|
|
932
|
-
status = (*dpiOciSymbols.fnCollTrim)(conn->env->handle, error->handle,
|
|
933
|
-
(int32_t) numToTrim, coll);
|
|
934
|
-
return dpiError__check(error, status, conn, "trim");
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
//-----------------------------------------------------------------------------
|
|
939
|
-
// dpiOci__contextGetValue() [INTERNAL]
|
|
940
|
-
// Wrapper for OCIContextGetValue().
|
|
941
|
-
//-----------------------------------------------------------------------------
|
|
942
|
-
int dpiOci__contextGetValue(dpiConn *conn, const char *key, uint32_t keyLength,
|
|
943
|
-
void **value, int checkError, dpiError *error)
|
|
944
|
-
{
|
|
945
|
-
int status;
|
|
946
|
-
|
|
947
|
-
DPI_OCI_LOAD_SYMBOL("OCIContextGetValue", dpiOciSymbols.fnContextGetValue)
|
|
948
|
-
status = (*dpiOciSymbols.fnContextGetValue)(conn->sessionHandle,
|
|
949
|
-
error->handle, key, (uint8_t) keyLength, value);
|
|
950
|
-
if (checkError)
|
|
951
|
-
return dpiError__check(error, status, conn, "get context value");
|
|
952
|
-
*value = NULL;
|
|
953
|
-
return DPI_SUCCESS;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
//-----------------------------------------------------------------------------
|
|
958
|
-
// dpiOci__contextSetValue() [INTERNAL]
|
|
959
|
-
// Wrapper for OCIContextSetValue().
|
|
960
|
-
//-----------------------------------------------------------------------------
|
|
961
|
-
int dpiOci__contextSetValue(dpiConn *conn, const char *key, uint32_t keyLength,
|
|
962
|
-
void *value, int checkError, dpiError *error)
|
|
963
|
-
{
|
|
964
|
-
int status;
|
|
965
|
-
|
|
966
|
-
DPI_OCI_LOAD_SYMBOL("OCIContextSetValue", dpiOciSymbols.fnContextSetValue)
|
|
967
|
-
status = (*dpiOciSymbols.fnContextSetValue)(conn->sessionHandle,
|
|
968
|
-
error->handle, DPI_OCI_DURATION_SESSION, key, (uint8_t) keyLength,
|
|
969
|
-
value);
|
|
970
|
-
if (checkError)
|
|
971
|
-
return dpiError__check(error, status, conn, "set context value");
|
|
972
|
-
return DPI_SUCCESS;
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
//-----------------------------------------------------------------------------
|
|
977
|
-
// dpiOci__dateTimeConstruct() [INTERNAL]
|
|
978
|
-
// Wrapper for OCIDateTimeConstruct().
|
|
979
|
-
//-----------------------------------------------------------------------------
|
|
980
|
-
int dpiOci__dateTimeConstruct(void *envHandle, void *handle, int16_t year,
|
|
981
|
-
uint8_t month, uint8_t day, uint8_t hour, uint8_t minute,
|
|
982
|
-
uint8_t second, uint32_t fsecond, const char *tz, size_t tzLength,
|
|
983
|
-
dpiError *error)
|
|
984
|
-
{
|
|
985
|
-
int status;
|
|
986
|
-
|
|
987
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeConstruct",
|
|
988
|
-
dpiOciSymbols.fnDateTimeConstruct)
|
|
989
|
-
status = (*dpiOciSymbols.fnDateTimeConstruct)(envHandle, error->handle,
|
|
990
|
-
handle, year, month, day, hour, minute, second, fsecond, tz,
|
|
991
|
-
tzLength);
|
|
992
|
-
return dpiError__check(error, status, NULL, "construct date");
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
//-----------------------------------------------------------------------------
|
|
997
|
-
// dpiOci__dateTimeGetDate() [INTERNAL]
|
|
998
|
-
// Wrapper for OCIDateTimeGetDate().
|
|
999
|
-
//-----------------------------------------------------------------------------
|
|
1000
|
-
int dpiOci__dateTimeGetDate(void *envHandle, void *handle, int16_t *year,
|
|
1001
|
-
uint8_t *month, uint8_t *day, dpiError *error)
|
|
1002
|
-
{
|
|
1003
|
-
int status;
|
|
1004
|
-
|
|
1005
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeGetDate", dpiOciSymbols.fnDateTimeGetDate)
|
|
1006
|
-
status = (*dpiOciSymbols.fnDateTimeGetDate)(envHandle, error->handle,
|
|
1007
|
-
handle, year, month, day);
|
|
1008
|
-
return dpiError__check(error, status, NULL, "get date portion");
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
//-----------------------------------------------------------------------------
|
|
1013
|
-
// dpiOci__dateTimeGetTime() [INTERNAL]
|
|
1014
|
-
// Wrapper for OCIDateTimeGetTime().
|
|
1015
|
-
//-----------------------------------------------------------------------------
|
|
1016
|
-
int dpiOci__dateTimeGetTime(void *envHandle, void *handle, uint8_t *hour,
|
|
1017
|
-
uint8_t *minute, uint8_t *second, uint32_t *fsecond, dpiError *error)
|
|
1018
|
-
{
|
|
1019
|
-
int status;
|
|
1020
|
-
|
|
1021
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeGetTime", dpiOciSymbols.fnDateTimeGetTime)
|
|
1022
|
-
status = (*dpiOciSymbols.fnDateTimeGetTime)(envHandle, error->handle,
|
|
1023
|
-
handle, hour, minute, second, fsecond);
|
|
1024
|
-
return dpiError__check(error, status, NULL, "get time portion");
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
//-----------------------------------------------------------------------------
|
|
1029
|
-
// dpiOci__dateTimeGetTimeZoneOffset() [INTERNAL]
|
|
1030
|
-
// Wrapper for OCIDateTimeGetTimeZoneOffset().
|
|
1031
|
-
//-----------------------------------------------------------------------------
|
|
1032
|
-
int dpiOci__dateTimeGetTimeZoneOffset(void *envHandle, void *handle,
|
|
1033
|
-
int8_t *tzHourOffset, int8_t *tzMinuteOffset, dpiError *error)
|
|
1034
|
-
{
|
|
1035
|
-
int status;
|
|
1036
|
-
|
|
1037
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeGetTimeZoneOffset",
|
|
1038
|
-
dpiOciSymbols.fnDateTimeGetTimeZoneOffset)
|
|
1039
|
-
status = (*dpiOciSymbols.fnDateTimeGetTimeZoneOffset)(envHandle,
|
|
1040
|
-
error->handle, handle, tzHourOffset, tzMinuteOffset);
|
|
1041
|
-
return dpiError__check(error, status, NULL, "get time zone portion");
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
//-----------------------------------------------------------------------------
|
|
1046
|
-
// dpiOci__dateTimeIntervalAdd() [INTERNAL]
|
|
1047
|
-
// Wrapper for OCIDateTimeIntervalAdd().
|
|
1048
|
-
//-----------------------------------------------------------------------------
|
|
1049
|
-
int dpiOci__dateTimeIntervalAdd(void *envHandle, void *handle, void *interval,
|
|
1050
|
-
void *outHandle, dpiError *error)
|
|
1051
|
-
{
|
|
1052
|
-
int status;
|
|
1053
|
-
|
|
1054
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeIntervalAdd",
|
|
1055
|
-
dpiOciSymbols.fnDateTimeIntervalAdd)
|
|
1056
|
-
status = (*dpiOciSymbols.fnDateTimeIntervalAdd)(envHandle, error->handle,
|
|
1057
|
-
handle, interval, outHandle);
|
|
1058
|
-
return dpiError__check(error, status, NULL, "add interval to date");
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
//-----------------------------------------------------------------------------
|
|
1063
|
-
// dpiOci__dateTimeSubtract() [INTERNAL]
|
|
1064
|
-
// Wrapper for OCIDateTimeSubtract().
|
|
1065
|
-
//-----------------------------------------------------------------------------
|
|
1066
|
-
int dpiOci__dateTimeSubtract(void *envHandle, void *handle1, void *handle2,
|
|
1067
|
-
void *interval, dpiError *error)
|
|
1068
|
-
{
|
|
1069
|
-
int status;
|
|
1070
|
-
|
|
1071
|
-
DPI_OCI_LOAD_SYMBOL("OCIDateTimeSubtract",
|
|
1072
|
-
dpiOciSymbols.fnDateTimeSubtract)
|
|
1073
|
-
status = (*dpiOciSymbols.fnDateTimeSubtract)(envHandle, error->handle,
|
|
1074
|
-
handle1, handle2, interval);
|
|
1075
|
-
return dpiError__check(error, status, NULL, "subtract date");
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
//-----------------------------------------------------------------------------
|
|
1080
|
-
// dpiOci__dbShutdown() [INTERNAL]
|
|
1081
|
-
// Wrapper for OCIDBShutdown().
|
|
1082
|
-
//-----------------------------------------------------------------------------
|
|
1083
|
-
int dpiOci__dbShutdown(dpiConn *conn, uint32_t mode, dpiError *error)
|
|
1084
|
-
{
|
|
1085
|
-
int status;
|
|
1086
|
-
|
|
1087
|
-
DPI_OCI_LOAD_SYMBOL("OCIDBShutdown", dpiOciSymbols.fnDbShutdown)
|
|
1088
|
-
status = (*dpiOciSymbols.fnDbShutdown)(conn->handle, error->handle, NULL,
|
|
1089
|
-
mode);
|
|
1090
|
-
return dpiError__check(error, status, NULL, "shutdown database");
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
//-----------------------------------------------------------------------------
|
|
1095
|
-
// dpiOci__dbStartup() [INTERNAL]
|
|
1096
|
-
// Wrapper for OCIDBStartup().
|
|
1097
|
-
//-----------------------------------------------------------------------------
|
|
1098
|
-
int dpiOci__dbStartup(dpiConn *conn, uint32_t mode, dpiError *error)
|
|
1099
|
-
{
|
|
1100
|
-
int status;
|
|
1101
|
-
|
|
1102
|
-
DPI_OCI_LOAD_SYMBOL("OCIDBStartup", dpiOciSymbols.fnDbStartup)
|
|
1103
|
-
status = (*dpiOciSymbols.fnDbStartup)(conn->handle, error->handle, NULL,
|
|
1104
|
-
DPI_OCI_DEFAULT, mode);
|
|
1105
|
-
return dpiError__check(error, status, NULL, "startup database");
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
//-----------------------------------------------------------------------------
|
|
1110
|
-
// dpiOci__defineByPos() [INTERNAL]
|
|
1111
|
-
// Wrapper for OCIDefineByPos().
|
|
1112
|
-
//-----------------------------------------------------------------------------
|
|
1113
|
-
int dpiOci__defineByPos(dpiStmt *stmt, void **defineHandle, uint32_t pos,
|
|
1114
|
-
dpiVar *var, dpiError *error)
|
|
1115
|
-
{
|
|
1116
|
-
int status;
|
|
1117
|
-
|
|
1118
|
-
DPI_OCI_LOAD_SYMBOL("OCIDefineByPos", dpiOciSymbols.fnDefineByPos)
|
|
1119
|
-
status = (*dpiOciSymbols.fnDefineByPos)(stmt->handle, defineHandle,
|
|
1120
|
-
error->handle, pos, (var->isDynamic) ? NULL :
|
|
1121
|
-
var->buffer.data.asRaw,
|
|
1122
|
-
(var->isDynamic) ? INT_MAX : (int32_t) var->sizeInBytes,
|
|
1123
|
-
var->type->oracleType, (var->isDynamic) ? NULL :
|
|
1124
|
-
var->buffer.indicator,
|
|
1125
|
-
(var->isDynamic) ? NULL : var->buffer.actualLength16,
|
|
1126
|
-
(var->isDynamic) ? NULL : var->buffer.returnCode,
|
|
1127
|
-
(var->isDynamic) ? DPI_OCI_DYNAMIC_FETCH : DPI_OCI_DEFAULT);
|
|
1128
|
-
return dpiError__check(error, status, stmt->conn, "define");
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
//-----------------------------------------------------------------------------
|
|
1133
|
-
// dpiOci__defineByPos2() [INTERNAL]
|
|
1134
|
-
// Wrapper for OCIDefineByPos2().
|
|
1135
|
-
//-----------------------------------------------------------------------------
|
|
1136
|
-
int dpiOci__defineByPos2(dpiStmt *stmt, void **defineHandle, uint32_t pos,
|
|
1137
|
-
dpiVar *var, dpiError *error)
|
|
1138
|
-
{
|
|
1139
|
-
int status;
|
|
1140
|
-
|
|
1141
|
-
DPI_OCI_LOAD_SYMBOL("OCIDefineByPos2", dpiOciSymbols.fnDefineByPos2)
|
|
1142
|
-
status = (*dpiOciSymbols.fnDefineByPos2)(stmt->handle, defineHandle,
|
|
1143
|
-
error->handle, pos, (var->isDynamic) ? NULL :
|
|
1144
|
-
var->buffer.data.asRaw,
|
|
1145
|
-
(var->isDynamic) ? INT_MAX : var->sizeInBytes,
|
|
1146
|
-
var->type->oracleType, (var->isDynamic) ? NULL :
|
|
1147
|
-
var->buffer.indicator,
|
|
1148
|
-
(var->isDynamic) ? NULL : var->buffer.actualLength32,
|
|
1149
|
-
(var->isDynamic) ? NULL : var->buffer.returnCode,
|
|
1150
|
-
(var->isDynamic) ? DPI_OCI_DYNAMIC_FETCH : DPI_OCI_DEFAULT);
|
|
1151
|
-
return dpiError__check(error, status, stmt->conn, "define");
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
//-----------------------------------------------------------------------------
|
|
1156
|
-
// dpiOci__defineDynamic() [INTERNAL]
|
|
1157
|
-
// Wrapper for OCIDefineDynamic().
|
|
1158
|
-
//-----------------------------------------------------------------------------
|
|
1159
|
-
int dpiOci__defineDynamic(dpiVar *var, void *defineHandle, dpiError *error)
|
|
1160
|
-
{
|
|
1161
|
-
int status;
|
|
1162
|
-
|
|
1163
|
-
DPI_OCI_LOAD_SYMBOL("OCIDefineDynamic", dpiOciSymbols.fnDefineDynamic)
|
|
1164
|
-
status = (*dpiOciSymbols.fnDefineDynamic)(defineHandle, error->handle, var,
|
|
1165
|
-
(void*) dpiVar__defineCallback);
|
|
1166
|
-
return dpiError__check(error, status, var->conn, "define dynamic");
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
//-----------------------------------------------------------------------------
|
|
1171
|
-
// dpiOci__defineObject() [INTERNAL]
|
|
1172
|
-
// Wrapper for OCIDefineObject().
|
|
1173
|
-
//-----------------------------------------------------------------------------
|
|
1174
|
-
int dpiOci__defineObject(dpiVar *var, void *defineHandle, dpiError *error)
|
|
1175
|
-
{
|
|
1176
|
-
int status;
|
|
1177
|
-
|
|
1178
|
-
DPI_OCI_LOAD_SYMBOL("OCIDefineObject", dpiOciSymbols.fnDefineObject)
|
|
1179
|
-
status = (*dpiOciSymbols.fnDefineObject)(defineHandle, error->handle,
|
|
1180
|
-
var->objectType->tdo, (void**) var->buffer.data.asRaw, 0,
|
|
1181
|
-
var->buffer.objectIndicator, 0);
|
|
1182
|
-
return dpiError__check(error, status, var->conn, "define object");
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
//-----------------------------------------------------------------------------
|
|
1187
|
-
// dpiOci__describeAny() [INTERNAL]
|
|
1188
|
-
// Wrapper for OCIDescribeAny().
|
|
1189
|
-
//-----------------------------------------------------------------------------
|
|
1190
|
-
int dpiOci__describeAny(dpiConn *conn, void *obj, uint32_t objLength,
|
|
1191
|
-
uint8_t objType, void *describeHandle, dpiError *error)
|
|
1192
|
-
{
|
|
1193
|
-
int status;
|
|
1194
|
-
|
|
1195
|
-
DPI_OCI_LOAD_SYMBOL("OCIDescribeAny", dpiOciSymbols.fnDescribeAny)
|
|
1196
|
-
status = (*dpiOciSymbols.fnDescribeAny)(conn->handle, error->handle, obj,
|
|
1197
|
-
objLength, objType, 0, DPI_OCI_PTYPE_TYPE, describeHandle);
|
|
1198
|
-
return dpiError__check(error, status, conn, "describe type");
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
//-----------------------------------------------------------------------------
|
|
1203
|
-
// dpiOci__descriptorAlloc() [INTERNAL]
|
|
1204
|
-
// Wrapper for OCIDescriptorAlloc().
|
|
1205
|
-
//-----------------------------------------------------------------------------
|
|
1206
|
-
int dpiOci__descriptorAlloc(void *envHandle, void **handle,
|
|
1207
|
-
const uint32_t handleType, const char *action, dpiError *error)
|
|
1208
|
-
{
|
|
1209
|
-
int status;
|
|
1210
|
-
|
|
1211
|
-
DPI_OCI_LOAD_SYMBOL("OCIDescriptorAlloc", dpiOciSymbols.fnDescriptorAlloc)
|
|
1212
|
-
status = (*dpiOciSymbols.fnDescriptorAlloc)(envHandle, handle, handleType,
|
|
1213
|
-
0, NULL);
|
|
1214
|
-
return dpiError__check(error, status, NULL, action);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
//-----------------------------------------------------------------------------
|
|
1219
|
-
// dpiOci__descriptorFree() [INTERNAL]
|
|
1220
|
-
// Wrapper for OCIDescriptorFree().
|
|
1221
|
-
//-----------------------------------------------------------------------------
|
|
1222
|
-
int dpiOci__descriptorFree(void *handle, uint32_t handleType)
|
|
1223
|
-
{
|
|
1224
|
-
dpiError *error = NULL;
|
|
1225
|
-
int status;
|
|
1226
|
-
|
|
1227
|
-
DPI_OCI_LOAD_SYMBOL("OCIDescriptorFree", dpiOciSymbols.fnDescriptorFree)
|
|
1228
|
-
status = (*dpiOciSymbols.fnDescriptorFree)(handle, handleType);
|
|
1229
|
-
if (status != DPI_OCI_SUCCESS && dpiDebugLevel & DPI_DEBUG_LEVEL_FREES)
|
|
1230
|
-
dpiDebug__print("free descriptor %p, type %d failed\n", handle,
|
|
1231
|
-
handleType);
|
|
1232
|
-
return DPI_SUCCESS;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
//-----------------------------------------------------------------------------
|
|
1237
|
-
// dpiOci__envNlsCreate() [INTERNAL]
|
|
1238
|
-
// Wrapper for OCIEnvNlsCreate().
|
|
1239
|
-
//-----------------------------------------------------------------------------
|
|
1240
|
-
int dpiOci__envNlsCreate(void **envHandle, uint32_t mode, uint16_t charsetId,
|
|
1241
|
-
uint16_t ncharsetId, dpiError *error)
|
|
1242
|
-
{
|
|
1243
|
-
void *mallocFn = NULL, *reallocFn = NULL, *freeFn = NULL;
|
|
1244
|
-
int status;
|
|
1245
|
-
|
|
1246
|
-
*envHandle = NULL;
|
|
1247
|
-
DPI_OCI_LOAD_SYMBOL("OCIEnvNlsCreate", dpiOciSymbols.fnEnvNlsCreate)
|
|
1248
|
-
if (dpiDebugLevel & DPI_DEBUG_LEVEL_MEM) {
|
|
1249
|
-
mallocFn = (void*) dpiOci__allocateMem;
|
|
1250
|
-
reallocFn = (void*) dpiOci__reallocMem;
|
|
1251
|
-
freeFn = (void*) dpiOci__freeMem;
|
|
1252
|
-
}
|
|
1253
|
-
status = (*dpiOciSymbols.fnEnvNlsCreate)(envHandle, mode, NULL, mallocFn,
|
|
1254
|
-
reallocFn, freeFn, 0, NULL, charsetId, ncharsetId);
|
|
1255
|
-
if (*envHandle) {
|
|
1256
|
-
if (status == DPI_OCI_SUCCESS || status == DPI_OCI_SUCCESS_WITH_INFO)
|
|
1257
|
-
return DPI_SUCCESS;
|
|
1258
|
-
if (dpiOci__errorGet(*envHandle, DPI_OCI_HTYPE_ENV, charsetId,
|
|
1259
|
-
"create env", error) == 0)
|
|
1260
|
-
return DPI_FAILURE;
|
|
1261
|
-
}
|
|
1262
|
-
return dpiError__set(error, "create env", DPI_ERR_CREATE_ENV);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
//-----------------------------------------------------------------------------
|
|
1267
|
-
// dpiOci__errorGet() [INTERNAL]
|
|
1268
|
-
// Wrapper for OCIErrorGet().
|
|
1269
|
-
//-----------------------------------------------------------------------------
|
|
1270
|
-
int dpiOci__errorGet(void *handle, uint32_t handleType, uint16_t charsetId,
|
|
1271
|
-
const char *action, dpiError *error)
|
|
1272
|
-
{
|
|
1273
|
-
uint32_t i, numChars, bufferChars;
|
|
1274
|
-
uint16_t *utf16chars;
|
|
1275
|
-
int status;
|
|
1276
|
-
char *ptr;
|
|
1277
|
-
|
|
1278
|
-
DPI_OCI_LOAD_SYMBOL("OCIErrorGet", dpiOciSymbols.fnErrorGet)
|
|
1279
|
-
status = (*dpiOciSymbols.fnErrorGet)(handle, 1, NULL, &error->buffer->code,
|
|
1280
|
-
error->buffer->message, sizeof(error->buffer->message),
|
|
1281
|
-
handleType);
|
|
1282
|
-
if (status != DPI_OCI_SUCCESS)
|
|
1283
|
-
return dpiError__set(error, action, DPI_ERR_GET_FAILED);
|
|
1284
|
-
error->buffer->action = action;
|
|
1285
|
-
|
|
1286
|
-
// determine length of message since OCI does not provide this information;
|
|
1287
|
-
// all encodings except UTF-16 can use normal string processing; cannot use
|
|
1288
|
-
// type whar_t for processing UTF-16, though, as its size may be 4 on some
|
|
1289
|
-
// platforms, not 2; also strip trailing whitespace from error messages
|
|
1290
|
-
if (charsetId == DPI_CHARSET_ID_UTF16) {
|
|
1291
|
-
numChars = 0;
|
|
1292
|
-
utf16chars = (uint16_t*) error->buffer->message;
|
|
1293
|
-
bufferChars = sizeof(error->buffer->message) / 2;
|
|
1294
|
-
for (i = 0; i < bufferChars; i++) {
|
|
1295
|
-
if (utf16chars[i] == 0)
|
|
1296
|
-
break;
|
|
1297
|
-
if (utf16chars[i] > 127 || !isspace(utf16chars[i]))
|
|
1298
|
-
numChars = i + 1;
|
|
1299
|
-
}
|
|
1300
|
-
error->buffer->messageLength = numChars * 2;
|
|
1301
|
-
} else {
|
|
1302
|
-
error->buffer->messageLength =
|
|
1303
|
-
(uint32_t) strlen(error->buffer->message);
|
|
1304
|
-
ptr = error->buffer->message + error->buffer->messageLength - 1;
|
|
1305
|
-
while (ptr > error->buffer->message && isspace((uint8_t) *ptr--))
|
|
1306
|
-
error->buffer->messageLength--;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
return DPI_SUCCESS;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
//-----------------------------------------------------------------------------
|
|
1314
|
-
// dpiOci__freeMem() [INTERNAL]
|
|
1315
|
-
// Wrapper for OCI allocation of memory, only used when debugging memory
|
|
1316
|
-
// allocation.
|
|
1317
|
-
//-----------------------------------------------------------------------------
|
|
1318
|
-
static void dpiOci__freeMem(void *unused, void *ptr)
|
|
1319
|
-
{
|
|
1320
|
-
char message[40];
|
|
1321
|
-
|
|
1322
|
-
(void) sprintf(message, "OCI freed ptr at %p", ptr);
|
|
1323
|
-
free(ptr);
|
|
1324
|
-
dpiDebug__print("%s\n", message);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
//-----------------------------------------------------------------------------
|
|
1329
|
-
// dpiOci__handleAlloc() [INTERNAL]
|
|
1330
|
-
// Wrapper for OCIHandleAlloc().
|
|
1331
|
-
//-----------------------------------------------------------------------------
|
|
1332
|
-
int dpiOci__handleAlloc(void *envHandle, void **handle, uint32_t handleType,
|
|
1333
|
-
const char *action, dpiError *error)
|
|
1334
|
-
{
|
|
1335
|
-
int status;
|
|
1336
|
-
|
|
1337
|
-
DPI_OCI_LOAD_SYMBOL("OCIHandleAlloc", dpiOciSymbols.fnHandleAlloc)
|
|
1338
|
-
status = (*dpiOciSymbols.fnHandleAlloc)(envHandle, handle, handleType, 0,
|
|
1339
|
-
NULL);
|
|
1340
|
-
if (handleType == DPI_OCI_HTYPE_ERROR && status != DPI_OCI_SUCCESS)
|
|
1341
|
-
return dpiError__set(error, action, DPI_ERR_NO_MEMORY);
|
|
1342
|
-
return dpiError__check(error, status, NULL, action);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
//-----------------------------------------------------------------------------
|
|
1347
|
-
// dpiOci__handleFree() [INTERNAL]
|
|
1348
|
-
// Wrapper for OCIHandleFree().
|
|
1349
|
-
//-----------------------------------------------------------------------------
|
|
1350
|
-
int dpiOci__handleFree(void *handle, uint32_t handleType)
|
|
1351
|
-
{
|
|
1352
|
-
dpiError *error = NULL;
|
|
1353
|
-
int status;
|
|
1354
|
-
|
|
1355
|
-
DPI_OCI_LOAD_SYMBOL("OCIHandleFree", dpiOciSymbols.fnHandleFree)
|
|
1356
|
-
status = (*dpiOciSymbols.fnHandleFree)(handle, handleType);
|
|
1357
|
-
if (status != DPI_OCI_SUCCESS && dpiDebugLevel & DPI_DEBUG_LEVEL_FREES)
|
|
1358
|
-
dpiDebug__print("free handle %p, handleType %d failed\n", handle,
|
|
1359
|
-
handleType);
|
|
1360
|
-
return DPI_SUCCESS;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
//-----------------------------------------------------------------------------
|
|
1365
|
-
// dpiOci__intervalGetDaySecond() [INTERNAL]
|
|
1366
|
-
// Wrapper for OCIIntervalGetDaySecond().
|
|
1367
|
-
//-----------------------------------------------------------------------------
|
|
1368
|
-
int dpiOci__intervalGetDaySecond(void *envHandle, int32_t *day, int32_t *hour,
|
|
1369
|
-
int32_t *minute, int32_t *second, int32_t *fsecond,
|
|
1370
|
-
const void *interval, dpiError *error)
|
|
1371
|
-
{
|
|
1372
|
-
int status;
|
|
1373
|
-
|
|
1374
|
-
DPI_OCI_LOAD_SYMBOL("OCIIntervalGetDaySecond",
|
|
1375
|
-
dpiOciSymbols.fnIntervalGetDaySecond)
|
|
1376
|
-
status = (*dpiOciSymbols.fnIntervalGetDaySecond)(envHandle,
|
|
1377
|
-
error->handle, day, hour, minute, second, fsecond, interval);
|
|
1378
|
-
return dpiError__check(error, status, NULL, "get interval components");
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
//-----------------------------------------------------------------------------
|
|
1383
|
-
// dpiOci__intervalGetYearMonth() [INTERNAL]
|
|
1384
|
-
// Wrapper for OCIIntervalGetYearMonth().
|
|
1385
|
-
//-----------------------------------------------------------------------------
|
|
1386
|
-
int dpiOci__intervalGetYearMonth(void *envHandle, int32_t *year,
|
|
1387
|
-
int32_t *month, const void *interval, dpiError *error)
|
|
1388
|
-
{
|
|
1389
|
-
int status;
|
|
1390
|
-
|
|
1391
|
-
DPI_OCI_LOAD_SYMBOL("OCIIntervalGetYearMonth",
|
|
1392
|
-
dpiOciSymbols.fnIntervalGetYearMonth)
|
|
1393
|
-
status = (*dpiOciSymbols.fnIntervalGetYearMonth)(envHandle, error->handle,
|
|
1394
|
-
year, month, interval);
|
|
1395
|
-
return dpiError__check(error, status, NULL, "get interval components");
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
//-----------------------------------------------------------------------------
|
|
1400
|
-
// dpiOci__intervalSetDaySecond() [INTERNAL]
|
|
1401
|
-
// Wrapper for OCIIntervalSetDaySecond().
|
|
1402
|
-
//-----------------------------------------------------------------------------
|
|
1403
|
-
int dpiOci__intervalSetDaySecond(void *envHandle, int32_t day, int32_t hour,
|
|
1404
|
-
int32_t minute, int32_t second, int32_t fsecond, void *interval,
|
|
1405
|
-
dpiError *error)
|
|
1406
|
-
{
|
|
1407
|
-
int status;
|
|
1408
|
-
|
|
1409
|
-
DPI_OCI_LOAD_SYMBOL("OCIIntervalSetDaySecond",
|
|
1410
|
-
dpiOciSymbols.fnIntervalSetDaySecond)
|
|
1411
|
-
status = (*dpiOciSymbols.fnIntervalSetDaySecond)(envHandle, error->handle,
|
|
1412
|
-
day, hour, minute, second, fsecond, interval);
|
|
1413
|
-
return dpiError__check(error, status, NULL, "set interval components");
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
//-----------------------------------------------------------------------------
|
|
1418
|
-
// dpiOci__intervalSetYearMonth() [INTERNAL]
|
|
1419
|
-
// Wrapper for OCIIntervalSetYearMonth().
|
|
1420
|
-
//-----------------------------------------------------------------------------
|
|
1421
|
-
int dpiOci__intervalSetYearMonth(void *envHandle, int32_t year, int32_t month,
|
|
1422
|
-
void *interval, dpiError *error)
|
|
1423
|
-
{
|
|
1424
|
-
int status;
|
|
1425
|
-
|
|
1426
|
-
DPI_OCI_LOAD_SYMBOL("OCIIntervalSetYearMonth",
|
|
1427
|
-
dpiOciSymbols.fnIntervalSetYearMonth)
|
|
1428
|
-
status = (*dpiOciSymbols.fnIntervalSetYearMonth)(envHandle, error->handle,
|
|
1429
|
-
year, month, interval);
|
|
1430
|
-
return dpiError__check(error, status, NULL, "set interval components");
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
#ifdef _WIN32
|
|
1435
|
-
//-----------------------------------------------------------------------------
|
|
1436
|
-
// dpiOci__checkDllArchitecture() [INTERNAL]
|
|
1437
|
-
// Check the architecture of the specified DLL name and check that it
|
|
1438
|
-
// matches the expected architecture. Returns -1 if the DLL architecture could
|
|
1439
|
-
// not be determined, 0 if it does not match and 1 if it matches.
|
|
1440
|
-
//-----------------------------------------------------------------------------
|
|
1441
|
-
static int dpiOci__checkDllArchitecture(const char *name)
|
|
1442
|
-
{
|
|
1443
|
-
IMAGE_DOS_HEADER dosHeader;
|
|
1444
|
-
IMAGE_NT_HEADERS ntHeaders;
|
|
1445
|
-
FILE *fp;
|
|
1446
|
-
|
|
1447
|
-
fp = fopen(name, "rb");
|
|
1448
|
-
if (!fp)
|
|
1449
|
-
return -1;
|
|
1450
|
-
fread(&dosHeader, sizeof(dosHeader), 1, fp);
|
|
1451
|
-
if (dosHeader.e_magic != IMAGE_DOS_SIGNATURE) {
|
|
1452
|
-
fclose(fp);
|
|
1453
|
-
return -1;
|
|
1454
|
-
}
|
|
1455
|
-
fseek(fp, dosHeader.e_lfanew, SEEK_SET);
|
|
1456
|
-
fread(&ntHeaders, sizeof(ntHeaders), 1, fp);
|
|
1457
|
-
fclose(fp);
|
|
1458
|
-
if (ntHeaders.Signature != IMAGE_NT_SIGNATURE)
|
|
1459
|
-
return -1;
|
|
1460
|
-
#if defined _M_AMD64
|
|
1461
|
-
if (ntHeaders.FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64)
|
|
1462
|
-
return 1;
|
|
1463
|
-
#elif defined _M_IX86
|
|
1464
|
-
if (ntHeaders.FileHeader.Machine == IMAGE_FILE_MACHINE_I386)
|
|
1465
|
-
return 1;
|
|
1466
|
-
#endif
|
|
1467
|
-
return 0;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
//-----------------------------------------------------------------------------
|
|
1472
|
-
// dpiOci__findAndCheckDllArchitecture() [INTERNAL]
|
|
1473
|
-
// Attempt to find the specified DLL name using the standard search path and
|
|
1474
|
-
// if the DLL can be found but is of the wrong architecture, include the full
|
|
1475
|
-
// name of the DLL in the load error. Return -1 if such a DLL could not be
|
|
1476
|
-
// found and 0 if the load error was changed.
|
|
1477
|
-
//-----------------------------------------------------------------------------
|
|
1478
|
-
static int dpiOci__findAndCheckDllArchitecture(const char *dllName,
|
|
1479
|
-
char *loadError, size_t loadErrorLength)
|
|
1480
|
-
{
|
|
1481
|
-
char fullName[_MAX_PATH + 1], *path, *temp;
|
|
1482
|
-
size_t length;
|
|
1483
|
-
int found = 0;
|
|
1484
|
-
|
|
1485
|
-
// first search executable directory
|
|
1486
|
-
if (GetModuleFileName(NULL, fullName, sizeof(fullName)) != 0) {
|
|
1487
|
-
temp = strrchr(fullName, '\\');
|
|
1488
|
-
if (temp) {
|
|
1489
|
-
*(temp + 1) = '\0';
|
|
1490
|
-
strncat(fullName, dllName,
|
|
1491
|
-
sizeof(fullName) - strlen(fullName) - 1);
|
|
1492
|
-
if (dpiOci__checkDllArchitecture(fullName) == 0)
|
|
1493
|
-
found = 1;
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
// check current directory
|
|
1498
|
-
if (!found && GetCurrentDirectory(sizeof(fullName), fullName) != 0) {
|
|
1499
|
-
temp = fullName + strlen(fullName);
|
|
1500
|
-
snprintf(temp, sizeof(fullName) - strlen(fullName), "\\%s", dllName);
|
|
1501
|
-
if (dpiOci__checkDllArchitecture(fullName) == 0)
|
|
1502
|
-
found = 1;
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
// search PATH
|
|
1506
|
-
path = getenv("PATH");
|
|
1507
|
-
if (path) {
|
|
1508
|
-
while (!found) {
|
|
1509
|
-
temp = strchr(path, ';');
|
|
1510
|
-
if (!temp)
|
|
1511
|
-
length = strlen(path);
|
|
1512
|
-
else length = temp - path;
|
|
1513
|
-
if (length <= _MAX_DIR) {
|
|
1514
|
-
snprintf(fullName, sizeof(fullName), "%.*s\\%s", (int) length,
|
|
1515
|
-
path, dllName);
|
|
1516
|
-
if (dpiOci__checkDllArchitecture(fullName) == 0) {
|
|
1517
|
-
found = 1;
|
|
1518
|
-
break;
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
if (!temp)
|
|
1522
|
-
break;
|
|
1523
|
-
path = temp + 1;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
// if found, adjust the load error
|
|
1528
|
-
if (found) {
|
|
1529
|
-
snprintf(loadError, loadErrorLength,
|
|
1530
|
-
"%s is not the correct architecture", fullName);
|
|
1531
|
-
loadError[loadErrorLength - 1] = '\0';
|
|
1532
|
-
return 0;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
return -1;
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
//-----------------------------------------------------------------------------
|
|
1540
|
-
// dpiOci__getLoadErrorOnWindows() [INTERNAL]
|
|
1541
|
-
// Get the error message for a load failure on Windows.
|
|
1542
|
-
//-----------------------------------------------------------------------------
|
|
1543
|
-
static void dpiOci__getLoadErrorOnWindows(const char *dllName,
|
|
1544
|
-
char *loadError, size_t loadErrorLength)
|
|
1545
|
-
{
|
|
1546
|
-
DWORD length = 0, errorNum, status;
|
|
1547
|
-
wchar_t *wLoadError = NULL;
|
|
1548
|
-
|
|
1549
|
-
// if DLL is of the wrong architecture, attempt to locate the DLL that was
|
|
1550
|
-
// loaded and use that information if it can be found
|
|
1551
|
-
errorNum = GetLastError();
|
|
1552
|
-
if (errorNum == ERROR_BAD_EXE_FORMAT &&
|
|
1553
|
-
dpiOci__findAndCheckDllArchitecture(dllName, loadError,
|
|
1554
|
-
loadErrorLength) == 0)
|
|
1555
|
-
return;
|
|
1556
|
-
|
|
1557
|
-
// get error message in Unicode first
|
|
1558
|
-
// use English unless English error messages aren't available
|
|
1559
|
-
status = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
|
|
1560
|
-
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
|
1561
|
-
NULL, errorNum, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
|
1562
|
-
(LPWSTR) &wLoadError, 0, NULL);
|
|
1563
|
-
if (!status && GetLastError() == ERROR_MUI_FILE_NOT_FOUND)
|
|
1564
|
-
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
|
|
1565
|
-
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
|
1566
|
-
NULL, errorNum, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
1567
|
-
(LPWSTR) &wLoadError, 0, NULL);
|
|
1568
|
-
|
|
1569
|
-
if (wLoadError) {
|
|
1570
|
-
|
|
1571
|
-
// strip trailing period and carriage return from message, if needed
|
|
1572
|
-
length = (DWORD) wcslen(wLoadError);
|
|
1573
|
-
while (length > 0) {
|
|
1574
|
-
if (wLoadError[length - 1] > 127 ||
|
|
1575
|
-
(wLoadError[length - 1] != L'.' &&
|
|
1576
|
-
!isspace(wLoadError[length - 1])))
|
|
1577
|
-
break;
|
|
1578
|
-
length--;
|
|
1579
|
-
}
|
|
1580
|
-
wLoadError[length] = L'\0';
|
|
1581
|
-
|
|
1582
|
-
// convert to a multi-byte string in UTF-8 encoding
|
|
1583
|
-
if (length > 0)
|
|
1584
|
-
length = WideCharToMultiByte(CP_UTF8, 0, wLoadError, -1, loadError,
|
|
1585
|
-
(int) loadErrorLength, NULL, NULL);
|
|
1586
|
-
LocalFree(wLoadError);
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
// fallback in case message cannot be determined
|
|
1591
|
-
if (length == 0)
|
|
1592
|
-
sprintf(loadError, "DLL load failed: Windows Error %d", errorNum);
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
//-----------------------------------------------------------------------------
|
|
1597
|
-
// dpiOci__loadLibOnWindows() [INTERNAL]
|
|
1598
|
-
// Load the library on the Windows platform. First an attempt is made to
|
|
1599
|
-
// determine the location of the module containing ODPI-C. If found, an attempt
|
|
1600
|
-
// is made to load oci.dll from that location; otherwise a standard Windows
|
|
1601
|
-
// search is made for oci.dll.
|
|
1602
|
-
//-----------------------------------------------------------------------------
|
|
1603
|
-
static void dpiOci__loadLibOnWindows(const char *dllName)
|
|
1604
|
-
{
|
|
1605
|
-
char moduleName[MAX_PATH + 1], *temp;
|
|
1606
|
-
HMODULE module = NULL;
|
|
1607
|
-
|
|
1608
|
-
// attempt to determine the location of the module containing ODPI-C;
|
|
1609
|
-
// errors in this code are ignored and the normal loading mechanism is
|
|
1610
|
-
// used instead
|
|
1611
|
-
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
|
|
1612
|
-
(LPCSTR) dpiOci__loadLibOnWindows, &module)) {
|
|
1613
|
-
if (GetModuleFileName(module, moduleName, sizeof(moduleName)) > 0) {
|
|
1614
|
-
temp = strrchr(moduleName, '\\');
|
|
1615
|
-
if (temp) {
|
|
1616
|
-
*(temp + 1) = '\0';
|
|
1617
|
-
strncat(moduleName, dllName,
|
|
1618
|
-
sizeof(moduleName) - strlen(moduleName) - 1);
|
|
1619
|
-
dpiOciLibHandle = LoadLibrary(moduleName);
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
FreeLibrary(module);
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
// if library was not loaded in the same location as ODPI-C, use the
|
|
1626
|
-
// standard Windows search to locate oci.dll instead
|
|
1627
|
-
if (!dpiOciLibHandle)
|
|
1628
|
-
dpiOciLibHandle = LoadLibrary(dllName);
|
|
1629
|
-
}
|
|
1630
|
-
#endif
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
//-----------------------------------------------------------------------------
|
|
1634
|
-
// dpiOci__loadLib() [INTERNAL]
|
|
1635
|
-
// Load the OCI library.
|
|
1636
|
-
//-----------------------------------------------------------------------------
|
|
1637
|
-
static int dpiOci__loadLib(dpiError *error)
|
|
1638
|
-
{
|
|
1639
|
-
const char *libName;
|
|
1640
|
-
char loadError[512];
|
|
1641
|
-
unsigned int i;
|
|
1642
|
-
#ifndef _WIN32
|
|
1643
|
-
char *oracleHome, *oracleHomeLibName;
|
|
1644
|
-
size_t oracleHomeLibNameLength;
|
|
1645
|
-
#endif
|
|
1646
|
-
|
|
1647
|
-
// dynamically load the OCI library
|
|
1648
|
-
for (i = 0; !dpiOciLibHandle; i++) {
|
|
1649
|
-
libName = dpiOciLibNames[i];
|
|
1650
|
-
if (!libName)
|
|
1651
|
-
break;
|
|
1652
|
-
#ifdef _WIN32
|
|
1653
|
-
dpiOci__loadLibOnWindows(libName);
|
|
1654
|
-
if (!dpiOciLibHandle && i == 0)
|
|
1655
|
-
dpiOci__getLoadErrorOnWindows(libName, loadError,
|
|
1656
|
-
sizeof(loadError));
|
|
1657
|
-
#else
|
|
1658
|
-
dpiOciLibHandle = dlopen(libName, RTLD_LAZY);
|
|
1659
|
-
if (!dpiOciLibHandle && i == 0) {
|
|
1660
|
-
strncpy(loadError, dlerror(), sizeof(loadError) - 1);
|
|
1661
|
-
loadError[sizeof(loadError) - 1] = '\0';
|
|
1662
|
-
}
|
|
1663
|
-
#endif
|
|
1664
|
-
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
#ifndef _WIN32
|
|
1668
|
-
// on platforms other than Windows, attempt to use
|
|
1669
|
-
// $ORACLE_HOME/lib/libclntsh.so
|
|
1670
|
-
if (!dpiOciLibHandle) {
|
|
1671
|
-
oracleHome = getenv("ORACLE_HOME");
|
|
1672
|
-
if (oracleHome) {
|
|
1673
|
-
oracleHomeLibNameLength = strlen(oracleHome) + 6 +
|
|
1674
|
-
strlen(dpiOciLibNames[0]);
|
|
1675
|
-
oracleHomeLibName = (char*) malloc(oracleHomeLibNameLength);
|
|
1676
|
-
if (oracleHomeLibName) {
|
|
1677
|
-
(void) sprintf(oracleHomeLibName, "%s/lib/%s", oracleHome,
|
|
1678
|
-
dpiOciLibNames[0]);
|
|
1679
|
-
dpiOciLibHandle = dlopen(oracleHomeLibName, RTLD_LAZY);
|
|
1680
|
-
free(oracleHomeLibName);
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
#endif
|
|
1685
|
-
|
|
1686
|
-
if (!dpiOciLibHandle) {
|
|
1687
|
-
const char *bits = (sizeof(void*) == 8) ? "64" : "32";
|
|
1688
|
-
return dpiError__set(error, "load library", DPI_ERR_LOAD_LIBRARY,
|
|
1689
|
-
bits, loadError, DPI_ERR_LOAD_URL_FRAGMENT);
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
// validate library
|
|
1693
|
-
if (dpiOci__loadLibValidate(error) < 0) {
|
|
1694
|
-
#ifdef _WIN32
|
|
1695
|
-
FreeLibrary(dpiOciLibHandle);
|
|
1696
|
-
#else
|
|
1697
|
-
dlclose(dpiOciLibHandle);
|
|
1698
|
-
#endif
|
|
1699
|
-
dpiOciLibHandle = NULL;
|
|
1700
|
-
memset(&dpiOciSymbols, 0, sizeof(dpiOciSymbols));
|
|
1701
|
-
return DPI_FAILURE;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
return DPI_SUCCESS;
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
//-----------------------------------------------------------------------------
|
|
1709
|
-
// dpiOci__loadLibValidate() [INTERNAL]
|
|
1710
|
-
// Validate the OCI library after loading.
|
|
1711
|
-
//-----------------------------------------------------------------------------
|
|
1712
|
-
static int dpiOci__loadLibValidate(dpiError *error)
|
|
1713
|
-
{
|
|
1714
|
-
// determine the OCI client version information
|
|
1715
|
-
if (dpiOci__loadSymbol("OCIClientVersion",
|
|
1716
|
-
(void**) &dpiOciSymbols.fnClientVersion, NULL) < 0)
|
|
1717
|
-
return dpiError__set(error, "check Oracle Client version",
|
|
1718
|
-
DPI_ERR_ORACLE_CLIENT_TOO_OLD, 11, 2, 0, 0);
|
|
1719
|
-
(*dpiOciSymbols.fnClientVersion)(&dpiOciLibVersionInfo.versionNum,
|
|
1720
|
-
&dpiOciLibVersionInfo.releaseNum,
|
|
1721
|
-
&dpiOciLibVersionInfo.updateNum,
|
|
1722
|
-
&dpiOciLibVersionInfo.portReleaseNum,
|
|
1723
|
-
&dpiOciLibVersionInfo.portUpdateNum);
|
|
1724
|
-
dpiOciLibVersionInfo.fullVersionNum = (uint32_t)
|
|
1725
|
-
DPI_ORACLE_VERSION_TO_NUMBER(dpiOciLibVersionInfo.versionNum,
|
|
1726
|
-
dpiOciLibVersionInfo.releaseNum,
|
|
1727
|
-
dpiOciLibVersionInfo.updateNum,
|
|
1728
|
-
dpiOciLibVersionInfo.portReleaseNum,
|
|
1729
|
-
dpiOciLibVersionInfo.portUpdateNum);
|
|
1730
|
-
|
|
1731
|
-
// OCI version must be a minimum of 11.2
|
|
1732
|
-
if (dpiUtils__checkClientVersion(&dpiOciLibVersionInfo, 11, 2, error) < 0)
|
|
1733
|
-
return DPI_FAILURE;
|
|
1734
|
-
|
|
1735
|
-
// initialize threading capability in the OCI library
|
|
1736
|
-
// this must be run prior to any other OCI threading calls
|
|
1737
|
-
DPI_OCI_LOAD_SYMBOL("OCIThreadProcessInit",
|
|
1738
|
-
dpiOciSymbols.fnThreadProcessInit)
|
|
1739
|
-
(*dpiOciSymbols.fnThreadProcessInit)();
|
|
1740
|
-
|
|
1741
|
-
// load symbols for key functions which are called many times
|
|
1742
|
-
// this list should be kept as small as possible in order to avoid
|
|
1743
|
-
// overhead in looking up symbols at startup
|
|
1744
|
-
DPI_OCI_LOAD_SYMBOL("OCIAttrGet", dpiOciSymbols.fnAttrGet)
|
|
1745
|
-
DPI_OCI_LOAD_SYMBOL("OCIAttrSet", dpiOciSymbols.fnAttrSet)
|
|
1746
|
-
DPI_OCI_LOAD_SYMBOL("OCIThreadKeyGet", dpiOciSymbols.fnThreadKeyGet)
|
|
1747
|
-
|
|
1748
|
-
return DPI_SUCCESS;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
//-----------------------------------------------------------------------------
|
|
1753
|
-
// dpiOci__loadSymbol() [INTERNAL]
|
|
1754
|
-
// Return the symbol for the function that is to be called. The symbol table
|
|
1755
|
-
// is first consulted. If the symbol is not found there, it is looked up and
|
|
1756
|
-
// then stored there so the next invocation does not have to perform the
|
|
1757
|
-
// lookup.
|
|
1758
|
-
//-----------------------------------------------------------------------------
|
|
1759
|
-
static int dpiOci__loadSymbol(const char *symbolName, void **symbol,
|
|
1760
|
-
dpiError *error)
|
|
1761
|
-
{
|
|
1762
|
-
// if library not already opened, open it
|
|
1763
|
-
if (!dpiOciLibHandle && dpiOci__loadLib(error) < 0)
|
|
1764
|
-
return DPI_FAILURE;
|
|
1765
|
-
|
|
1766
|
-
// load symbol
|
|
1767
|
-
#ifdef _WIN32
|
|
1768
|
-
*symbol = GetProcAddress(dpiOciLibHandle, symbolName);
|
|
1769
|
-
#else
|
|
1770
|
-
*symbol = dlsym(dpiOciLibHandle, symbolName);
|
|
1771
|
-
#endif
|
|
1772
|
-
if (!*symbol)
|
|
1773
|
-
return dpiError__set(error, "get symbol", DPI_ERR_LOAD_SYMBOL,
|
|
1774
|
-
symbolName);
|
|
1775
|
-
|
|
1776
|
-
return DPI_SUCCESS;
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
//-----------------------------------------------------------------------------
|
|
1781
|
-
// dpiOci__lobClose() [INTERNAL]
|
|
1782
|
-
// Wrapper for OCILobClose().
|
|
1783
|
-
//-----------------------------------------------------------------------------
|
|
1784
|
-
int dpiOci__lobClose(dpiLob *lob, dpiError *error)
|
|
1785
|
-
{
|
|
1786
|
-
int status;
|
|
1787
|
-
|
|
1788
|
-
DPI_OCI_LOAD_SYMBOL("OCILobClose", dpiOciSymbols.fnLobClose)
|
|
1789
|
-
status = (*dpiOciSymbols.fnLobClose)(lob->conn->handle, error->handle,
|
|
1790
|
-
lob->locator);
|
|
1791
|
-
return dpiError__check(error, status, lob->conn, "close LOB");
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
//-----------------------------------------------------------------------------
|
|
1796
|
-
// dpiOci__lobCreateTemporary() [INTERNAL]
|
|
1797
|
-
// Wrapper for OCILobCreateTemporary().
|
|
1798
|
-
//-----------------------------------------------------------------------------
|
|
1799
|
-
int dpiOci__lobCreateTemporary(dpiLob *lob, dpiError *error)
|
|
1800
|
-
{
|
|
1801
|
-
uint8_t lobType;
|
|
1802
|
-
int status;
|
|
1803
|
-
|
|
1804
|
-
DPI_OCI_LOAD_SYMBOL("OCILobCreateTemporary",
|
|
1805
|
-
dpiOciSymbols.fnLobCreateTemporary)
|
|
1806
|
-
if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_BLOB)
|
|
1807
|
-
lobType = DPI_OCI_TEMP_BLOB;
|
|
1808
|
-
else lobType = DPI_OCI_TEMP_CLOB;
|
|
1809
|
-
status = (*dpiOciSymbols.fnLobCreateTemporary)(lob->conn->handle,
|
|
1810
|
-
error->handle, lob->locator, DPI_OCI_DEFAULT,
|
|
1811
|
-
lob->type->charsetForm, lobType, 1, DPI_OCI_DURATION_SESSION);
|
|
1812
|
-
return dpiError__check(error, status, lob->conn, "create temporary LOB");
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
//-----------------------------------------------------------------------------
|
|
1817
|
-
// dpiOci__lobFileExists() [INTERNAL]
|
|
1818
|
-
// Wrapper for OCILobFileExists().
|
|
1819
|
-
//-----------------------------------------------------------------------------
|
|
1820
|
-
int dpiOci__lobFileExists(dpiLob *lob, int *exists, dpiError *error)
|
|
1821
|
-
{
|
|
1822
|
-
int status;
|
|
1823
|
-
|
|
1824
|
-
DPI_OCI_LOAD_SYMBOL("OCILobFileExists", dpiOciSymbols.fnLobFileExists)
|
|
1825
|
-
status = (*dpiOciSymbols.fnLobFileExists)(lob->conn->handle, error->handle,
|
|
1826
|
-
lob->locator, exists);
|
|
1827
|
-
return dpiError__check(error, status, lob->conn, "get file exists");
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
//-----------------------------------------------------------------------------
|
|
1832
|
-
// dpiOci__lobFileGetName() [INTERNAL]
|
|
1833
|
-
// Wrapper for OCILobFileGetName().
|
|
1834
|
-
//-----------------------------------------------------------------------------
|
|
1835
|
-
int dpiOci__lobFileGetName(dpiLob *lob, char *dirAlias,
|
|
1836
|
-
uint16_t *dirAliasLength, char *name, uint16_t *nameLength,
|
|
1837
|
-
dpiError *error)
|
|
1838
|
-
{
|
|
1839
|
-
int status;
|
|
1840
|
-
|
|
1841
|
-
DPI_OCI_LOAD_SYMBOL("OCILobFileGetName", dpiOciSymbols.fnLobFileGetName)
|
|
1842
|
-
status = (*dpiOciSymbols.fnLobFileGetName)(lob->env->handle, error->handle,
|
|
1843
|
-
lob->locator, dirAlias, dirAliasLength, name, nameLength);
|
|
1844
|
-
return dpiError__check(error, status, lob->conn, "get LOB file name");
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
//-----------------------------------------------------------------------------
|
|
1849
|
-
// dpiOci__lobFileSetName() [INTERNAL]
|
|
1850
|
-
// Wrapper for OCILobFileSetName().
|
|
1851
|
-
//-----------------------------------------------------------------------------
|
|
1852
|
-
int dpiOci__lobFileSetName(dpiLob *lob, const char *dirAlias,
|
|
1853
|
-
uint16_t dirAliasLength, const char *name, uint16_t nameLength,
|
|
1854
|
-
dpiError *error)
|
|
1855
|
-
{
|
|
1856
|
-
int status;
|
|
1857
|
-
|
|
1858
|
-
DPI_OCI_LOAD_SYMBOL("OCILobFileSetName", dpiOciSymbols.fnLobFileSetName)
|
|
1859
|
-
status = (*dpiOciSymbols.fnLobFileSetName)(lob->env->handle, error->handle,
|
|
1860
|
-
&lob->locator, dirAlias, dirAliasLength, name, nameLength);
|
|
1861
|
-
return dpiError__check(error, status, lob->conn, "set LOB file name");
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
//-----------------------------------------------------------------------------
|
|
1866
|
-
// dpiOci__lobFreeTemporary() [INTERNAL]
|
|
1867
|
-
// Wrapper for OCILobFreeTemporary().
|
|
1868
|
-
//-----------------------------------------------------------------------------
|
|
1869
|
-
int dpiOci__lobFreeTemporary(dpiConn *conn, void *lobLocator, int checkError,
|
|
1870
|
-
dpiError *error)
|
|
1871
|
-
{
|
|
1872
|
-
int status;
|
|
1873
|
-
|
|
1874
|
-
DPI_OCI_LOAD_SYMBOL("OCILobFreeTemporary",
|
|
1875
|
-
dpiOciSymbols.fnLobFreeTemporary)
|
|
1876
|
-
status = (*dpiOciSymbols.fnLobFreeTemporary)(conn->handle,
|
|
1877
|
-
error->handle, lobLocator);
|
|
1878
|
-
if (checkError)
|
|
1879
|
-
return dpiError__check(error, status, conn, "free temporary LOB");
|
|
1880
|
-
return DPI_SUCCESS;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
//-----------------------------------------------------------------------------
|
|
1885
|
-
// dpiOci__lobGetChunkSize() [INTERNAL]
|
|
1886
|
-
// Wrapper for OCILobGetChunkSize().
|
|
1887
|
-
//-----------------------------------------------------------------------------
|
|
1888
|
-
int dpiOci__lobGetChunkSize(dpiLob *lob, uint32_t *size, dpiError *error)
|
|
1889
|
-
{
|
|
1890
|
-
int status;
|
|
1891
|
-
|
|
1892
|
-
DPI_OCI_LOAD_SYMBOL("OCILobGetChunkSize", dpiOciSymbols.fnLobGetChunkSize)
|
|
1893
|
-
status = (*dpiOciSymbols.fnLobGetChunkSize)(lob->conn->handle,
|
|
1894
|
-
error->handle, lob->locator, size);
|
|
1895
|
-
return dpiError__check(error, status, lob->conn, "get chunk size");
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
//-----------------------------------------------------------------------------
|
|
1900
|
-
// dpiOci__lobGetLength2() [INTERNAL]
|
|
1901
|
-
// Wrapper for OCILobGetLength2().
|
|
1902
|
-
//-----------------------------------------------------------------------------
|
|
1903
|
-
int dpiOci__lobGetLength2(dpiLob *lob, uint64_t *size, dpiError *error)
|
|
1904
|
-
{
|
|
1905
|
-
int status;
|
|
1906
|
-
|
|
1907
|
-
DPI_OCI_LOAD_SYMBOL("OCILobGetLength2", dpiOciSymbols.fnLobGetLength2)
|
|
1908
|
-
status = (*dpiOciSymbols.fnLobGetLength2)(lob->conn->handle, error->handle,
|
|
1909
|
-
lob->locator, size);
|
|
1910
|
-
return dpiError__check(error, status, lob->conn, "get length");
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
//-----------------------------------------------------------------------------
|
|
1915
|
-
// dpiOci__lobIsOpen() [INTERNAL]
|
|
1916
|
-
// Wrapper for OCILobIsOpen().
|
|
1917
|
-
//-----------------------------------------------------------------------------
|
|
1918
|
-
int dpiOci__lobIsOpen(dpiLob *lob, int *isOpen, dpiError *error)
|
|
1919
|
-
{
|
|
1920
|
-
int status;
|
|
1921
|
-
|
|
1922
|
-
DPI_OCI_LOAD_SYMBOL("OCILobIsOpen", dpiOciSymbols.fnLobIsOpen)
|
|
1923
|
-
status = (*dpiOciSymbols.fnLobIsOpen)(lob->conn->handle, error->handle,
|
|
1924
|
-
lob->locator, isOpen);
|
|
1925
|
-
return dpiError__check(error, status, lob->conn, "check is open");
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
//-----------------------------------------------------------------------------
|
|
1930
|
-
// dpiOci__lobIsTemporary() [INTERNAL]
|
|
1931
|
-
// Wrapper for OCILobIsTemporary().
|
|
1932
|
-
//-----------------------------------------------------------------------------
|
|
1933
|
-
int dpiOci__lobIsTemporary(dpiLob *lob, int *isTemporary, int checkError,
|
|
1934
|
-
dpiError *error)
|
|
1935
|
-
{
|
|
1936
|
-
int status;
|
|
1937
|
-
|
|
1938
|
-
*isTemporary = 0;
|
|
1939
|
-
DPI_OCI_LOAD_SYMBOL("OCILobIsTemporary", dpiOciSymbols.fnLobIsTemporary)
|
|
1940
|
-
status = (*dpiOciSymbols.fnLobIsTemporary)(lob->env->handle, error->handle,
|
|
1941
|
-
lob->locator, isTemporary);
|
|
1942
|
-
if (checkError)
|
|
1943
|
-
return dpiError__check(error, status, lob->conn, "check is temporary");
|
|
1944
|
-
return DPI_SUCCESS;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
//-----------------------------------------------------------------------------
|
|
1949
|
-
// dpiOci__lobLocatorAssign() [INTERNAL]
|
|
1950
|
-
// Wrapper for OCILobLocatorAssign().
|
|
1951
|
-
//-----------------------------------------------------------------------------
|
|
1952
|
-
int dpiOci__lobLocatorAssign(dpiLob *lob, void **copiedHandle, dpiError *error)
|
|
1953
|
-
{
|
|
1954
|
-
int status;
|
|
1955
|
-
|
|
1956
|
-
DPI_OCI_LOAD_SYMBOL("OCILobLocatorAssign",
|
|
1957
|
-
dpiOciSymbols.fnLobLocatorAssign)
|
|
1958
|
-
status = (*dpiOciSymbols.fnLobLocatorAssign)(lob->conn->handle,
|
|
1959
|
-
error->handle, lob->locator, copiedHandle);
|
|
1960
|
-
return dpiError__check(error, status, lob->conn, "assign locator");
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
//-----------------------------------------------------------------------------
|
|
1965
|
-
// dpiOci__lobOpen() [INTERNAL]
|
|
1966
|
-
// Wrapper for OCILobOpen().
|
|
1967
|
-
//-----------------------------------------------------------------------------
|
|
1968
|
-
int dpiOci__lobOpen(dpiLob *lob, dpiError *error)
|
|
1969
|
-
{
|
|
1970
|
-
uint8_t mode;
|
|
1971
|
-
int status;
|
|
1972
|
-
|
|
1973
|
-
DPI_OCI_LOAD_SYMBOL("OCILobOpen", dpiOciSymbols.fnLobOpen)
|
|
1974
|
-
mode = (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_BFILE) ?
|
|
1975
|
-
DPI_OCI_LOB_READONLY : DPI_OCI_LOB_READWRITE;
|
|
1976
|
-
status = (*dpiOciSymbols.fnLobOpen)(lob->conn->handle, error->handle,
|
|
1977
|
-
lob->locator, mode);
|
|
1978
|
-
return dpiError__check(error, status, lob->conn, "close LOB");
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
//-----------------------------------------------------------------------------
|
|
1983
|
-
// dpiOci__lobRead2() [INTERNAL]
|
|
1984
|
-
// Wrapper for OCILobRead2().
|
|
1985
|
-
//-----------------------------------------------------------------------------
|
|
1986
|
-
int dpiOci__lobRead2(dpiLob *lob, uint64_t offset, uint64_t *amountInBytes,
|
|
1987
|
-
uint64_t *amountInChars, char *buffer, uint64_t bufferLength,
|
|
1988
|
-
dpiError *error)
|
|
1989
|
-
{
|
|
1990
|
-
uint16_t charsetId;
|
|
1991
|
-
int status;
|
|
1992
|
-
|
|
1993
|
-
DPI_OCI_LOAD_SYMBOL("OCILobRead2", dpiOciSymbols.fnLobRead2)
|
|
1994
|
-
charsetId = (lob->type->charsetForm == DPI_SQLCS_NCHAR) ?
|
|
1995
|
-
lob->env->ncharsetId : lob->env->charsetId;
|
|
1996
|
-
status = (*dpiOciSymbols.fnLobRead2)(lob->conn->handle, error->handle,
|
|
1997
|
-
lob->locator, amountInBytes, amountInChars, offset, buffer,
|
|
1998
|
-
bufferLength, DPI_OCI_ONE_PIECE, NULL, NULL, charsetId,
|
|
1999
|
-
lob->type->charsetForm);
|
|
2000
|
-
return dpiError__check(error, status, lob->conn, "read from LOB");
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
//-----------------------------------------------------------------------------
|
|
2005
|
-
// dpiOci__lobTrim2() [INTERNAL]
|
|
2006
|
-
// Wrapper for OCILobTrim2().
|
|
2007
|
-
//-----------------------------------------------------------------------------
|
|
2008
|
-
int dpiOci__lobTrim2(dpiLob *lob, uint64_t newLength, dpiError *error)
|
|
2009
|
-
{
|
|
2010
|
-
int status;
|
|
2011
|
-
|
|
2012
|
-
DPI_OCI_LOAD_SYMBOL("OCILobTrim2", dpiOciSymbols.fnLobTrim2)
|
|
2013
|
-
status = (*dpiOciSymbols.fnLobTrim2)(lob->conn->handle, error->handle,
|
|
2014
|
-
lob->locator, newLength);
|
|
2015
|
-
if (status == DPI_OCI_INVALID_HANDLE)
|
|
2016
|
-
return dpiOci__lobCreateTemporary(lob, error);
|
|
2017
|
-
return dpiError__check(error, status, lob->conn, "trim LOB");
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
//-----------------------------------------------------------------------------
|
|
2022
|
-
// dpiOci__lobWrite2() [INTERNAL]
|
|
2023
|
-
// Wrapper for OCILobWrite2().
|
|
2024
|
-
//-----------------------------------------------------------------------------
|
|
2025
|
-
int dpiOci__lobWrite2(dpiLob *lob, uint64_t offset, const char *value,
|
|
2026
|
-
uint64_t valueLength, dpiError *error)
|
|
2027
|
-
{
|
|
2028
|
-
uint64_t lengthInBytes = valueLength, lengthInChars = 0;
|
|
2029
|
-
uint16_t charsetId;
|
|
2030
|
-
int status;
|
|
2031
|
-
|
|
2032
|
-
DPI_OCI_LOAD_SYMBOL("OCILobWrite2", dpiOciSymbols.fnLobWrite2)
|
|
2033
|
-
charsetId = (lob->type->charsetForm == DPI_SQLCS_NCHAR) ?
|
|
2034
|
-
lob->env->ncharsetId : lob->env->charsetId;
|
|
2035
|
-
status = (*dpiOciSymbols.fnLobWrite2)(lob->conn->handle, error->handle,
|
|
2036
|
-
lob->locator, &lengthInBytes, &lengthInChars, offset, (void*) value,
|
|
2037
|
-
valueLength, DPI_OCI_ONE_PIECE, NULL, NULL, charsetId,
|
|
2038
|
-
lob->type->charsetForm);
|
|
2039
|
-
return dpiError__check(error, status, lob->conn, "write to LOB");
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
//-----------------------------------------------------------------------------
|
|
2044
|
-
// dpiOci__memoryAlloc() [INTERNAL]
|
|
2045
|
-
// Wrapper for OCIMemoryAlloc().
|
|
2046
|
-
//-----------------------------------------------------------------------------
|
|
2047
|
-
int dpiOci__memoryAlloc(dpiConn *conn, void **ptr, uint32_t size,
|
|
2048
|
-
int checkError, dpiError *error)
|
|
2049
|
-
{
|
|
2050
|
-
int status;
|
|
2051
|
-
|
|
2052
|
-
*ptr = NULL;
|
|
2053
|
-
DPI_OCI_LOAD_SYMBOL("OCIMemoryAlloc", dpiOciSymbols.fnMemoryAlloc)
|
|
2054
|
-
status = (*dpiOciSymbols.fnMemoryAlloc)(conn->sessionHandle, error->handle,
|
|
2055
|
-
ptr, DPI_OCI_DURATION_SESSION, size, DPI_OCI_MEMORY_CLEARED);
|
|
2056
|
-
if (checkError)
|
|
2057
|
-
return dpiError__check(error, status, conn, "allocate memory");
|
|
2058
|
-
return DPI_SUCCESS;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
//-----------------------------------------------------------------------------
|
|
2063
|
-
// dpiOci__memoryFree() [INTERNAL]
|
|
2064
|
-
// Wrapper for OCIMemoryFree().
|
|
2065
|
-
//-----------------------------------------------------------------------------
|
|
2066
|
-
int dpiOci__memoryFree(dpiConn *conn, void *ptr, dpiError *error)
|
|
2067
|
-
{
|
|
2068
|
-
DPI_OCI_LOAD_SYMBOL("OCIMemoryFree", dpiOciSymbols.fnMemoryFree)
|
|
2069
|
-
(*dpiOciSymbols.fnMemoryFree)(conn->sessionHandle, error->handle, ptr);
|
|
2070
|
-
return DPI_SUCCESS;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
//-----------------------------------------------------------------------------
|
|
2075
|
-
// dpiOci__nlsCharSetConvert() [INTERNAL]
|
|
2076
|
-
// Wrapper for OCINlsCharSetConvert().
|
|
2077
|
-
//-----------------------------------------------------------------------------
|
|
2078
|
-
int dpiOci__nlsCharSetConvert(void *envHandle, uint16_t destCharsetId,
|
|
2079
|
-
char *dest, size_t destLength, uint16_t sourceCharsetId,
|
|
2080
|
-
const char *source, size_t sourceLength, size_t *resultSize,
|
|
2081
|
-
dpiError *error)
|
|
2082
|
-
{
|
|
2083
|
-
int status;
|
|
2084
|
-
|
|
2085
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsCharSetConvert",
|
|
2086
|
-
dpiOciSymbols.fnNlsCharSetConvert)
|
|
2087
|
-
status = (*dpiOciSymbols.fnNlsCharSetConvert)(envHandle, error->handle,
|
|
2088
|
-
destCharsetId, dest, destLength, sourceCharsetId, source,
|
|
2089
|
-
sourceLength, resultSize);
|
|
2090
|
-
return dpiError__check(error, status, NULL, "convert text");
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
//-----------------------------------------------------------------------------
|
|
2095
|
-
// dpiOci__nlsCharSetIdToName() [INTERNAL]
|
|
2096
|
-
// Wrapper for OCINlsCharSetIdToName().
|
|
2097
|
-
//-----------------------------------------------------------------------------
|
|
2098
|
-
int dpiOci__nlsCharSetIdToName(void *envHandle, char *buf, size_t bufLength,
|
|
2099
|
-
uint16_t charsetId, dpiError *error)
|
|
2100
|
-
{
|
|
2101
|
-
int status;
|
|
2102
|
-
|
|
2103
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsCharSetIdToName",
|
|
2104
|
-
dpiOciSymbols.fnNlsCharSetIdToName)
|
|
2105
|
-
status = (*dpiOciSymbols.fnNlsCharSetIdToName)(envHandle, buf, bufLength,
|
|
2106
|
-
charsetId);
|
|
2107
|
-
return (status == DPI_OCI_SUCCESS) ? DPI_SUCCESS : DPI_FAILURE;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
//-----------------------------------------------------------------------------
|
|
2112
|
-
// dpiOci__nlsCharSetNameToId() [INTERNAL]
|
|
2113
|
-
// Wrapper for OCINlsCharSetNameToId().
|
|
2114
|
-
//-----------------------------------------------------------------------------
|
|
2115
|
-
int dpiOci__nlsCharSetNameToId(void *envHandle, const char *name,
|
|
2116
|
-
uint16_t *charsetId, dpiError *error)
|
|
2117
|
-
{
|
|
2118
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsCharSetNameToId",
|
|
2119
|
-
dpiOciSymbols.fnNlsCharSetNameToId)
|
|
2120
|
-
*charsetId = (*dpiOciSymbols.fnNlsCharSetNameToId)(envHandle, name);
|
|
2121
|
-
return DPI_SUCCESS;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
//-----------------------------------------------------------------------------
|
|
2126
|
-
// dpiOci__nlsEnvironmentVariableGet() [INTERNAL]
|
|
2127
|
-
// Wrapper for OCIEnvironmentVariableGet().
|
|
2128
|
-
//-----------------------------------------------------------------------------
|
|
2129
|
-
int dpiOci__nlsEnvironmentVariableGet(uint16_t item, void *value,
|
|
2130
|
-
dpiError *error)
|
|
2131
|
-
{
|
|
2132
|
-
size_t ignored;
|
|
2133
|
-
int status;
|
|
2134
|
-
|
|
2135
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsEnvironmentVariableGet",
|
|
2136
|
-
dpiOciSymbols.fnNlsEnvironmentVariableGet)
|
|
2137
|
-
status = (*dpiOciSymbols.fnNlsEnvironmentVariableGet)(value, 0, item, 0,
|
|
2138
|
-
&ignored);
|
|
2139
|
-
if (status != DPI_OCI_SUCCESS)
|
|
2140
|
-
return dpiError__set(error, "get NLS environment variable",
|
|
2141
|
-
DPI_ERR_NLS_ENV_VAR_GET);
|
|
2142
|
-
return DPI_SUCCESS;
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
//-----------------------------------------------------------------------------
|
|
2147
|
-
// dpiOci__nlsNameMap() [INTERNAL]
|
|
2148
|
-
// Wrapper for OCINlsNameMap().
|
|
2149
|
-
//-----------------------------------------------------------------------------
|
|
2150
|
-
int dpiOci__nlsNameMap(void *envHandle, char *buf, size_t bufLength,
|
|
2151
|
-
const char *source, uint32_t flag, dpiError *error)
|
|
2152
|
-
{
|
|
2153
|
-
int status;
|
|
2154
|
-
|
|
2155
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsNameMap", dpiOciSymbols.fnNlsNameMap)
|
|
2156
|
-
status = (*dpiOciSymbols.fnNlsNameMap)(envHandle, buf, bufLength, source,
|
|
2157
|
-
flag);
|
|
2158
|
-
return (status == DPI_OCI_SUCCESS) ? DPI_SUCCESS : DPI_FAILURE;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
//-----------------------------------------------------------------------------
|
|
2163
|
-
// dpiOci__nlsNumericInfoGet() [INTERNAL]
|
|
2164
|
-
// Wrapper for OCINlsNumericInfoGet().
|
|
2165
|
-
//-----------------------------------------------------------------------------
|
|
2166
|
-
int dpiOci__nlsNumericInfoGet(void *envHandle, int32_t *value, uint16_t item,
|
|
2167
|
-
dpiError *error)
|
|
2168
|
-
{
|
|
2169
|
-
int status;
|
|
2170
|
-
|
|
2171
|
-
DPI_OCI_LOAD_SYMBOL("OCINlsNumericInfoGet",
|
|
2172
|
-
dpiOciSymbols.fnNlsNumericInfoGet)
|
|
2173
|
-
status = (*dpiOciSymbols.fnNlsNumericInfoGet)(envHandle, error->handle,
|
|
2174
|
-
value, item);
|
|
2175
|
-
return dpiError__check(error, status, NULL, "get NLS info");
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
//-----------------------------------------------------------------------------
|
|
2180
|
-
// dpiOci__numberFromInt() [INTERNAL]
|
|
2181
|
-
// Wrapper for OCINumberFromInt().
|
|
2182
|
-
//-----------------------------------------------------------------------------
|
|
2183
|
-
int dpiOci__numberFromInt(const void *value, unsigned int valueLength,
|
|
2184
|
-
unsigned int flags, void *number, dpiError *error)
|
|
2185
|
-
{
|
|
2186
|
-
int status;
|
|
2187
|
-
|
|
2188
|
-
DPI_OCI_LOAD_SYMBOL("OCINumberFromInt", dpiOciSymbols.fnNumberFromInt)
|
|
2189
|
-
status = (*dpiOciSymbols.fnNumberFromInt)(error->handle, value,
|
|
2190
|
-
valueLength, flags, number);
|
|
2191
|
-
return dpiError__check(error, status, NULL, "number from integer");
|
|
2192
|
-
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
//-----------------------------------------------------------------------------
|
|
2196
|
-
// dpiOci__numberFromReal() [INTERNAL]
|
|
2197
|
-
// Wrapper for OCINumberFromReal().
|
|
2198
|
-
//-----------------------------------------------------------------------------
|
|
2199
|
-
int dpiOci__numberFromReal(const double value, void *number, dpiError *error)
|
|
2200
|
-
{
|
|
2201
|
-
int status;
|
|
2202
|
-
|
|
2203
|
-
DPI_OCI_LOAD_SYMBOL("OCINumberFromReal", dpiOciSymbols.fnNumberFromReal)
|
|
2204
|
-
status = (*dpiOciSymbols.fnNumberFromReal)(error->handle, &value,
|
|
2205
|
-
sizeof(double), number);
|
|
2206
|
-
return dpiError__check(error, status, NULL, "number from real");
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
//-----------------------------------------------------------------------------
|
|
2211
|
-
// dpiOci__numberToInt() [INTERNAL]
|
|
2212
|
-
// Wrapper for OCINumberToInt().
|
|
2213
|
-
//-----------------------------------------------------------------------------
|
|
2214
|
-
int dpiOci__numberToInt(void *number, void *value, unsigned int valueLength,
|
|
2215
|
-
unsigned int flags, dpiError *error)
|
|
2216
|
-
{
|
|
2217
|
-
int status;
|
|
2218
|
-
|
|
2219
|
-
DPI_OCI_LOAD_SYMBOL("OCINumberToInt", dpiOciSymbols.fnNumberToInt)
|
|
2220
|
-
status = (*dpiOciSymbols.fnNumberToInt)(error->handle, number, valueLength,
|
|
2221
|
-
flags, value);
|
|
2222
|
-
return dpiError__check(error, status, NULL, "number to integer");
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
//-----------------------------------------------------------------------------
|
|
2227
|
-
// dpiOci__numberToReal() [INTERNAL]
|
|
2228
|
-
// Wrapper for OCINumberToReal().
|
|
2229
|
-
//-----------------------------------------------------------------------------
|
|
2230
|
-
int dpiOci__numberToReal(double *value, void *number, dpiError *error)
|
|
2231
|
-
{
|
|
2232
|
-
int status;
|
|
2233
|
-
|
|
2234
|
-
DPI_OCI_LOAD_SYMBOL("OCINumberToReal", dpiOciSymbols.fnNumberToReal)
|
|
2235
|
-
status = (*dpiOciSymbols.fnNumberToReal)(error->handle, number,
|
|
2236
|
-
sizeof(double), value);
|
|
2237
|
-
return dpiError__check(error, status, NULL, "number to real");
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
//-----------------------------------------------------------------------------
|
|
2242
|
-
// dpiOci__objectCopy() [INTERNAL]
|
|
2243
|
-
// Wrapper for OCIObjectCopy().
|
|
2244
|
-
//-----------------------------------------------------------------------------
|
|
2245
|
-
int dpiOci__objectCopy(dpiObject *obj, void *sourceInstance,
|
|
2246
|
-
void *sourceIndicator, dpiError *error)
|
|
2247
|
-
{
|
|
2248
|
-
int status;
|
|
2249
|
-
|
|
2250
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectCopy", dpiOciSymbols.fnObjectCopy)
|
|
2251
|
-
status = (*dpiOciSymbols.fnObjectCopy)(obj->env->handle, error->handle,
|
|
2252
|
-
obj->type->conn->handle, sourceInstance, sourceIndicator,
|
|
2253
|
-
obj->instance, obj->indicator, obj->type->tdo,
|
|
2254
|
-
DPI_OCI_DURATION_SESSION, DPI_OCI_DEFAULT);
|
|
2255
|
-
return dpiError__check(error, status, obj->type->conn, "copy object");
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
//-----------------------------------------------------------------------------
|
|
2260
|
-
// dpiOci__objectFree() [INTERNAL]
|
|
2261
|
-
// Wrapper for OCIObjectFree().
|
|
2262
|
-
//-----------------------------------------------------------------------------
|
|
2263
|
-
int dpiOci__objectFree(dpiObject *obj, int checkError, dpiError *error)
|
|
2264
|
-
{
|
|
2265
|
-
int status;
|
|
2266
|
-
|
|
2267
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectFree", dpiOciSymbols.fnObjectFree)
|
|
2268
|
-
status = (*dpiOciSymbols.fnObjectFree)(obj->env->handle, error->handle,
|
|
2269
|
-
obj->instance, DPI_OCI_DEFAULT);
|
|
2270
|
-
if (checkError)
|
|
2271
|
-
return dpiError__check(error, status, obj->type->conn,
|
|
2272
|
-
"free instance");
|
|
2273
|
-
if (obj->freeIndicator) {
|
|
2274
|
-
status = (*dpiOciSymbols.fnObjectFree)(obj->env->handle, error->handle,
|
|
2275
|
-
obj->indicator, DPI_OCI_DEFAULT);
|
|
2276
|
-
if (checkError)
|
|
2277
|
-
return dpiError__check(error, status, obj->type->conn,
|
|
2278
|
-
"free indicator");
|
|
2279
|
-
}
|
|
2280
|
-
return DPI_SUCCESS;
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
//-----------------------------------------------------------------------------
|
|
2285
|
-
// dpiOci__objectGetAttr() [INTERNAL]
|
|
2286
|
-
// Wrapper for OCIObjectGetAttr().
|
|
2287
|
-
//-----------------------------------------------------------------------------
|
|
2288
|
-
int dpiOci__objectGetAttr(dpiObject *obj, dpiObjectAttr *attr,
|
|
2289
|
-
int16_t *scalarValueIndicator, void **valueIndicator, void **value,
|
|
2290
|
-
void **tdo, dpiError *error)
|
|
2291
|
-
{
|
|
2292
|
-
int status;
|
|
2293
|
-
|
|
2294
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectGetAttr", dpiOciSymbols.fnObjectGetAttr)
|
|
2295
|
-
status = (*dpiOciSymbols.fnObjectGetAttr)(obj->env->handle, error->handle,
|
|
2296
|
-
obj->instance, obj->indicator, obj->type->tdo, &attr->name,
|
|
2297
|
-
&attr->nameLength, 1, 0, 0, scalarValueIndicator, valueIndicator,
|
|
2298
|
-
value, tdo);
|
|
2299
|
-
return dpiError__check(error, status, obj->type->conn, "get attribute");
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
//-----------------------------------------------------------------------------
|
|
2304
|
-
// dpiOci__objectGetInd() [INTERNAL]
|
|
2305
|
-
// Wrapper for OCIObjectGetInd().
|
|
2306
|
-
//-----------------------------------------------------------------------------
|
|
2307
|
-
int dpiOci__objectGetInd(dpiObject *obj, dpiError *error)
|
|
2308
|
-
{
|
|
2309
|
-
int status;
|
|
2310
|
-
|
|
2311
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectGetInd", dpiOciSymbols.fnObjectGetInd)
|
|
2312
|
-
status = (*dpiOciSymbols.fnObjectGetInd)(obj->env->handle, error->handle,
|
|
2313
|
-
obj->instance, &obj->indicator);
|
|
2314
|
-
return dpiError__check(error, status, obj->type->conn, "get indicator");
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
//-----------------------------------------------------------------------------
|
|
2319
|
-
// dpiOci__objectNew() [INTERNAL]
|
|
2320
|
-
// Wrapper for OCIObjectNew().
|
|
2321
|
-
//-----------------------------------------------------------------------------
|
|
2322
|
-
int dpiOci__objectNew(dpiObject *obj, dpiError *error)
|
|
2323
|
-
{
|
|
2324
|
-
int status;
|
|
2325
|
-
|
|
2326
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectNew", dpiOciSymbols.fnObjectNew)
|
|
2327
|
-
status = (*dpiOciSymbols.fnObjectNew)(obj->env->handle, error->handle,
|
|
2328
|
-
obj->type->conn->handle, obj->type->typeCode, obj->type->tdo, NULL,
|
|
2329
|
-
DPI_OCI_DURATION_SESSION, 1, &obj->instance);
|
|
2330
|
-
return dpiError__check(error, status, obj->type->conn, "create object");
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
//-----------------------------------------------------------------------------
|
|
2335
|
-
// dpiOci__objectPin() [INTERNAL]
|
|
2336
|
-
// Wrapper for OCIObjectPin().
|
|
2337
|
-
//-----------------------------------------------------------------------------
|
|
2338
|
-
int dpiOci__objectPin(void *envHandle, void *objRef, void **obj,
|
|
2339
|
-
dpiError *error)
|
|
2340
|
-
{
|
|
2341
|
-
int status;
|
|
2342
|
-
|
|
2343
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectPin", dpiOciSymbols.fnObjectPin)
|
|
2344
|
-
status = (*dpiOciSymbols.fnObjectPin)(envHandle, error->handle, objRef,
|
|
2345
|
-
NULL, DPI_OCI_PIN_ANY, DPI_OCI_DURATION_SESSION, DPI_OCI_LOCK_NONE,
|
|
2346
|
-
obj);
|
|
2347
|
-
return dpiError__check(error, status, NULL, "pin reference");
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
//-----------------------------------------------------------------------------
|
|
2352
|
-
// dpiOci__objectSetAttr() [INTERNAL]
|
|
2353
|
-
// Wrapper for OCIObjectSetAttr().
|
|
2354
|
-
//-----------------------------------------------------------------------------
|
|
2355
|
-
int dpiOci__objectSetAttr(dpiObject *obj, dpiObjectAttr *attr,
|
|
2356
|
-
int16_t scalarValueIndicator, void *valueIndicator, const void *value,
|
|
2357
|
-
dpiError *error)
|
|
2358
|
-
{
|
|
2359
|
-
int status;
|
|
2360
|
-
|
|
2361
|
-
DPI_OCI_LOAD_SYMBOL("OCIObjectSetAttr", dpiOciSymbols.fnObjectSetAttr)
|
|
2362
|
-
status = (*dpiOciSymbols.fnObjectSetAttr)(obj->env->handle, error->handle,
|
|
2363
|
-
obj->instance, obj->indicator, obj->type->tdo, &attr->name,
|
|
2364
|
-
&attr->nameLength, 1, NULL, 0, scalarValueIndicator,
|
|
2365
|
-
valueIndicator, value);
|
|
2366
|
-
return dpiError__check(error, status, obj->type->conn, "set attribute");
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
//-----------------------------------------------------------------------------
|
|
2371
|
-
// dpiOci__passwordChange() [INTERNAL]
|
|
2372
|
-
// Wrapper for OCIPasswordChange().
|
|
2373
|
-
//-----------------------------------------------------------------------------
|
|
2374
|
-
int dpiOci__passwordChange(dpiConn *conn, const char *userName,
|
|
2375
|
-
uint32_t userNameLength, const char *oldPassword,
|
|
2376
|
-
uint32_t oldPasswordLength, const char *newPassword,
|
|
2377
|
-
uint32_t newPasswordLength, uint32_t mode, dpiError *error)
|
|
2378
|
-
{
|
|
2379
|
-
int status;
|
|
2380
|
-
|
|
2381
|
-
DPI_OCI_LOAD_SYMBOL("OCIPasswordChange", dpiOciSymbols.fnPasswordChange)
|
|
2382
|
-
status = (*dpiOciSymbols.fnPasswordChange)(conn->handle, error->handle,
|
|
2383
|
-
userName, userNameLength, oldPassword, oldPasswordLength,
|
|
2384
|
-
newPassword, newPasswordLength, mode);
|
|
2385
|
-
return dpiError__check(error, status, conn, "change password");
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
//-----------------------------------------------------------------------------
|
|
2390
|
-
// dpiOci__paramGet() [INTERNAL]
|
|
2391
|
-
// Wrapper for OCIParamGet().
|
|
2392
|
-
//-----------------------------------------------------------------------------
|
|
2393
|
-
int dpiOci__paramGet(const void *handle, uint32_t handleType, void **parameter,
|
|
2394
|
-
uint32_t pos, const char *action, dpiError *error)
|
|
2395
|
-
{
|
|
2396
|
-
int status;
|
|
2397
|
-
|
|
2398
|
-
DPI_OCI_LOAD_SYMBOL("OCIParamGet", dpiOciSymbols.fnParamGet)
|
|
2399
|
-
status = (*dpiOciSymbols.fnParamGet)(handle, handleType, error->handle,
|
|
2400
|
-
parameter, pos);
|
|
2401
|
-
return dpiError__check(error, status, NULL, action);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
//-----------------------------------------------------------------------------
|
|
2406
|
-
// dpiOci__ping() [INTERNAL]
|
|
2407
|
-
// Wrapper for OCIPing().
|
|
2408
|
-
//-----------------------------------------------------------------------------
|
|
2409
|
-
int dpiOci__ping(dpiConn *conn, dpiError *error)
|
|
2410
|
-
{
|
|
2411
|
-
int status;
|
|
2412
|
-
|
|
2413
|
-
DPI_OCI_LOAD_SYMBOL("OCIPing", dpiOciSymbols.fnPing)
|
|
2414
|
-
status = (*dpiOciSymbols.fnPing)(conn->handle, error->handle,
|
|
2415
|
-
DPI_OCI_DEFAULT);
|
|
2416
|
-
status = dpiError__check(error, status, conn, "ping");
|
|
2417
|
-
|
|
2418
|
-
// attempting to ping a database earlier than 10g will result in error
|
|
2419
|
-
// ORA-1010: invalid OCI operation, but that implies a successful ping
|
|
2420
|
-
// so ignore that error and treat it as a successful operation
|
|
2421
|
-
if (status < 0 && error->buffer->code == 1010)
|
|
2422
|
-
return DPI_SUCCESS;
|
|
2423
|
-
|
|
2424
|
-
return status;
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
//-----------------------------------------------------------------------------
|
|
2429
|
-
// dpiOci__rawAssignBytes() [INTERNAL]
|
|
2430
|
-
// Wrapper for OCIRawAssignBytes().
|
|
2431
|
-
//-----------------------------------------------------------------------------
|
|
2432
|
-
int dpiOci__rawAssignBytes(void *envHandle, const char *value,
|
|
2433
|
-
uint32_t valueLength, void **handle, dpiError *error)
|
|
2434
|
-
{
|
|
2435
|
-
int status;
|
|
2436
|
-
|
|
2437
|
-
DPI_OCI_LOAD_SYMBOL("OCIRawAssignBytes", dpiOciSymbols.fnRawAssignBytes)
|
|
2438
|
-
status = (*dpiOciSymbols.fnRawAssignBytes)(envHandle, error->handle, value,
|
|
2439
|
-
valueLength, handle);
|
|
2440
|
-
return dpiError__check(error, status, NULL, "assign bytes to raw");
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
//-----------------------------------------------------------------------------
|
|
2445
|
-
// dpiOci__rawPtr() [INTERNAL]
|
|
2446
|
-
// Wrapper for OCIRawPtr().
|
|
2447
|
-
//-----------------------------------------------------------------------------
|
|
2448
|
-
int dpiOci__rawPtr(void *envHandle, void *handle, void **ptr)
|
|
2449
|
-
{
|
|
2450
|
-
dpiError *error = NULL;
|
|
2451
|
-
|
|
2452
|
-
DPI_OCI_LOAD_SYMBOL("OCIRawPtr", dpiOciSymbols.fnRawPtr)
|
|
2453
|
-
*ptr = (*dpiOciSymbols.fnRawPtr)(envHandle, handle);
|
|
2454
|
-
return DPI_SUCCESS;
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
//-----------------------------------------------------------------------------
|
|
2459
|
-
// dpiOci__rawResize() [INTERNAL]
|
|
2460
|
-
// Wrapper for OCIRawResize().
|
|
2461
|
-
//-----------------------------------------------------------------------------
|
|
2462
|
-
int dpiOci__rawResize(void *envHandle, void **handle, uint32_t newSize,
|
|
2463
|
-
dpiError *error)
|
|
2464
|
-
{
|
|
2465
|
-
int status;
|
|
2466
|
-
|
|
2467
|
-
DPI_OCI_LOAD_SYMBOL("OCIRawResize", dpiOciSymbols.fnRawResize)
|
|
2468
|
-
status = (*dpiOciSymbols.fnRawResize)(envHandle, error->handle, newSize,
|
|
2469
|
-
handle);
|
|
2470
|
-
return dpiError__check(error, status, NULL, "resize raw");
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
//-----------------------------------------------------------------------------
|
|
2475
|
-
// dpiOci__rawSize() [INTERNAL]
|
|
2476
|
-
// Wrapper for OCIRawSize().
|
|
2477
|
-
//-----------------------------------------------------------------------------
|
|
2478
|
-
int dpiOci__rawSize(void *envHandle, void *handle, uint32_t *size)
|
|
2479
|
-
{
|
|
2480
|
-
dpiError *error = NULL;
|
|
2481
|
-
|
|
2482
|
-
DPI_OCI_LOAD_SYMBOL("OCIRawSize", dpiOciSymbols.fnRawSize)
|
|
2483
|
-
*size = (*dpiOciSymbols.fnRawSize)(envHandle, handle);
|
|
2484
|
-
return DPI_SUCCESS;
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
//-----------------------------------------------------------------------------
|
|
2489
|
-
// dpiOci__reallocMem() [INTERNAL]
|
|
2490
|
-
// Wrapper for OCI allocation of memory, only used when debugging memory
|
|
2491
|
-
// allocation.
|
|
2492
|
-
//-----------------------------------------------------------------------------
|
|
2493
|
-
static void *dpiOci__reallocMem(void *unused, void *ptr, size_t newSize)
|
|
2494
|
-
{
|
|
2495
|
-
char message[80];
|
|
2496
|
-
void *newPtr;
|
|
2497
|
-
|
|
2498
|
-
(void) sprintf(message, "OCI reallocated ptr at %p", ptr);
|
|
2499
|
-
newPtr = realloc(ptr, newSize);
|
|
2500
|
-
dpiDebug__print("%s to %u bytes at %p\n", message, newSize, newPtr);
|
|
2501
|
-
return newPtr;
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
//-----------------------------------------------------------------------------
|
|
2506
|
-
// dpiOci__rowidToChar() [INTERNAL]
|
|
2507
|
-
// Wrapper for OCIRowidToChar().
|
|
2508
|
-
//-----------------------------------------------------------------------------
|
|
2509
|
-
int dpiOci__rowidToChar(dpiRowid *rowid, char *buffer, uint16_t *bufferSize,
|
|
2510
|
-
dpiError *error)
|
|
2511
|
-
{
|
|
2512
|
-
uint16_t origSize;
|
|
2513
|
-
int status;
|
|
2514
|
-
|
|
2515
|
-
DPI_OCI_LOAD_SYMBOL("OCIRowidToChar", dpiOciSymbols.fnRowidToChar)
|
|
2516
|
-
origSize = *bufferSize;
|
|
2517
|
-
status = (*dpiOciSymbols.fnRowidToChar)(rowid->handle, buffer, bufferSize,
|
|
2518
|
-
error->handle);
|
|
2519
|
-
if (origSize == 0)
|
|
2520
|
-
return DPI_SUCCESS;
|
|
2521
|
-
return dpiError__check(error, status, NULL, "get rowid as string");
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
//-----------------------------------------------------------------------------
|
|
2526
|
-
// dpiOci__serverAttach() [INTERNAL]
|
|
2527
|
-
// Wrapper for OCIServerAttach().
|
|
2528
|
-
//-----------------------------------------------------------------------------
|
|
2529
|
-
int dpiOci__serverAttach(dpiConn *conn, const char *connectString,
|
|
2530
|
-
uint32_t connectStringLength, dpiError *error)
|
|
2531
|
-
{
|
|
2532
|
-
int status;
|
|
2533
|
-
|
|
2534
|
-
DPI_OCI_LOAD_SYMBOL("OCIServerAttach", dpiOciSymbols.fnServerAttach)
|
|
2535
|
-
status = (*dpiOciSymbols.fnServerAttach)(conn->serverHandle, error->handle,
|
|
2536
|
-
connectString, (int32_t) connectStringLength, DPI_OCI_DEFAULT);
|
|
2537
|
-
return dpiError__check(error, status, conn, "server attach");
|
|
2538
|
-
}
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
//-----------------------------------------------------------------------------
|
|
2542
|
-
// dpiOci__serverDetach() [INTERNAL]
|
|
2543
|
-
// Wrapper for OCIServerDetach().
|
|
2544
|
-
//-----------------------------------------------------------------------------
|
|
2545
|
-
int dpiOci__serverDetach(dpiConn *conn, int checkError, dpiError *error)
|
|
2546
|
-
{
|
|
2547
|
-
int status;
|
|
2548
|
-
|
|
2549
|
-
DPI_OCI_LOAD_SYMBOL("OCIServerDetach", dpiOciSymbols.fnServerDetach)
|
|
2550
|
-
status = (*dpiOciSymbols.fnServerDetach)(conn->serverHandle, error->handle,
|
|
2551
|
-
DPI_OCI_DEFAULT);
|
|
2552
|
-
if (checkError)
|
|
2553
|
-
return dpiError__check(error, status, conn, "detatch from server");
|
|
2554
|
-
return DPI_SUCCESS;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
//-----------------------------------------------------------------------------
|
|
2559
|
-
// dpiOci__serverRelease() [INTERNAL]
|
|
2560
|
-
// Wrapper for OCIServerRelease().
|
|
2561
|
-
//-----------------------------------------------------------------------------
|
|
2562
|
-
int dpiOci__serverRelease(dpiConn *conn, char *buffer, uint32_t bufferSize,
|
|
2563
|
-
uint32_t *version, dpiError *error)
|
|
2564
|
-
{
|
|
2565
|
-
int status;
|
|
2566
|
-
|
|
2567
|
-
if (conn->env->versionInfo->versionNum < 18) {
|
|
2568
|
-
DPI_OCI_LOAD_SYMBOL("OCIServerRelease", dpiOciSymbols.fnServerRelease)
|
|
2569
|
-
status = (*dpiOciSymbols.fnServerRelease)(conn->handle, error->handle,
|
|
2570
|
-
buffer, bufferSize, DPI_OCI_HTYPE_SVCCTX, version);
|
|
2571
|
-
} else {
|
|
2572
|
-
DPI_OCI_LOAD_SYMBOL("OCIServerRelease2",
|
|
2573
|
-
dpiOciSymbols.fnServerRelease2)
|
|
2574
|
-
status = (*dpiOciSymbols.fnServerRelease2)(conn->handle, error->handle,
|
|
2575
|
-
buffer, bufferSize, DPI_OCI_HTYPE_SVCCTX, version,
|
|
2576
|
-
DPI_OCI_DEFAULT);
|
|
2577
|
-
}
|
|
2578
|
-
return dpiError__check(error, status, conn, "get server version");
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
//-----------------------------------------------------------------------------
|
|
2583
|
-
// dpiOci__sessionBegin() [INTERNAL]
|
|
2584
|
-
// Wrapper for OCISessionBegin().
|
|
2585
|
-
//-----------------------------------------------------------------------------
|
|
2586
|
-
int dpiOci__sessionBegin(dpiConn *conn, uint32_t credentialType,
|
|
2587
|
-
uint32_t mode, dpiError *error)
|
|
2588
|
-
{
|
|
2589
|
-
int status;
|
|
2590
|
-
|
|
2591
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionBegin", dpiOciSymbols.fnSessionBegin)
|
|
2592
|
-
status = (*dpiOciSymbols.fnSessionBegin)(conn->handle, error->handle,
|
|
2593
|
-
conn->sessionHandle, credentialType, mode);
|
|
2594
|
-
return dpiError__check(error, status, conn, "begin session");
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
//-----------------------------------------------------------------------------
|
|
2599
|
-
// dpiOci__sessionEnd() [INTERNAL]
|
|
2600
|
-
// Wrapper for OCISessionEnd().
|
|
2601
|
-
//-----------------------------------------------------------------------------
|
|
2602
|
-
int dpiOci__sessionEnd(dpiConn *conn, int checkError, dpiError *error)
|
|
2603
|
-
{
|
|
2604
|
-
int status;
|
|
2605
|
-
|
|
2606
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionEnd", dpiOciSymbols.fnSessionEnd)
|
|
2607
|
-
status = (*dpiOciSymbols.fnSessionEnd)(conn->handle, error->handle,
|
|
2608
|
-
conn->sessionHandle, DPI_OCI_DEFAULT);
|
|
2609
|
-
if (checkError)
|
|
2610
|
-
return dpiError__check(error, status, conn, "end session");
|
|
2611
|
-
return DPI_SUCCESS;
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
//-----------------------------------------------------------------------------
|
|
2616
|
-
// dpiOci__sessionGet() [INTERNAL]
|
|
2617
|
-
// Wrapper for OCISessionGet().
|
|
2618
|
-
//-----------------------------------------------------------------------------
|
|
2619
|
-
int dpiOci__sessionGet(void *envHandle, void **handle, void *authInfo,
|
|
2620
|
-
const char *connectString, uint32_t connectStringLength,
|
|
2621
|
-
const char *tag, uint32_t tagLength, const char **outTag,
|
|
2622
|
-
uint32_t *outTagLength, int *found, uint32_t mode, dpiError *error)
|
|
2623
|
-
{
|
|
2624
|
-
int status;
|
|
2625
|
-
|
|
2626
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionGet", dpiOciSymbols.fnSessionGet)
|
|
2627
|
-
status = (*dpiOciSymbols.fnSessionGet)(envHandle, error->handle, handle,
|
|
2628
|
-
authInfo, connectString, connectStringLength, tag, tagLength,
|
|
2629
|
-
outTag, outTagLength, found, mode);
|
|
2630
|
-
return dpiError__check(error, status, NULL, "get session");
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
//-----------------------------------------------------------------------------
|
|
2635
|
-
// dpiOci__sessionPoolCreate() [INTERNAL]
|
|
2636
|
-
// Wrapper for OCISessionPoolCreate().
|
|
2637
|
-
//-----------------------------------------------------------------------------
|
|
2638
|
-
int dpiOci__sessionPoolCreate(dpiPool *pool, const char *connectString,
|
|
2639
|
-
uint32_t connectStringLength, uint32_t minSessions,
|
|
2640
|
-
uint32_t maxSessions, uint32_t sessionIncrement, const char *userName,
|
|
2641
|
-
uint32_t userNameLength, const char *password, uint32_t passwordLength,
|
|
2642
|
-
uint32_t mode, dpiError *error)
|
|
2643
|
-
{
|
|
2644
|
-
int status;
|
|
2645
|
-
|
|
2646
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionPoolCreate",
|
|
2647
|
-
dpiOciSymbols.fnSessionPoolCreate)
|
|
2648
|
-
status = (*dpiOciSymbols.fnSessionPoolCreate)(pool->env->handle,
|
|
2649
|
-
error->handle, pool->handle, (char**) &pool->name,
|
|
2650
|
-
&pool->nameLength, connectString, connectStringLength, minSessions,
|
|
2651
|
-
maxSessions, sessionIncrement, userName, userNameLength, password,
|
|
2652
|
-
passwordLength, mode);
|
|
2653
|
-
return dpiError__check(error, status, NULL, "create pool");
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
//-----------------------------------------------------------------------------
|
|
2658
|
-
// dpiOci__sessionPoolDestroy() [INTERNAL]
|
|
2659
|
-
// Wrapper for OCISessionPoolDestroy().
|
|
2660
|
-
//-----------------------------------------------------------------------------
|
|
2661
|
-
int dpiOci__sessionPoolDestroy(dpiPool *pool, uint32_t mode, int checkError,
|
|
2662
|
-
dpiError *error)
|
|
2663
|
-
{
|
|
2664
|
-
void *handle;
|
|
2665
|
-
int status;
|
|
2666
|
-
|
|
2667
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionPoolDestroy",
|
|
2668
|
-
dpiOciSymbols.fnSessionPoolDestroy)
|
|
2669
|
-
|
|
2670
|
-
// clear the pool handle immediately so that no further attempts are made
|
|
2671
|
-
// to use the pool while the pool is being closed; if the pool close fails,
|
|
2672
|
-
// restore the pool handle afterwards
|
|
2673
|
-
handle = pool->handle;
|
|
2674
|
-
pool->handle = NULL;
|
|
2675
|
-
status = (*dpiOciSymbols.fnSessionPoolDestroy)(handle, error->handle,
|
|
2676
|
-
mode);
|
|
2677
|
-
if (checkError &&
|
|
2678
|
-
dpiError__check(error, status, NULL, "destroy pool") < 0) {
|
|
2679
|
-
pool->handle = handle;
|
|
2680
|
-
return DPI_FAILURE;
|
|
2681
|
-
}
|
|
2682
|
-
dpiOci__handleFree(handle, DPI_OCI_HTYPE_SPOOL);
|
|
2683
|
-
return DPI_SUCCESS;
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
//-----------------------------------------------------------------------------
|
|
2688
|
-
// dpiOci__sessionRelease() [INTERNAL]
|
|
2689
|
-
// Wrapper for OCISessionRelease().
|
|
2690
|
-
//-----------------------------------------------------------------------------
|
|
2691
|
-
int dpiOci__sessionRelease(dpiConn *conn, const char *tag, uint32_t tagLength,
|
|
2692
|
-
uint32_t mode, int checkError, dpiError *error)
|
|
2693
|
-
{
|
|
2694
|
-
int status;
|
|
2695
|
-
|
|
2696
|
-
DPI_OCI_LOAD_SYMBOL("OCISessionRelease", dpiOciSymbols.fnSessionRelease)
|
|
2697
|
-
status = (*dpiOciSymbols.fnSessionRelease)(conn->handle, error->handle,
|
|
2698
|
-
tag, tagLength, mode);
|
|
2699
|
-
if (checkError)
|
|
2700
|
-
return dpiError__check(error, status, conn, "release session");
|
|
2701
|
-
return DPI_SUCCESS;
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
//-----------------------------------------------------------------------------
|
|
2706
|
-
// dpiOci__shardingKeyColumnAdd() [INTERNAL]
|
|
2707
|
-
// Wrapper for OCIshardingKeyColumnAdd().
|
|
2708
|
-
//-----------------------------------------------------------------------------
|
|
2709
|
-
int dpiOci__shardingKeyColumnAdd(void *shardingKey, void *col, uint32_t colLen,
|
|
2710
|
-
uint16_t colType, dpiError *error)
|
|
2711
|
-
{
|
|
2712
|
-
int status;
|
|
2713
|
-
|
|
2714
|
-
DPI_OCI_LOAD_SYMBOL("OCIShardingKeyColumnAdd",
|
|
2715
|
-
dpiOciSymbols.fnShardingKeyColumnAdd)
|
|
2716
|
-
status = (*dpiOciSymbols.fnShardingKeyColumnAdd)(shardingKey,
|
|
2717
|
-
error->handle, col, colLen, colType, DPI_OCI_DEFAULT);
|
|
2718
|
-
return dpiError__check(error, status, NULL, "add sharding column");
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
//-----------------------------------------------------------------------------
|
|
2723
|
-
// dpiOci__sodaCollCreateWithMetadata() [INTERNAL]
|
|
2724
|
-
// Wrapper for OCISodaCollCreateWithMetadata().
|
|
2725
|
-
//-----------------------------------------------------------------------------
|
|
2726
|
-
int dpiOci__sodaCollCreateWithMetadata(dpiSodaDb *db, const char *name,
|
|
2727
|
-
uint32_t nameLength, const char *metadata, uint32_t metadataLength,
|
|
2728
|
-
uint32_t mode, void **handle, dpiError *error)
|
|
2729
|
-
{
|
|
2730
|
-
int status;
|
|
2731
|
-
|
|
2732
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaCollCreateWithMetadata",
|
|
2733
|
-
dpiOciSymbols.fnSodaCollCreateWithMetadata)
|
|
2734
|
-
status = (*dpiOciSymbols.fnSodaCollCreateWithMetadata)(db->conn->handle,
|
|
2735
|
-
name, nameLength, metadata, metadataLength, handle, error->handle,
|
|
2736
|
-
mode);
|
|
2737
|
-
return dpiError__check(error, status, db->conn, "create SODA collection");
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
//-----------------------------------------------------------------------------
|
|
2742
|
-
// dpiOci__sodaCollDrop() [INTERNAL]
|
|
2743
|
-
// Wrapper for OCISodaCollDrop().
|
|
2744
|
-
//-----------------------------------------------------------------------------
|
|
2745
|
-
int dpiOci__sodaCollDrop(dpiSodaColl *coll, int *isDropped, uint32_t mode,
|
|
2746
|
-
dpiError *error)
|
|
2747
|
-
{
|
|
2748
|
-
int status;
|
|
2749
|
-
|
|
2750
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaCollDrop", dpiOciSymbols.fnSodaCollDrop)
|
|
2751
|
-
status = (*dpiOciSymbols.fnSodaCollDrop)(coll->db->conn->handle,
|
|
2752
|
-
coll->handle, isDropped, error->handle, mode);
|
|
2753
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
2754
|
-
"drop SODA collection");
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
//-----------------------------------------------------------------------------
|
|
2759
|
-
// dpiOci__sodaCollGetNext() [INTERNAL]
|
|
2760
|
-
// Wrapper for OCISodaCollGetNext().
|
|
2761
|
-
//-----------------------------------------------------------------------------
|
|
2762
|
-
int dpiOci__sodaCollGetNext(dpiConn *conn, void *cursorHandle,
|
|
2763
|
-
void **collectionHandle, uint32_t mode, dpiError *error)
|
|
2764
|
-
{
|
|
2765
|
-
int status;
|
|
2766
|
-
|
|
2767
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaCollGetNext", dpiOciSymbols.fnSodaCollGetNext)
|
|
2768
|
-
status = (*dpiOciSymbols.fnSodaCollGetNext)(conn->handle, cursorHandle,
|
|
2769
|
-
collectionHandle, error->handle, mode);
|
|
2770
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
2771
|
-
*collectionHandle = NULL;
|
|
2772
|
-
return DPI_SUCCESS;
|
|
2773
|
-
}
|
|
2774
|
-
return dpiError__check(error, status, conn, "get next collection");
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
//-----------------------------------------------------------------------------
|
|
2779
|
-
// dpiOci__sodaCollList() [INTERNAL]
|
|
2780
|
-
// Wrapper for OCISodaCollList().
|
|
2781
|
-
//-----------------------------------------------------------------------------
|
|
2782
|
-
int dpiOci__sodaCollList(dpiSodaDb *db, const char *startingName,
|
|
2783
|
-
uint32_t startingNameLength, void **handle, uint32_t mode,
|
|
2784
|
-
dpiError *error)
|
|
2785
|
-
{
|
|
2786
|
-
int status;
|
|
2787
|
-
|
|
2788
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaCollList", dpiOciSymbols.fnSodaCollList)
|
|
2789
|
-
status = (*dpiOciSymbols.fnSodaCollList)(db->conn->handle, startingName,
|
|
2790
|
-
startingNameLength, handle, error->handle, mode);
|
|
2791
|
-
return dpiError__check(error, status, db->conn,
|
|
2792
|
-
"get SODA collection cursor");
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
//-----------------------------------------------------------------------------
|
|
2797
|
-
// dpiOci__sodaCollOpen() [INTERNAL]
|
|
2798
|
-
// Wrapper for OCISodaCollOpen().
|
|
2799
|
-
//-----------------------------------------------------------------------------
|
|
2800
|
-
int dpiOci__sodaCollOpen(dpiSodaDb *db, const char *name, uint32_t nameLength,
|
|
2801
|
-
uint32_t mode, void **handle, dpiError *error)
|
|
2802
|
-
{
|
|
2803
|
-
int status;
|
|
2804
|
-
|
|
2805
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaCollOpen", dpiOciSymbols.fnSodaCollOpen)
|
|
2806
|
-
status = (*dpiOciSymbols.fnSodaCollOpen)(db->conn->handle, name,
|
|
2807
|
-
nameLength, handle, error->handle, mode);
|
|
2808
|
-
return dpiError__check(error, status, db->conn, "open SODA collection");
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
//-----------------------------------------------------------------------------
|
|
2813
|
-
// dpiOci__sodaDataGuideGet() [INTERNAL]
|
|
2814
|
-
// Wrapper for OCISodaDataGuideGet().
|
|
2815
|
-
//-----------------------------------------------------------------------------
|
|
2816
|
-
int dpiOci__sodaDataGuideGet(dpiSodaColl *coll, void **handle, uint32_t mode,
|
|
2817
|
-
dpiError *error)
|
|
2818
|
-
{
|
|
2819
|
-
int status;
|
|
2820
|
-
|
|
2821
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaDataGuideGet",
|
|
2822
|
-
dpiOciSymbols.fnSodaDataGuideGet)
|
|
2823
|
-
status = (*dpiOciSymbols.fnSodaDataGuideGet)(coll->db->conn->handle,
|
|
2824
|
-
coll->handle, DPI_OCI_DEFAULT, handle, error->handle, mode);
|
|
2825
|
-
if (dpiError__check(error, status, coll->db->conn, "get data guide") < 0) {
|
|
2826
|
-
if (error->buffer->code != 24801)
|
|
2827
|
-
return DPI_FAILURE;
|
|
2828
|
-
*handle = NULL;
|
|
2829
|
-
}
|
|
2830
|
-
return DPI_SUCCESS;
|
|
2831
|
-
}
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
//-----------------------------------------------------------------------------
|
|
2835
|
-
// dpiOci__sodaDocCount() [INTERNAL]
|
|
2836
|
-
// Wrapper for OCISodaDocCount().
|
|
2837
|
-
//-----------------------------------------------------------------------------
|
|
2838
|
-
int dpiOci__sodaDocCount(dpiSodaColl *coll, void *options, uint32_t mode,
|
|
2839
|
-
uint64_t *count, dpiError *error)
|
|
2840
|
-
{
|
|
2841
|
-
int status;
|
|
2842
|
-
|
|
2843
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaDocCount", dpiOciSymbols.fnSodaDocCount)
|
|
2844
|
-
status = (*dpiOciSymbols.fnSodaDocCount)(coll->db->conn->handle,
|
|
2845
|
-
coll->handle, options, count, error->handle, mode);
|
|
2846
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
2847
|
-
"get document count");
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
//-----------------------------------------------------------------------------
|
|
2852
|
-
// dpiOci__sodaDocGetNext() [INTERNAL]
|
|
2853
|
-
// Wrapper for OCISodaDocGetNext().
|
|
2854
|
-
//-----------------------------------------------------------------------------
|
|
2855
|
-
int dpiOci__sodaDocGetNext(dpiSodaDocCursor *cursor, void **handle,
|
|
2856
|
-
uint32_t mode, dpiError *error)
|
|
2857
|
-
{
|
|
2858
|
-
int status;
|
|
2859
|
-
|
|
2860
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaDocGetNext", dpiOciSymbols.fnSodaDocGetNext)
|
|
2861
|
-
status = (*dpiOciSymbols.fnSodaDocGetNext)(cursor->coll->db->conn->handle,
|
|
2862
|
-
cursor->handle, handle, error->handle, mode);
|
|
2863
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
2864
|
-
*handle = NULL;
|
|
2865
|
-
return DPI_SUCCESS;
|
|
2866
|
-
}
|
|
2867
|
-
return dpiError__check(error, status, cursor->coll->db->conn,
|
|
2868
|
-
"get next document");
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
//-----------------------------------------------------------------------------
|
|
2873
|
-
// dpiOci__sodaFind() [INTERNAL]
|
|
2874
|
-
// Wrapper for OCISodaFind().
|
|
2875
|
-
//-----------------------------------------------------------------------------
|
|
2876
|
-
int dpiOci__sodaFind(dpiSodaColl *coll, const void *options, uint32_t flags,
|
|
2877
|
-
uint32_t mode, void **handle, dpiError *error)
|
|
2878
|
-
{
|
|
2879
|
-
int status;
|
|
2880
|
-
|
|
2881
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaFind", dpiOciSymbols.fnSodaFind)
|
|
2882
|
-
status = (*dpiOciSymbols.fnSodaFind)(coll->db->conn->handle,
|
|
2883
|
-
coll->handle, options, flags, handle, error->handle, mode);
|
|
2884
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
2885
|
-
*handle = NULL;
|
|
2886
|
-
return DPI_SUCCESS;
|
|
2887
|
-
}
|
|
2888
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
2889
|
-
"find SODA documents");
|
|
2890
|
-
}
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
//-----------------------------------------------------------------------------
|
|
2894
|
-
// dpiOci__sodaFindOne() [INTERNAL]
|
|
2895
|
-
// Wrapper for OCISodaFindOne().
|
|
2896
|
-
//-----------------------------------------------------------------------------
|
|
2897
|
-
int dpiOci__sodaFindOne(dpiSodaColl *coll, const void *options, uint32_t flags,
|
|
2898
|
-
uint32_t mode, void **handle, dpiError *error)
|
|
2899
|
-
{
|
|
2900
|
-
int status;
|
|
2901
|
-
|
|
2902
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaFindOne", dpiOciSymbols.fnSodaFindOne)
|
|
2903
|
-
status = (*dpiOciSymbols.fnSodaFindOne)(coll->db->conn->handle,
|
|
2904
|
-
coll->handle, options, flags, handle, error->handle, mode);
|
|
2905
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
2906
|
-
*handle = NULL;
|
|
2907
|
-
return DPI_SUCCESS;
|
|
2908
|
-
}
|
|
2909
|
-
return dpiError__check(error, status, coll->db->conn, "get SODA document");
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
//-----------------------------------------------------------------------------
|
|
2914
|
-
// dpiOci__sodaIndexCreate() [INTERNAL]
|
|
2915
|
-
// Wrapper for OCISodaIndexCreate().
|
|
2916
|
-
//-----------------------------------------------------------------------------
|
|
2917
|
-
int dpiOci__sodaIndexCreate(dpiSodaColl *coll, const char *indexSpec,
|
|
2918
|
-
uint32_t indexSpecLength, uint32_t mode, dpiError *error)
|
|
2919
|
-
{
|
|
2920
|
-
int status;
|
|
2921
|
-
|
|
2922
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaIndexCreate", dpiOciSymbols.fnSodaIndexCreate)
|
|
2923
|
-
status = (*dpiOciSymbols.fnSodaIndexCreate)(coll->db->conn->handle,
|
|
2924
|
-
coll->handle, indexSpec, indexSpecLength, error->handle, mode);
|
|
2925
|
-
return dpiError__check(error, status, coll->db->conn, "create index");
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
//-----------------------------------------------------------------------------
|
|
2930
|
-
// dpiOci__sodaIndexDrop() [INTERNAL]
|
|
2931
|
-
// Wrapper for OCISodaIndexDrop().
|
|
2932
|
-
//-----------------------------------------------------------------------------
|
|
2933
|
-
int dpiOci__sodaIndexDrop(dpiSodaColl *coll, const char *name,
|
|
2934
|
-
uint32_t nameLength, uint32_t mode, int *isDropped, dpiError *error)
|
|
2935
|
-
{
|
|
2936
|
-
int status;
|
|
2937
|
-
|
|
2938
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaIndexDrop", dpiOciSymbols.fnSodaIndexDrop)
|
|
2939
|
-
status = (*dpiOciSymbols.fnSodaIndexDrop)(coll->db->conn->handle, name,
|
|
2940
|
-
nameLength, isDropped, error->handle, mode);
|
|
2941
|
-
return dpiError__check(error, status, coll->db->conn, "drop index");
|
|
2942
|
-
}
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
//-----------------------------------------------------------------------------
|
|
2946
|
-
// dpiOci__sodaInsert() [INTERNAL]
|
|
2947
|
-
// Wrapper for OCISodaInsert().
|
|
2948
|
-
//-----------------------------------------------------------------------------
|
|
2949
|
-
int dpiOci__sodaInsert(dpiSodaColl *coll, void *handle, uint32_t mode,
|
|
2950
|
-
dpiError *error)
|
|
2951
|
-
{
|
|
2952
|
-
int status;
|
|
2953
|
-
|
|
2954
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaInsert", dpiOciSymbols.fnSodaInsert)
|
|
2955
|
-
status = (*dpiOciSymbols.fnSodaInsert)(coll->db->conn->handle,
|
|
2956
|
-
coll->handle, handle, error->handle, mode);
|
|
2957
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
2958
|
-
"insert SODA document");
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
//-----------------------------------------------------------------------------
|
|
2963
|
-
// dpiOci__sodaInsertAndGet() [INTERNAL]
|
|
2964
|
-
// Wrapper for OCISodaInsertAndGet().
|
|
2965
|
-
//-----------------------------------------------------------------------------
|
|
2966
|
-
int dpiOci__sodaInsertAndGet(dpiSodaColl *coll, void **handle, uint32_t mode,
|
|
2967
|
-
dpiError *error)
|
|
2968
|
-
{
|
|
2969
|
-
int status;
|
|
2970
|
-
|
|
2971
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaInsertAndGet",
|
|
2972
|
-
dpiOciSymbols.fnSodaInsertAndGet)
|
|
2973
|
-
status = (*dpiOciSymbols.fnSodaInsertAndGet)(coll->db->conn->handle,
|
|
2974
|
-
coll->handle, handle, error->handle, mode);
|
|
2975
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
2976
|
-
"insert and get SODA document");
|
|
2977
|
-
}
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
//-----------------------------------------------------------------------------
|
|
2981
|
-
// dpiOci__sodaOperKeysSet() [INTERNAL]
|
|
2982
|
-
// Wrapper for OCISodaOperKeysSet().
|
|
2983
|
-
//-----------------------------------------------------------------------------
|
|
2984
|
-
int dpiOci__sodaOperKeysSet(const dpiSodaOperOptions *options, void *handle,
|
|
2985
|
-
dpiError *error)
|
|
2986
|
-
{
|
|
2987
|
-
int status;
|
|
2988
|
-
|
|
2989
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaOperKeysSet", dpiOciSymbols.fnSodaOperKeysSet)
|
|
2990
|
-
status = (*dpiOciSymbols.fnSodaOperKeysSet)(handle, options->keys,
|
|
2991
|
-
options->keyLengths, options->numKeys, error->handle,
|
|
2992
|
-
DPI_OCI_DEFAULT);
|
|
2993
|
-
return dpiError__check(error, status, NULL, "set operation options keys");
|
|
2994
|
-
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
//-----------------------------------------------------------------------------
|
|
2998
|
-
// dpiOci__sodaRemove() [INTERNAL]
|
|
2999
|
-
// Wrapper for OCISodaRemove().
|
|
3000
|
-
//-----------------------------------------------------------------------------
|
|
3001
|
-
int dpiOci__sodaRemove(dpiSodaColl *coll, void *options, uint32_t mode,
|
|
3002
|
-
uint64_t *count, dpiError *error)
|
|
3003
|
-
{
|
|
3004
|
-
int status;
|
|
3005
|
-
|
|
3006
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaRemove", dpiOciSymbols.fnSodaRemove)
|
|
3007
|
-
status = (*dpiOciSymbols.fnSodaRemove)(coll->db->conn->handle,
|
|
3008
|
-
coll->handle, options, count, error->handle, mode);
|
|
3009
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
3010
|
-
"remove documents from SODA collection");
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
//-----------------------------------------------------------------------------
|
|
3015
|
-
// dpiOci__sodaReplOne() [INTERNAL]
|
|
3016
|
-
// Wrapper for OCISodaReplOne().
|
|
3017
|
-
//-----------------------------------------------------------------------------
|
|
3018
|
-
int dpiOci__sodaReplOne(dpiSodaColl *coll, const void *options, void *handle,
|
|
3019
|
-
uint32_t mode, int *isReplaced, dpiError *error)
|
|
3020
|
-
{
|
|
3021
|
-
int status;
|
|
3022
|
-
|
|
3023
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaReplOne", dpiOciSymbols.fnSodaReplOne)
|
|
3024
|
-
status = (*dpiOciSymbols.fnSodaReplOne)(coll->db->conn->handle,
|
|
3025
|
-
coll->handle, options, handle, isReplaced, error->handle, mode);
|
|
3026
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
3027
|
-
"replace SODA document");
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
//-----------------------------------------------------------------------------
|
|
3032
|
-
// dpiOci__sodaReplOneAndGet() [INTERNAL]
|
|
3033
|
-
// Wrapper for OCISodaReplOneAndGet().
|
|
3034
|
-
//-----------------------------------------------------------------------------
|
|
3035
|
-
int dpiOci__sodaReplOneAndGet(dpiSodaColl *coll, const void *options,
|
|
3036
|
-
void **handle, uint32_t mode, int *isReplaced, dpiError *error)
|
|
3037
|
-
{
|
|
3038
|
-
int status;
|
|
3039
|
-
|
|
3040
|
-
DPI_OCI_LOAD_SYMBOL("OCISodaReplOneAndGet",
|
|
3041
|
-
dpiOciSymbols.fnSodaReplOneAndGet)
|
|
3042
|
-
status = (*dpiOciSymbols.fnSodaReplOneAndGet)(coll->db->conn->handle,
|
|
3043
|
-
coll->handle, options, handle, isReplaced, error->handle, mode);
|
|
3044
|
-
return dpiError__check(error, status, coll->db->conn,
|
|
3045
|
-
"replace and get SODA document");
|
|
3046
|
-
}
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
//-----------------------------------------------------------------------------
|
|
3050
|
-
// dpiOci__stmtExecute() [INTERNAL]
|
|
3051
|
-
// Wrapper for OCIStmtExecute().
|
|
3052
|
-
//-----------------------------------------------------------------------------
|
|
3053
|
-
int dpiOci__stmtExecute(dpiStmt *stmt, uint32_t numIters, uint32_t mode,
|
|
3054
|
-
dpiError *error)
|
|
3055
|
-
{
|
|
3056
|
-
int status;
|
|
3057
|
-
|
|
3058
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtExecute", dpiOciSymbols.fnStmtExecute)
|
|
3059
|
-
status = (*dpiOciSymbols.fnStmtExecute)(stmt->conn->handle, stmt->handle,
|
|
3060
|
-
error->handle, numIters, 0, 0, 0, mode);
|
|
3061
|
-
return dpiError__check(error, status, stmt->conn, "execute");
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
//-----------------------------------------------------------------------------
|
|
3066
|
-
// dpiOci__stmtFetch2() [INTERNAL]
|
|
3067
|
-
// Wrapper for OCIStmtFetch2().
|
|
3068
|
-
//-----------------------------------------------------------------------------
|
|
3069
|
-
int dpiOci__stmtFetch2(dpiStmt *stmt, uint32_t numRows, uint16_t fetchMode,
|
|
3070
|
-
int32_t offset, dpiError *error)
|
|
3071
|
-
{
|
|
3072
|
-
int status;
|
|
3073
|
-
|
|
3074
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtFetch2", dpiOciSymbols.fnStmtFetch2)
|
|
3075
|
-
status = (*dpiOciSymbols.fnStmtFetch2)(stmt->handle, error->handle,
|
|
3076
|
-
numRows, fetchMode, offset, DPI_OCI_DEFAULT);
|
|
3077
|
-
if (status == DPI_OCI_NO_DATA || fetchMode == DPI_MODE_FETCH_LAST)
|
|
3078
|
-
stmt->hasRowsToFetch = 0;
|
|
3079
|
-
else if (dpiError__check(error, status, stmt->conn, "fetch") < 0)
|
|
3080
|
-
return DPI_FAILURE;
|
|
3081
|
-
else stmt->hasRowsToFetch = 1;
|
|
3082
|
-
return DPI_SUCCESS;
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
//-----------------------------------------------------------------------------
|
|
3087
|
-
// dpiOci__stmtGetBindInfo() [INTERNAL]
|
|
3088
|
-
// Wrapper for OCIStmtGetBindInfo().
|
|
3089
|
-
//-----------------------------------------------------------------------------
|
|
3090
|
-
int dpiOci__stmtGetBindInfo(dpiStmt *stmt, uint32_t size, uint32_t startLoc,
|
|
3091
|
-
int32_t *numFound, char *names[], uint8_t nameLengths[],
|
|
3092
|
-
char *indNames[], uint8_t indNameLengths[], uint8_t isDuplicate[],
|
|
3093
|
-
void *bindHandles[], dpiError *error)
|
|
3094
|
-
{
|
|
3095
|
-
int status;
|
|
3096
|
-
|
|
3097
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtGetBindInfo", dpiOciSymbols.fnStmtGetBindInfo)
|
|
3098
|
-
status = (*dpiOciSymbols.fnStmtGetBindInfo)(stmt->handle, error->handle,
|
|
3099
|
-
size, startLoc, numFound, names, nameLengths, indNames,
|
|
3100
|
-
indNameLengths, isDuplicate, bindHandles);
|
|
3101
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
3102
|
-
*numFound = 0;
|
|
3103
|
-
return DPI_SUCCESS;
|
|
3104
|
-
}
|
|
3105
|
-
return dpiError__check(error, status, stmt->conn, "get bind info");
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
//-----------------------------------------------------------------------------
|
|
3110
|
-
// dpiOci__stmtGetNextResult() [INTERNAL]
|
|
3111
|
-
// Wrapper for OCIStmtGetNextResult().
|
|
3112
|
-
//-----------------------------------------------------------------------------
|
|
3113
|
-
int dpiOci__stmtGetNextResult(dpiStmt *stmt, void **handle, dpiError *error)
|
|
3114
|
-
{
|
|
3115
|
-
uint32_t returnType;
|
|
3116
|
-
int status;
|
|
3117
|
-
|
|
3118
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtGetNextResult",
|
|
3119
|
-
dpiOciSymbols.fnStmtGetNextResult)
|
|
3120
|
-
status = (*dpiOciSymbols.fnStmtGetNextResult)(stmt->handle, error->handle,
|
|
3121
|
-
handle, &returnType, DPI_OCI_DEFAULT);
|
|
3122
|
-
if (status == DPI_OCI_NO_DATA) {
|
|
3123
|
-
*handle = NULL;
|
|
3124
|
-
return DPI_SUCCESS;
|
|
3125
|
-
}
|
|
3126
|
-
return dpiError__check(error, status, stmt->conn, "get next result");
|
|
3127
|
-
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
//-----------------------------------------------------------------------------
|
|
3131
|
-
// dpiOci__stmtPrepare2() [INTERNAL]
|
|
3132
|
-
// Wrapper for OCIStmtPrepare2().
|
|
3133
|
-
//-----------------------------------------------------------------------------
|
|
3134
|
-
int dpiOci__stmtPrepare2(dpiStmt *stmt, const char *sql, uint32_t sqlLength,
|
|
3135
|
-
const char *tag, uint32_t tagLength, dpiError *error)
|
|
3136
|
-
{
|
|
3137
|
-
int status;
|
|
3138
|
-
|
|
3139
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtPrepare2", dpiOciSymbols.fnStmtPrepare2)
|
|
3140
|
-
status = (*dpiOciSymbols.fnStmtPrepare2)(stmt->conn->handle, &stmt->handle,
|
|
3141
|
-
error->handle, sql, sqlLength, tag, tagLength, DPI_OCI_NTV_SYNTAX,
|
|
3142
|
-
DPI_OCI_DEFAULT);
|
|
3143
|
-
if (dpiError__check(error, status, stmt->conn, "prepare SQL") < 0) {
|
|
3144
|
-
stmt->handle = NULL;
|
|
3145
|
-
return DPI_FAILURE;
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
return DPI_SUCCESS;
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
//-----------------------------------------------------------------------------
|
|
3153
|
-
// dpiOci__stmtRelease() [INTERNAL]
|
|
3154
|
-
// Wrapper for OCIStmtRelease().
|
|
3155
|
-
//-----------------------------------------------------------------------------
|
|
3156
|
-
int dpiOci__stmtRelease(dpiStmt *stmt, const char *tag, uint32_t tagLength,
|
|
3157
|
-
int checkError, dpiError *error)
|
|
3158
|
-
{
|
|
3159
|
-
uint32_t mode = DPI_OCI_DEFAULT;
|
|
3160
|
-
uint32_t cacheSize = 0;
|
|
3161
|
-
int status;
|
|
3162
|
-
|
|
3163
|
-
// if the statement should be deleted from the cache, first check to see
|
|
3164
|
-
// that there actually is a cache currently being used; otherwise, the
|
|
3165
|
-
// error "ORA-24300: bad value for mode" will be raised
|
|
3166
|
-
if (stmt->deleteFromCache) {
|
|
3167
|
-
dpiOci__attrGet(stmt->conn->handle, DPI_OCI_HTYPE_SVCCTX,
|
|
3168
|
-
&cacheSize, NULL, DPI_OCI_ATTR_STMTCACHESIZE, NULL, error);
|
|
3169
|
-
if (cacheSize > 0)
|
|
3170
|
-
mode = DPI_OCI_STRLS_CACHE_DELETE;
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
|
-
DPI_OCI_LOAD_SYMBOL("OCIStmtRelease", dpiOciSymbols.fnStmtRelease)
|
|
3174
|
-
status = (*dpiOciSymbols.fnStmtRelease)(stmt->handle, error->handle, tag,
|
|
3175
|
-
tagLength, mode);
|
|
3176
|
-
if (checkError)
|
|
3177
|
-
return dpiError__check(error, status, stmt->conn, "release statement");
|
|
3178
|
-
return DPI_SUCCESS;
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
//-----------------------------------------------------------------------------
|
|
3183
|
-
// dpiOci__stringAssignText() [INTERNAL]
|
|
3184
|
-
// Wrapper for OCIStringAssignText().
|
|
3185
|
-
//-----------------------------------------------------------------------------
|
|
3186
|
-
int dpiOci__stringAssignText(void *envHandle, const char *value,
|
|
3187
|
-
uint32_t valueLength, void **handle, dpiError *error)
|
|
3188
|
-
{
|
|
3189
|
-
int status;
|
|
3190
|
-
|
|
3191
|
-
DPI_OCI_LOAD_SYMBOL("OCIStringAssignText",
|
|
3192
|
-
dpiOciSymbols.fnStringAssignText)
|
|
3193
|
-
status = (*dpiOciSymbols.fnStringAssignText)(envHandle, error->handle,
|
|
3194
|
-
value, valueLength, handle);
|
|
3195
|
-
return dpiError__check(error, status, NULL, "assign to string");
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
//-----------------------------------------------------------------------------
|
|
3200
|
-
// dpiOci__stringPtr() [INTERNAL]
|
|
3201
|
-
// Wrapper for OCIStringPtr().
|
|
3202
|
-
//-----------------------------------------------------------------------------
|
|
3203
|
-
int dpiOci__stringPtr(void *envHandle, void *handle, char **ptr)
|
|
3204
|
-
{
|
|
3205
|
-
dpiError *error = NULL;
|
|
3206
|
-
|
|
3207
|
-
DPI_OCI_LOAD_SYMBOL("OCIStringPtr", dpiOciSymbols.fnStringPtr)
|
|
3208
|
-
*ptr = (*dpiOciSymbols.fnStringPtr)(envHandle, handle);
|
|
3209
|
-
return DPI_SUCCESS;
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
//-----------------------------------------------------------------------------
|
|
3214
|
-
// dpiOci__stringResize() [INTERNAL]
|
|
3215
|
-
// Wrapper for OCIStringResize().
|
|
3216
|
-
//-----------------------------------------------------------------------------
|
|
3217
|
-
int dpiOci__stringResize(void *envHandle, void **handle, uint32_t newSize,
|
|
3218
|
-
dpiError *error)
|
|
3219
|
-
{
|
|
3220
|
-
int status;
|
|
3221
|
-
|
|
3222
|
-
DPI_OCI_LOAD_SYMBOL("OCIStringResize", dpiOciSymbols.fnStringResize)
|
|
3223
|
-
status = (*dpiOciSymbols.fnStringResize)(envHandle, error->handle, newSize,
|
|
3224
|
-
handle);
|
|
3225
|
-
return dpiError__check(error, status, NULL, "resize string");
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
//-----------------------------------------------------------------------------
|
|
3230
|
-
// dpiOci__stringSize() [INTERNAL]
|
|
3231
|
-
// Wrapper for OCIStringSize().
|
|
3232
|
-
//-----------------------------------------------------------------------------
|
|
3233
|
-
int dpiOci__stringSize(void *envHandle, void *handle, uint32_t *size)
|
|
3234
|
-
{
|
|
3235
|
-
dpiError *error = NULL;
|
|
3236
|
-
|
|
3237
|
-
DPI_OCI_LOAD_SYMBOL("OCIStringSize", dpiOciSymbols.fnStringSize)
|
|
3238
|
-
*size = (*dpiOciSymbols.fnStringSize)(envHandle, handle);
|
|
3239
|
-
return DPI_SUCCESS;
|
|
3240
|
-
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
//-----------------------------------------------------------------------------
|
|
3244
|
-
// dpiOci__subscriptionRegister() [INTERNAL]
|
|
3245
|
-
// Wrapper for OCISubscriptionRegister().
|
|
3246
|
-
//-----------------------------------------------------------------------------
|
|
3247
|
-
int dpiOci__subscriptionRegister(dpiConn *conn, void **handle, dpiError *error)
|
|
3248
|
-
{
|
|
3249
|
-
int status;
|
|
3250
|
-
|
|
3251
|
-
DPI_OCI_LOAD_SYMBOL("OCISubscriptionRegister",
|
|
3252
|
-
dpiOciSymbols.fnSubscriptionRegister)
|
|
3253
|
-
status = (*dpiOciSymbols.fnSubscriptionRegister)(conn->handle, handle, 1,
|
|
3254
|
-
error->handle, DPI_OCI_DEFAULT);
|
|
3255
|
-
return dpiError__check(error, status, conn, "register");
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
//-----------------------------------------------------------------------------
|
|
3260
|
-
// dpiOci__subscriptionUnRegister() [INTERNAL]
|
|
3261
|
-
// Wrapper for OCISubscriptionUnRegister().
|
|
3262
|
-
//-----------------------------------------------------------------------------
|
|
3263
|
-
int dpiOci__subscriptionUnRegister(dpiConn *conn, dpiSubscr *subscr,
|
|
3264
|
-
dpiError *error)
|
|
3265
|
-
{
|
|
3266
|
-
int status;
|
|
3267
|
-
|
|
3268
|
-
DPI_OCI_LOAD_SYMBOL("OCISubscriptionUnRegister",
|
|
3269
|
-
dpiOciSymbols.fnSubscriptionUnRegister)
|
|
3270
|
-
status = (*dpiOciSymbols.fnSubscriptionUnRegister)(conn->handle,
|
|
3271
|
-
subscr->handle, error->handle, DPI_OCI_DEFAULT);
|
|
3272
|
-
return dpiError__check(error, status, conn, "unregister");
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
//-----------------------------------------------------------------------------
|
|
3277
|
-
// dpiOci__tableDelete() [INTERNAL]
|
|
3278
|
-
// Wrapper for OCITableDelete().
|
|
3279
|
-
//-----------------------------------------------------------------------------
|
|
3280
|
-
int dpiOci__tableDelete(dpiObject *obj, int32_t index, dpiError *error)
|
|
3281
|
-
{
|
|
3282
|
-
int status;
|
|
3283
|
-
|
|
3284
|
-
DPI_OCI_LOAD_SYMBOL("OCITableDelete", dpiOciSymbols.fnTableDelete)
|
|
3285
|
-
status = (*dpiOciSymbols.fnTableDelete)(obj->env->handle, error->handle,
|
|
3286
|
-
index, obj->instance);
|
|
3287
|
-
return dpiError__check(error, status, obj->type->conn, "delete element");
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
//-----------------------------------------------------------------------------
|
|
3292
|
-
// dpiOci__tableExists() [INTERNAL]
|
|
3293
|
-
// Wrapper for OCITableExists().
|
|
3294
|
-
//-----------------------------------------------------------------------------
|
|
3295
|
-
int dpiOci__tableExists(dpiObject *obj, int32_t index, int *exists,
|
|
3296
|
-
dpiError *error)
|
|
3297
|
-
{
|
|
3298
|
-
int status;
|
|
3299
|
-
|
|
3300
|
-
DPI_OCI_LOAD_SYMBOL("OCITableExists", dpiOciSymbols.fnTableExists)
|
|
3301
|
-
status = (*dpiOciSymbols.fnTableExists)(obj->env->handle, error->handle,
|
|
3302
|
-
obj->instance, index, exists);
|
|
3303
|
-
return dpiError__check(error, status, obj->type->conn, "get index exists");
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
//-----------------------------------------------------------------------------
|
|
3308
|
-
// dpiOci__tableFirst() [INTERNAL]
|
|
3309
|
-
// Wrapper for OCITableFirst().
|
|
3310
|
-
//-----------------------------------------------------------------------------
|
|
3311
|
-
int dpiOci__tableFirst(dpiObject *obj, int32_t *index, dpiError *error)
|
|
3312
|
-
{
|
|
3313
|
-
int status;
|
|
3314
|
-
|
|
3315
|
-
DPI_OCI_LOAD_SYMBOL("OCITableFirst", dpiOciSymbols.fnTableFirst)
|
|
3316
|
-
status = (*dpiOciSymbols.fnTableFirst)(obj->env->handle, error->handle,
|
|
3317
|
-
obj->instance, index);
|
|
3318
|
-
return dpiError__check(error, status, obj->type->conn, "get first index");
|
|
3319
|
-
}
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
//-----------------------------------------------------------------------------
|
|
3323
|
-
// dpiOci__tableLast() [INTERNAL]
|
|
3324
|
-
// Wrapper for OCITableLast().
|
|
3325
|
-
//-----------------------------------------------------------------------------
|
|
3326
|
-
int dpiOci__tableLast(dpiObject *obj, int32_t *index, dpiError *error)
|
|
3327
|
-
{
|
|
3328
|
-
int status;
|
|
3329
|
-
|
|
3330
|
-
DPI_OCI_LOAD_SYMBOL("OCITableLast", dpiOciSymbols.fnTableLast)
|
|
3331
|
-
status = (*dpiOciSymbols.fnTableLast)(obj->env->handle, error->handle,
|
|
3332
|
-
obj->instance, index);
|
|
3333
|
-
return dpiError__check(error, status, obj->type->conn, "get last index");
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
//-----------------------------------------------------------------------------
|
|
3338
|
-
// dpiOci__tableNext() [INTERNAL]
|
|
3339
|
-
// Wrapper for OCITableNext().
|
|
3340
|
-
//-----------------------------------------------------------------------------
|
|
3341
|
-
int dpiOci__tableNext(dpiObject *obj, int32_t index, int32_t *nextIndex,
|
|
3342
|
-
int *exists, dpiError *error)
|
|
3343
|
-
{
|
|
3344
|
-
int status;
|
|
3345
|
-
|
|
3346
|
-
DPI_OCI_LOAD_SYMBOL("OCITableNext", dpiOciSymbols.fnTableNext)
|
|
3347
|
-
status = (*dpiOciSymbols.fnTableNext)(obj->env->handle, error->handle,
|
|
3348
|
-
index, obj->instance, nextIndex, exists);
|
|
3349
|
-
return dpiError__check(error, status, obj->type->conn, "get next index");
|
|
3350
|
-
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
//-----------------------------------------------------------------------------
|
|
3354
|
-
// dpiOci__tablePrev() [INTERNAL]
|
|
3355
|
-
// Wrapper for OCITablePrev().
|
|
3356
|
-
//-----------------------------------------------------------------------------
|
|
3357
|
-
int dpiOci__tablePrev(dpiObject *obj, int32_t index, int32_t *prevIndex,
|
|
3358
|
-
int *exists, dpiError *error)
|
|
3359
|
-
{
|
|
3360
|
-
int status;
|
|
3361
|
-
|
|
3362
|
-
DPI_OCI_LOAD_SYMBOL("OCITablePrev", dpiOciSymbols.fnTablePrev)
|
|
3363
|
-
status = (*dpiOciSymbols.fnTablePrev)(obj->env->handle, error->handle,
|
|
3364
|
-
index, obj->instance, prevIndex, exists);
|
|
3365
|
-
return dpiError__check(error, status, obj->type->conn, "get prev index");
|
|
3366
|
-
}
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
//-----------------------------------------------------------------------------
|
|
3370
|
-
// dpiOci__tableSize() [INTERNAL]
|
|
3371
|
-
// Wrapper for OCITableSize().
|
|
3372
|
-
//-----------------------------------------------------------------------------
|
|
3373
|
-
int dpiOci__tableSize(dpiObject *obj, int32_t *size, dpiError *error)
|
|
3374
|
-
{
|
|
3375
|
-
int status;
|
|
3376
|
-
|
|
3377
|
-
DPI_OCI_LOAD_SYMBOL("OCITableSize", dpiOciSymbols.fnTableSize)
|
|
3378
|
-
status = (*dpiOciSymbols.fnTableSize)(obj->env->handle, error->handle,
|
|
3379
|
-
obj->instance, size);
|
|
3380
|
-
return dpiError__check(error, status, obj->type->conn, "get size");
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
//-----------------------------------------------------------------------------
|
|
3385
|
-
// dpiOci__threadKeyDestroy() [INTERNAL]
|
|
3386
|
-
// Wrapper for OCIThreadKeyDestroy().
|
|
3387
|
-
//-----------------------------------------------------------------------------
|
|
3388
|
-
int dpiOci__threadKeyDestroy(void *envHandle, void *errorHandle, void **key,
|
|
3389
|
-
dpiError *error)
|
|
3390
|
-
{
|
|
3391
|
-
DPI_OCI_LOAD_SYMBOL("OCIThreadKeyDestroy",
|
|
3392
|
-
dpiOciSymbols.fnThreadKeyDestroy)
|
|
3393
|
-
(*dpiOciSymbols.fnThreadKeyDestroy)(envHandle, errorHandle, key);
|
|
3394
|
-
return DPI_SUCCESS;
|
|
3395
|
-
}
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
//-----------------------------------------------------------------------------
|
|
3399
|
-
// dpiOci__threadKeyGet() [INTERNAL]
|
|
3400
|
-
// Wrapper for OCIThreadKeyGet().
|
|
3401
|
-
//-----------------------------------------------------------------------------
|
|
3402
|
-
int dpiOci__threadKeyGet(void *envHandle, void *errorHandle, void *key,
|
|
3403
|
-
void **value, dpiError *error)
|
|
3404
|
-
{
|
|
3405
|
-
int status;
|
|
3406
|
-
|
|
3407
|
-
status = (*dpiOciSymbols.fnThreadKeyGet)(envHandle, errorHandle, key,
|
|
3408
|
-
value);
|
|
3409
|
-
if (status != DPI_OCI_SUCCESS)
|
|
3410
|
-
return dpiError__set(error, "get TLS error", DPI_ERR_TLS_ERROR);
|
|
3411
|
-
return DPI_SUCCESS;
|
|
3412
|
-
}
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
//-----------------------------------------------------------------------------
|
|
3416
|
-
// dpiOci__threadKeyInit() [INTERNAL]
|
|
3417
|
-
// Wrapper for OCIThreadKeyInit().
|
|
3418
|
-
//-----------------------------------------------------------------------------
|
|
3419
|
-
int dpiOci__threadKeyInit(void *envHandle, void *errorHandle, void **key,
|
|
3420
|
-
void *destroyFunc, dpiError *error)
|
|
3421
|
-
{
|
|
3422
|
-
int status;
|
|
3423
|
-
|
|
3424
|
-
DPI_OCI_LOAD_SYMBOL("OCIThreadKeyInit", dpiOciSymbols.fnThreadKeyInit)
|
|
3425
|
-
status = (*dpiOciSymbols.fnThreadKeyInit)(envHandle, errorHandle, key,
|
|
3426
|
-
destroyFunc);
|
|
3427
|
-
return dpiError__check(error, status, NULL, "initialize thread key");
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
//-----------------------------------------------------------------------------
|
|
3432
|
-
// dpiOci__threadKeySet() [INTERNAL]
|
|
3433
|
-
// Wrapper for OCIThreadKeySet().
|
|
3434
|
-
//-----------------------------------------------------------------------------
|
|
3435
|
-
int dpiOci__threadKeySet(void *envHandle, void *errorHandle, void *key,
|
|
3436
|
-
void *value, dpiError *error)
|
|
3437
|
-
{
|
|
3438
|
-
int status;
|
|
3439
|
-
|
|
3440
|
-
DPI_OCI_LOAD_SYMBOL("OCIThreadKeySet", dpiOciSymbols.fnThreadKeySet)
|
|
3441
|
-
status = (*dpiOciSymbols.fnThreadKeySet)(envHandle, errorHandle, key,
|
|
3442
|
-
value);
|
|
3443
|
-
if (status != DPI_OCI_SUCCESS)
|
|
3444
|
-
return dpiError__set(error, "set TLS error", DPI_ERR_TLS_ERROR);
|
|
3445
|
-
return DPI_SUCCESS;
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
//-----------------------------------------------------------------------------
|
|
3450
|
-
// dpiOci__transCommit() [INTERNAL]
|
|
3451
|
-
// Wrapper for OCITransCommit().
|
|
3452
|
-
//-----------------------------------------------------------------------------
|
|
3453
|
-
int dpiOci__transCommit(dpiConn *conn, uint32_t flags, dpiError *error)
|
|
3454
|
-
{
|
|
3455
|
-
int status;
|
|
3456
|
-
|
|
3457
|
-
DPI_OCI_LOAD_SYMBOL("OCITransCommit", dpiOciSymbols.fnTransCommit)
|
|
3458
|
-
status = (*dpiOciSymbols.fnTransCommit)(conn->handle, error->handle,
|
|
3459
|
-
flags);
|
|
3460
|
-
return dpiError__check(error, status, conn, "commit");
|
|
3461
|
-
}
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
//-----------------------------------------------------------------------------
|
|
3465
|
-
// dpiOci__transPrepare() [INTERNAL]
|
|
3466
|
-
// Wrapper for OCITransPrepare().
|
|
3467
|
-
//-----------------------------------------------------------------------------
|
|
3468
|
-
int dpiOci__transPrepare(dpiConn *conn, int *commitNeeded, dpiError *error)
|
|
3469
|
-
{
|
|
3470
|
-
int status;
|
|
3471
|
-
|
|
3472
|
-
DPI_OCI_LOAD_SYMBOL("OCITransPrepare", dpiOciSymbols.fnTransPrepare)
|
|
3473
|
-
status = (*dpiOciSymbols.fnTransPrepare)(conn->handle, error->handle,
|
|
3474
|
-
DPI_OCI_DEFAULT);
|
|
3475
|
-
*commitNeeded = (status == DPI_OCI_SUCCESS);
|
|
3476
|
-
return dpiError__check(error, status, conn, "prepare transaction");
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
//-----------------------------------------------------------------------------
|
|
3481
|
-
// dpiOci__transRollback() [INTERNAL]
|
|
3482
|
-
// Wrapper for OCITransRollback().
|
|
3483
|
-
//-----------------------------------------------------------------------------
|
|
3484
|
-
int dpiOci__transRollback(dpiConn *conn, int checkError, dpiError *error)
|
|
3485
|
-
{
|
|
3486
|
-
int status;
|
|
3487
|
-
|
|
3488
|
-
DPI_OCI_LOAD_SYMBOL("OCITransRollback", dpiOciSymbols.fnTransRollback)
|
|
3489
|
-
status = (*dpiOciSymbols.fnTransRollback)(conn->handle, error->handle,
|
|
3490
|
-
DPI_OCI_DEFAULT);
|
|
3491
|
-
if (checkError)
|
|
3492
|
-
return dpiError__check(error, status, conn, "rollback");
|
|
3493
|
-
return DPI_SUCCESS;
|
|
3494
|
-
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
//-----------------------------------------------------------------------------
|
|
3498
|
-
// dpiOci__transStart() [INTERNAL]
|
|
3499
|
-
// Wrapper for OCITransStart().
|
|
3500
|
-
//-----------------------------------------------------------------------------
|
|
3501
|
-
int dpiOci__transStart(dpiConn *conn, dpiError *error)
|
|
3502
|
-
{
|
|
3503
|
-
int status;
|
|
3504
|
-
|
|
3505
|
-
DPI_OCI_LOAD_SYMBOL("OCITransStart", dpiOciSymbols.fnTransStart)
|
|
3506
|
-
status = (*dpiOciSymbols.fnTransStart)(conn->handle, error->handle, 0,
|
|
3507
|
-
DPI_OCI_TRANS_NEW);
|
|
3508
|
-
return dpiError__check(error, status, conn, "start transaction");
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
//-----------------------------------------------------------------------------
|
|
3513
|
-
// dpiOci__typeByFullName() [INTERNAL]
|
|
3514
|
-
// Wrapper for OCITypeByFullName().
|
|
3515
|
-
//-----------------------------------------------------------------------------
|
|
3516
|
-
int dpiOci__typeByFullName(dpiConn *conn, const char *name,
|
|
3517
|
-
uint32_t nameLength, void **tdo, dpiError *error)
|
|
3518
|
-
{
|
|
3519
|
-
int status;
|
|
3520
|
-
|
|
3521
|
-
DPI_OCI_LOAD_SYMBOL("OCITypeByFullName", dpiOciSymbols.fnTypeByFullName)
|
|
3522
|
-
status = (*dpiOciSymbols.fnTypeByFullName)(conn->env->handle,
|
|
3523
|
-
error->handle, conn->handle, name, nameLength, NULL, 0,
|
|
3524
|
-
DPI_OCI_DURATION_SESSION, DPI_OCI_TYPEGET_ALL, tdo);
|
|
3525
|
-
return dpiError__check(error, status, conn, "get type by full name");
|
|
3526
|
-
}
|
|
3527
|
-
|