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/dpiObjectAttr.c
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
//-----------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 2016, 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
|
-
// dpiObjectAttr.c
|
|
14
|
-
// Implementation of object attributes.
|
|
15
|
-
//-----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
#include "dpiImpl.h"
|
|
18
|
-
|
|
19
|
-
//-----------------------------------------------------------------------------
|
|
20
|
-
// dpiObjectAttr__allocate() [INTERNAL]
|
|
21
|
-
// Allocate and initialize an object attribute structure.
|
|
22
|
-
//-----------------------------------------------------------------------------
|
|
23
|
-
int dpiObjectAttr__allocate(dpiObjectType *objType, void *param,
|
|
24
|
-
dpiObjectAttr **attr, dpiError *error)
|
|
25
|
-
{
|
|
26
|
-
dpiObjectAttr *tempAttr;
|
|
27
|
-
|
|
28
|
-
// allocate and assign main reference to the type this attribute belongs to
|
|
29
|
-
*attr = NULL;
|
|
30
|
-
if (dpiGen__allocate(DPI_HTYPE_OBJECT_ATTR, objType->env,
|
|
31
|
-
(void**) &tempAttr, error) < 0)
|
|
32
|
-
return DPI_FAILURE;
|
|
33
|
-
dpiGen__setRefCount(objType, error, 1);
|
|
34
|
-
tempAttr->belongsToType = objType;
|
|
35
|
-
|
|
36
|
-
// determine the name of the attribute
|
|
37
|
-
if (dpiUtils__getAttrStringWithDup("get name", param, DPI_OCI_DTYPE_PARAM,
|
|
38
|
-
DPI_OCI_ATTR_NAME, &tempAttr->name, &tempAttr->nameLength,
|
|
39
|
-
error) < 0) {
|
|
40
|
-
dpiObjectAttr__free(tempAttr, error);
|
|
41
|
-
return DPI_FAILURE;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// determine type information of the attribute
|
|
45
|
-
if (dpiOracleType__populateTypeInfo(objType->conn, param,
|
|
46
|
-
DPI_OCI_DTYPE_PARAM, &tempAttr->typeInfo, error) < 0) {
|
|
47
|
-
dpiObjectAttr__free(tempAttr, error);
|
|
48
|
-
return DPI_FAILURE;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
*attr = tempAttr;
|
|
52
|
-
return DPI_SUCCESS;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//-----------------------------------------------------------------------------
|
|
57
|
-
// dpiObjectAttr__free() [INTERNAL]
|
|
58
|
-
// Free the memory for an object attribute.
|
|
59
|
-
//-----------------------------------------------------------------------------
|
|
60
|
-
void dpiObjectAttr__free(dpiObjectAttr *attr, dpiError *error)
|
|
61
|
-
{
|
|
62
|
-
if (attr->belongsToType) {
|
|
63
|
-
dpiGen__setRefCount(attr->belongsToType, error, -1);
|
|
64
|
-
attr->belongsToType = NULL;
|
|
65
|
-
}
|
|
66
|
-
if (attr->typeInfo.objectType) {
|
|
67
|
-
dpiGen__setRefCount(attr->typeInfo.objectType, error, -1);
|
|
68
|
-
attr->typeInfo.objectType = NULL;
|
|
69
|
-
}
|
|
70
|
-
if (attr->name) {
|
|
71
|
-
dpiUtils__freeMemory((void*) attr->name);
|
|
72
|
-
attr->name = NULL;
|
|
73
|
-
}
|
|
74
|
-
dpiUtils__freeMemory(attr);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//-----------------------------------------------------------------------------
|
|
79
|
-
// dpiObjectAttr_addRef() [PUBLIC]
|
|
80
|
-
// Add a reference to the object attribute.
|
|
81
|
-
//-----------------------------------------------------------------------------
|
|
82
|
-
int dpiObjectAttr_addRef(dpiObjectAttr *attr)
|
|
83
|
-
{
|
|
84
|
-
return dpiGen__addRef(attr, DPI_HTYPE_OBJECT_ATTR, __func__);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//-----------------------------------------------------------------------------
|
|
89
|
-
// dpiObjectAttr_getInfo() [PUBLIC]
|
|
90
|
-
// Return information about the attribute to the caller.
|
|
91
|
-
//-----------------------------------------------------------------------------
|
|
92
|
-
int dpiObjectAttr_getInfo(dpiObjectAttr *attr, dpiObjectAttrInfo *info)
|
|
93
|
-
{
|
|
94
|
-
dpiError error;
|
|
95
|
-
|
|
96
|
-
if (dpiGen__startPublicFn(attr, DPI_HTYPE_OBJECT_ATTR, __func__, 0,
|
|
97
|
-
&error) < 0)
|
|
98
|
-
return dpiGen__endPublicFn(attr, DPI_FAILURE, &error);
|
|
99
|
-
DPI_CHECK_PTR_NOT_NULL(attr, info)
|
|
100
|
-
info->name = attr->name;
|
|
101
|
-
info->nameLength = attr->nameLength;
|
|
102
|
-
info->typeInfo = attr->typeInfo;
|
|
103
|
-
return dpiGen__endPublicFn(attr, DPI_SUCCESS, &error);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
//-----------------------------------------------------------------------------
|
|
108
|
-
// dpiObjectAttr_release() [PUBLIC]
|
|
109
|
-
// Release a reference to the object attribute.
|
|
110
|
-
//-----------------------------------------------------------------------------
|
|
111
|
-
int dpiObjectAttr_release(dpiObjectAttr *attr)
|
|
112
|
-
{
|
|
113
|
-
return dpiGen__release(attr, DPI_HTYPE_OBJECT_ATTR, __func__);
|
|
114
|
-
}
|
|
115
|
-
|
package/odpi/src/dpiObjectType.c
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
//-----------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 2016, 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
|
-
// dpiObjectType.c
|
|
14
|
-
// Implementation of object types.
|
|
15
|
-
//-----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
#include "dpiImpl.h"
|
|
18
|
-
|
|
19
|
-
// forward declarations of internal functions only used in this file
|
|
20
|
-
static int dpiObjectType__init(dpiObjectType *objType, void *param,
|
|
21
|
-
uint32_t nameAttribute, dpiError *error);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//-----------------------------------------------------------------------------
|
|
25
|
-
// dpiObjectType__allocate() [INTERNAL]
|
|
26
|
-
// Allocate and initialize an object type structure.
|
|
27
|
-
//-----------------------------------------------------------------------------
|
|
28
|
-
int dpiObjectType__allocate(dpiConn *conn, void *param,
|
|
29
|
-
uint32_t nameAttribute, dpiObjectType **objType, dpiError *error)
|
|
30
|
-
{
|
|
31
|
-
dpiObjectType *tempObjType;
|
|
32
|
-
|
|
33
|
-
// create structure and retain reference to connection
|
|
34
|
-
*objType = NULL;
|
|
35
|
-
if (dpiGen__allocate(DPI_HTYPE_OBJECT_TYPE, conn->env,
|
|
36
|
-
(void**) &tempObjType, error) < 0)
|
|
37
|
-
return DPI_FAILURE;
|
|
38
|
-
dpiGen__setRefCount(conn, error, 1);
|
|
39
|
-
tempObjType->conn = conn;
|
|
40
|
-
|
|
41
|
-
// perform initialization
|
|
42
|
-
if (dpiObjectType__init(tempObjType, param, nameAttribute, error) < 0) {
|
|
43
|
-
dpiObjectType__free(tempObjType, error);
|
|
44
|
-
return DPI_FAILURE;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
*objType = tempObjType;
|
|
48
|
-
return DPI_SUCCESS;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//-----------------------------------------------------------------------------
|
|
53
|
-
// dpiObjectType__check() [INTERNAL]
|
|
54
|
-
// Validate that the connection from which the object type was created is
|
|
55
|
-
// still connected and issue an error if it is not.
|
|
56
|
-
//-----------------------------------------------------------------------------
|
|
57
|
-
static int dpiObjectType__check(dpiObjectType *objType, const char *fnName,
|
|
58
|
-
dpiError *error)
|
|
59
|
-
{
|
|
60
|
-
if (dpiGen__startPublicFn(objType, DPI_HTYPE_OBJECT_TYPE, fnName, 1,
|
|
61
|
-
error) < 0)
|
|
62
|
-
return DPI_FAILURE;
|
|
63
|
-
return dpiConn__checkConnected(objType->conn, error);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
//-----------------------------------------------------------------------------
|
|
68
|
-
// dpiObjectType__describe() [INTERNAL]
|
|
69
|
-
// Describe the object type and store information about it. Note that a
|
|
70
|
-
// separate call to OCIDescribeAny() is made in order to support nested types;
|
|
71
|
-
// an illegal attribute value is returned if this is not done.
|
|
72
|
-
//-----------------------------------------------------------------------------
|
|
73
|
-
static int dpiObjectType__describe(dpiObjectType *objType,
|
|
74
|
-
void *describeHandle, dpiError *error)
|
|
75
|
-
{
|
|
76
|
-
void *collectionParam, *param;
|
|
77
|
-
uint16_t typeCode;
|
|
78
|
-
|
|
79
|
-
// describe the type
|
|
80
|
-
if (dpiOci__describeAny(objType->conn, objType->tdo, 0, DPI_OCI_OTYPE_PTR,
|
|
81
|
-
describeHandle, error) < 0)
|
|
82
|
-
return DPI_FAILURE;
|
|
83
|
-
|
|
84
|
-
// get top level parameter descriptor
|
|
85
|
-
if (dpiOci__attrGet(describeHandle, DPI_OCI_HTYPE_DESCRIBE, ¶m, 0,
|
|
86
|
-
DPI_OCI_ATTR_PARAM, "get top level parameter", error) < 0)
|
|
87
|
-
return DPI_FAILURE;
|
|
88
|
-
|
|
89
|
-
// determine type code
|
|
90
|
-
if (dpiOci__attrGet(param, DPI_OCI_DTYPE_PARAM, &typeCode, 0,
|
|
91
|
-
DPI_OCI_ATTR_TYPECODE, "get type code", error) < 0)
|
|
92
|
-
return DPI_FAILURE;
|
|
93
|
-
objType->typeCode = typeCode;
|
|
94
|
-
|
|
95
|
-
// determine the number of attributes
|
|
96
|
-
if (dpiOci__attrGet(param, DPI_OCI_DTYPE_PARAM,
|
|
97
|
-
(void*) &objType->numAttributes, 0, DPI_OCI_ATTR_NUM_TYPE_ATTRS,
|
|
98
|
-
"get number of attributes", error) < 0)
|
|
99
|
-
return DPI_FAILURE;
|
|
100
|
-
|
|
101
|
-
// if a collection, need to determine the element type
|
|
102
|
-
if (typeCode == DPI_SQLT_NCO) {
|
|
103
|
-
objType->isCollection = 1;
|
|
104
|
-
|
|
105
|
-
// acquire collection parameter descriptor
|
|
106
|
-
if (dpiOci__attrGet(param, DPI_OCI_DTYPE_PARAM, &collectionParam, 0,
|
|
107
|
-
DPI_OCI_ATTR_COLLECTION_ELEMENT, "get collection descriptor",
|
|
108
|
-
error) < 0)
|
|
109
|
-
return DPI_FAILURE;
|
|
110
|
-
|
|
111
|
-
// determine type of element
|
|
112
|
-
if (dpiOracleType__populateTypeInfo(objType->conn, collectionParam,
|
|
113
|
-
DPI_OCI_DTYPE_PARAM, &objType->elementTypeInfo, error) < 0)
|
|
114
|
-
return DPI_FAILURE;
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return DPI_SUCCESS;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//-----------------------------------------------------------------------------
|
|
123
|
-
// dpiObjectType__free() [INTERNAL]
|
|
124
|
-
// Free the memory for an object type.
|
|
125
|
-
//-----------------------------------------------------------------------------
|
|
126
|
-
void dpiObjectType__free(dpiObjectType *objType, dpiError *error)
|
|
127
|
-
{
|
|
128
|
-
if (objType->conn) {
|
|
129
|
-
dpiGen__setRefCount(objType->conn, error, -1);
|
|
130
|
-
objType->conn = NULL;
|
|
131
|
-
}
|
|
132
|
-
if (objType->elementTypeInfo.objectType) {
|
|
133
|
-
dpiGen__setRefCount(objType->elementTypeInfo.objectType, error, -1);
|
|
134
|
-
objType->elementTypeInfo.objectType = NULL;
|
|
135
|
-
}
|
|
136
|
-
if (objType->schema) {
|
|
137
|
-
dpiUtils__freeMemory((void*) objType->schema);
|
|
138
|
-
objType->schema = NULL;
|
|
139
|
-
}
|
|
140
|
-
if (objType->name) {
|
|
141
|
-
dpiUtils__freeMemory((void*) objType->name);
|
|
142
|
-
objType->name = NULL;
|
|
143
|
-
}
|
|
144
|
-
dpiUtils__freeMemory(objType);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
//-----------------------------------------------------------------------------
|
|
149
|
-
// dpiObjectType__init() [INTERNAL]
|
|
150
|
-
// Initialize the object type.
|
|
151
|
-
//-----------------------------------------------------------------------------
|
|
152
|
-
static int dpiObjectType__init(dpiObjectType *objType, void *param,
|
|
153
|
-
uint32_t nameAttribute, dpiError *error)
|
|
154
|
-
{
|
|
155
|
-
void *describeHandle;
|
|
156
|
-
void *tdoReference;
|
|
157
|
-
|
|
158
|
-
// determine the schema of the type
|
|
159
|
-
if (dpiUtils__getAttrStringWithDup("get schema", param,
|
|
160
|
-
DPI_OCI_DTYPE_PARAM, DPI_OCI_ATTR_SCHEMA_NAME, &objType->schema,
|
|
161
|
-
&objType->schemaLength, error) < 0)
|
|
162
|
-
return DPI_FAILURE;
|
|
163
|
-
|
|
164
|
-
// determine the name of the type
|
|
165
|
-
if (dpiUtils__getAttrStringWithDup("get name", param, DPI_OCI_DTYPE_PARAM,
|
|
166
|
-
nameAttribute, &objType->name, &objType->nameLength, error) < 0)
|
|
167
|
-
return DPI_FAILURE;
|
|
168
|
-
|
|
169
|
-
// retrieve TDO of the parameter and pin it in the cache
|
|
170
|
-
if (dpiOci__attrGet(param, DPI_OCI_DTYPE_PARAM, (void*) &tdoReference, 0,
|
|
171
|
-
DPI_OCI_ATTR_REF_TDO, "get TDO reference", error) < 0)
|
|
172
|
-
return DPI_FAILURE;
|
|
173
|
-
if (dpiOci__objectPin(objType->env->handle, tdoReference, &objType->tdo,
|
|
174
|
-
error) < 0)
|
|
175
|
-
return DPI_FAILURE;
|
|
176
|
-
|
|
177
|
-
// acquire a describe handle
|
|
178
|
-
if (dpiOci__handleAlloc(objType->env->handle, &describeHandle,
|
|
179
|
-
DPI_OCI_HTYPE_DESCRIBE, "allocate describe handle", error) < 0)
|
|
180
|
-
return DPI_FAILURE;
|
|
181
|
-
|
|
182
|
-
// describe the type
|
|
183
|
-
if (dpiObjectType__describe(objType, describeHandle, error) < 0) {
|
|
184
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
185
|
-
return DPI_FAILURE;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// free the describe handle
|
|
189
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
190
|
-
|
|
191
|
-
return DPI_SUCCESS;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
//-----------------------------------------------------------------------------
|
|
196
|
-
// dpiObjectType_addRef() [PUBLIC]
|
|
197
|
-
// Add a reference to the object type.
|
|
198
|
-
//-----------------------------------------------------------------------------
|
|
199
|
-
int dpiObjectType_addRef(dpiObjectType *objType)
|
|
200
|
-
{
|
|
201
|
-
return dpiGen__addRef(objType, DPI_HTYPE_OBJECT_TYPE, __func__);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
//-----------------------------------------------------------------------------
|
|
206
|
-
// dpiObjectType_createObject() [PUBLIC]
|
|
207
|
-
// Create a new object of the specified type and return it. Return NULL on
|
|
208
|
-
// error.
|
|
209
|
-
//-----------------------------------------------------------------------------
|
|
210
|
-
int dpiObjectType_createObject(dpiObjectType *objType, dpiObject **obj)
|
|
211
|
-
{
|
|
212
|
-
dpiError error;
|
|
213
|
-
int status;
|
|
214
|
-
|
|
215
|
-
// validate parameters
|
|
216
|
-
if (dpiObjectType__check(objType, __func__, &error) < 0)
|
|
217
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
218
|
-
DPI_CHECK_PTR_NOT_NULL(objType, obj)
|
|
219
|
-
status = dpiObject__allocate(objType, NULL, NULL, NULL, obj, &error);
|
|
220
|
-
return dpiGen__endPublicFn(objType, status, &error);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
//-----------------------------------------------------------------------------
|
|
225
|
-
// dpiObjectType_getAttributes() [PUBLIC]
|
|
226
|
-
// Get the attributes for the object type in the provided array.
|
|
227
|
-
//-----------------------------------------------------------------------------
|
|
228
|
-
int dpiObjectType_getAttributes(dpiObjectType *objType, uint16_t numAttributes,
|
|
229
|
-
dpiObjectAttr **attributes)
|
|
230
|
-
{
|
|
231
|
-
void *topLevelParam, *attrListParam, *attrParam, *describeHandle;
|
|
232
|
-
dpiError error;
|
|
233
|
-
uint16_t i;
|
|
234
|
-
|
|
235
|
-
// validate object type and the number of attributes
|
|
236
|
-
if (dpiObjectType__check(objType, __func__, &error) < 0)
|
|
237
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
238
|
-
DPI_CHECK_PTR_NOT_NULL(objType, attributes)
|
|
239
|
-
if (numAttributes < objType->numAttributes) {
|
|
240
|
-
dpiError__set(&error, "get attributes", DPI_ERR_ARRAY_SIZE_TOO_SMALL,
|
|
241
|
-
numAttributes);
|
|
242
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
243
|
-
}
|
|
244
|
-
if (numAttributes == 0)
|
|
245
|
-
return dpiGen__endPublicFn(objType, DPI_SUCCESS, &error);
|
|
246
|
-
|
|
247
|
-
// acquire a describe handle
|
|
248
|
-
if (dpiOci__handleAlloc(objType->env->handle, &describeHandle,
|
|
249
|
-
DPI_OCI_HTYPE_DESCRIBE, "allocate describe handle", &error) < 0)
|
|
250
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
251
|
-
|
|
252
|
-
// describe the type
|
|
253
|
-
if (dpiOci__describeAny(objType->conn, objType->tdo, 0, DPI_OCI_OTYPE_PTR,
|
|
254
|
-
describeHandle, &error) < 0) {
|
|
255
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
256
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// get the top level parameter descriptor
|
|
260
|
-
if (dpiOci__attrGet(describeHandle, DPI_OCI_HTYPE_DESCRIBE, &topLevelParam,
|
|
261
|
-
0, DPI_OCI_ATTR_PARAM, "get top level param", &error) < 0) {
|
|
262
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
263
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// get the attribute list parameter descriptor
|
|
267
|
-
if (dpiOci__attrGet(topLevelParam, DPI_OCI_DTYPE_PARAM,
|
|
268
|
-
(void*) &attrListParam, 0, DPI_OCI_ATTR_LIST_TYPE_ATTRS,
|
|
269
|
-
"get attr list param", &error) < 0) {
|
|
270
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
271
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// create attribute structure for each attribute
|
|
275
|
-
for (i = 0; i < objType->numAttributes; i++) {
|
|
276
|
-
if (dpiOci__paramGet(attrListParam, DPI_OCI_DTYPE_PARAM, &attrParam,
|
|
277
|
-
(uint32_t) i + 1, "get attribute param", &error) < 0) {
|
|
278
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
279
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
280
|
-
}
|
|
281
|
-
if (dpiObjectAttr__allocate(objType, attrParam, &attributes[i],
|
|
282
|
-
&error) < 0) {
|
|
283
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
284
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// free the describe handle
|
|
289
|
-
dpiOci__handleFree(describeHandle, DPI_OCI_HTYPE_DESCRIBE);
|
|
290
|
-
|
|
291
|
-
return dpiGen__endPublicFn(objType, DPI_SUCCESS, &error);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
//-----------------------------------------------------------------------------
|
|
296
|
-
// dpiObjectType_getInfo() [PUBLIC]
|
|
297
|
-
// Return information about the object type.
|
|
298
|
-
//-----------------------------------------------------------------------------
|
|
299
|
-
int dpiObjectType_getInfo(dpiObjectType *objType, dpiObjectTypeInfo *info)
|
|
300
|
-
{
|
|
301
|
-
dpiError error;
|
|
302
|
-
|
|
303
|
-
if (dpiGen__startPublicFn(objType, DPI_HTYPE_OBJECT_TYPE, __func__, 0,
|
|
304
|
-
&error) < 0)
|
|
305
|
-
return dpiGen__endPublicFn(objType, DPI_FAILURE, &error);
|
|
306
|
-
DPI_CHECK_PTR_NOT_NULL(objType, info)
|
|
307
|
-
info->name = objType->name;
|
|
308
|
-
info->nameLength = objType->nameLength;
|
|
309
|
-
info->schema = objType->schema;
|
|
310
|
-
info->schemaLength = objType->schemaLength;
|
|
311
|
-
info->isCollection = objType->isCollection;
|
|
312
|
-
info->elementTypeInfo = objType->elementTypeInfo;
|
|
313
|
-
info->numAttributes = objType->numAttributes;
|
|
314
|
-
return dpiGen__endPublicFn(objType, DPI_SUCCESS, &error);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
//-----------------------------------------------------------------------------
|
|
319
|
-
// dpiObjectType_release() [PUBLIC]
|
|
320
|
-
// Release a reference to the object type.
|
|
321
|
-
//-----------------------------------------------------------------------------
|
|
322
|
-
int dpiObjectType_release(dpiObjectType *objType)
|
|
323
|
-
{
|
|
324
|
-
return dpiGen__release(objType, DPI_HTYPE_OBJECT_TYPE, __func__);
|
|
325
|
-
}
|
|
326
|
-
|