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,492 +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
- // dpiOracleType.c
14
- // Implementation of variable types.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // definition of Oracle types (MUST be in same order as enumeration)
21
- //-----------------------------------------------------------------------------
22
- static const dpiOracleType
23
- dpiAllOracleTypes[DPI_ORACLE_TYPE_MAX - DPI_ORACLE_TYPE_NONE - 1] = {
24
- {
25
- DPI_ORACLE_TYPE_VARCHAR, // public Oracle type
26
- DPI_NATIVE_TYPE_BYTES, // default native type
27
- DPI_SQLT_CHR, // internal Oracle type
28
- DPI_SQLCS_IMPLICIT, // charset form
29
- 0, // buffer size
30
- 1, // is character data
31
- 1, // can be in array
32
- 0 // requires pre-fetch
33
- },
34
- {
35
- DPI_ORACLE_TYPE_NVARCHAR, // public Oracle type
36
- DPI_NATIVE_TYPE_BYTES, // default native type
37
- DPI_SQLT_CHR, // internal Oracle type
38
- DPI_SQLCS_NCHAR, // charset form
39
- 0, // buffer size
40
- 1, // is character data
41
- 1, // can be in array
42
- 0 // requires pre-fetch
43
- },
44
- {
45
- DPI_ORACLE_TYPE_CHAR, // public Oracle type
46
- DPI_NATIVE_TYPE_BYTES, // default native type
47
- DPI_SQLT_AFC, // internal Oracle type
48
- DPI_SQLCS_IMPLICIT, // charset form
49
- 0, // buffer size
50
- 1, // is character data
51
- 1, // can be in array
52
- 0 // requires pre-fetch
53
- },
54
- {
55
- DPI_ORACLE_TYPE_NCHAR, // public Oracle type
56
- DPI_NATIVE_TYPE_BYTES, // default native type
57
- DPI_SQLT_AFC, // internal Oracle type
58
- DPI_SQLCS_NCHAR, // charset form
59
- 0, // buffer size
60
- 1, // is character data
61
- 1, // can be in array
62
- 0 // requires pre-fetch
63
- },
64
- {
65
- DPI_ORACLE_TYPE_ROWID, // public Oracle type
66
- DPI_NATIVE_TYPE_ROWID, // default native type
67
- DPI_SQLT_RDD, // internal Oracle type
68
- DPI_SQLCS_IMPLICIT, // charset form
69
- sizeof(void*), // buffer size
70
- 1, // is character data
71
- 1, // can be in array
72
- 1 // requires pre-fetch
73
- },
74
- {
75
- DPI_ORACLE_TYPE_RAW, // public Oracle type
76
- DPI_NATIVE_TYPE_BYTES, // default native type
77
- DPI_SQLT_BIN, // internal Oracle type
78
- DPI_SQLCS_IMPLICIT, // charset form
79
- 0, // buffer size
80
- 0, // is character data
81
- 1, // can be in array
82
- 0 // requires pre-fetch
83
- },
84
- {
85
- DPI_ORACLE_TYPE_NATIVE_FLOAT, // public Oracle type
86
- DPI_NATIVE_TYPE_FLOAT, // default native type
87
- DPI_SQLT_BFLOAT, // internal Oracle type
88
- DPI_SQLCS_IMPLICIT, // charset form
89
- sizeof(float), // buffer size
90
- 0, // is character data
91
- 1, // can be in array
92
- 0 // requires pre-fetch
93
- },
94
- {
95
- DPI_ORACLE_TYPE_NATIVE_DOUBLE, // public Oracle type
96
- DPI_NATIVE_TYPE_DOUBLE, // default native type
97
- DPI_SQLT_BDOUBLE, // internal Oracle type
98
- DPI_SQLCS_IMPLICIT, // charset form
99
- sizeof(double), // buffer size
100
- 0, // is character data
101
- 1, // can be in array
102
- 0 // requires pre-fetch
103
- },
104
- {
105
- DPI_ORACLE_TYPE_NATIVE_INT, // public Oracle type
106
- DPI_NATIVE_TYPE_INT64, // default native type
107
- DPI_SQLT_INT, // internal Oracle type
108
- DPI_SQLCS_IMPLICIT, // charset form
109
- sizeof(int64_t), // buffer size
110
- 0, // is character data
111
- 1, // can be in array
112
- 0 // requires pre-fetch
113
- },
114
- {
115
- DPI_ORACLE_TYPE_NUMBER, // public Oracle type
116
- DPI_NATIVE_TYPE_DOUBLE, // default native type
117
- DPI_SQLT_VNU, // internal Oracle type
118
- DPI_SQLCS_IMPLICIT, // charset form
119
- DPI_OCI_NUMBER_SIZE, // buffer size
120
- 0, // is character data
121
- 1, // can be in array
122
- 0 // requires pre-fetch
123
- },
124
- {
125
- DPI_ORACLE_TYPE_DATE, // public Oracle type
126
- DPI_NATIVE_TYPE_TIMESTAMP, // default native type
127
- DPI_SQLT_ODT, // internal Oracle type
128
- DPI_SQLCS_IMPLICIT, // charset form
129
- sizeof(dpiOciDate), // buffer size
130
- 0, // is character data
131
- 1, // can be in array
132
- 0 // requires pre-fetch
133
- },
134
- {
135
- DPI_ORACLE_TYPE_TIMESTAMP, // public Oracle type
136
- DPI_NATIVE_TYPE_TIMESTAMP, // default native type
137
- DPI_SQLT_TIMESTAMP, // internal Oracle type
138
- DPI_SQLCS_IMPLICIT, // charset form
139
- sizeof(void*), // buffer size
140
- 0, // is character data
141
- 1, // can be in array
142
- 0 // requires pre-fetch
143
- },
144
- {
145
- DPI_ORACLE_TYPE_TIMESTAMP_TZ, // public Oracle type
146
- DPI_NATIVE_TYPE_TIMESTAMP, // default native type
147
- DPI_SQLT_TIMESTAMP_TZ, // internal Oracle type
148
- DPI_SQLCS_IMPLICIT, // charset form
149
- sizeof(void*), // buffer size
150
- 0, // is character data
151
- 1, // can be in array
152
- 0 // requires pre-fetch
153
- },
154
- {
155
- DPI_ORACLE_TYPE_TIMESTAMP_LTZ, // public Oracle type
156
- DPI_NATIVE_TYPE_TIMESTAMP, // default native type
157
- DPI_SQLT_TIMESTAMP_LTZ, // internal Oracle type
158
- DPI_SQLCS_IMPLICIT, // charset form
159
- sizeof(void*), // buffer size
160
- 0, // is character data
161
- 1, // can be in array
162
- 0 // requires pre-fetch
163
- },
164
- {
165
- DPI_ORACLE_TYPE_INTERVAL_DS, // public Oracle type
166
- DPI_NATIVE_TYPE_INTERVAL_DS, // default native type
167
- DPI_SQLT_INTERVAL_DS, // internal Oracle type
168
- DPI_SQLCS_IMPLICIT, // charset form
169
- sizeof(void*), // buffer size
170
- 0, // is character data
171
- 1, // can be in array
172
- 0 // requires pre-fetch
173
- },
174
- {
175
- DPI_ORACLE_TYPE_INTERVAL_YM, // public Oracle type
176
- DPI_NATIVE_TYPE_INTERVAL_YM, // default native type
177
- DPI_SQLT_INTERVAL_YM, // internal Oracle type
178
- DPI_SQLCS_IMPLICIT, // charset form
179
- sizeof(void*), // buffer size
180
- 0, // is character data
181
- 1, // can be in array
182
- 0 // requires pre-fetch
183
- },
184
- {
185
- DPI_ORACLE_TYPE_CLOB, // public Oracle type
186
- DPI_NATIVE_TYPE_LOB, // default native type
187
- DPI_SQLT_CLOB, // internal Oracle type
188
- DPI_SQLCS_IMPLICIT, // charset form
189
- sizeof(void*), // buffer size
190
- 1, // is character data
191
- 0, // can be in array
192
- 1 // requires pre-fetch
193
- },
194
- {
195
- DPI_ORACLE_TYPE_NCLOB, // public Oracle type
196
- DPI_NATIVE_TYPE_LOB, // default native type
197
- DPI_SQLT_CLOB, // internal Oracle type
198
- DPI_SQLCS_NCHAR, // charset form
199
- sizeof(void*), // buffer size
200
- 1, // is character data
201
- 0, // can be in array
202
- 1 // requires pre-fetch
203
- },
204
- {
205
- DPI_ORACLE_TYPE_BLOB, // public Oracle type
206
- DPI_NATIVE_TYPE_LOB, // default native type
207
- DPI_SQLT_BLOB, // internal Oracle type
208
- DPI_SQLCS_IMPLICIT, // charset form
209
- sizeof(void*), // buffer size
210
- 0, // is character data
211
- 0, // can be in array
212
- 1 // requires pre-fetch
213
- },
214
- {
215
- DPI_ORACLE_TYPE_BFILE, // public Oracle type
216
- DPI_NATIVE_TYPE_LOB, // default native type
217
- DPI_SQLT_BFILE, // internal Oracle type
218
- DPI_SQLCS_IMPLICIT, // charset form
219
- sizeof(void*), // buffer size
220
- 0, // is character data
221
- 0, // can be in array
222
- 1 // requires pre-fetch
223
- },
224
- {
225
- DPI_ORACLE_TYPE_STMT, // public Oracle type
226
- DPI_NATIVE_TYPE_STMT, // default native type
227
- DPI_SQLT_RSET, // internal Oracle type
228
- DPI_SQLCS_IMPLICIT, // charset form
229
- sizeof(void*), // buffer size
230
- 0, // is character data
231
- 0, // can be in array
232
- 1 // requires pre-fetch
233
- },
234
- {
235
- DPI_ORACLE_TYPE_BOOLEAN, // public Oracle type
236
- DPI_NATIVE_TYPE_BOOLEAN, // default native type
237
- DPI_SQLT_BOL, // internal Oracle type
238
- DPI_SQLCS_IMPLICIT, // charset form
239
- sizeof(int), // buffer size
240
- 0, // is character data
241
- 0, // can be in array
242
- 0 // requires pre-fetch
243
- },
244
- {
245
- DPI_ORACLE_TYPE_OBJECT, // public Oracle type
246
- DPI_NATIVE_TYPE_OBJECT, // default native type
247
- DPI_SQLT_NTY, // internal Oracle type
248
- DPI_SQLCS_IMPLICIT, // charset form
249
- sizeof(void*), // buffer size
250
- 0, // is character data
251
- 0, // can be in array
252
- 1 // requires pre-fetch
253
- },
254
- {
255
- DPI_ORACLE_TYPE_LONG_VARCHAR, // public Oracle type
256
- DPI_NATIVE_TYPE_BYTES, // default native type
257
- DPI_SQLT_CHR, // internal Oracle type
258
- DPI_SQLCS_IMPLICIT, // charset form
259
- DPI_MAX_BASIC_BUFFER_SIZE + 1, // buffer size
260
- 1, // is character data
261
- 0, // can be in array
262
- 0 // requires pre-fetch
263
- },
264
- {
265
- DPI_ORACLE_TYPE_LONG_RAW, // public Oracle type
266
- DPI_NATIVE_TYPE_BYTES, // default native type
267
- DPI_SQLT_BIN, // internal Oracle type
268
- DPI_SQLCS_IMPLICIT, // charset form
269
- DPI_MAX_BASIC_BUFFER_SIZE + 1, // buffer size
270
- 0, // is character data
271
- 0, // can be in array
272
- 0 // requires pre-fetch
273
- },
274
- {
275
- DPI_ORACLE_TYPE_NATIVE_UINT, // public Oracle type
276
- DPI_NATIVE_TYPE_UINT64, // default native type
277
- DPI_SQLT_UIN, // internal Oracle type
278
- DPI_SQLCS_IMPLICIT, // charset form
279
- sizeof(uint64_t), // buffer size
280
- 0, // is character data
281
- 1, // can be in array
282
- 0 // requires pre-fetch
283
- }
284
- };
285
-
286
-
287
- //-----------------------------------------------------------------------------
288
- // dpiOracleType__convertFromOracle() [INTERNAL]
289
- // Return a value from the dpiOracleTypeNum enumeration for the OCI data type
290
- // and charset form. If the OCI data type is not supported, 0 is returned.
291
- //-----------------------------------------------------------------------------
292
- static dpiOracleTypeNum dpiOracleType__convertFromOracle(uint16_t typeCode,
293
- uint8_t charsetForm)
294
- {
295
- switch(typeCode) {
296
- case DPI_SQLT_CHR:
297
- case DPI_SQLT_VCS:
298
- if (charsetForm == DPI_SQLCS_NCHAR)
299
- return DPI_ORACLE_TYPE_NVARCHAR;
300
- return DPI_ORACLE_TYPE_VARCHAR;
301
- case DPI_SQLT_FLT:
302
- case DPI_SQLT_NUM:
303
- case DPI_SQLT_PDN:
304
- case DPI_SQLT_VNU:
305
- case DPI_SQLT_BFLOAT:
306
- case DPI_SQLT_BDOUBLE:
307
- return DPI_ORACLE_TYPE_NUMBER;
308
- case DPI_SQLT_DAT:
309
- case DPI_SQLT_ODT:
310
- return DPI_ORACLE_TYPE_DATE;
311
- case DPI_SQLT_BIN:
312
- return DPI_ORACLE_TYPE_RAW;
313
- case DPI_SQLT_AFC:
314
- if (charsetForm == DPI_SQLCS_NCHAR)
315
- return DPI_ORACLE_TYPE_NCHAR;
316
- return DPI_ORACLE_TYPE_CHAR;
317
- case DPI_SQLT_INT:
318
- case DPI_OCI_TYPECODE_SMALLINT:
319
- return DPI_ORACLE_TYPE_NATIVE_INT;
320
- case DPI_SQLT_IBFLOAT:
321
- return DPI_ORACLE_TYPE_NATIVE_FLOAT;
322
- case DPI_SQLT_IBDOUBLE:
323
- return DPI_ORACLE_TYPE_NATIVE_DOUBLE;
324
- case DPI_SQLT_DATE:
325
- case DPI_SQLT_TIMESTAMP:
326
- return DPI_ORACLE_TYPE_TIMESTAMP;
327
- case DPI_SQLT_TIMESTAMP_TZ:
328
- return DPI_ORACLE_TYPE_TIMESTAMP_TZ;
329
- case DPI_SQLT_TIMESTAMP_LTZ:
330
- return DPI_ORACLE_TYPE_TIMESTAMP_LTZ;
331
- case DPI_SQLT_NTY:
332
- case DPI_SQLT_REC:
333
- case DPI_SQLT_NCO:
334
- return DPI_ORACLE_TYPE_OBJECT;
335
- case DPI_SQLT_BOL:
336
- return DPI_ORACLE_TYPE_BOOLEAN;
337
- case DPI_SQLT_CLOB:
338
- if (charsetForm == DPI_SQLCS_NCHAR)
339
- return DPI_ORACLE_TYPE_NCLOB;
340
- return DPI_ORACLE_TYPE_CLOB;
341
- case DPI_SQLT_BLOB:
342
- return DPI_ORACLE_TYPE_BLOB;
343
- case DPI_SQLT_BFILE:
344
- return DPI_ORACLE_TYPE_BFILE;
345
- case DPI_SQLT_RDD:
346
- return DPI_ORACLE_TYPE_ROWID;
347
- case DPI_SQLT_RSET:
348
- return DPI_ORACLE_TYPE_STMT;
349
- case DPI_SQLT_INTERVAL_DS:
350
- return DPI_ORACLE_TYPE_INTERVAL_DS;
351
- case DPI_SQLT_INTERVAL_YM:
352
- return DPI_ORACLE_TYPE_INTERVAL_YM;
353
- case DPI_SQLT_LNG:
354
- return DPI_ORACLE_TYPE_LONG_VARCHAR;
355
- case DPI_SQLT_LBI:
356
- return DPI_ORACLE_TYPE_LONG_RAW;
357
- }
358
- return (dpiOracleTypeNum) 0;
359
- }
360
-
361
-
362
- //-----------------------------------------------------------------------------
363
- // dpiOracleType__getFromNum() [INTERNAL]
364
- // Return the type associated with the type number.
365
- //-----------------------------------------------------------------------------
366
- const dpiOracleType *dpiOracleType__getFromNum(dpiOracleTypeNum typeNum,
367
- dpiError *error)
368
- {
369
- if (typeNum > DPI_ORACLE_TYPE_NONE && typeNum < DPI_ORACLE_TYPE_MAX)
370
- return &dpiAllOracleTypes[typeNum - DPI_ORACLE_TYPE_NONE - 1];
371
- dpiError__set(error, "check type", DPI_ERR_INVALID_ORACLE_TYPE, typeNum);
372
- return NULL;
373
- }
374
-
375
-
376
- //-----------------------------------------------------------------------------
377
- // dpiOracleType__populateTypeInfo() [INTERNAL]
378
- // Populate dpiDataTypeInfo structure given an Oracle descriptor. Note that
379
- // no error is raised by this function if the data type is not supported. This
380
- // method is called for both implicit and explicit describes (which behave
381
- // slightly differently).
382
- //-----------------------------------------------------------------------------
383
- int dpiOracleType__populateTypeInfo(dpiConn *conn, void *handle,
384
- uint32_t handleType, dpiDataTypeInfo *info, dpiError *error)
385
- {
386
- const dpiOracleType *oracleType = NULL;
387
- dpiNativeTypeNum nativeTypeNum;
388
- uint32_t dataTypeAttribute;
389
- uint8_t charsetForm;
390
- uint16_t ociSize;
391
-
392
- // acquire data type
393
- if (handleType == DPI_OCI_DTYPE_PARAM)
394
- dataTypeAttribute = DPI_OCI_ATTR_TYPECODE;
395
- else dataTypeAttribute = DPI_OCI_ATTR_DATA_TYPE;
396
- if (dpiOci__attrGet(handle, handleType, (void*) &info->ociTypeCode, 0,
397
- dataTypeAttribute, "get data type", error) < 0)
398
- return DPI_FAILURE;
399
-
400
- // acquire character set form
401
- if (info->ociTypeCode != DPI_SQLT_CHR &&
402
- info->ociTypeCode != DPI_SQLT_AFC &&
403
- info->ociTypeCode != DPI_SQLT_VCS &&
404
- info->ociTypeCode != DPI_SQLT_CLOB)
405
- charsetForm = DPI_SQLCS_IMPLICIT;
406
- else if (dpiOci__attrGet(handle, handleType, (void*) &charsetForm, 0,
407
- DPI_OCI_ATTR_CHARSET_FORM, "get charset form", error) < 0)
408
- return DPI_FAILURE;
409
-
410
- // convert Oracle type to ODPI-C enumerations, if possible
411
- info->oracleTypeNum = dpiOracleType__convertFromOracle(info->ociTypeCode,
412
- charsetForm);
413
- if (!info->oracleTypeNum)
414
- info->defaultNativeTypeNum = (dpiNativeTypeNum) 0;
415
- else {
416
- oracleType = dpiOracleType__getFromNum(info->oracleTypeNum, error);
417
- if (!oracleType)
418
- return DPI_FAILURE;
419
- info->defaultNativeTypeNum = oracleType->defaultNativeTypeNum;
420
- }
421
-
422
- // determine precision/scale
423
- nativeTypeNum = info->defaultNativeTypeNum;
424
- switch (nativeTypeNum) {
425
- case DPI_NATIVE_TYPE_DOUBLE:
426
- case DPI_NATIVE_TYPE_FLOAT:
427
- case DPI_NATIVE_TYPE_INT64:
428
- case DPI_NATIVE_TYPE_TIMESTAMP:
429
- case DPI_NATIVE_TYPE_INTERVAL_YM:
430
- case DPI_NATIVE_TYPE_INTERVAL_DS:
431
- if (dpiOci__attrGet(handle, handleType, (void*) &info->scale, 0,
432
- DPI_OCI_ATTR_SCALE, "get scale", error) < 0)
433
- return DPI_FAILURE;
434
- if (dpiOci__attrGet(handle, handleType, (void*) &info->precision,
435
- 0, DPI_OCI_ATTR_PRECISION, "get precision", error) < 0)
436
- return DPI_FAILURE;
437
- if (nativeTypeNum == DPI_NATIVE_TYPE_TIMESTAMP ||
438
- nativeTypeNum == DPI_NATIVE_TYPE_INTERVAL_DS) {
439
- info->fsPrecision = (uint8_t) info->scale;
440
- info->scale = 0;
441
- }
442
- break;
443
- default:
444
- info->precision = 0;
445
- info->fsPrecision = 0;
446
- info->scale = 0;
447
- break;
448
- }
449
-
450
- // change default type to integer if precision/scale supports it
451
- if (info->oracleTypeNum == DPI_ORACLE_TYPE_NUMBER && info->scale == 0 &&
452
- info->precision > 0 && info->precision <= DPI_MAX_INT64_PRECISION)
453
- info->defaultNativeTypeNum = DPI_NATIVE_TYPE_INT64;
454
-
455
- // acquire size (in bytes) of item
456
- info->sizeInChars = 0;
457
- if (oracleType && oracleType->sizeInBytes == 0) {
458
- if (dpiOci__attrGet(handle, handleType, (void*) &ociSize, 0,
459
- DPI_OCI_ATTR_DATA_SIZE, "get size (bytes)", error) < 0)
460
- return DPI_FAILURE;
461
- info->dbSizeInBytes = ociSize;
462
- info->clientSizeInBytes = ociSize;
463
- } else {
464
- info->dbSizeInBytes = 0;
465
- info->clientSizeInBytes = 0;
466
- }
467
-
468
- // acquire size (in characters) of item, if applicable
469
- if (oracleType && oracleType->isCharacterData &&
470
- oracleType->sizeInBytes == 0) {
471
- if (dpiOci__attrGet(handle, handleType, (void*) &ociSize, 0,
472
- DPI_OCI_ATTR_CHAR_SIZE, "get size (chars)", error) < 0)
473
- return DPI_FAILURE;
474
- info->sizeInChars = ociSize;
475
- if (charsetForm == DPI_SQLCS_NCHAR)
476
- info->clientSizeInBytes = info->sizeInChars *
477
- conn->env->nmaxBytesPerCharacter;
478
- else if (conn->charsetId != conn->env->charsetId)
479
- info->clientSizeInBytes = info->sizeInChars *
480
- conn->env->maxBytesPerCharacter;
481
- }
482
-
483
- // acquire object type, if applicable
484
- if (info->oracleTypeNum == DPI_ORACLE_TYPE_OBJECT) {
485
- if (dpiObjectType__allocate(conn, handle, DPI_OCI_ATTR_TYPE_NAME,
486
- &info->objectType, error) < 0)
487
- return DPI_FAILURE;
488
- }
489
-
490
- return DPI_SUCCESS;
491
- }
492
-