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. */
2
2
3
3
/******************************************************************************
4
4
*
26
26
27
27
const oracledb = require ( 'oracledb' ) ;
28
28
const should = require ( 'should' ) ;
29
- const assert = require ( 'assert' ) ;
30
29
const dbconfig = require ( './dbconfig.js' ) ;
31
30
const testsUtil = require ( './testsUtil.js' ) ;
32
31
@@ -169,5 +168,31 @@ describe('228. lastRowid.js', function() {
169
168
} catch ( err ) {
170
169
should . not . exist ( err ) ;
171
170
}
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
173
198
} ) ;
0 commit comments