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+ } ) ;
0 commit comments