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/dpiSodaDoc.c
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
//-----------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 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
|
-
// dpiSodaDoc.c
|
|
14
|
-
// Implementation of SODA documents.
|
|
15
|
-
//-----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
#include "dpiImpl.h"
|
|
18
|
-
|
|
19
|
-
//-----------------------------------------------------------------------------
|
|
20
|
-
// dpiSodaDoc__allocate() [INTERNAL]
|
|
21
|
-
// Allocate and initialize a SODA document structure.
|
|
22
|
-
//-----------------------------------------------------------------------------
|
|
23
|
-
int dpiSodaDoc__allocate(dpiSodaDb *db, void *handle, dpiSodaDoc **doc,
|
|
24
|
-
dpiError *error)
|
|
25
|
-
{
|
|
26
|
-
dpiSodaDoc *tempDoc;
|
|
27
|
-
|
|
28
|
-
if (dpiGen__allocate(DPI_HTYPE_SODA_DOC, db->env, (void**) &tempDoc,
|
|
29
|
-
error) < 0)
|
|
30
|
-
return DPI_FAILURE;
|
|
31
|
-
dpiGen__setRefCount(db, error, 1);
|
|
32
|
-
tempDoc->db = db;
|
|
33
|
-
tempDoc->handle = handle;
|
|
34
|
-
*doc = tempDoc;
|
|
35
|
-
return DPI_SUCCESS;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//-----------------------------------------------------------------------------
|
|
40
|
-
// dpiSodaDoc__check() [INTERNAL]
|
|
41
|
-
// Determine if the SODA document is available to use.
|
|
42
|
-
//-----------------------------------------------------------------------------
|
|
43
|
-
static int dpiSodaDoc__check(dpiSodaDoc *doc, const char *fnName,
|
|
44
|
-
dpiError *error)
|
|
45
|
-
{
|
|
46
|
-
if (dpiGen__startPublicFn(doc, DPI_HTYPE_SODA_DOC, fnName, 1, error) < 0)
|
|
47
|
-
return DPI_FAILURE;
|
|
48
|
-
if (!doc->db->conn->handle || doc->db->conn->closing)
|
|
49
|
-
return dpiError__set(error, "check connection", DPI_ERR_NOT_CONNECTED);
|
|
50
|
-
return DPI_SUCCESS;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//-----------------------------------------------------------------------------
|
|
55
|
-
// dpiSodaDoc__free() [INTERNAL]
|
|
56
|
-
// Free the memory for a SODA document.
|
|
57
|
-
//-----------------------------------------------------------------------------
|
|
58
|
-
void dpiSodaDoc__free(dpiSodaDoc *doc, dpiError *error)
|
|
59
|
-
{
|
|
60
|
-
if (doc->db) {
|
|
61
|
-
dpiGen__setRefCount(doc->db, error, -1);
|
|
62
|
-
doc->db = NULL;
|
|
63
|
-
}
|
|
64
|
-
if (doc->handle) {
|
|
65
|
-
dpiOci__handleFree(doc->handle, DPI_OCI_HTYPE_SODA_DOCUMENT);
|
|
66
|
-
doc->handle = NULL;
|
|
67
|
-
}
|
|
68
|
-
dpiUtils__freeMemory(doc);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
//-----------------------------------------------------------------------------
|
|
73
|
-
// dpiSodaDoc__getAttributeText() [INTERNAL]
|
|
74
|
-
// Get the value of the OCI attribute as a text string.
|
|
75
|
-
//-----------------------------------------------------------------------------
|
|
76
|
-
static int dpiSodaDoc__getAttributeText(dpiSodaDoc *doc, uint32_t attribute,
|
|
77
|
-
const char **value, uint32_t *valueLength, const char *fnName)
|
|
78
|
-
{
|
|
79
|
-
dpiError error;
|
|
80
|
-
int status;
|
|
81
|
-
|
|
82
|
-
// validate parameters
|
|
83
|
-
if (dpiSodaDoc__check(doc, fnName, &error) < 0)
|
|
84
|
-
return dpiGen__endPublicFn(doc, DPI_FAILURE, &error);
|
|
85
|
-
DPI_CHECK_PTR_NOT_NULL(doc, value)
|
|
86
|
-
DPI_CHECK_PTR_NOT_NULL(doc, valueLength)
|
|
87
|
-
|
|
88
|
-
// get attribute value
|
|
89
|
-
status = dpiOci__attrGet(doc->handle, DPI_OCI_HTYPE_SODA_DOCUMENT,
|
|
90
|
-
(void*) value, valueLength, attribute, "get value", &error);
|
|
91
|
-
return dpiGen__endPublicFn(doc, status, &error);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
//-----------------------------------------------------------------------------
|
|
96
|
-
// dpiSodaDoc_addRef() [PUBLIC]
|
|
97
|
-
// Add a reference to the SODA document.
|
|
98
|
-
//-----------------------------------------------------------------------------
|
|
99
|
-
int dpiSodaDoc_addRef(dpiSodaDoc *doc)
|
|
100
|
-
{
|
|
101
|
-
return dpiGen__addRef(doc, DPI_HTYPE_SODA_DOC, __func__);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//-----------------------------------------------------------------------------
|
|
106
|
-
// dpiSodaDoc_getContent() [PUBLIC]
|
|
107
|
-
// Return the content of the SODA document.
|
|
108
|
-
//-----------------------------------------------------------------------------
|
|
109
|
-
int dpiSodaDoc_getContent(dpiSodaDoc *doc, const char **value,
|
|
110
|
-
uint32_t *valueLength, const char **encoding)
|
|
111
|
-
{
|
|
112
|
-
uint16_t charsetId;
|
|
113
|
-
dpiError error;
|
|
114
|
-
|
|
115
|
-
// validate parameters
|
|
116
|
-
if (dpiSodaDoc__check(doc, __func__, &error) < 0)
|
|
117
|
-
return dpiGen__endPublicFn(doc, DPI_FAILURE, &error);
|
|
118
|
-
DPI_CHECK_PTR_NOT_NULL(doc, value)
|
|
119
|
-
DPI_CHECK_PTR_NOT_NULL(doc, valueLength)
|
|
120
|
-
DPI_CHECK_PTR_NOT_NULL(doc, encoding)
|
|
121
|
-
|
|
122
|
-
// get content
|
|
123
|
-
if (dpiOci__attrGet(doc->handle, DPI_OCI_HTYPE_SODA_DOCUMENT,
|
|
124
|
-
(void*) value, valueLength, DPI_OCI_ATTR_SODA_CONTENT,
|
|
125
|
-
"get content", &error) < 0)
|
|
126
|
-
return dpiGen__endPublicFn(doc, DPI_FAILURE, &error);
|
|
127
|
-
|
|
128
|
-
// if content is not in binary form, always use UTF-8
|
|
129
|
-
if (!doc->binaryContent)
|
|
130
|
-
*encoding = DPI_CHARSET_NAME_UTF8;
|
|
131
|
-
|
|
132
|
-
// otherwise, determine the encoding from OCI
|
|
133
|
-
else {
|
|
134
|
-
if (dpiOci__attrGet(doc->handle, DPI_OCI_HTYPE_SODA_DOCUMENT,
|
|
135
|
-
(void*) &charsetId, 0, DPI_OCI_ATTR_SODA_JSON_CHARSET_ID,
|
|
136
|
-
"get charset", &error) < 0)
|
|
137
|
-
return dpiGen__endPublicFn(doc, DPI_FAILURE, &error);
|
|
138
|
-
switch (charsetId) {
|
|
139
|
-
case 0:
|
|
140
|
-
*encoding = NULL;
|
|
141
|
-
break;
|
|
142
|
-
case DPI_CHARSET_ID_UTF8:
|
|
143
|
-
*encoding = DPI_CHARSET_NAME_UTF8;
|
|
144
|
-
break;
|
|
145
|
-
case DPI_CHARSET_ID_UTF16BE:
|
|
146
|
-
*encoding = DPI_CHARSET_NAME_UTF16BE;
|
|
147
|
-
break;
|
|
148
|
-
case DPI_CHARSET_ID_UTF16LE:
|
|
149
|
-
*encoding = DPI_CHARSET_NAME_UTF16LE;
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
dpiError__set(&error, "check charset",
|
|
153
|
-
DPI_ERR_INVALID_CHARSET_ID, charsetId);
|
|
154
|
-
return dpiGen__endPublicFn(doc, DPI_FAILURE, &error);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return dpiGen__endPublicFn(doc, DPI_SUCCESS, &error);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
//-----------------------------------------------------------------------------
|
|
163
|
-
// dpiSodaDoc_getCreatedOn() [PUBLIC]
|
|
164
|
-
// Return the created timestamp of the SODA document.
|
|
165
|
-
//-----------------------------------------------------------------------------
|
|
166
|
-
int dpiSodaDoc_getCreatedOn(dpiSodaDoc *doc, const char **value,
|
|
167
|
-
uint32_t *valueLength)
|
|
168
|
-
{
|
|
169
|
-
return dpiSodaDoc__getAttributeText(doc,
|
|
170
|
-
DPI_OCI_ATTR_SODA_CREATE_TIMESTAMP, value, valueLength, __func__);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
//-----------------------------------------------------------------------------
|
|
175
|
-
// dpiSodaDoc_getKey() [PUBLIC]
|
|
176
|
-
// Return the created timestamp of the SODA document.
|
|
177
|
-
//-----------------------------------------------------------------------------
|
|
178
|
-
int dpiSodaDoc_getKey(dpiSodaDoc *doc, const char **value,
|
|
179
|
-
uint32_t *valueLength)
|
|
180
|
-
{
|
|
181
|
-
return dpiSodaDoc__getAttributeText(doc, DPI_OCI_ATTR_SODA_KEY, value,
|
|
182
|
-
valueLength, __func__);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
//-----------------------------------------------------------------------------
|
|
187
|
-
// dpiSodaDoc_getLastModified() [PUBLIC]
|
|
188
|
-
// Return the last modified timestamp of the SODA document.
|
|
189
|
-
//-----------------------------------------------------------------------------
|
|
190
|
-
int dpiSodaDoc_getLastModified(dpiSodaDoc *doc, const char **value,
|
|
191
|
-
uint32_t *valueLength)
|
|
192
|
-
{
|
|
193
|
-
return dpiSodaDoc__getAttributeText(doc,
|
|
194
|
-
DPI_OCI_ATTR_SODA_LASTMOD_TIMESTAMP, value, valueLength, __func__);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
//-----------------------------------------------------------------------------
|
|
199
|
-
// dpiSodaDoc_getMediaType() [PUBLIC]
|
|
200
|
-
// Return the media type of the SODA document.
|
|
201
|
-
//-----------------------------------------------------------------------------
|
|
202
|
-
int dpiSodaDoc_getMediaType(dpiSodaDoc *doc, const char **value,
|
|
203
|
-
uint32_t *valueLength)
|
|
204
|
-
{
|
|
205
|
-
return dpiSodaDoc__getAttributeText(doc, DPI_OCI_ATTR_SODA_MEDIA_TYPE,
|
|
206
|
-
value, valueLength, __func__);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
//-----------------------------------------------------------------------------
|
|
211
|
-
// dpiSodaDoc_getVersion() [PUBLIC]
|
|
212
|
-
// Return the version of the SODA document.
|
|
213
|
-
//-----------------------------------------------------------------------------
|
|
214
|
-
int dpiSodaDoc_getVersion(dpiSodaDoc *doc, const char **value,
|
|
215
|
-
uint32_t *valueLength)
|
|
216
|
-
{
|
|
217
|
-
return dpiSodaDoc__getAttributeText(doc, DPI_OCI_ATTR_SODA_VERSION,
|
|
218
|
-
value, valueLength, __func__);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
//-----------------------------------------------------------------------------
|
|
223
|
-
// dpiSodaDoc_release() [PUBLIC]
|
|
224
|
-
// Release a reference to the SODA document.
|
|
225
|
-
//-----------------------------------------------------------------------------
|
|
226
|
-
int dpiSodaDoc_release(dpiSodaDoc *doc)
|
|
227
|
-
{
|
|
228
|
-
return dpiGen__release(doc, DPI_HTYPE_SODA_DOC, __func__);
|
|
229
|
-
}
|
|
230
|
-
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
//-----------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 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
|
-
// dpiSodaDocCursor.c
|
|
14
|
-
// Implementation of SODA document cursors.
|
|
15
|
-
//-----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
#include "dpiImpl.h"
|
|
18
|
-
|
|
19
|
-
//-----------------------------------------------------------------------------
|
|
20
|
-
// dpiSodaDocCursor__allocate() [INTERNAL]
|
|
21
|
-
// Allocate and initialize a SODA document cursor structure.
|
|
22
|
-
//-----------------------------------------------------------------------------
|
|
23
|
-
int dpiSodaDocCursor__allocate(dpiSodaColl *coll, void *handle,
|
|
24
|
-
dpiSodaDocCursor **cursor, dpiError *error)
|
|
25
|
-
{
|
|
26
|
-
dpiSodaDocCursor *tempCursor;
|
|
27
|
-
|
|
28
|
-
if (dpiGen__allocate(DPI_HTYPE_SODA_DOC_CURSOR, coll->env,
|
|
29
|
-
(void**) &tempCursor, error) < 0)
|
|
30
|
-
return DPI_FAILURE;
|
|
31
|
-
dpiGen__setRefCount(coll, error, 1);
|
|
32
|
-
tempCursor->coll = coll;
|
|
33
|
-
tempCursor->handle = handle;
|
|
34
|
-
*cursor = tempCursor;
|
|
35
|
-
return DPI_SUCCESS;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//-----------------------------------------------------------------------------
|
|
40
|
-
// dpiSodaDocCursor__check() [INTERNAL]
|
|
41
|
-
// Determine if the SODA document cursor is available to use.
|
|
42
|
-
//-----------------------------------------------------------------------------
|
|
43
|
-
static int dpiSodaDocCursor__check(dpiSodaDocCursor *cursor,
|
|
44
|
-
const char *fnName, dpiError *error)
|
|
45
|
-
{
|
|
46
|
-
if (dpiGen__startPublicFn(cursor, DPI_HTYPE_SODA_DOC_CURSOR, fnName, 1,
|
|
47
|
-
error) < 0)
|
|
48
|
-
return DPI_FAILURE;
|
|
49
|
-
if (!cursor->handle)
|
|
50
|
-
return dpiError__set(error, "check closed",
|
|
51
|
-
DPI_ERR_SODA_CURSOR_CLOSED);
|
|
52
|
-
if (!cursor->coll->db->conn->handle || cursor->coll->db->conn->closing)
|
|
53
|
-
return dpiError__set(error, "check connection", DPI_ERR_NOT_CONNECTED);
|
|
54
|
-
return DPI_SUCCESS;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//-----------------------------------------------------------------------------
|
|
59
|
-
// dpiSodaDocCursor__free() [INTERNAL]
|
|
60
|
-
// Free the memory for a SODA document cursor.
|
|
61
|
-
//-----------------------------------------------------------------------------
|
|
62
|
-
void dpiSodaDocCursor__free(dpiSodaDocCursor *cursor, dpiError *error)
|
|
63
|
-
{
|
|
64
|
-
if (cursor->coll) {
|
|
65
|
-
dpiGen__setRefCount(cursor->coll, error, -1);
|
|
66
|
-
cursor->coll = NULL;
|
|
67
|
-
}
|
|
68
|
-
if (cursor->handle) {
|
|
69
|
-
dpiOci__handleFree(cursor->handle, DPI_OCI_HTYPE_SODA_DOC_CURSOR);
|
|
70
|
-
cursor->handle = NULL;
|
|
71
|
-
}
|
|
72
|
-
dpiUtils__freeMemory(cursor);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//-----------------------------------------------------------------------------
|
|
77
|
-
// dpiSodaDocCursor_addRef() [PUBLIC]
|
|
78
|
-
// Add a reference to the SODA document cursor.
|
|
79
|
-
//-----------------------------------------------------------------------------
|
|
80
|
-
int dpiSodaDocCursor_addRef(dpiSodaDocCursor *cursor)
|
|
81
|
-
{
|
|
82
|
-
return dpiGen__addRef(cursor, DPI_HTYPE_SODA_DOC_CURSOR, __func__);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//-----------------------------------------------------------------------------
|
|
87
|
-
// dpiSodaDocCursor_close() [PUBLIC]
|
|
88
|
-
// Close the cursor.
|
|
89
|
-
//-----------------------------------------------------------------------------
|
|
90
|
-
int dpiSodaDocCursor_close(dpiSodaDocCursor *cursor)
|
|
91
|
-
{
|
|
92
|
-
dpiError error;
|
|
93
|
-
|
|
94
|
-
if (dpiSodaDocCursor__check(cursor, __func__, &error) < 0)
|
|
95
|
-
return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error);
|
|
96
|
-
if (cursor->handle) {
|
|
97
|
-
dpiOci__handleFree(cursor->handle, DPI_OCI_HTYPE_SODA_DOC_CURSOR);
|
|
98
|
-
cursor->handle = NULL;
|
|
99
|
-
}
|
|
100
|
-
return dpiGen__endPublicFn(cursor, DPI_SUCCESS, &error);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
//-----------------------------------------------------------------------------
|
|
105
|
-
// dpiSodaDocCursor_getNext() [PUBLIC]
|
|
106
|
-
// Return the next document available from the cursor.
|
|
107
|
-
//-----------------------------------------------------------------------------
|
|
108
|
-
int dpiSodaDocCursor_getNext(dpiSodaDocCursor *cursor, uint32_t flags,
|
|
109
|
-
dpiSodaDoc **doc)
|
|
110
|
-
{
|
|
111
|
-
dpiError error;
|
|
112
|
-
uint32_t mode;
|
|
113
|
-
void *handle;
|
|
114
|
-
|
|
115
|
-
if (dpiSodaDocCursor__check(cursor, __func__, &error) < 0)
|
|
116
|
-
return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error);
|
|
117
|
-
DPI_CHECK_PTR_NOT_NULL(cursor, doc)
|
|
118
|
-
mode = DPI_OCI_DEFAULT;
|
|
119
|
-
if (flags & DPI_SODA_FLAGS_ATOMIC_COMMIT)
|
|
120
|
-
mode |= DPI_OCI_SODA_ATOMIC_COMMIT;
|
|
121
|
-
if (dpiOci__sodaDocGetNext(cursor, &handle, mode, &error) < 0)
|
|
122
|
-
return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error);
|
|
123
|
-
*doc = NULL;
|
|
124
|
-
if (handle) {
|
|
125
|
-
if (dpiSodaDoc__allocate(cursor->coll->db, handle, doc, &error) < 0) {
|
|
126
|
-
dpiOci__handleFree(handle, DPI_OCI_HTYPE_SODA_DOCUMENT);
|
|
127
|
-
return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error);
|
|
128
|
-
}
|
|
129
|
-
(*doc)->binaryContent = cursor->coll->binaryContent;
|
|
130
|
-
}
|
|
131
|
-
return dpiGen__endPublicFn(cursor, DPI_SUCCESS, &error);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//-----------------------------------------------------------------------------
|
|
136
|
-
// dpiSodaDocCursor_release() [PUBLIC]
|
|
137
|
-
// Release a reference to the SODA document cursor.
|
|
138
|
-
//-----------------------------------------------------------------------------
|
|
139
|
-
int dpiSodaDocCursor_release(dpiSodaDocCursor *cursor)
|
|
140
|
-
{
|
|
141
|
-
return dpiGen__release(cursor, DPI_HTYPE_SODA_DOC_CURSOR, __func__);
|
|
142
|
-
}
|
|
143
|
-
|