@@ -524,6 +524,149 @@ describe('163. executeMany1.js', function() {
524
524
await doDropProc ( ) ;
525
525
} ) ; // 163.17
526
526
527
+ it ( '163.18 Negative - executeMany with SELECT query, positional bind' , async function ( ) {
528
+
529
+ if ( testsUtil . getClientVersion < 1201000200 ) {
530
+ return this . skip ( ) ;
531
+ }
532
+
533
+ const sql = "SELECT :1 FROM DUAL" ;
534
+ const binds = [ [ 3 ] ] ;
535
+
536
+ await assert . rejects (
537
+ async ( ) => await conn . executeMany ( sql , binds ) ,
538
+ // Thick mode - DPI-1013: not supported
539
+ // Thin mode - NJS-157: executeMany() cannot be used with
540
+ // SELECT statement or WITH SQL clause
541
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
542
+ ) ;
543
+ } ) ; // 163.18
544
+
545
+ it ( '163.19 Negative - executeMany with SELECT query, named bind' , async function ( ) {
546
+
547
+ if ( testsUtil . getClientVersion < 1201000200 ) {
548
+ return this . skip ( ) ;
549
+ }
550
+
551
+ const sql = "SELECT :num FROM DUAL" ;
552
+ const binds = [ { num : 3 } ] ;
553
+
554
+ await assert . rejects (
555
+ async ( ) => await conn . executeMany ( sql , binds ) ,
556
+ // Thick mode - DPI-1013: not supported
557
+ // Thin mode - NJS-157: executeMany() cannot be used with
558
+ // SELECT statement or WITH SQL clause
559
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
560
+ ) ;
561
+ } ) ; // 163.19
562
+
563
+ it ( '163.20 Negative - executeMany with WITH SQL clause, positional bind' , async function ( ) {
564
+
565
+ if ( testsUtil . getClientVersion < 1201000200 ) {
566
+ return this . skip ( ) ;
567
+ }
568
+
569
+ const sql = "WITH data as (SELECT 1 as Num1, 2 as Num2 from dual) SELECT :1 from data" ;
570
+ const binds = [ [ 1 ] ] ;
571
+
572
+ await assert . rejects (
573
+ async ( ) => await conn . executeMany ( sql , binds ) ,
574
+ // Thick mode - DPI-1013: not supported
575
+ // Thin mode - NJS-157: executeMany() cannot be used with
576
+ // SELECT statement or WITH SQL clause
577
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
578
+ ) ;
579
+ } ) ; // 163.20
580
+
581
+ it ( '163.21 Negative - executeMany with WITH SQL clause, named bind' , async function ( ) {
582
+
583
+ if ( testsUtil . getClientVersion < 1201000200 ) {
584
+ return this . skip ( ) ;
585
+ }
586
+
587
+ const sql = "WITH data as (SELECT 1 as Num1, 2 as Num2 from dual) SELECT :Num1 from data" ;
588
+ const binds = [ { Num1 : 3 } ] ;
589
+
590
+ await assert . rejects (
591
+ async ( ) => await conn . executeMany ( sql , binds ) ,
592
+ // Thick mode - DPI-1013: not supported
593
+ // Thin mode - NJS-157: executeMany() cannot be used with
594
+ // SELECT statement or WITH SQL clause
595
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
596
+ ) ;
597
+ } ) ; // 163.21
598
+
599
+ it ( '163.22 Negative - executeMany with SELECT query, multiple positional binds' , async function ( ) {
600
+
601
+ if ( testsUtil . getClientVersion < 1201000200 ) {
602
+ return this . skip ( ) ;
603
+ }
604
+
605
+ const sql = "SELECT :1, :2 FROM DUAL" ;
606
+ const binds = [ [ 1 , 2 ] ] ;
607
+
608
+ await assert . rejects (
609
+ async ( ) => await conn . executeMany ( sql , binds ) ,
610
+ // Thick mode - DPI-1013: not supported
611
+ // Thin mode - NJS-157: executeMany() cannot be used with
612
+ // SELECT statement or WITH SQL clause
613
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
614
+ ) ;
615
+ } ) ; // 163.22
616
+
617
+ it ( '163.23 Negative - executeMany with WITH SQL clause and multiple positional binds' , async function ( ) {
618
+
619
+ if ( testsUtil . getClientVersion < 1201000200 ) {
620
+ return this . skip ( ) ;
621
+ }
622
+
623
+ const sql = "WITH data as (SELECT 1 as Num1, 2 as Num2 from dual) SELECT :1, :2 FROM data" ;
624
+ const binds = [ [ 1 , 2 ] ] ;
625
+
626
+ await assert . rejects (
627
+ async ( ) => await conn . executeMany ( sql , binds ) ,
628
+ // Thick mode - DPI-1013: not supported
629
+ // Thin mode - NJS-157: executeMany() cannot be used with
630
+ // SELECT statement or WITH SQL clause
631
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
632
+ ) ;
633
+ } ) ; // 163.23
634
+
635
+ it ( '163.24 Negative - executeMany with SELECT query and invalid bind variable' , async function ( ) {
636
+
637
+ if ( testsUtil . getClientVersion < 1201000200 ) {
638
+ return this . skip ( ) ;
639
+ }
640
+
641
+ const sql = "SELECT :invalidBind FROM DUAL" ;
642
+ const binds = [ [ 3 ] ] ;
643
+
644
+ await assert . rejects (
645
+ async ( ) => await conn . executeMany ( sql , binds ) ,
646
+ // Thick mode - DPI-1013: not supported
647
+ // Thin mode - NJS-157: executeMany() cannot be used with
648
+ // SELECT statement or WITH SQL clause
649
+ / D P I - 1 0 1 3 : | N J S - 1 5 7 : /
650
+ ) ;
651
+ } ) ; // 163.24
652
+
653
+ it ( '163.25 Negative - executeMany with DDL - CREATE TABLE' , async function ( ) {
654
+
655
+ // Does not throw the proper error in Thin mode yet
656
+ if ( testsUtil . getClientVersion < 1201000200 || oracledb . thin ) {
657
+ return this . skip ( ) ;
658
+ }
659
+
660
+ const sql = "CREATE TABLE :tblname (:id NUMBER, :name VARCHAR2(30))" ;
661
+ const binds = [ [ "tbl1" , "ID" , "NAME" ] ] ;
662
+
663
+ await assert . rejects (
664
+ async ( ) => await conn . executeMany ( sql , binds ) ,
665
+ // Thick mode - DPI-1059: bind variables are not supported in DDL statements
666
+ / D P I - 1 0 5 9 : /
667
+ ) ;
668
+ } ) ; // 163.25
669
+
527
670
const doCreateProc = async function ( ) {
528
671
const proc = "CREATE OR REPLACE PROCEDURE nodb_proc_em (a_num IN NUMBER, " +
529
672
" a_outnum OUT NUMBER, a_outstr OUT VARCHAR2) \n" +
0 commit comments