Skip to content

Commit b4228ca

Browse files
author
Roman Balayan
committed
Add libs and prebuilt executable for v5.0.0
1 parent 6e6e5f0 commit b4228ca

File tree

14 files changed

+1223
-1307
lines changed

14 files changed

+1223
-1307
lines changed

build/Release/oracledb.node

12.3 KB
Binary file not shown.

lib/aqQueue.js

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved
22

33
//-----------------------------------------------------------------------------
44
//
@@ -22,61 +22,58 @@
2222
const nodbUtil = require('./util.js');
2323

2424
//-----------------------------------------------------------------------------
25-
// deqOne
25+
// deqOne()
2626
// Returns a single message from the queue, if one is available.
2727
//-----------------------------------------------------------------------------
28-
function deqOne(cb) {
29-
nodbUtil.checkAsyncArgs(arguments, 1, 1);
30-
this._deqOne(cb);
28+
async function deqOne() {
29+
nodbUtil.checkArgCount(arguments, 0, 0);
30+
return await this._deqOne();
3131
}
3232

3333

3434
//-----------------------------------------------------------------------------
35-
// deqMany
35+
// deqMany()
3636
// Returns an array of messages from the queue, up to the maximum specified,
3737
// if any are available.
3838
//----------------------------------------------------------------------------
39-
function deqMany(maxMessages, cb) {
40-
nodbUtil.checkAsyncArgs(arguments, 2, 2);
39+
async function deqMany(maxMessages) {
40+
nodbUtil.checkArgCount(arguments, 1, 1);
4141
nodbUtil.assert(typeof maxMessages === 'number', 'NJS-005', 1);
42-
43-
this._deqMany(maxMessages, cb);
42+
return await this._deqMany(maxMessages);
4443
}
4544

4645

4746
//-----------------------------------------------------------------------------
48-
// enqOne
47+
// enqOne()
4948
// Enqueues a single message into the queue.
5049
//-----------------------------------------------------------------------------
51-
function enqOne(message, cb) {
52-
nodbUtil.checkAsyncArgs(arguments, 2, 2);
50+
async function enqOne(message) {
51+
nodbUtil.checkArgCount(arguments, 1, 1);
5352
nodbUtil.assert(typeof message === 'object' || typeof message === 'string',
5453
'NJS-005', 1);
55-
56-
this._enqOne(message, cb);
54+
return await this._enqOne(message);
5755
}
5856

5957

6058
//-----------------------------------------------------------------------------
61-
// enqMany
62-
// Returns an array of messages from the queue, up to the maximum specified,
63-
// if any are available.
59+
// enqMany()
60+
// Enqueues multiple messages into the queue at the same time, avoiding
61+
// multiple round-trips.
6462
//----------------------------------------------------------------------------
65-
function enqMany(messages, cb) {
66-
nodbUtil.checkAsyncArgs(arguments, 2, 2);
63+
async function enqMany(messages) {
64+
nodbUtil.checkArgCount(arguments, 1, 1);
6765
nodbUtil.assert(Array.isArray(messages), 'NJS-005', 1);
68-
69-
this._enqMany(messages, cb);
66+
return await this._enqMany(messages);
7067
}
7168

7269

7370
class AqQueue {
7471

75-
_extend(oracledb) {
76-
this.deqOne = nodbUtil.promisify(oracledb, deqOne);
77-
this.deqMany = nodbUtil.promisify(oracledb, deqMany);
78-
this.enqOne = nodbUtil.promisify(oracledb, enqOne);
79-
this.enqMany = nodbUtil.promisify(oracledb, enqMany);
72+
_extend() {
73+
this.deqOne = nodbUtil.callbackify(deqOne);
74+
this.deqMany = nodbUtil.callbackify(deqMany);
75+
this.enqOne = nodbUtil.callbackify(enqOne);
76+
this.enqMany = nodbUtil.callbackify(enqMany);
8077
}
8178

8279
}

0 commit comments

Comments
 (0)