@@ -40,10 +40,10 @@ var should = require('should');
40
40
var dbConfig = require ( './dbconfig.js' ) ;
41
41
var assist = require ( './dataTypeAssist.js' ) ;
42
42
43
- var inFileName = './ test/clobexample.txt' ; // the file with text to be inserted into the database
44
- var outFileName = './ test/clobstreamout.txt' ;
43
+ var inFileName = 'test/clobexample.txt' ; // the file with text to be inserted into the database
44
+ var outFileName = 'test/clobstreamout.txt' ;
45
45
46
- describe . skip ( '40. dataTypeClob.js' , function ( ) {
46
+ describe ( '40. dataTypeClob.js' , function ( ) {
47
47
48
48
var connection = null ;
49
49
var tableName = "nodb_myclobs" ;
@@ -90,12 +90,6 @@ describe.skip('40. dataTypeClob.js', function() {
90
90
async . series ( [
91
91
function clobinsert1 ( callback ) {
92
92
93
- var lobFinishEventFired = false ;
94
- setTimeout ( function ( ) {
95
- lobFinishEventFired . should . equal ( true , "lob does not fire 'finish' event!" ) ;
96
- callback ( ) ;
97
- } , 2000 ) ;
98
-
99
93
connection . execute (
100
94
"INSERT INTO nodb_myclobs (num, content) VALUES (:n, EMPTY_CLOB()) RETURNING content INTO :lobbv" ,
101
95
{ n : 1 , lobbv : { type : oracledb . CLOB , dir : oracledb . BIND_OUT } } ,
@@ -116,11 +110,11 @@ describe.skip('40. dataTypeClob.js', function() {
116
110
should . not . exist ( err , "inStream.on 'error' event" ) ;
117
111
} ) ;
118
112
119
- lob . on ( 'finish' , function ( ) {
120
- lobFinishEventFired = true ;
113
+ lob . on ( 'close' , function ( ) {
121
114
// now commit updates
122
115
connection . commit ( function ( err ) {
123
116
should . not . exist ( err ) ;
117
+ callback ( ) ;
124
118
} ) ;
125
119
} ) ;
126
120
@@ -129,12 +123,6 @@ describe.skip('40. dataTypeClob.js', function() {
129
123
) ;
130
124
} ,
131
125
function clobstream1 ( callback ) {
132
- var streamFinishEventFired = false ;
133
- setTimeout ( function ( ) {
134
- streamFinishEventFired . should . equal ( true , "stream does not call 'Finish' Event!" ) ;
135
- callback ( ) ;
136
- } , 2000 ) ;
137
-
138
126
connection . execute (
139
127
"SELECT content FROM nodb_myclobs WHERE num = :n" ,
140
128
{ n : 1 } ,
@@ -156,7 +144,7 @@ describe.skip('40. dataTypeClob.js', function() {
156
144
157
145
lob . pipe ( outStream ) ;
158
146
159
- outStream . on ( 'finish ' , function ( ) {
147
+ outStream . on ( 'close ' , function ( ) {
160
148
161
149
fs . readFile ( inFileName , { encoding : 'utf8' } , function ( err , originalData ) {
162
150
should . not . exist ( err ) ;
@@ -165,22 +153,15 @@ describe.skip('40. dataTypeClob.js', function() {
165
153
should . not . exist ( err ) ;
166
154
originalData . should . equal ( generatedData ) ;
167
155
168
- streamFinishEventFired = true ;
156
+ callback ( ) ;
169
157
} ) ;
170
158
} ) ;
171
159
} ) ;
160
+
172
161
}
173
162
) ;
174
163
} ,
175
164
function clobstream2 ( callback ) {
176
- var lobEndEventFired = false ;
177
- var lobDataEventFired = false ;
178
- setTimeout ( function ( ) {
179
- lobDataEventFired . should . equal ( true , "lob does not call 'data' event!" ) ;
180
- lobEndEventFired . should . equal ( true , "lob does not call 'end' event!" ) ;
181
- callback ( ) ;
182
- } , 2000 ) ;
183
-
184
165
connection . execute (
185
166
"SELECT content FROM nodb_myclobs WHERE num = :n" ,
186
167
{ n : 1 } ,
@@ -193,19 +174,15 @@ describe.skip('40. dataTypeClob.js', function() {
193
174
lob . setEncoding ( 'utf8' ) ; // set the encoding so we get a 'string' not a 'buffer'
194
175
195
176
lob . on ( 'data' , function ( chunk ) {
196
- // console.log("lob.on 'data' event");
197
- // console.log(' - got %d bytes of data', chunk.length);
198
- lobDataEventFired = true ;
199
177
clob += chunk ;
200
178
} ) ;
201
179
202
- lob . on ( 'end ' , function ( ) {
180
+ lob . on ( 'close ' , function ( ) {
203
181
fs . readFile ( inFileName , { encoding : 'utf8' } , function ( err , data ) {
204
182
should . not . exist ( err ) ;
205
- lobEndEventFired = true ;
206
-
207
183
data . length . should . be . exactly ( clob . length ) ;
208
184
data . should . equal ( clob ) ;
185
+ callback ( ) ;
209
186
} ) ;
210
187
} ) ;
211
188
@@ -216,14 +193,6 @@ describe.skip('40. dataTypeClob.js', function() {
216
193
) ;
217
194
} ,
218
195
function objectOutFormat ( callback ) {
219
- var lobEndEventFired = false ;
220
- var lobDataEventFired = false ;
221
- setTimeout ( function ( ) {
222
- lobDataEventFired . should . equal ( true , "lob does not call 'data' event!" ) ;
223
- lobEndEventFired . should . equal ( true , "lob does not call 'end' event!" ) ;
224
- callback ( ) ;
225
- } , 2000 ) ;
226
-
227
196
connection . execute (
228
197
"SELECT content FROM nodb_myclobs WHERE num = :n" ,
229
198
{ n : 1 } ,
@@ -238,12 +207,11 @@ describe.skip('40. dataTypeClob.js', function() {
238
207
lob . setEncoding ( 'utf8' ) ;
239
208
240
209
lob . on ( 'data' , function ( chunk ) {
241
- lobDataEventFired = true ;
242
210
clob = clob + chunk ;
243
211
} ) ;
244
212
245
- lob . on ( 'end ' , function ( ) {
246
- lobEndEventFired = true ;
213
+ lob . on ( 'close ' , function ( ) {
214
+ callback ( ) ;
247
215
} ) ;
248
216
249
217
lob . on ( 'error' , function ( err ) {
0 commit comments