22
22
* 142. urowidFunctionBindAsString3.js
23
23
*
24
24
* DESCRIPTION
25
- * Testing UROWID(> 50 bytes) plsql function bind in/out as String.
25
+ * Testing UROWID(> 200 bytes) plsql function bind in/out as String.
26
26
*
27
27
* NUMBERING RULE
28
28
* Test numbers follow this numbering rule:
@@ -59,7 +59,7 @@ describe('142. urowidFunctionBindAsString3.js', function() {
59
59
" EXECUTE IMMEDIATE ( ' \n" +
60
60
" CREATE TABLE " + tableName_indexed + " ( \n" +
61
61
" c1 NUMBER, \n" +
62
- " c2 VARCHAR2(3000 ), \n" +
62
+ " c2 VARCHAR2(3189 ), \n" +
63
63
" primary key(c1, c2) \n" +
64
64
" ) organization index \n" +
65
65
" '); \n" +
@@ -146,18 +146,18 @@ describe('142. urowidFunctionBindAsString3.js', function() {
146
146
sql . executeSql ( connection , fun_drop , { } , { } , done ) ;
147
147
} ) ;
148
148
149
- it ( '142.1.1 urowid length > 50 ' , function ( done ) {
150
- var exceptedLen = 50 ;
149
+ it ( '142.1.1 urowid length > 200 ' , function ( done ) {
150
+ var exceptedLen = 200 ;
151
151
funBindOut ( fun_execute , exceptedLen , done ) ;
152
152
} ) ;
153
153
154
- it ( '142.1.2 urowid length > 100 ' , function ( done ) {
155
- var exceptedLen = 100 ;
154
+ it ( '142.1.2 urowid length > 500 ' , function ( done ) {
155
+ var exceptedLen = 500 ;
156
156
funBindOut ( fun_execute , exceptedLen , done ) ;
157
157
} ) ;
158
158
159
- it . skip ( '142.1.3 urowid length > 200 ' , function ( done ) {
160
- var exceptedLen = 200 ;
159
+ it ( '142.1.3 urowid length > 2000 ' , function ( done ) {
160
+ var exceptedLen = 2000 ;
161
161
funBindOut ( fun_execute , exceptedLen , done ) ;
162
162
} ) ;
163
163
@@ -183,25 +183,25 @@ describe('142. urowidFunctionBindAsString3.js', function() {
183
183
sql . executeSql ( connection , fun_drop , { } , { } , done ) ;
184
184
} ) ;
185
185
186
- it ( '142.2.1 urowid length > 50 ' , function ( done ) {
187
- var exceptedLen = 50 ;
186
+ it ( '142.2.1 urowid length > 200 ' , function ( done ) {
187
+ var exceptedLen = 200 ;
188
188
funBindOut ( fun_execute , exceptedLen , done ) ;
189
189
} ) ;
190
190
191
- it ( '142.2.2 urowid length > 100 ' , function ( done ) {
192
- var exceptedLen = 100 ;
191
+ it ( '142.2.2 urowid length > 500 ' , function ( done ) {
192
+ var exceptedLen = 500 ;
193
193
funBindOut ( fun_execute , exceptedLen , done ) ;
194
194
} ) ;
195
195
196
- it . skip ( '142.2.3 urowid length > 200 ' , function ( done ) {
197
- var exceptedLen = 200 ;
196
+ it ( '142.2.3 urowid length > 2000 ' , function ( done ) {
197
+ var exceptedLen = 2000 ;
198
198
funBindOut ( fun_execute , exceptedLen , done ) ;
199
199
} ) ;
200
200
201
201
} ) ;
202
202
203
203
describe ( '142.3 FUNCTION BIND_IN, UPDATE' , function ( ) {
204
- var fun_create = "CREATE OR REPLACE FUNCTION nodb_rowid_bind_1083 (id_in IN NUMBER, content_1 IN STRING , content_2 IN UROWID) RETURN UROWID\n" +
204
+ var fun_create = "CREATE OR REPLACE FUNCTION nodb_rowid_bind_1083 (id_in IN NUMBER, content_1 IN VARCHAR2 , content_2 IN UROWID) RETURN UROWID\n" +
205
205
"IS \n" +
206
206
" tmp UROWID; \n" +
207
207
"BEGIN \n" +
@@ -221,21 +221,21 @@ describe('142. urowidFunctionBindAsString3.js', function() {
221
221
sql . executeSql ( connection , fun_drop , { } , { } , done ) ;
222
222
} ) ;
223
223
224
- it ( '142.3.1 update with UROWID > 50 ' , function ( done ) {
224
+ it ( '142.3.1 update with UROWID > 200 ' , function ( done ) {
225
225
var contentLen_1 = 10 ;
226
- var contentLen_2 = 50 ;
226
+ var contentLen_2 = 200 ;
227
227
funBindOut_update ( fun_exec , contentLen_1 , contentLen_2 , done ) ;
228
228
} ) ;
229
229
230
- it ( '142.3.2 update with UROWID > 100 ' , function ( done ) {
230
+ it ( '142.3.2 update with UROWID > 500 ' , function ( done ) {
231
231
var contentLen_1 = 50 ;
232
- var contentLen_2 = 100 ;
232
+ var contentLen_2 = 500 ;
233
233
funBindOut_update ( fun_exec , contentLen_1 , contentLen_2 , done ) ;
234
234
} ) ;
235
235
236
- it . skip ( '142.3.3 update with UROWID > 200 ' , function ( done ) {
236
+ it ( '142.3.3 update with UROWID > 2000 ' , function ( done ) {
237
237
var contentLen_1 = 50 ;
238
- var contentLen_2 = 200 ;
238
+ var contentLen_2 = 2000 ;
239
239
funBindOut_update ( fun_exec , contentLen_1 , contentLen_2 , done ) ;
240
240
} ) ;
241
241
@@ -265,22 +265,16 @@ describe('142. urowidFunctionBindAsString3.js', function() {
265
265
var bindVar_in = {
266
266
i : { val : insertID , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
267
267
c : { val : urowid , type : oracledb . STRING , dir : oracledb . BIND_IN } ,
268
- o : { type : oracledb . STRING , dir : oracledb . BIND_OUT }
268
+ o : { type : oracledb . STRING , dir : oracledb . BIND_OUT , maxSize : 5000 }
269
269
} ;
270
270
connection . execute (
271
271
fun_exec ,
272
272
bindVar_in ,
273
273
function ( err , result ) {
274
- if ( urowidLen > 200 ) {
275
- should . exist ( err ) ;
276
- // When excuting same function in SQLPLUS, will get PLS-00114: identifier 'XXX' too long
277
- // ORA-06502: PL/SQL: numeric or value error: character string buffer too small
278
- ( err . message ) . should . startWith ( 'ORA-06502:' ) ;
279
- } else {
280
- should . not . exist ( err ) ;
281
- var resultVal = result . outBinds . o ;
282
- should . strictEqual ( resultVal , urowid ) ;
283
- }
274
+ should . not . exist ( err ) ;
275
+ var resultVal = result . outBinds . o ;
276
+ should . strictEqual ( resultVal . length , urowidLen ) ;
277
+ should . strictEqual ( resultVal , urowid ) ;
284
278
cb ( ) ;
285
279
}
286
280
) ;
@@ -292,7 +286,7 @@ describe('142. urowidFunctionBindAsString3.js', function() {
292
286
var funBindOut_update = function ( fun_exec , contentLen_1 , contentLen_2 , callback ) {
293
287
var str_1 = random . getRandomLengthString ( contentLen_1 ) ;
294
288
var str_2 = random . getRandomLengthString ( contentLen_2 ) ;
295
- var urowid_1 , urowid_2 , urowidLen_2 , id_1 , id_2 ;
289
+ var urowid_1 , urowid_2 , urowidLen_1 , urowidLen_2 , id_1 , id_2 ;
296
290
async . series ( [
297
291
function ( cb ) {
298
292
id_1 = insertID ;
@@ -305,12 +299,14 @@ describe('142. urowidFunctionBindAsString3.js', function() {
305
299
function ( err , result ) {
306
300
should . not . exist ( err ) ;
307
301
urowid_1 = result . rows [ 0 ] [ 0 ] ;
302
+ urowidLen_1 = urowid_1 . length ;
303
+ urowidLen_1 . should . be . above ( contentLen_1 ) ;
308
304
cb ( ) ;
309
305
}
310
306
) ;
311
307
} ,
312
308
function ( cb ) {
313
- id_2 = insertID ++ ;
309
+ id_2 = insertID + 1 ;
314
310
var sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str_2 + "')" ;
315
311
sql . executeInsert ( connection , sql_insert , { } , { } , cb ) ;
316
312
} ,
@@ -321,6 +317,7 @@ describe('142. urowidFunctionBindAsString3.js', function() {
321
317
should . not . exist ( err ) ;
322
318
urowid_2 = result . rows [ 0 ] [ 0 ] ;
323
319
urowidLen_2 = urowid_2 . length ;
320
+ urowidLen_2 . should . be . above ( contentLen_2 ) ;
324
321
cb ( ) ;
325
322
}
326
323
) ;
@@ -330,21 +327,17 @@ describe('142. urowidFunctionBindAsString3.js', function() {
330
327
i : { val : insertID , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
331
328
c1 : { val : urowid_1 , type : oracledb . STRING , dir : oracledb . BIND_IN } ,
332
329
c2 : { val : urowid_2 , type : oracledb . STRING , dir : oracledb . BIND_IN } ,
333
- o : { type : oracledb . STRING , dir : oracledb . BIND_OUT }
330
+ o : { type : oracledb . STRING , dir : oracledb . BIND_OUT , maxSize : 5000 }
334
331
} ;
335
332
connection . execute (
336
333
fun_exec ,
337
334
bindVar_in ,
338
335
function ( err , result ) {
339
- if ( urowidLen_2 > 200 ) {
340
- should . exist ( err ) ;
341
- // ORA-06502: PL/SQL: numeric or value error: character string buffer too small
342
- ( err . message ) . should . startWith ( 'ORA-06502:' ) ;
343
- } else {
344
- should . not . exist ( err ) ;
345
- var resultVal = result . outBinds . o ;
346
- should . strictEqual ( resultVal , urowid_2 ) ;
347
- }
336
+ should . not . exist ( err ) ;
337
+ var resultVal = result . outBinds . o ;
338
+ should . strictEqual ( resultVal . length , urowidLen_2 ) ;
339
+ should . strictEqual ( resultVal , urowid_2 ) ;
340
+ insertID = insertID + 10 ;
348
341
cb ( ) ;
349
342
}
350
343
) ;
0 commit comments