@@ -511,29 +511,52 @@ describe('173. soda5.js', () => {
511
511
should . not . exist ( err ) ;
512
512
}
513
513
514
+ let compatibleVersion ;
515
+ if ( dbconfig . test . DBA_PRIVILEGE ) {
516
+ try {
517
+ const connectionDetails = {
518
+ user : dbconfig . test . DBA_user ,
519
+ password : dbconfig . test . DBA_password ,
520
+ connectString : dbconfig . connectString ,
521
+ privilege : oracledb . SYSDBA ,
522
+ } ;
523
+ let conn = await oracledb . getConnection ( connectionDetails ) ;
524
+ let res = await conn . execute ( "select name, value from v$parameter where name like lower('%'||:x||'%')" , [ 'COMPATIBLE' ] ) ;
525
+ if ( res . rows . length > 0 ) {
526
+ compatibleVersion = res . rows [ 0 ] [ 1 ] ;
527
+ }
528
+ await conn . close ( ) ;
529
+ } catch ( err ) {
530
+ should . not . exist ( err ) ;
531
+ }
532
+ }
533
+ const isCreateIndexEnabled = sodaUtil . versionStringCompare ( compatibleVersion , '12.2.0.0.0' ) ;
514
534
try {
515
535
let indexSpec = {
516
536
"name" : "TEST_IDX" ,
517
537
"search_on" : "none" ,
518
538
"dataguide" : "on"
519
539
} ;
520
- await collection . createIndex ( indexSpec ) ;
521
-
522
- let outDocument = await collection . getDataGuide ( ) ;
523
- should . exist ( outDocument ) ;
524
-
540
+ if ( isCreateIndexEnabled >= 0 ) {
541
+ await collection . createIndex ( indexSpec ) ;
542
+ let outDocument = await collection . getDataGuide ( ) ;
543
+ should . exist ( outDocument ) ;
544
+ } else if ( isCreateIndexEnabled < 0 ) {
545
+ await sodaUtil . assertThrowsAsync ( async ( ) => { await collection . createIndex ( indexSpec ) ; } , / O R A - 0 0 4 0 6 : / ) ;
546
+ }
525
547
} catch ( err ) {
526
548
should . not . exist ( err ) ;
527
549
}
528
-
529
- try {
530
- let result = await collection . dropIndex ( 'TEST_IDX' ) ;
531
- should . strictEqual ( result . dropped , true ) ;
532
- await conn . commit ( ) ;
533
- await collection . drop ( ) ;
534
- await conn . close ( ) ;
535
- } catch ( err ) {
536
- should . not . exist ( err ) ;
550
+ if ( isCreateIndexEnabled >= 0 ) {
551
+ try {
552
+ let result = await collection . dropIndex ( 'TEST_IDX' ) ;
553
+ should . strictEqual ( result . dropped , true ) ;
554
+ await conn . commit ( ) ;
555
+ await collection . drop ( ) ;
556
+ await conn . close ( ) ;
557
+ } catch ( err ) {
558
+ should . not . exist ( err ) ;
559
+ }
537
560
}
538
561
539
562
} ) ; // 173.12
0 commit comments