@@ -42,6 +42,7 @@ const fs = require('fs');
42
42
const assert = require ( 'assert' ) ;
43
43
const dbConfig = require ( './dbconfig.js' ) ;
44
44
const assist = require ( './dataTypeAssist.js' ) ;
45
+ const testsUtil = require ( './testsUtil.js' ) ;
45
46
46
47
let inFileName = 'test/clobexample.txt' ; // the file with text to be inserted into the database
47
48
let outFileName = 'test/clobstreamout.txt' ; // output file with the stream out data
@@ -170,4 +171,43 @@ describe('40. dataTypeClob.js', function() {
170
171
await assist . verifyNullValues ( connection , tableName ) ;
171
172
} ) ;
172
173
} ) ;
174
+
175
+ describe ( '40.3 Read CLOB data on meta data change' , function ( ) {
176
+ let connection = null ;
177
+ const tableNameCLOB = 'nodb_myclobs_re_create' ;
178
+ const sqlCreateQuery = `
179
+ CREATE TABLE ${ tableNameCLOB } (
180
+ num NUMBER,
181
+ content CLOB
182
+ )` ;
183
+ const sqlDrop = testsUtil . sqlDropTable ( tableNameCLOB ) ;
184
+ const sqlCreate = testsUtil . sqlCreateTable ( tableNameCLOB , sqlCreateQuery ) ;
185
+ const insertSql = `INSERT INTO ${ tableNameCLOB } (num, content) ` +
186
+ `VALUES (:n, 'CLOB')` ;
187
+ const selectSql = `SELECT content FROM ${ tableNameCLOB } WHERE num = 1` ;
188
+
189
+ before ( async function ( ) {
190
+ oracledb . fetchAsString = [ oracledb . CLOB ] ;
191
+ connection = await oracledb . getConnection ( dbConfig ) ;
192
+ await connection . execute ( sqlCreate ) ;
193
+ await connection . execute ( insertSql , { n : 1 } , { autoCommit : false } ) ;
194
+ } ) ;
195
+
196
+ after ( async function ( ) {
197
+ oracledb . fetchAsString = [ ] ;
198
+ await connection . execute ( sqlDrop ) ;
199
+ await connection . close ( ) ;
200
+ } ) ;
201
+
202
+ it ( '40.3.1 Recreate table after CLOB column is read and statement is in statement cache' ,
203
+ async function ( ) {
204
+ await connection . execute ( selectSql , { } , { keepInStmtCache : true } ) ;
205
+ await connection . execute ( sqlDrop ) ;
206
+ await connection . execute ( sqlCreate ) ;
207
+ await connection . execute ( insertSql , { n : 1 } , { autoCommit : false } ) ;
208
+ await connection . execute ( selectSql ) ;
209
+ } ) ;
210
+
211
+ } ) ;
212
+
173
213
} ) ;
0 commit comments