@@ -155,7 +155,7 @@ describe('76. fetchClobAsString.js', function() {
155155 return str ;
156156 } ;
157157
158- describe ( '76.1 fetch clob columns by set oracledb.fetchAsString' , function ( ) {
158+ describe ( '76.1 fetch CLOB columns by setting oracledb.fetchAsString' , function ( ) {
159159
160160 before ( 'create Table and populate' , function ( done ) {
161161 connection . execute (
@@ -210,7 +210,7 @@ describe('76. fetchClobAsString.js', function() {
210210 ] , done ) ;
211211 } ) ; // 76.1.1
212212
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 ) {
214214 var id = 2 ;
215215 var specialStr = '76.1.2' ;
216216 var contentLength = 26 ;
@@ -238,26 +238,26 @@ describe('76. fetchClobAsString.js', function() {
238238 ] , done ) ;
239239 } ) ; // 76.1.2
240240
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 ;
243243 var specialStr_1 = '76.1.3_1' ;
244244 var contentLength_1 = 26 ;
245245 var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
246- var id_2 = 2 ;
246+ var id_2 = 4 ;
247247 var specialStr_2 = '76.1.3_2' ;
248248 var contentLength_2 = 30 ;
249249 var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
250250
251251 async . series ( [
252252 function ( cb ) {
253- updateClobTable1 ( id_1 , content_1 , cb ) ;
253+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
254254 } ,
255255 function ( cb ) {
256- updateClobTable1 ( id_2 , content_2 , cb ) ;
256+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
257257 } ,
258258 function ( cb ) {
259259 connection . execute (
260- "SELECT ID, C from nodb_clob1" ,
260+ "SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
261261 function ( err , result ) {
262262 should . not . exist ( err ) ;
263263 var specialStrLen_1 = specialStr_1 . length ;
@@ -278,26 +278,26 @@ describe('76. fetchClobAsString.js', function() {
278278 ] , done ) ;
279279 } ) ; // 76.1.3
280280
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 ;
283283 var specialStr_1 = '76.1.4_1' ;
284284 var contentLength_1 = 20 ;
285285 var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
286- var id_2 = 2 ;
286+ var id_2 = 6 ;
287287 var specialStr_2 = '76.1.4_2' ;
288288 var contentLength_2 = 36 ;
289289 var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
290290
291291 async . series ( [
292292 function ( cb ) {
293- updateClobTable1 ( id_1 , content_1 , cb ) ;
293+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
294294 } ,
295295 function ( cb ) {
296- updateClobTable1 ( id_2 , content_2 , cb ) ;
296+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
297297 } ,
298298 function ( cb ) {
299299 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 ,
301301 function ( err , result ) {
302302 should . not . exist ( err ) ;
303303 var specialStrLen_1 = specialStr_1 . length ;
@@ -325,7 +325,7 @@ describe('76. fetchClobAsString.js', function() {
325325 } ) ; // 76.1.4
326326
327327 it ( '76.1.5 works with (64K - 1) value' , function ( done ) {
328- var id = 5 ;
328+ var id = 7 ;
329329 var specialStr = '76.1.5' ;
330330 var contentLength = 65535 ;
331331 var content = getRandomString ( contentLength , specialStr ) ;
@@ -352,8 +352,8 @@ describe('76. fetchClobAsString.js', function() {
352352 ] , done ) ;
353353 } ) ; // 76.1.5
354354
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 ;
357357 var specialStr = '76.1.6' ;
358358 var specialStrLen = specialStr . length ;
359359 var contentLength = 100 ;
@@ -379,9 +379,9 @@ describe('76. fetchClobAsString.js', function() {
379379 ] , done ) ;
380380 } ) ; // 76.1.6
381381
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() " ;
385385
386386 async . series ( [
387387 function ( cb ) {
@@ -401,8 +401,8 @@ describe('76. fetchClobAsString.js', function() {
401401 ] , done ) ;
402402 } ) ; // 76.1.7
403403
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 ;
406406 var specialStr = '76.1.8' ;
407407 var contentLength = 40 ;
408408 var content = getRandomString ( contentLength , specialStr ) ;
@@ -451,7 +451,7 @@ describe('76. fetchClobAsString.js', function() {
451451 } ) ; // 76.1.8
452452
453453 it ( '76.1.9 works with REF CURSOR' , function ( done ) {
454- var id = 9 ;
454+ var id = 11 ;
455455 var specialStr = '76.1.9' ;
456456 var contentLength = 26 ;
457457 var content = getRandomString ( contentLength , specialStr ) ;
@@ -510,9 +510,56 @@ describe('76. fetchClobAsString.js', function() {
510510 ] , done ) ;
511511 } ) ; // 76.1.9
512512
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+
513560 } ) ; // 76.1
514561
515- describe ( '76.2 fetch CLOB columns by set fetchInfo option' , function ( ) {
562+ describe ( '76.2 fetch CLOB columns by setting fetchInfo option' , function ( ) {
516563 before ( 'create Table and populate' , function ( done ) {
517564 connection . execute (
518565 proc_create_table1 ,
@@ -556,7 +603,7 @@ describe('76. fetchClobAsString.js', function() {
556603 ] , done ) ;
557604 } ) ; // 76.2.1
558605
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 ) {
560607 var id = 2 ;
561608 var specialStr = '76.2.2' ;
562609 var contentLength = 26 ;
@@ -585,26 +632,26 @@ describe('76. fetchClobAsString.js', function() {
585632 ] , done ) ;
586633 } ) ; // 76.2.2
587634
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 ;
590637 var specialStr_1 = '76.2.3_1' ;
591638 var contentLength_1 = 26 ;
592639 var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
593- var id_2 = 2 ;
640+ var id_2 = 4 ;
594641 var specialStr_2 = '76.2.3_2' ;
595642 var contentLength_2 = 30 ;
596643 var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
597644
598645 async . series ( [
599646 function ( cb ) {
600- updateClobTable1 ( id_1 , content_1 , cb ) ;
647+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
601648 } ,
602649 function ( cb ) {
603- updateClobTable1 ( id_2 , content_2 , cb ) ;
650+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
604651 } ,
605652 function ( cb ) {
606653 connection . execute (
607- "SELECT ID, C from nodb_clob1" ,
654+ "SELECT ID, C from nodb_clob1 where id = " + id_1 + " or id = " + id_2 ,
608655 { } ,
609656 { fetchInfo : { C : { type : oracledb . STRING } } } ,
610657 function ( err , result ) {
@@ -627,32 +674,32 @@ describe('76. fetchClobAsString.js', function() {
627674 ] , done ) ;
628675 } ) ; // 76.2.3
629676
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 ;
632679 var specialStr_1 = '76.2.4_1' ;
633680 var contentLength_1 = 20 ;
634681 var content_1 = getRandomString ( contentLength_1 , specialStr_1 ) ;
635- var id_2 = 2 ;
682+ var id_2 = 6 ;
636683 var specialStr_2 = '76.2.4_2' ;
637684 var contentLength_2 = 36 ;
638685 var content_2 = getRandomString ( contentLength_2 , specialStr_2 ) ;
639686
640687 async . series ( [
641688 function ( cb ) {
642- updateClobTable1 ( id_1 , content_1 , cb ) ;
689+ insertIntoClobTable1 ( id_1 , content_1 , cb ) ;
643690 } ,
644691 function ( cb ) {
645- updateClobTable1 ( id_2 , content_2 , cb ) ;
692+ insertIntoClobTable1 ( id_2 , content_2 , cb ) ;
646693 } ,
647694 function ( cb ) {
648695 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 ,
650697 { } ,
651698 { 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+ }
656703 } ,
657704 function ( err , result ) {
658705 should . not . exist ( err ) ;
@@ -681,7 +728,7 @@ describe('76. fetchClobAsString.js', function() {
681728 } ) ; // 76.2.4
682729
683730 it ( '76.2.5 works with (64K - 1) value' , function ( done ) {
684- var id = 5 ;
731+ var id = 7 ;
685732 var specialStr = '76.2.5' ;
686733 var contentLength = 65535 ;
687734 var content = getRandomString ( contentLength , specialStr ) ;
@@ -709,8 +756,8 @@ describe('76. fetchClobAsString.js', function() {
709756 ] , done ) ;
710757 } ) ; // 76.2.5
711758
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 ;
714761 var specialStr = '76.2.6' ;
715762 var specialStrLen = specialStr . length ;
716763 var contentLength = 100 ;
@@ -737,9 +784,9 @@ describe('76. fetchClobAsString.js', function() {
737784 ] , done ) ;
738785 } ) ; // 76.2.6
739786
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() " ;
743790
744791 async . series ( [
745792 function ( cb ) {
@@ -760,9 +807,60 @@ describe('76. fetchClobAsString.js', function() {
760807 ] , done ) ;
761808 } ) ; // 76.2.7
762809
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+
763861 } ) ; // 76.2
764862
765- describe ( '76.3 fetch mutiple CLOBs' , function ( ) {
863+ describe ( '76.3 fetch multiple CLOBs' , function ( ) {
766864 before ( 'create Table and populate' , function ( done ) {
767865 connection . execute (
768866 proc_create_table2 ,
@@ -794,7 +892,7 @@ describe('76. fetchClobAsString.js', function() {
794892 done ( ) ;
795893 } ) ; // afterEach
796894
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 ) {
798896 var id = 1 ;
799897 var specialStr_1 = '76.3.1_1' ;
800898 var contentLength_1 = 26 ;
0 commit comments