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.
Files changed (112) hide show
  1. package/CHANGELOG.md +135 -8
  2. package/README.md +6 -4
  3. package/build/Release/oracledb-abi48-darwin-x64.node +0 -0
  4. package/build/Release/oracledb-abi48-darwin-x64.node-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-abi48-linux-x64.node +0 -0
  6. package/build/Release/oracledb-abi48-linux-x64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-abi48-win32-x64.node +0 -0
  8. package/build/Release/oracledb-abi48-win32-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-abi57-darwin-x64.node +0 -0
  10. package/build/Release/oracledb-abi57-darwin-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-abi57-linux-x64.node +0 -0
  12. package/build/Release/oracledb-abi57-linux-x64.node-buildinfo.txt +1 -0
  13. package/build/Release/oracledb-abi57-win32-x64.node +0 -0
  14. package/build/Release/oracledb-abi57-win32-x64.node-buildinfo.txt +1 -0
  15. package/build/Release/oracledb-abi64-darwin-x64.node +0 -0
  16. package/build/Release/oracledb-abi64-darwin-x64.node-buildinfo.txt +1 -0
  17. package/build/Release/oracledb-abi64-linux-x64.node +0 -0
  18. package/build/Release/oracledb-abi64-linux-x64.node-buildinfo.txt +1 -0
  19. package/build/Release/oracledb-abi64-win32-x64.node +0 -0
  20. package/build/Release/oracledb-abi64-win32-x64.node-buildinfo.txt +1 -0
  21. package/build/Release/oracledb-abi67-darwin-x64.node +0 -0
  22. package/build/Release/oracledb-abi67-darwin-x64.node-buildinfo.txt +1 -0
  23. package/build/Release/oracledb-abi67-linux-x64.node +0 -0
  24. package/build/Release/oracledb-abi67-linux-x64.node-buildinfo.txt +1 -0
  25. package/build/Release/oracledb-abi67-win32-x64.node +0 -0
  26. package/build/Release/oracledb-abi67-win32-x64.node-buildinfo.txt +1 -0
  27. package/lib/connection.js +18 -4
  28. package/lib/oracledb.js +44 -92
  29. package/lib/pool.js +36 -2
  30. package/lib/sodaCollection.js +1 -1
  31. package/lib/sodaDatabase.js +1 -1
  32. package/lib/util.js +82 -5
  33. package/package/README.md +32 -101
  34. package/package/install.js +139 -0
  35. package/package/prunebinaries.js +51 -0
  36. package/package.json +4 -11
  37. package/binding.gyp +0 -162
  38. package/lib/rel.txt +0 -1
  39. package/odpi/.npmignore +0 -4
  40. package/odpi/LICENSE.md +0 -218
  41. package/odpi/README.md +0 -61
  42. package/odpi/embed/README.md +0 -4
  43. package/odpi/embed/dpi.c +0 -50
  44. package/odpi/include/dpi.h +0 -1748
  45. package/odpi/src/dpiConn.c +0 -2089
  46. package/odpi/src/dpiContext.c +0 -296
  47. package/odpi/src/dpiData.c +0 -797
  48. package/odpi/src/dpiDebug.c +0 -184
  49. package/odpi/src/dpiDeqOptions.c +0 -370
  50. package/odpi/src/dpiEnqOptions.c +0 -174
  51. package/odpi/src/dpiEnv.c +0 -189
  52. package/odpi/src/dpiError.c +0 -204
  53. package/odpi/src/dpiErrorMessages.h +0 -86
  54. package/odpi/src/dpiGen.c +0 -303
  55. package/odpi/src/dpiGlobal.c +0 -292
  56. package/odpi/src/dpiHandleList.c +0 -117
  57. package/odpi/src/dpiHandlePool.c +0 -118
  58. package/odpi/src/dpiImpl.h +0 -1707
  59. package/odpi/src/dpiLob.c +0 -506
  60. package/odpi/src/dpiMsgProps.c +0 -386
  61. package/odpi/src/dpiObject.c +0 -897
  62. package/odpi/src/dpiObjectAttr.c +0 -115
  63. package/odpi/src/dpiObjectType.c +0 -326
  64. package/odpi/src/dpiOci.c +0 -3527
  65. package/odpi/src/dpiOracleType.c +0 -492
  66. package/odpi/src/dpiPool.c +0 -549
  67. package/odpi/src/dpiRowid.c +0 -136
  68. package/odpi/src/dpiSodaColl.c +0 -685
  69. package/odpi/src/dpiSodaCollCursor.c +0 -143
  70. package/odpi/src/dpiSodaDb.c +0 -432
  71. package/odpi/src/dpiSodaDoc.c +0 -230
  72. package/odpi/src/dpiSodaDocCursor.c +0 -143
  73. package/odpi/src/dpiStmt.c +0 -1797
  74. package/odpi/src/dpiSubscr.c +0 -674
  75. package/odpi/src/dpiUtils.c +0 -410
  76. package/odpi/src/dpiVar.c +0 -1794
  77. package/package/MAKEPKG.BAT +0 -156
  78. package/package/Makefile +0 -85
  79. package/package/createpackage.js +0 -186
  80. package/package/extractpackage.js +0 -76
  81. package/package/getversion.js +0 -37
  82. package/package/oracledbinstall.js +0 -497
  83. package/package/package.json +0 -54
  84. package/package/util.js +0 -286
  85. package/src/njsCommon.cpp +0 -1055
  86. package/src/njsCommon.h +0 -484
  87. package/src/njsConnection.cpp +0 -2926
  88. package/src/njsConnection.h +0 -227
  89. package/src/njsIntLob.cpp +0 -618
  90. package/src/njsIntLob.h +0 -179
  91. package/src/njsMessages.cpp +0 -122
  92. package/src/njsMessages.h +0 -118
  93. package/src/njsOracle.cpp +0 -1274
  94. package/src/njsOracle.h +0 -237
  95. package/src/njsPool.cpp +0 -482
  96. package/src/njsPool.h +0 -132
  97. package/src/njsResultSet.cpp +0 -478
  98. package/src/njsResultSet.h +0 -120
  99. package/src/njsSodaCollection.cpp +0 -507
  100. package/src/njsSodaCollection.h +0 -128
  101. package/src/njsSodaDatabase.cpp +0 -335
  102. package/src/njsSodaDatabase.h +0 -108
  103. package/src/njsSodaDocCursor.cpp +0 -203
  104. package/src/njsSodaDocCursor.h +0 -94
  105. package/src/njsSodaDocument.cpp +0 -412
  106. package/src/njsSodaDocument.h +0 -105
  107. package/src/njsSodaOperation.cpp +0 -557
  108. package/src/njsSodaOperation.h +0 -123
  109. package/src/njsSubscription.cpp +0 -388
  110. package/src/njsSubscription.h +0 -111
  111. package/src/njsUtils.cpp +0 -158
  112. package/src/njsUtils.h +0 -68
@@ -1,174 +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
- // dpiEnqOptions.c
14
- // Implementation of AQ enqueue options.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // dpiEnqOptions__create() [INTERNAL]
21
- // Create a new subscription structure and return it. In case of error NULL
22
- // is returned.
23
- //-----------------------------------------------------------------------------
24
- int dpiEnqOptions__create(dpiEnqOptions *options, dpiConn *conn,
25
- dpiError *error)
26
- {
27
- dpiGen__setRefCount(conn, error, 1);
28
- options->conn = conn;
29
- return dpiOci__descriptorAlloc(conn->env->handle, &options->handle,
30
- DPI_OCI_DTYPE_AQENQ_OPTIONS, "allocate descriptor", error);
31
- }
32
-
33
-
34
- //-----------------------------------------------------------------------------
35
- // dpiEnqOptions__free() [INTERNAL]
36
- // Free the memory for a enqueue options structure.
37
- //-----------------------------------------------------------------------------
38
- void dpiEnqOptions__free(dpiEnqOptions *options, dpiError *error)
39
- {
40
- if (options->handle) {
41
- dpiOci__descriptorFree(options->handle, DPI_OCI_DTYPE_AQENQ_OPTIONS);
42
- options->handle = NULL;
43
- }
44
- if (options->conn) {
45
- dpiGen__setRefCount(options->conn, error, -1);
46
- options->conn = NULL;
47
- }
48
- dpiUtils__freeMemory(options);
49
- }
50
-
51
-
52
- //-----------------------------------------------------------------------------
53
- // dpiEnqOptions__getAttrValue() [INTERNAL]
54
- // Get the attribute value in OCI.
55
- //-----------------------------------------------------------------------------
56
- static int dpiEnqOptions__getAttrValue(dpiEnqOptions *options,
57
- uint32_t attribute, const char *fnName, void *value,
58
- uint32_t *valueLength)
59
- {
60
- dpiError error;
61
- int status;
62
-
63
- if (dpiGen__startPublicFn(options, DPI_HTYPE_ENQ_OPTIONS, fnName, 1,
64
- &error) < 0)
65
- return dpiGen__endPublicFn(options, DPI_FAILURE, &error);
66
- DPI_CHECK_PTR_NOT_NULL(options, value)
67
- DPI_CHECK_PTR_NOT_NULL(options, valueLength)
68
- status = dpiOci__attrGet(options->handle, DPI_OCI_DTYPE_AQENQ_OPTIONS,
69
- value, valueLength, attribute, "get attribute value", &error);
70
- return dpiGen__endPublicFn(options, status, &error);
71
- }
72
-
73
-
74
- //-----------------------------------------------------------------------------
75
- // dpiEnqOptions__setAttrValue() [INTERNAL]
76
- // Set the attribute value in OCI.
77
- //-----------------------------------------------------------------------------
78
- static int dpiEnqOptions__setAttrValue(dpiEnqOptions *options,
79
- uint32_t attribute, const char *fnName, const void *value,
80
- uint32_t valueLength)
81
- {
82
- dpiError error;
83
- int status;
84
-
85
- if (dpiGen__startPublicFn(options, DPI_HTYPE_ENQ_OPTIONS, fnName, 1,
86
- &error) < 0)
87
- return dpiGen__endPublicFn(options, DPI_FAILURE, &error);
88
- DPI_CHECK_PTR_NOT_NULL(options, value)
89
- status = dpiOci__attrSet(options->handle, DPI_OCI_DTYPE_AQENQ_OPTIONS,
90
- (void*) value, valueLength, attribute, "set attribute value",
91
- &error);
92
- return dpiGen__endPublicFn(options, status, &error);
93
- }
94
-
95
-
96
- //-----------------------------------------------------------------------------
97
- // dpiEnqOptions_addRef() [PUBLIC]
98
- // Add a reference to the enqueue options.
99
- //-----------------------------------------------------------------------------
100
- int dpiEnqOptions_addRef(dpiEnqOptions *options)
101
- {
102
- return dpiGen__addRef(options, DPI_HTYPE_ENQ_OPTIONS, __func__);
103
- }
104
-
105
-
106
- //-----------------------------------------------------------------------------
107
- // dpiEnqOptions_getTransformation() [PUBLIC]
108
- // Return transformation associated with enqueue options.
109
- //-----------------------------------------------------------------------------
110
- int dpiEnqOptions_getTransformation(dpiEnqOptions *options, const char **value,
111
- uint32_t *valueLength)
112
- {
113
- return dpiEnqOptions__getAttrValue(options, DPI_OCI_ATTR_TRANSFORMATION,
114
- __func__, (void*) value, valueLength);
115
- }
116
-
117
-
118
- //-----------------------------------------------------------------------------
119
- // dpiEnqOptions_getVisibility() [PUBLIC]
120
- // Return visibility associated with enqueue options.
121
- //-----------------------------------------------------------------------------
122
- int dpiEnqOptions_getVisibility(dpiEnqOptions *options, dpiVisibility *value)
123
- {
124
- uint32_t valueLength = sizeof(uint32_t);
125
-
126
- return dpiEnqOptions__getAttrValue(options, DPI_OCI_ATTR_VISIBILITY,
127
- __func__, value, &valueLength);
128
- }
129
-
130
-
131
- //-----------------------------------------------------------------------------
132
- // dpiEnqOptions_release() [PUBLIC]
133
- // Release a reference to the enqueue options.
134
- //-----------------------------------------------------------------------------
135
- int dpiEnqOptions_release(dpiEnqOptions *options)
136
- {
137
- return dpiGen__release(options, DPI_HTYPE_ENQ_OPTIONS, __func__);
138
- }
139
-
140
-
141
- //-----------------------------------------------------------------------------
142
- // dpiEnqOptions_setDeliveryMode() [PUBLIC]
143
- // Set the delivery mode associated with enqueue options.
144
- //-----------------------------------------------------------------------------
145
- int dpiEnqOptions_setDeliveryMode(dpiEnqOptions *options,
146
- dpiMessageDeliveryMode value)
147
- {
148
- return dpiEnqOptions__setAttrValue(options, DPI_OCI_ATTR_MSG_DELIVERY_MODE,
149
- __func__, &value, 0);
150
- }
151
-
152
-
153
- //-----------------------------------------------------------------------------
154
- // dpiEnqOptions_setTransformation() [PUBLIC]
155
- // Set transformation associated with enqueue options.
156
- //-----------------------------------------------------------------------------
157
- int dpiEnqOptions_setTransformation(dpiEnqOptions *options, const char *value,
158
- uint32_t valueLength)
159
- {
160
- return dpiEnqOptions__setAttrValue(options, DPI_OCI_ATTR_TRANSFORMATION,
161
- __func__, value, valueLength);
162
- }
163
-
164
-
165
- //-----------------------------------------------------------------------------
166
- // dpiEnqOptions_setVisibility() [PUBLIC]
167
- // Set visibility associated with enqueue options.
168
- //-----------------------------------------------------------------------------
169
- int dpiEnqOptions_setVisibility(dpiEnqOptions *options, dpiVisibility value)
170
- {
171
- return dpiEnqOptions__setAttrValue(options, DPI_OCI_ATTR_VISIBILITY,
172
- __func__, &value, 0);
173
- }
174
-
package/odpi/src/dpiEnv.c DELETED
@@ -1,189 +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
- // dpiEnv.c
14
- // Implementation of environment.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // dpiEnv__free() [INTERNAL]
21
- // Free the memory associated with the environment.
22
- //-----------------------------------------------------------------------------
23
- void dpiEnv__free(dpiEnv *env, dpiError *error)
24
- {
25
- if (env->threaded)
26
- dpiMutex__destroy(env->mutex);
27
- if (env->handle) {
28
- dpiOci__handleFree(env->handle, DPI_OCI_HTYPE_ENV);
29
- env->handle = NULL;
30
- }
31
- if (env->errorHandles) {
32
- dpiHandlePool__free(env->errorHandles);
33
- env->errorHandles = NULL;
34
- error->handle = NULL;
35
- }
36
- dpiUtils__freeMemory(env);
37
- }
38
-
39
-
40
- //-----------------------------------------------------------------------------
41
- // dpiEnv__getCharacterSetIdAndName() [INTERNAL]
42
- // Retrieve and store the IANA character set name for the attribute.
43
- //-----------------------------------------------------------------------------
44
- static int dpiEnv__getCharacterSetIdAndName(dpiEnv *env, uint16_t attribute,
45
- uint16_t *charsetId, char *encoding, dpiError *error)
46
- {
47
- *charsetId = 0;
48
- dpiOci__attrGet(env->handle, DPI_OCI_HTYPE_ENV, charsetId, NULL, attribute,
49
- "get environment", error);
50
- return dpiGlobal__lookupEncoding(*charsetId, encoding, error);
51
- }
52
-
53
-
54
- //-----------------------------------------------------------------------------
55
- // dpiEnv__getEncodingInfo() [INTERNAL]
56
- // Populate the structure with the encoding info.
57
- //-----------------------------------------------------------------------------
58
- int dpiEnv__getEncodingInfo(dpiEnv *env, dpiEncodingInfo *info)
59
- {
60
- info->encoding = env->encoding;
61
- info->maxBytesPerCharacter = env->maxBytesPerCharacter;
62
- info->nencoding = env->nencoding;
63
- info->nmaxBytesPerCharacter = env->nmaxBytesPerCharacter;
64
- return DPI_SUCCESS;
65
- }
66
-
67
-
68
- //-----------------------------------------------------------------------------
69
- // dpiEnv__init() [INTERNAL]
70
- // Initialize the environment structure by creating the OCI environment and
71
- // populating information about the environment.
72
- //-----------------------------------------------------------------------------
73
- int dpiEnv__init(dpiEnv *env, const dpiContext *context,
74
- const dpiCommonCreateParams *params, dpiError *error)
75
- {
76
- char timezoneBuffer[20];
77
- size_t timezoneLength;
78
-
79
- // lookup encoding
80
- if (params->encoding && dpiGlobal__lookupCharSet(params->encoding,
81
- &env->charsetId, error) < 0)
82
- return DPI_FAILURE;
83
-
84
- // check for identical encoding before performing lookup
85
- if (params->nencoding && params->encoding &&
86
- strcmp(params->nencoding, params->encoding) == 0)
87
- env->ncharsetId = env->charsetId;
88
- else if (params->nencoding && dpiGlobal__lookupCharSet(params->nencoding,
89
- &env->ncharsetId, error) < 0)
90
- return DPI_FAILURE;
91
-
92
- // both charsetId and ncharsetId must be zero or both must be non-zero
93
- // use NLS routine to look up missing value, if needed
94
- if (env->charsetId && !env->ncharsetId) {
95
- if (dpiOci__nlsEnvironmentVariableGet(DPI_OCI_NLS_NCHARSET_ID,
96
- &env->ncharsetId, error) < 0)
97
- return DPI_FAILURE;
98
- } else if (!env->charsetId && env->ncharsetId) {
99
- if (dpiOci__nlsEnvironmentVariableGet(DPI_OCI_NLS_CHARSET_ID,
100
- &env->charsetId, error) < 0)
101
- return DPI_FAILURE;
102
- }
103
-
104
- // create the new environment handle
105
- env->context = context;
106
- env->versionInfo = context->versionInfo;
107
- if (dpiOci__envNlsCreate(&env->handle, params->createMode | DPI_OCI_OBJECT,
108
- env->charsetId, env->ncharsetId, error) < 0)
109
- return DPI_FAILURE;
110
-
111
- // create the error handle pool and acquire the first error handle
112
- if (dpiHandlePool__create(&env->errorHandles, error) < 0)
113
- return DPI_FAILURE;
114
- if (dpiEnv__initError(env, error) < 0)
115
- return DPI_FAILURE;
116
-
117
- // if threaded, create mutex for reference counts
118
- if (params->createMode & DPI_OCI_THREADED)
119
- dpiMutex__initialize(env->mutex);
120
-
121
- // determine encodings in use
122
- if (dpiEnv__getCharacterSetIdAndName(env, DPI_OCI_ATTR_CHARSET_ID,
123
- &env->charsetId, env->encoding, error) < 0)
124
- return DPI_FAILURE;
125
- if (dpiEnv__getCharacterSetIdAndName(env, DPI_OCI_ATTR_NCHARSET_ID,
126
- &env->ncharsetId, env->nencoding, error) < 0)
127
- return DPI_FAILURE;
128
-
129
- // acquire max bytes per character
130
- if (dpiOci__nlsNumericInfoGet(env->handle, &env->maxBytesPerCharacter,
131
- DPI_OCI_NLS_CHARSET_MAXBYTESZ, error) < 0)
132
- return DPI_FAILURE;
133
-
134
- // for NCHAR we have no idea of how many so we simply take the worst case
135
- // unless the charsets are identical
136
- if (env->ncharsetId == env->charsetId)
137
- env->nmaxBytesPerCharacter = env->maxBytesPerCharacter;
138
- else env->nmaxBytesPerCharacter = 4;
139
-
140
- // allocate base date descriptor (for converting to/from time_t)
141
- if (dpiOci__descriptorAlloc(env->handle, &env->baseDate,
142
- DPI_OCI_DTYPE_TIMESTAMP_LTZ, "alloc base date descriptor",
143
- error) < 0)
144
- return DPI_FAILURE;
145
-
146
- // populate base date with January 1, 1970
147
- if (dpiOci__nlsCharSetConvert(env->handle, env->charsetId, timezoneBuffer,
148
- sizeof(timezoneBuffer), DPI_CHARSET_ID_ASCII, "+00:00", 6,
149
- &timezoneLength, error) < 0)
150
- return DPI_FAILURE;
151
- if (dpiOci__dateTimeConstruct(env->handle, env->baseDate, 1970, 1, 1, 0, 0,
152
- 0, 0, timezoneBuffer, timezoneLength, error) < 0)
153
- return DPI_FAILURE;
154
-
155
- // set whether or not we are threaded
156
- if (params->createMode & DPI_MODE_CREATE_THREADED)
157
- env->threaded = 1;
158
-
159
- // set whether or not events mode has been set
160
- if (params->createMode & DPI_MODE_CREATE_EVENTS)
161
- env->events = 1;
162
-
163
- return DPI_SUCCESS;
164
- }
165
-
166
-
167
- //-----------------------------------------------------------------------------
168
- // dpiEnv__initError() [INTERNAL]
169
- // Retrieve the OCI error handle to use for error handling, from a pool of
170
- // error handles common to the environment handle. The environment that was
171
- // used to create the error handle is stored in the error structure so that
172
- // the encoding and character set can be retrieved in the event of an OCI
173
- // error (which uses the CHAR encoding of the environment).
174
- //-----------------------------------------------------------------------------
175
- int dpiEnv__initError(dpiEnv *env, dpiError *error)
176
- {
177
- error->env = env;
178
- if (dpiHandlePool__acquire(env->errorHandles, &error->handle, error) < 0)
179
- return DPI_FAILURE;
180
-
181
- if (!error->handle) {
182
- if (dpiOci__handleAlloc(env->handle, &error->handle,
183
- DPI_OCI_HTYPE_ERROR, "allocate OCI error", error) < 0)
184
- return DPI_FAILURE;
185
- }
186
-
187
- return DPI_SUCCESS;
188
- }
189
-
@@ -1,204 +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
- // dpiError.c
14
- // Implementation of error.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
- #include "dpiErrorMessages.h"
19
-
20
- //-----------------------------------------------------------------------------
21
- // dpiError__check() [INTERNAL]
22
- // Checks to see if the status of the last call resulted in an error
23
- // condition. If so, the error is populated. Note that trailing newlines and
24
- // spaces are truncated from the message if they exist. If the connection is
25
- // not NULL a check is made to see if the connection is no longer viable.
26
- //-----------------------------------------------------------------------------
27
- int dpiError__check(dpiError *error, int status, dpiConn *conn,
28
- const char *action)
29
- {
30
- uint32_t callTimeout;
31
-
32
- // no error has taken place
33
- if (status == DPI_OCI_SUCCESS || status == DPI_OCI_SUCCESS_WITH_INFO)
34
- return DPI_SUCCESS;
35
-
36
- // special error cases
37
- if (status == DPI_OCI_INVALID_HANDLE)
38
- return dpiError__set(error, action, DPI_ERR_INVALID_HANDLE, "OCI");
39
- else if (!error)
40
- return DPI_FAILURE;
41
- else if (!error->handle)
42
- return dpiError__set(error, action, DPI_ERR_ERR_NOT_INITIALIZED);
43
- else if (status != DPI_OCI_ERROR && status != DPI_OCI_NO_DATA)
44
- return dpiError__set(error, action,
45
- DPI_ERR_UNEXPECTED_OCI_RETURN_VALUE, status,
46
- error->buffer->fnName);
47
-
48
- // fetch OCI error
49
- error->buffer->action = action;
50
- strcpy(error->buffer->encoding, error->env->encoding);
51
- if (dpiOci__errorGet(error->handle, DPI_OCI_HTYPE_ERROR,
52
- error->env->charsetId, action, error) < 0)
53
- return DPI_FAILURE;
54
- if (dpiDebugLevel & DPI_DEBUG_LEVEL_ERRORS)
55
- dpiDebug__print("OCI error %.*s (%s / %s)\n",
56
- error->buffer->messageLength, error->buffer->message,
57
- error->buffer->fnName, action);
58
-
59
- // determine if error is recoverable (Transaction Guard)
60
- // if the attribute cannot be read properly, simply leave it as false;
61
- // otherwise, that error will mask the one that we really want to see
62
- error->buffer->isRecoverable = 0;
63
- dpiOci__attrGet(error->handle, DPI_OCI_HTYPE_ERROR,
64
- (void*) &error->buffer->isRecoverable, 0,
65
- DPI_OCI_ATTR_ERROR_IS_RECOVERABLE, NULL, error);
66
-
67
- // check for certain errors which indicate that the session is dead and
68
- // should be dropped from the session pool (if a session pool was used)
69
- // also check for call timeout and raise unified message instead
70
- if (conn && !conn->deadSession) {
71
- switch (error->buffer->code) {
72
- case 22: // invalid session ID; access denied
73
- case 28: // your session has been killed
74
- case 31: // your session has been marked for kill
75
- case 45: // your session has been terminated with no replay
76
- case 378: // buffer pools cannot be created as specified
77
- case 602: // internal programming exception
78
- case 603: // ORACLE server session terminated by fatal error
79
- case 609: // could not attach to incoming connection
80
- case 1012: // not logged on
81
- case 1041: // internal error. hostdef extension doesn't exist
82
- case 1043: // user side memory corruption
83
- case 1089: // immediate shutdown or close in progress
84
- case 1092: // ORACLE instance terminated. Disconnection forced
85
- case 2396: // exceeded maximum idle time, please connect again
86
- case 3113: // end-of-file on communication channel
87
- case 3114: // not connected to ORACLE
88
- case 3122: // attempt to close ORACLE-side window on user side
89
- case 3135: // connection lost contact
90
- case 12153: // TNS:not connected
91
- case 12537: // TNS:connection closed
92
- case 12547: // TNS:lost contact
93
- case 12570: // TNS:packet reader failure
94
- case 12583: // TNS:no reader
95
- case 27146: // post/wait initialization failed
96
- case 28511: // lost RPC connection
97
- case 56600: // an illegal OCI function call was issued
98
- conn->deadSession = 1;
99
- break;
100
- case 3136: // inbound connection timed out
101
- case 12161: // TNS:internal error: partial data received
102
- callTimeout = 0;
103
- if (conn->env->versionInfo->versionNum >= 18)
104
- dpiOci__attrGet(conn->handle, DPI_OCI_HTYPE_SVCCTX,
105
- (void*) &callTimeout, 0, DPI_OCI_ATTR_CALL_TIMEOUT,
106
- NULL, error);
107
- if (callTimeout > 0) {
108
- dpiError__set(error, action, DPI_ERR_CALL_TIMEOUT,
109
- callTimeout, error->buffer->code);
110
- error->buffer->code = 0;
111
- }
112
- break;
113
- }
114
- }
115
-
116
- return DPI_FAILURE;
117
- }
118
-
119
-
120
- //-----------------------------------------------------------------------------
121
- // dpiError__getInfo() [INTERNAL]
122
- // Get the error state from the error structure. Returns DPI_FAILURE as a
123
- // convenience to the caller.
124
- //-----------------------------------------------------------------------------
125
- int dpiError__getInfo(dpiError *error, dpiErrorInfo *info)
126
- {
127
- if (!info)
128
- return DPI_FAILURE;
129
- info->code = error->buffer->code;
130
- info->offset = error->buffer->offset;
131
- info->message = error->buffer->message;
132
- info->messageLength = error->buffer->messageLength;
133
- info->fnName = error->buffer->fnName;
134
- info->action = error->buffer->action;
135
- info->isRecoverable = error->buffer->isRecoverable;
136
- info->encoding = error->buffer->encoding;
137
- switch(info->code) {
138
- case 12154: // TNS:could not resolve the connect identifier specified
139
- info->sqlState = "42S02";
140
- break;
141
- case 22: // invalid session ID; access denied
142
- case 378: // buffer pools cannot be created as specified
143
- case 602: // Internal programming exception
144
- case 603: // ORACLE server session terminated by fatal error
145
- case 604: // error occurred at recursive SQL level
146
- case 609: // could not attach to incoming connection
147
- case 1012: // not logged on
148
- case 1033: // ORACLE initialization or shutdown in progress
149
- case 1041: // internal error. hostdef extension doesn't exist
150
- case 1043: // user side memory corruption
151
- case 1089: // immediate shutdown or close in progress
152
- case 1090: // shutdown in progress
153
- case 1092: // ORACLE instance terminated. Disconnection forced
154
- case 3113: // end-of-file on communication channel
155
- case 3114: // not connected to ORACLE
156
- case 3122: // attempt to close ORACLE-side window on user side
157
- case 3135: // connection lost contact
158
- case 12153: // TNS:not connected
159
- case 27146: // post/wait initialization failed
160
- case 28511: // lost RPC connection to heterogeneous remote agent
161
- info->sqlState = "01002";
162
- break;
163
- default:
164
- if (error->buffer->code == 0 &&
165
- error->buffer->errorNum == (dpiErrorNum) 0)
166
- info->sqlState = "00000";
167
- else info->sqlState = "HY000";
168
- break;
169
- }
170
- return DPI_FAILURE;
171
- }
172
-
173
-
174
- //-----------------------------------------------------------------------------
175
- // dpiError__set() [INTERNAL]
176
- // Set the error buffer to the specified DPI error. Returns DPI_FAILURE as a
177
- // convenience to the caller.
178
- //-----------------------------------------------------------------------------
179
- int dpiError__set(dpiError *error, const char *action, dpiErrorNum errorNum,
180
- ...)
181
- {
182
- va_list varArgs;
183
-
184
- if (error) {
185
- error->buffer->code = 0;
186
- error->buffer->isRecoverable = 0;
187
- error->buffer->offset = 0;
188
- strcpy(error->buffer->encoding, DPI_CHARSET_NAME_UTF8);
189
- error->buffer->action = action;
190
- error->buffer->errorNum = errorNum;
191
- va_start(varArgs, errorNum);
192
- error->buffer->messageLength =
193
- (uint32_t) vsnprintf(error->buffer->message,
194
- sizeof(error->buffer->message),
195
- dpiErrorMessages[errorNum - DPI_ERR_NO_ERR], varArgs);
196
- va_end(varArgs);
197
- if (dpiDebugLevel & DPI_DEBUG_LEVEL_ERRORS)
198
- dpiDebug__print("internal error %.*s (%s / %s)\n",
199
- error->buffer->messageLength, error->buffer->message,
200
- error->buffer->fnName, action);
201
- }
202
- return DPI_FAILURE;
203
- }
204
-
@@ -1,86 +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
- // dpiErrorMessages.h
14
- // Definition of error messages used in ODPI-C.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- static const char* const dpiErrorMessages[DPI_ERR_MAX - DPI_ERR_NO_ERR] = {
20
- "DPI-1000: no error", // DPI_ERR_NO_ERR
21
- "DPI-1001: out of memory", // DPI_ERR_NO_MEMORY
22
- "DPI-1002: invalid %s handle", // DPI_ERR_INVALID_HANDLE
23
- "DPI-1003: OCI error handle is not initialized", // DPI_ERR_ERR_NOT_INITIALIZED
24
- "DPI-1004: unable to get error message", // DPI_ERR_GET_FAILED
25
- "DPI-1005: unable to acquire Oracle environment handle", // DPI_ERR_CREATE_ENV
26
- "DPI-1006: unable to convert text to session character set", // DPI_ERR_CONVERT_TEXT
27
- "DPI-1007: no query has been executed", // DPI_ERR_QUERY_NOT_EXECUTED
28
- "DPI-1008: data type %d is not supported", // DPI_ERR_UNHANDLED_DATA_TYPE
29
- "DPI-1009: zero-based position %u is not valid with max array size of %u", // DPI_ERR_INVALID_ARRAY_POSITION
30
- "DPI-1010: not connected", // DPI_ERR_NOT_CONNECTED
31
- "DPI-1011: connection was not acquired from a session pool", // DPI_ERR_CONN_NOT_IN_POOL
32
- "DPI-1012: proxy authentication is not possible with homogeneous pools", // DPI_ERR_INVALID_PROXY
33
- "DPI-1013: not supported", // DPI_ERR_NOT_SUPPORTED
34
- "DPI-1014: conversion between Oracle type %d and native type %d is not implemented", // DPI_ERR_UNHANDLED_CONVERSION
35
- "DPI-1015: array size of %u is too large", // DPI_ERR_ARRAY_SIZE_TOO_BIG
36
- "DPI-1016: invalid date", // DPI_ERR_INVALID_DATE
37
- "DPI-1017: value is null", // DPI_ERR_VALUE_IS_NULL
38
- "DPI-1018: array size of %u is too small", // DPI_ERR_ARRAY_SIZE_TOO_SMALL
39
- "DPI-1019: buffer size of %u is too small", // DPI_ERR_BUFFER_SIZE_TOO_SMALL
40
- "DPI-1020: version %d.%d is not supported by ODPI-C library version %d.%d", // DPI_ERR_VERSION_NOT_SUPPORTED
41
- "DPI-1021: Oracle type %u is invalid", // DPI_ERR_INVALID_ORACLE_TYPE
42
- "DPI-1022: attribute %.*s is not part of object type %.*s.%.*s", // DPI_ERR_WRONG_ATTR
43
- "DPI-1023: object %.*s.%.*s is not a collection", // DPI_ERR_NOT_COLLECTION
44
- "DPI-1024: element at index %d does not exist", // DPI_ERR_INVALID_INDEX
45
- "DPI-1025: no object type specified for object variable", // DPI_ERR_NO_OBJECT_TYPE
46
- "DPI-1026: invalid character set %s", // DPI_ERR_INVALID_CHARSET
47
- "DPI-1027: scroll operation would go out of the result set", // DPI_ERR_SCROLL_OUT_OF_RS
48
- "DPI-1028: query position %u is invalid", // DPI_ERR_QUERY_POSITION_INVALID
49
- "DPI-1029: no row currently fetched", // DPI_ERR_NO_ROW_FETCHED
50
- "DPI-1030: unable to get or set error structure for thread local storage", // DPI_ERR_TLS_ERROR
51
- "DPI-1031: array size cannot be zero", // DPI_ERR_ARRAY_SIZE_ZERO
52
- "DPI-1032: user name and password cannot be set when using external authentication", // DPI_ERR_EXT_AUTH_WITH_CREDENTIALS
53
- "DPI-1033: unable to get row offset", // DPI_ERR_CANNOT_GET_ROW_OFFSET
54
- "DPI-1034: connection created from external handle cannot be closed", // DPI_ERR_CONN_IS_EXTERNAL
55
- "DPI-1035: size of the transaction ID is %u and cannot exceed %u", // DPI_ERR_TRANS_ID_TOO_LARGE
56
- "DPI-1036: size of the branch ID is %u and cannot exceed %u", // DPI_ERR_BRANCH_ID_TOO_LARGE
57
- "DPI-1037: column at array position %u fetched with error %u", // DPI_ERR_COLUMN_FETCH
58
- "DPI-1039: statement was already closed", // DPI_ERR_STMT_CLOSED
59
- "DPI-1040: LOB was already closed", // DPI_ERR_LOB_CLOSED
60
- "DPI-1041: invalid character set id %d", // DPI_ERR_INVALID_CHARSET_ID
61
- "DPI-1042: invalid OCI number", // DPI_ERR_INVALID_OCI_NUMBER
62
- "DPI-1043: invalid number", // DPI_ERR_INVALID_NUMBER
63
- "DPI-1044: number too large", // DPI_ERR_NUMBER_TOO_LARGE
64
- "DPI-1045: strings converted to numbers can only be up to 172 characters long", // DPI_ERR_NUMBER_STRING_TOO_LONG
65
- "DPI-1046: parameter %s cannot be a NULL pointer", // DPI_ERR_NULL_POINTER_PARAMETER
66
- "DPI-1047: %s-bit Oracle Client library cannot be loaded: \"%s\". See https://oracle.github.io/odpi/doc/installation.html#%s for help", // DPI_ERR_LOAD_LIBRARY
67
- "DPI-1049: symbol %s not found in OCI library", // DPI_ERR_LOAD_SYMBOL
68
- "DPI-1050: Oracle Client library is at version %d.%d but must be at version %d.%d or higher", // DPI_ERR_ORACLE_CLIENT_TOO_OLD
69
- "DPI-1052: unable to get NLS environment variable", // DPI_ERR_NLS_ENV_VAR_GET,
70
- "DPI-1053: parameter %s cannot be a NULL pointer while corresponding length parameter is non-zero", // DPI_ERR_PTR_LENGTH_MISMATCH
71
- "DPI-1055: value is not a number (NaN) and cannot be used in Oracle numbers", // DPI_ERR_NAN
72
- "DPI-1056: found object of type %.*s.%.*s when expecting object of type %.*s.%.*s", // DPI_ERR_WRONG_TYPE
73
- "DPI-1057: buffer size of %u is too large (max %u)", // DPI_ERR_BUFFER_SIZE_TOO_LARGE
74
- "DPI-1058: edition not supported with connection class", // DPI_ERR_NO_EDITION_WITH_CONN_CLASS
75
- "DPI-1059: bind variables are not supported in DDL statements", // DPI_ERR_NO_BIND_VARS_IN_DDL
76
- "DPI-1060: subscription was already closed", // DPI_ERR_SUBSCR_CLOSED
77
- "DPI-1061: edition is not supported when a new password is specified", // DPI_ERR_NO_EDITION_WITH_NEW_PASSWORD
78
- "DPI-1062: unexpected OCI return value %d in function %s", // DPI_ERR_UNEXPECTED_OCI_RETURN_VALUE
79
- "DPI-1063: modes DPI_MODE_EXEC_BATCH_ERRORS and DPI_MODE_EXEC_ARRAY_DML_ROWCOUNTS can only be used with insert, update, delete and merge statements", // DPI_ERR_EXEC_MODE_ONLY_FOR_DML
80
- "DPI-1064: array variables are not supported with dpiStmt_executeMany()", // DPI_ERR_ARRAY_VAR_NOT_SUPPORTED
81
- "DPI-1065: events mode is required to subscribe to events in the database", // DPI_ERR_EVENTS_MODE_REQUIRED
82
- "DPI-1066: Oracle Database is at version %d.%d but must be at version %d.%d or higher", // DPI_ERR_ORACLE_DB_TOO_OLD
83
- "DPI-1067: call timeout of %u ms exceeded with ORA-%d", // DPI_ERR_CALL_TIMEOUT
84
- "DPI-1068: SODA cursor was already closed", // DPI_ERR_SODA_CURSOR_CLOSED
85
- };
86
-