Skip to content

Commit 0a5f30c

Browse files
committed
Add test of INSERT ALL statement in lastRowid suite
1 parent ed55a78 commit 0a5f30c

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

test/lastRowid.js

Lines changed: 28 additions & 3 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
*
@@ -26,7 +26,6 @@
2626

2727
const oracledb = require('oracledb');
2828
const should = require('should');
29-
const assert = require('assert');
3029
const dbconfig = require('./dbconfig.js');
3130
const testsUtil = require('./testsUtil.js');
3231

@@ -169,5 +168,31 @@ describe('228. lastRowid.js', function() {
169168
} catch (err) {
170169
should.not.exist(err);
171170
}
172-
});
171+
}); // 228.3
172+
173+
it('228.4 INSERT ALL statement', async () => {
174+
const rows = ['Redwood city', 'Sydney', 'Shenzhen'];
175+
const sqlInsertAll = `
176+
insert all
177+
into ${TABLE} (id, value) values (100, :v)
178+
into ${TABLE} (id, value) values (200, :v)
179+
into ${TABLE} (id, value) values (300, :v)
180+
select * from dual
181+
`;
182+
183+
try {
184+
let result = await conn.execute(sqlInsertAll, rows);
185+
should.not.exist(result.lastRowid);
186+
should.strictEqual(result.rowsAffected, 3);
187+
188+
let sql = `select * from ${TABLE} where id >= 100 order by id asc`;
189+
result = await conn.execute(sql);
190+
191+
should.strictEqual(result.rows[0][1], rows[0]);
192+
should.strictEqual(result.rows[1][1], rows[1]);
193+
should.strictEqual(result.rows[2][1], rows[2]);
194+
} catch (err) {
195+
should.not.exist(err);
196+
}
197+
}); // 228.4
173198
});

test/list.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4642,4 +4642,5 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
46424642
228. lastRowid.js
46434643
228.1 examples
46444644
228.2 MERGE statement
4645-
228.3 Negative - not applicable to executeMany()
4645+
228.3 Negative - not applicable to executeMany()
4646+
228.4 INSERT ALL statement

0 commit comments

Comments
 (0)