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,94 +0,0 @@
1
- /* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /*****************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * This file uses NAN:
19
- *
20
- * Copyright (c) 2015 NAN contributors
21
- *
22
- * NAN contributors listed at https://github.com/rvagg/nan#contributors
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining
25
- * a copy of this software and associated documentation files (the
26
- * "Software"), to deal in the Software without restriction, including
27
- * without limitation the rights to use, copy, modify, merge, publish,
28
- * distribute, sublicense, and/or sell copies of the Software, and to
29
- * permit persons to whom the Software is furnished to do so, subject to
30
- * the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be
33
- * included in all copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
39
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
40
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
41
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
- *
43
- * NAME
44
- * njsSodaDocCurosr.h
45
- *
46
- * DESCRIPTION
47
- * SODA document cursor class
48
- *
49
- *****************************************************************************/
50
-
51
- #ifndef __NJSSODADOCCURSOR_H__
52
- #define __NJSSODADOCCURSOR_H__
53
-
54
- #include "njsCommon.h"
55
-
56
- class njsSodaDocCursor : public njsCommon {
57
- public:
58
- static void Init (Local<Object> target);
59
- static Local<Object> CreateFromBaton (njsBaton *baton);
60
-
61
- private:
62
- static NAN_METHOD(New);
63
-
64
- static NAN_METHOD(GetNext);
65
- static void Async_GetNext(njsBaton *baton);
66
- static void Async_AfterGetNext(njsBaton *baton, Local<Value> argv[]);
67
-
68
- static NAN_METHOD(Close);
69
- static void Async_Close(njsBaton *baton);
70
-
71
- bool IsValid() const { return (dpiSodaDocCursorHandle) ? true : false; }
72
-
73
- njsErrorType GetInvalidErrorType() const
74
- { return errInvalidSodaDocCursor; }
75
-
76
- // constructor
77
- njsSodaDocCursor() : dpiSodaDocCursorHandle(NULL) { }
78
-
79
- // destructor
80
- ~njsSodaDocCursor() {
81
- if (dpiSodaDocCursorHandle) {
82
- dpiSodaDocCursor_release(dpiSodaDocCursorHandle);
83
- dpiSodaDocCursorHandle = NULL;
84
- }
85
- jsOracledb.Reset();
86
- }
87
-
88
- dpiSodaDocCursor *dpiSodaDocCursorHandle;
89
- Nan::Persistent<Object> jsOracledb;
90
-
91
- static Nan::Persistent<FunctionTemplate> sodaDocCursorTemplate_s;
92
- };
93
-
94
- #endif // __NJSSODADOCCURSOR_H__
@@ -1,412 +0,0 @@
1
- /* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /******************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * This file uses NAN:
19
- *
20
- * Copyright (c) 2015 NAN contributors
21
- *
22
- * NAN contributors listed at https://github.com/rvagg/nan#contributors
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining
25
- * a copy of this software and associated documentation files (the
26
- * "Software"), to deal in the Software without restriction, including
27
- * without limitation the rights to use, copy, modify, merge, publish,
28
- * distribute, sublicense, and/or sell copies of the Software, and to
29
- * permit persons to whom the Software is furnished to do so, subject to
30
- * the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be
33
- * included in all copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
39
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
40
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
41
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
- *
43
- * NAME
44
- * njsSodaCollection.cpp
45
- *
46
- * DESCRIPTION
47
- * SodaCollection class implementation.
48
- *
49
- ****************************************************************************/
50
-
51
- #include "njsSodaDocument.h"
52
- #include "njsOracle.h"
53
-
54
- using namespace std;
55
-
56
- // persistent SodaDocument class handle
57
- Nan::Persistent<FunctionTemplate> njsSodaDocument::sodaDocTemplate_s;
58
-
59
-
60
- //-----------------------------------------------------------------------------
61
- // njsSodaDocument::Init
62
- // Initialization function, maps functions and properties from JS to C++
63
- //-----------------------------------------------------------------------------
64
- void njsSodaDocument::Init(Local<Object> target)
65
- {
66
- Nan::HandleScope scope;
67
-
68
- Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(
69
- njsSodaDocument::New);
70
- tpl->InstanceTemplate()->SetInternalFieldCount(1);
71
- tpl->SetClassName(Nan::New<v8::String>("Document").ToLocalChecked());
72
-
73
- // Methods
74
- Nan::SetPrototypeMethod (tpl, "getContentAsString", GetContentAsString);
75
- Nan::SetPrototypeMethod (tpl, "getContentAsBuffer", GetContentAsBuffer);
76
-
77
-
78
- // Properties
79
- Nan::SetAccessor(tpl->InstanceTemplate (),
80
- Nan::New<v8::String>("createdOn").ToLocalChecked(),
81
- njsSodaDocument::GetCreatedOn,
82
- njsSodaDocument::SetCreatedOn);
83
- Nan::SetAccessor(tpl->InstanceTemplate (),
84
- Nan::New<v8::String>("key").ToLocalChecked(),
85
- njsSodaDocument::GetKey,
86
- njsSodaDocument::SetKey);
87
- Nan::SetAccessor(tpl->InstanceTemplate (),
88
- Nan::New<v8::String>("lastModified").ToLocalChecked(),
89
- njsSodaDocument::GetLastModified,
90
- njsSodaDocument::SetLastModified);
91
- Nan::SetAccessor(tpl->InstanceTemplate (),
92
- Nan::New<v8::String>("mediaType").ToLocalChecked(),
93
- njsSodaDocument::GetMediaType,
94
- njsSodaDocument::SetMediaType);
95
- Nan::SetAccessor(tpl->InstanceTemplate (),
96
- Nan::New<v8::String>("version").ToLocalChecked (),
97
- njsSodaDocument::GetVersion,
98
- njsSodaDocument::SetVersion);
99
-
100
- sodaDocTemplate_s.Reset(tpl);
101
- Nan::Set(target, Nan::New<v8::String>("Document").ToLocalChecked(),
102
- tpl->GetFunction ());
103
- }
104
-
105
-
106
- //-----------------------------------------------------------------------------
107
- // njsSodaDocument::New
108
- // To allocate a new instance of njsSodaDocument object
109
- //-----------------------------------------------------------------------------
110
- NAN_METHOD(njsSodaDocument::New)
111
- {
112
- njsSodaDocument *doc = new njsSodaDocument();
113
- doc->Wrap(info.Holder());
114
- info.GetReturnValue().Set(info.Holder());
115
- }
116
-
117
-
118
- //-----------------------------------------------------------------------------
119
- // njsSodaDocument::CreateFromBaton()
120
- // To create an instance of njsSodaDocument object using DPI sodaDoc object
121
- // from baton structure.
122
- //-----------------------------------------------------------------------------
123
- Local<Object> njsSodaDocument::CreateFromBaton(njsBaton *baton)
124
- {
125
- Nan::EscapableHandleScope scope;
126
- Local<Object> obj =
127
- njsSodaDocument::CreateFromDPIDoc(baton->dpiSodaDocHandle);
128
- baton->dpiSodaDocHandle = NULL;
129
- return scope.Escape(obj);
130
- }
131
-
132
-
133
- //-----------------------------------------------------------------------------
134
- // njsSodaDOcument::CreateFromDPIDoc()
135
- // To create an instance of njsSodaDocument from DPI-document object
136
- //-----------------------------------------------------------------------------
137
- Local<Object> njsSodaDocument::CreateFromDPIDoc(dpiSodaDoc *dpiSodaDocHandle)
138
- {
139
- Nan::EscapableHandleScope scope;
140
- njsSodaDocument *doc;
141
- Local<Function> func;
142
- Local<Object> obj;
143
-
144
- func = Nan::GetFunction(
145
- Nan::New<FunctionTemplate>(sodaDocTemplate_s)).ToLocalChecked();
146
- obj = Nan::NewInstance(func).ToLocalChecked();
147
- doc = Nan::ObjectWrap::Unwrap<njsSodaDocument>(obj);
148
- doc->dpiSodaDocHandle = dpiSodaDocHandle;
149
- return scope.Escape(obj);
150
- }
151
-
152
-
153
- //-----------------------------------------------------------------------------
154
- // njsSodaDocument::CreateArrayFromBaton()
155
- // To create v8::Array object of DPI doc objects
156
- //-----------------------------------------------------------------------------
157
- Local<Object> njsSodaDocument::CreateArrayFromBaton(njsBaton *baton)
158
- {
159
- Nan::EscapableHandleScope scope;
160
- Local<Array> docArray;
161
-
162
- docArray = Nan::New<v8::Array>(baton->dpiSodaDocsVec.size());
163
- for (unsigned int i = 0; i < baton->dpiSodaDocsVec.size(); i++) {
164
- Local<Object> obj = CreateFromDPIDoc(baton->dpiSodaDocsVec[i]);
165
- Nan::Set(docArray, i, obj);
166
- }
167
- return scope.Escape(docArray);
168
- }
169
-
170
-
171
- //-----------------------------------------------------------------------------
172
- // njsSodaDOcument::GetContentAsString()
173
- // To obtain the content of the document as string. (Synchronous call)
174
- //-----------------------------------------------------------------------------
175
- NAN_METHOD(njsSodaDocument::GetContentAsString)
176
- {
177
- njsSodaDocument *doc = (njsSodaDocument*) ValidateArgs(info, 0, 0);
178
- if (!doc)
179
- return;
180
-
181
- // get content from ODPI-C document
182
- const char *value, *encoding;
183
- uint32_t valueLength;
184
- if (dpiSodaDoc_getContent(doc->dpiSodaDocHandle, &value, &valueLength,
185
- &encoding) < 0) {
186
- njsOracledb::ThrowDPIError();
187
- return;
188
- }
189
-
190
- // convert to Javascript string
191
- Local<Value> jsValue;
192
- if (valueLength == 0) {
193
- jsValue = Nan::Null();
194
- } else if (!encoding || strcmp(encoding, "UTF-8") == 0) {
195
- jsValue = Nan::New<String>(value, valueLength).ToLocalChecked();
196
- } else {
197
- uint16_t *utf16Value = (uint16_t*) value;
198
- int utf16ValueLength = valueLength / 2;
199
- jsValue = Nan::New<String>(utf16Value,
200
- utf16ValueLength).ToLocalChecked();
201
- }
202
- info.GetReturnValue().Set(jsValue);
203
- }
204
-
205
-
206
- //----------------------------------------------------------------------------
207
- // njsSodaDOcument::GetContentAsBuffer()
208
- // To obtain the content of the document as buffer. (Synchronous call)
209
- //-----------------------------------------------------------------------------
210
- NAN_METHOD(njsSodaDocument::GetContentAsBuffer)
211
- {
212
- njsSodaDocument *doc = (njsSodaDocument*) ValidateArgs(info, 0, 0);
213
- if (!doc)
214
- return;
215
-
216
- // get content from ODPI-C document
217
- const char *value, *encoding;
218
- uint32_t valueLength;
219
- if (dpiSodaDoc_getContent(doc->dpiSodaDocHandle, &value, &valueLength,
220
- &encoding) < 0) {
221
- njsOracledb::ThrowDPIError();
222
- return;
223
- }
224
-
225
- // convert to Javascript buffer
226
- Local<Value> jsValue = Nan::CopyBuffer(value,
227
- valueLength).ToLocalChecked();
228
- info.GetReturnValue().Set(jsValue);
229
- }
230
-
231
-
232
- //-----------------------------------------------------------------------------
233
- // njsSodaDocument::GetCreatedOn()
234
- // Get accessor of "createdOn" property.
235
- //-----------------------------------------------------------------------------
236
- NAN_GETTER(njsSodaDocument::GetCreatedOn)
237
- {
238
- njsSodaDocument *doc = (njsSodaDocument*) ValidateGetter(info);
239
- if (!doc)
240
- return;
241
-
242
- const char *createdOn;
243
- uint32_t createdOnLen;
244
- if (dpiSodaDoc_getCreatedOn(doc->dpiSodaDocHandle, &createdOn,
245
- &createdOnLen) < 0)
246
- return;
247
-
248
- Local<Value> value;
249
- if (createdOnLen > 0) {
250
- value = Nan::New<v8::String>(createdOn, createdOnLen).ToLocalChecked();
251
- } else {
252
- value = Nan::Null();
253
- }
254
- info.GetReturnValue().Set(value);
255
- }
256
-
257
-
258
- //-----------------------------------------------------------------------------
259
- // njsSodaDocument::SetCreatedOn()
260
- // Set accessor of "createdOn" property.
261
- //-----------------------------------------------------------------------------
262
- NAN_SETTER(njsSodaDocument::SetCreatedOn)
263
- {
264
- PropertyIsReadOnly("createdOn");
265
- }
266
-
267
-
268
- //-----------------------------------------------------------------------------
269
- // njsSodaDocument::GetKey()
270
- // Get accessor of "key" property.
271
- //-----------------------------------------------------------------------------
272
- NAN_GETTER(njsSodaDocument::GetKey)
273
- {
274
- njsSodaDocument *doc = (njsSodaDocument*) ValidateGetter(info);
275
- if (!doc)
276
- return;
277
-
278
- const char *key;
279
- uint32_t keyLen;
280
- if (dpiSodaDoc_getKey(doc->dpiSodaDocHandle, &key, &keyLen) < 0)
281
- return;
282
-
283
- Local<Value> value;
284
- if (keyLen > 0) {
285
- value = Nan::New<v8::String>(key, keyLen).ToLocalChecked();
286
- } else {
287
- value = Nan::Null();
288
- }
289
- info.GetReturnValue().Set(value);
290
- }
291
-
292
-
293
- //-----------------------------------------------------------------------------
294
- // njsSodaDocument::SetKey()
295
- // Set accessor of "key" property.
296
- //-----------------------------------------------------------------------------
297
- NAN_SETTER(njsSodaDocument::SetKey)
298
- {
299
- PropertyIsReadOnly("key");
300
- }
301
-
302
-
303
- //-----------------------------------------------------------------------------
304
- // njsSodaDocument::GetLastModified()
305
- // Get accessor of "lastModified" property.
306
- //-----------------------------------------------------------------------------
307
- NAN_GETTER(njsSodaDocument::GetLastModified)
308
- {
309
- njsSodaDocument *doc = (njsSodaDocument*) ValidateGetter(info);
310
- if (!doc)
311
- return;
312
-
313
- const char *lastModified;
314
- uint32_t lastModifiedLen;
315
- if (dpiSodaDoc_getLastModified(doc->dpiSodaDocHandle, &lastModified,
316
- &lastModifiedLen) < 0)
317
- return;
318
-
319
- Local<Value> value;
320
- if (lastModifiedLen > 0) {
321
- value = Nan::New<v8::String>(lastModified,
322
- lastModifiedLen).ToLocalChecked();
323
- } else {
324
- value = Nan::Null();
325
- }
326
- info.GetReturnValue().Set(value);
327
- }
328
-
329
-
330
-
331
- //-----------------------------------------------------------------------------
332
- // njsSodaDocument::SetLastModified()
333
- // Set accessor of "lastModified" property.
334
- //-----------------------------------------------------------------------------
335
- NAN_SETTER(njsSodaDocument::SetLastModified)
336
- {
337
- PropertyIsReadOnly("lastModified");
338
- }
339
-
340
-
341
- //-----------------------------------------------------------------------------
342
- // njsSodaDocument::GetMediaType()
343
- // Get accessor of "mediaType" property.
344
- //-----------------------------------------------------------------------------
345
- NAN_GETTER(njsSodaDocument::GetMediaType)
346
- {
347
- njsSodaDocument *doc = (njsSodaDocument*) ValidateGetter(info);
348
- if (!doc)
349
- return;
350
-
351
- const char *mediaType;
352
- uint32_t mediaTypeLen;
353
-
354
- if (dpiSodaDoc_getMediaType(doc->dpiSodaDocHandle, &mediaType,
355
- &mediaTypeLen) < 0)
356
- return;
357
-
358
- Local<Value> value;
359
- if (mediaTypeLen > 0) {
360
- value = Nan::New<v8::String>(mediaType, mediaTypeLen).ToLocalChecked();
361
- } else {
362
- value = Nan::Null();
363
- }
364
- info.GetReturnValue().Set(value);
365
- }
366
-
367
-
368
- //-----------------------------------------------------------------------------
369
- // njsSodaDocument::SetMediaType()
370
- // Set accessor of "mediaType" property.
371
- //-----------------------------------------------------------------------------
372
- NAN_SETTER(njsSodaDocument::SetMediaType)
373
- {
374
- PropertyIsReadOnly("mediaType");
375
- }
376
-
377
-
378
- //-----------------------------------------------------------------------------
379
- // njsSodaDocument::GetVersion()
380
- // Get accessor of "version" property.
381
- //-----------------------------------------------------------------------------
382
- NAN_GETTER(njsSodaDocument::GetVersion)
383
- {
384
- njsSodaDocument *doc = (njsSodaDocument*) ValidateGetter(info);
385
- if (!doc)
386
- return;
387
-
388
- const char *version;
389
- uint32_t versionLen;
390
-
391
- if (dpiSodaDoc_getVersion(doc->dpiSodaDocHandle, &version,
392
- &versionLen) < 0)
393
- return;
394
-
395
- Local<Value> value;
396
- if (versionLen > 0) {
397
- value = Nan::New<v8::String>(version, versionLen).ToLocalChecked();
398
- } else {
399
- value = Nan::Null();
400
- }
401
- info.GetReturnValue().Set(value);
402
- }
403
-
404
-
405
- //-----------------------------------------------------------------------------
406
- // njsDoaDocument::SetVersion()
407
- // Set accessor of "version" property.
408
- //-----------------------------------------------------------------------------
409
- NAN_SETTER(njsSodaDocument::SetVersion)
410
- {
411
- PropertyIsReadOnly("version");
412
- }
@@ -1,105 +0,0 @@
1
- /* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /******************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * This file uses NAN:
19
- *
20
- * Copyright (c) 2015 NAN contributors
21
- *
22
- * NAN contributors listed at https://github.com/rvagg/nan#contributors
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining
25
- * a copy of this software and associated documentation files (the
26
- * "Software"), to deal in the Software without restriction, including
27
- * without limitation the rights to use, copy, modify, merge, publish,
28
- * distribute, sublicense, and/or sell copies of the Software, and to
29
- * permit persons to whom the Software is furnished to do so, subject to
30
- * the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be
33
- * included in all copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
39
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
40
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
41
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
- *
43
- * NAME
44
- * njsSodaDocument.h
45
- *
46
- * DESCRIPTION
47
- * Connection class implementation.
48
- *
49
- *****************************************************************************/
50
-
51
- #ifndef __NJSSODADOCUMENT_H__
52
- #define __NJSSODADOCUMENT_H__
53
-
54
- #include "njsCommon.h"
55
-
56
- class njsSodaDocument : public njsCommon {
57
- public:
58
- static void Init(Local<Object> target);
59
- static Local<Object> CreateFromBaton(njsBaton *baton);
60
- static Local<Object> CreateFromDPIDoc(dpiSodaDoc *doc);
61
- static Local<Object> CreateArrayFromBaton(njsBaton *baton);
62
-
63
- dpiSodaDoc *GetDPISodaDocHandle() { return dpiSodaDocHandle; }
64
-
65
- private:
66
- static Nan::Persistent<FunctionTemplate> sodaDocTemplate_s;
67
-
68
- static NAN_METHOD(New);
69
-
70
- // Methods
71
- static NAN_METHOD(GetContentAsString);
72
- static NAN_METHOD(GetContentAsBuffer);
73
-
74
- // Define Getter Accessor for propertie
75
- static NAN_GETTER(GetCreatedOn);
76
- static NAN_GETTER(GetKey);
77
- static NAN_GETTER(GetLastModified);
78
- static NAN_GETTER(GetMediaType);
79
- static NAN_GETTER(GetVersion);
80
-
81
- // Define Setter Accessors for properties
82
- static NAN_SETTER(SetCreatedOn);
83
- static NAN_SETTER(SetKey);
84
- static NAN_SETTER(SetLastModified);
85
- static NAN_SETTER(SetMediaType);
86
- static NAN_SETTER(SetVersion);
87
-
88
- bool IsValid() const { return true; }
89
- njsErrorType GetInvalidErrorType() const { return errSuccess; }
90
-
91
- // Constructor
92
- njsSodaDocument() : dpiSodaDocHandle(NULL) { }
93
-
94
- // Destructor
95
- ~njsSodaDocument () {
96
- if (dpiSodaDocHandle) {
97
- dpiSodaDoc_release(dpiSodaDocHandle);
98
- dpiSodaDocHandle = NULL;
99
- }
100
- }
101
-
102
- dpiSodaDoc *dpiSodaDocHandle ; // Soda Document object
103
- };
104
-
105
- #endif // __NJSSODADOCUMENT_H__