@@ -155,7 +155,7 @@ describe('76. fetchClobAsString.js', function() {
155
155
return str ;
156
156
} ;
157
157
158
- describe ( '76.1 fetch clob columns by set oracledb.fetchAsString' , function ( ) {
158
+ describe ( '76.1 fetch CLOB columns by setting oracledb.fetchAsString' , function ( ) {
159
159
160
160
before ( 'create Table and populate' , function ( done ) {
161
161
connection . execute (
@@ -210,7 +210,7 @@ describe('76. fetchClobAsString.js', function() {
210
210
] , done ) ;
211
211
} ) ; // 76.1.1
212
212
213
- it ( '76.1.2 works with small clob data, the length of string is 26 ' , function ( done ) {
213
+ it ( '76.1.2 works with small CLOB data' , function ( done ) {
214
214
var id = 2 ;
215
215
var specialStr = '76.1.2' ;
216
216
var contentLength = 26 ;
@@ -238,26 +238,26 @@ describe('76. fetchClobAsString.js', function() {
238
238
] , done ) ;
239
239
} ) ; // 76.1.2
240
240
241
- it ( '76.1.3 fetch multiple CLOB column as string ' , function ( done ) {
242
- var id_1 = 1 ;
241
+ it ( '76.1.3 fetch multiple CLOB columns as String ' , function ( done ) {
242
+ var id_1 = 3 ;
243
243
var specialStr_1 = '76.1.3_1' ;
244
244
var contentLength_1 = 26 ;
245
245
var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
246
- var id_2 = 2 ;
246
+ var id_2 = 4 ;
247
247
var specialStr_2 = '76.1.3_2' ;
248
248
var contentLength_2 = 30 ;
249
249
var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
250
250
251
251
async . series ( [
252
252
function ( cb ) {
253
- updateClobTable1 ( id_1 , content_1 , cb ) ;
253
+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
254
254
} ,
255
255
function ( cb ) {
256
- updateClobTable1 ( id_2 , content_2 , cb ) ;
256
+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
257
257
} ,
258
258
function ( cb ) {
259
259
connection . execute (
260
- "SELECT ID, C from nodb_clob1" ,
260
+ "SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
261
261
function ( err , result ) {
262
262
should . not . exist ( err ) ;
263
263
var specialStrLen_1 = specialStr_1 . length ;
@@ -278,26 +278,26 @@ describe('76. fetchClobAsString.js', function() {
278
278
] , done ) ;
279
279
} ) ; // 76.1.3
280
280
281
- it ( '76.1.4 fetch same CLOB column multiple times' , function ( done ) {
282
- var id_1 = 1 ;
281
+ it ( '76.1.4 fetch the same CLOB column multiple times' , function ( done ) {
282
+ var id_1 = 5 ;
283
283
var specialStr_1 = '76.1.4_1' ;
284
284
var contentLength_1 = 20 ;
285
285
var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
286
- var id_2 = 2 ;
286
+ var id_2 = 6 ;
287
287
var specialStr_2 = '76.1.4_2' ;
288
288
var contentLength_2 = 36 ;
289
289
var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
290
290
291
291
async . series ( [
292
292
function ( cb ) {
293
- updateClobTable1 ( id_1 , content_1 , cb ) ;
293
+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
294
294
} ,
295
295
function ( cb ) {
296
- updateClobTable1 ( id_2 , content_2 , cb ) ;
296
+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
297
297
} ,
298
298
function ( cb ) {
299
299
connection . execute (
300
- "SELECT ID, C AS C1, C AS C2 from nodb_clob1" ,
300
+ "SELECT ID, C AS C1, C AS C2 from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
301
301
function ( err , result ) {
302
302
should . not . exist ( err ) ;
303
303
var specialStrLen_1 = specialStr_1 . length ;
@@ -325,7 +325,7 @@ describe('76. fetchClobAsString.js', function() {
325
325
} ) ; // 76.1.4
326
326
327
327
it ( '76.1.5 works with (64K - 1) value' , function ( done ) {
328
- var id = 5 ;
328
+ var id = 7 ;
329
329
var specialStr = '76.1.5' ;
330
330
var contentLength = 65535 ;
331
331
var content = getRandomString ( contentLength , specialStr ) ;
@@ -352,8 +352,8 @@ describe('76. fetchClobAsString.js', function() {
352
352
] , done ) ;
353
353
} ) ; // 76.1.5
354
354
355
- it ( '76.1.6 fetch with substr' , function ( done ) {
356
- var id = 6 ;
355
+ it ( '76.1.6 fetch with substr() ' , function ( done ) {
356
+ var id = 8 ;
357
357
var specialStr = '76.1.6' ;
358
358
var specialStrLen = specialStr . length ;
359
359
var contentLength = 100 ;
@@ -379,9 +379,9 @@ describe('76. fetchClobAsString.js', function() {
379
379
] , done ) ;
380
380
} ) ; // 76.1.6
381
381
382
- it ( '76.1.7 works with EMPTY_CLOB' , function ( done ) {
383
- var id = 7 ;
384
- var content = "EMPTY_CLOB" ;
382
+ it ( '76.1.7 works with EMPTY_CLOB() ' , function ( done ) {
383
+ var id = 9 ;
384
+ var content = "EMPTY_CLOB() " ;
385
385
386
386
async . series ( [
387
387
function ( cb ) {
@@ -401,8 +401,8 @@ describe('76. fetchClobAsString.js', function() {
401
401
] , done ) ;
402
402
} ) ; // 76.1.7
403
403
404
- it ( '76.1.8 fetch clob using stream' , function ( done ) {
405
- var id = 8 ;
404
+ it ( '76.1.8 fetch CLOB with stream' , function ( done ) {
405
+ var id = 10 ;
406
406
var specialStr = '76.1.8' ;
407
407
var contentLength = 40 ;
408
408
var content = getRandomString ( contentLength , specialStr ) ;
@@ -451,7 +451,7 @@ describe('76. fetchClobAsString.js', function() {
451
451
} ) ; // 76.1.8
452
452
453
453
it ( '76.1.9 works with REF CURSOR' , function ( done ) {
454
- var id = 9 ;
454
+ var id = 11 ;
455
455
var specialStr = '76.1.9' ;
456
456
var contentLength = 26 ;
457
457
var content = getRandomString ( contentLength , specialStr ) ;
@@ -510,9 +510,56 @@ describe('76. fetchClobAsString.js', function() {
510
510
] , done ) ;
511
511
} ) ; // 76.1.9
512
512
513
+ it ( '76.1.10 work with update' , function ( done ) {
514
+ var id = 12 ;
515
+ var specialStr_1 = '76.1.10_1' ;
516
+ var contentLength_1 = 26 ;
517
+ var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
518
+ var specialStr_2 = '76.1.10_2' ;
519
+ var contentLength_2 = 30 ;
520
+ var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
521
+
522
+ async . series ( [
523
+ function ( cb ) {
524
+ insertIntoClobTable1 ( id , content_1 , cb ) ;
525
+ } ,
526
+ function ( cb ) {
527
+ connection . execute (
528
+ "SELECT ID, C from nodb_clob1 where id = " + id ,
529
+ function ( err , result ) {
530
+ should . not . exist ( err ) ;
531
+ var specialStrLen = specialStr_1 . length ;
532
+ var resultLen = result . rows [ 0 ] [ 1 ] . length ;
533
+ should . equal ( result . rows [ 0 ] [ 1 ] . length , contentLength_1 ) ;
534
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( 0 , specialStrLen ) , specialStr_1 ) ;
535
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( resultLen - specialStrLen , resultLen ) , specialStr_1 ) ;
536
+ cb ( ) ;
537
+ }
538
+ ) ;
539
+ } ,
540
+ function ( cb ) {
541
+ updateClobTable1 ( id , content_2 , cb ) ;
542
+ } ,
543
+ function ( cb ) {
544
+ connection . execute (
545
+ "SELECT ID, C from nodb_clob1 where id = " + id ,
546
+ function ( err , result ) {
547
+ should . not . exist ( err ) ;
548
+ var specialStrLen = specialStr_2 . length ;
549
+ var resultLen = result . rows [ 0 ] [ 1 ] . length ;
550
+ should . equal ( result . rows [ 0 ] [ 1 ] . length , contentLength_2 ) ;
551
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( 0 , specialStrLen ) , specialStr_2 ) ;
552
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( resultLen - specialStrLen , resultLen ) , specialStr_2 ) ;
553
+ cb ( ) ;
554
+ }
555
+ ) ;
556
+ }
557
+ ] , done ) ;
558
+ } ) ; // 76.1.10
559
+
513
560
} ) ; // 76.1
514
561
515
- describe ( '76.2 fetch CLOB columns by set fetchInfo option' , function ( ) {
562
+ describe ( '76.2 fetch CLOB columns by setting fetchInfo option' , function ( ) {
516
563
before ( 'create Table and populate' , function ( done ) {
517
564
connection . execute (
518
565
proc_create_table1 ,
@@ -556,7 +603,7 @@ describe('76. fetchClobAsString.js', function() {
556
603
] , done ) ;
557
604
} ) ; // 76.2.1
558
605
559
- it ( '76.2.2 works with small clob data, the length of string is 26 ' , function ( done ) {
606
+ it ( '76.2.2 works with small CLOB data' , function ( done ) {
560
607
var id = 2 ;
561
608
var specialStr = '76.2.2' ;
562
609
var contentLength = 26 ;
@@ -585,26 +632,26 @@ describe('76. fetchClobAsString.js', function() {
585
632
] , done ) ;
586
633
} ) ; // 76.2.2
587
634
588
- it ( '76.2.3 fetch multiple CLOB column as string ' , function ( done ) {
589
- var id_1 = 1 ;
635
+ it ( '76.2.3 fetch multiple CLOB columns as String ' , function ( done ) {
636
+ var id_1 = 3 ;
590
637
var specialStr_1 = '76.2.3_1' ;
591
638
var contentLength_1 = 26 ;
592
639
var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
593
- var id_2 = 2 ;
640
+ var id_2 = 4 ;
594
641
var specialStr_2 = '76.2.3_2' ;
595
642
var contentLength_2 = 30 ;
596
643
var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
597
644
598
645
async . series ( [
599
646
function ( cb ) {
600
- updateClobTable1 ( id_1 , content_1 , cb ) ;
647
+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
601
648
} ,
602
649
function ( cb ) {
603
- updateClobTable1 ( id_2 , content_2 , cb ) ;
650
+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
604
651
} ,
605
652
function ( cb ) {
606
653
connection . execute (
607
- "SELECT ID, C from nodb_clob1" ,
654
+ "SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
608
655
{ } ,
609
656
{ fetchInfo : { C : { type : oracledb . STRING } } } ,
610
657
function ( err , result ) {
@@ -627,32 +674,32 @@ describe('76. fetchClobAsString.js', function() {
627
674
] , done ) ;
628
675
} ) ; // 76.2.3
629
676
630
- it ( '76.2.4 fetch same CLOB column multiple times' , function ( done ) {
631
- var id_1 = 1 ;
677
+ it ( '76.2.4 fetch the same CLOB column multiple times' , function ( done ) {
678
+ var id_1 = 5 ;
632
679
var specialStr_1 = '76.2.4_1' ;
633
680
var contentLength_1 = 20 ;
634
681
var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
635
- var id_2 = 2 ;
682
+ var id_2 = 6 ;
636
683
var specialStr_2 = '76.2.4_2' ;
637
684
var contentLength_2 = 36 ;
638
685
var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
639
686
640
687
async . series ( [
641
688
function ( cb ) {
642
- updateClobTable1 ( id_1 , content_1 , cb ) ;
689
+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
643
690
} ,
644
691
function ( cb ) {
645
- updateClobTable1 ( id_2 , content_2 , cb ) ;
692
+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
646
693
} ,
647
694
function ( cb ) {
648
695
connection . execute (
649
- "SELECT ID, C AS C1, C AS C2 from nodb_clob1" ,
696
+ "SELECT ID, C AS C1, C AS C2 from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
650
697
{ } ,
651
698
{ fetchInfo :
652
- {
653
- C1 : { type : oracledb . STRING } ,
654
- C2 : { type : oracledb . STRING }
655
- }
699
+ {
700
+ C1 : { type : oracledb . STRING } ,
701
+ C2 : { type : oracledb . STRING }
702
+ }
656
703
} ,
657
704
function ( err , result ) {
658
705
should . not . exist ( err ) ;
@@ -681,7 +728,7 @@ describe('76. fetchClobAsString.js', function() {
681
728
} ) ; // 76.2.4
682
729
683
730
it ( '76.2.5 works with (64K - 1) value' , function ( done ) {
684
- var id = 5 ;
731
+ var id = 7 ;
685
732
var specialStr = '76.2.5' ;
686
733
var contentLength = 65535 ;
687
734
var content = getRandomString ( contentLength , specialStr ) ;
@@ -709,8 +756,8 @@ describe('76. fetchClobAsString.js', function() {
709
756
] , done ) ;
710
757
} ) ; // 76.2.5
711
758
712
- it ( '76.2.6 works with substr' , function ( done ) {
713
- var id = 6 ;
759
+ it ( '76.2.6 works with substr() ' , function ( done ) {
760
+ var id = 8 ;
714
761
var specialStr = '76.2.6' ;
715
762
var specialStrLen = specialStr . length ;
716
763
var contentLength = 100 ;
@@ -737,9 +784,9 @@ describe('76. fetchClobAsString.js', function() {
737
784
] , done ) ;
738
785
} ) ; // 76.2.6
739
786
740
- it ( '76.2.7 works with EMPTY_CLOB' , function ( done ) {
741
- var id = 7 ;
742
- var content = "EMPTY_CLOB" ;
787
+ it ( '76.2.7 works with EMPTY_CLOB() ' , function ( done ) {
788
+ var id = 9 ;
789
+ var content = "EMPTY_CLOB() " ;
743
790
744
791
async . series ( [
745
792
function ( cb ) {
@@ -760,9 +807,60 @@ describe('76. fetchClobAsString.js', function() {
760
807
] , done ) ;
761
808
} ) ; // 76.2.7
762
809
810
+ it ( '76.2.8 work with UPDATE statement' , function ( done ) {
811
+ var id = 10 ;
812
+ var specialStr_1 = '76.2.10_1' ;
813
+ var contentLength_1 = 26 ;
814
+ var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
815
+ var specialStr_2 = '76.2.10_2' ;
816
+ var contentLength_2 = 30 ;
817
+ var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
818
+
819
+ async . series ( [
820
+ function ( cb ) {
821
+ insertIntoClobTable1 ( id , content_1 , cb ) ;
822
+ } ,
823
+ function ( cb ) {
824
+ connection . execute (
825
+ "SELECT ID, C from nodb_clob1 where id = :id" ,
826
+ { id : id } ,
827
+ { fetchInfo : { C : { type : oracledb . STRING } } } ,
828
+ function ( err , result ) {
829
+ should . not . exist ( err ) ;
830
+ var specialStrLen = specialStr_1 . length ;
831
+ var resultLen = result . rows [ 0 ] [ 1 ] . length ;
832
+ should . equal ( result . rows [ 0 ] [ 1 ] . length , contentLength_1 ) ;
833
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( 0 , specialStrLen ) , specialStr_1 ) ;
834
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( resultLen - specialStrLen , resultLen ) , specialStr_1 ) ;
835
+ cb ( ) ;
836
+ }
837
+ ) ;
838
+ } ,
839
+ function ( cb ) {
840
+ updateClobTable1 ( id , content_2 , cb ) ;
841
+ } ,
842
+ function ( cb ) {
843
+ connection . execute (
844
+ "SELECT ID, C from nodb_clob1 where id = :id" ,
845
+ { id : id } ,
846
+ { fetchInfo : { C : { type : oracledb . STRING } } } ,
847
+ function ( err , result ) {
848
+ should . not . exist ( err ) ;
849
+ var specialStrLen = specialStr_2 . length ;
850
+ var resultLen = result . rows [ 0 ] [ 1 ] . length ;
851
+ should . equal ( result . rows [ 0 ] [ 1 ] . length , contentLength_2 ) ;
852
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( 0 , specialStrLen ) , specialStr_2 ) ;
853
+ should . strictEqual ( result . rows [ 0 ] [ 1 ] . substring ( resultLen - specialStrLen , resultLen ) , specialStr_2 ) ;
854
+ cb ( ) ;
855
+ }
856
+ ) ;
857
+ }
858
+ ] , done ) ;
859
+ } ) ; // 76.2.8
860
+
763
861
} ) ; // 76.2
764
862
765
- describe ( '76.3 fetch mutiple CLOBs' , function ( ) {
863
+ describe ( '76.3 fetch multiple CLOBs' , function ( ) {
766
864
before ( 'create Table and populate' , function ( done ) {
767
865
connection . execute (
768
866
proc_create_table2 ,
@@ -794,7 +892,7 @@ describe('76. fetchClobAsString.js', function() {
794
892
done ( ) ;
795
893
} ) ; // afterEach
796
894
797
- it ( '76.3.1 fetch mutiple CLOB columns as string ' , function ( done ) {
895
+ it ( '76.3.1 fetch multiple CLOB columns as String ' , function ( done ) {
798
896
var id = 1 ;
799
897
var specialStr_1 = '76.3.1_1' ;
800
898
var contentLength_1 = 26 ;
0 commit comments