Skip to content

Commit 9444510

Browse files
committed
Add regression test for GitHub issue #995
1 parent e8214df commit 9444510

File tree

4 files changed

+97
-5
lines changed

4 files changed

+97
-5
lines changed

test/executeMany.js renamed to test/executeMany1.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* See LICENSE.md for relevant licenses.
2020
*
2121
* NAME
22-
* 163. executeMany.js
22+
* 163. executeMany1.js
2323
*
2424
* DESCRIPTION
2525
* Test connection.executeMany() method.
@@ -32,7 +32,7 @@ var should = require('should');
3232
var async = require('async');
3333
var dbConfig = require('./dbconfig.js');
3434

35-
describe('163. executeMany.js', function() {
35+
describe('163. executeMany1.js', function() {
3636

3737
var conn;
3838

@@ -849,4 +849,4 @@ describe('163. executeMany.js', function() {
849849
], callback);
850850
}; // dropParentChildTables()
851851

852-
});
852+
});

test/executeMany2.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19+
* See LICENSE.md for relevant licenses.
20+
*
21+
* NAME
22+
* 172. executeMany2.js
23+
*
24+
* DESCRIPTION
25+
* This is a negative test of executeMany().
26+
*
27+
* The executeMany(): Binds section of the doc says:
28+
* The first data record determines the number of bind variables,
29+
* each bind variable’s data type, and its name (when binding by name).
30+
*
31+
*****************************************************************************/
32+
'use strict';
33+
34+
var oracledb = require('oracledb');
35+
var should = require('should');
36+
var dbconfig = require('./dbconfig.js');
37+
38+
describe('172. executeMany2.js', function() {
39+
40+
before(function() {
41+
if (!dbconfig.test.DBA_PRIVILEGE) this.skip();
42+
});
43+
44+
// Currently skipped for
45+
// Segmentation fault: 11
46+
it.skip('172.1 Negative - incorrect parameters', async () => {
47+
48+
let conn;
49+
try {
50+
const connectionDetails = {
51+
user : dbconfig.test.DBA_user,
52+
password : dbconfig.test.DBA_password,
53+
connectString : dbconfig.connectString,
54+
privilege : oracledb.SYSDBA
55+
};
56+
const schema = 'T_APPDEV4DB';
57+
const password = 'oracle';
58+
59+
conn = await oracledb.getConnection(connectionDetails);
60+
61+
await conn.execute(
62+
`DROP USER ${schema} CASCADE`
63+
);
64+
await conn.execute(
65+
`GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO ${schema} identified by ${password}`
66+
);
67+
await conn.execute(
68+
`create table "${schema}"."SALES" ("AMOUNT_SOLD" NUMBER(10,2))`
69+
);
70+
71+
await conn.executeMany(
72+
`insert into "${schema}"."SALES" ("AMOUNT_SOLD") values (:1)`,
73+
[ 48, 33, 3, 999, 1, 13.13 ]
74+
);
75+
76+
} catch(err) {
77+
should.not.exist(err);
78+
} finally {
79+
if (conn) {
80+
try {
81+
await conn.close();
82+
} catch(err) {
83+
should.not.exist(err);
84+
}
85+
}
86+
}
87+
}); // 172.1
88+
});

test/list.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,7 +4146,7 @@ Overview of node-oracledb functional tests
41464146
162.25 ROLLBACK
41474147
162.26 TRUNCATE
41484148

4149-
163. executeMany.js
4149+
163. executeMany1.js
41504150
163.1 inserts many rows with bind by name
41514151
163.2 inserts rows with bind by position
41524152
163.3 DML RETURNING that returns single value
@@ -4234,4 +4234,7 @@ Overview of node-oracledb functional tests
42344234
171. jsObjectGetter2.js
42354235
171.1 oracledb.fetchAsBuffer
42364236
171.2 oracledb.fetchAsString
4237-
171.3 data bind
4237+
171.3 data bind
4238+
4239+
172. executeMany2.js
4240+
172.1 Negative - incorrect parameters

test/opts/mocha.opts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,4 @@ test/sodaCallback.js
197197

198198
test/soda4.js
199199
test/jsObjectGetter2.js
200+
test/executeMany2.js

0 commit comments

Comments
 (0)