Skip to content

Commit a3faee5

Browse files
committed
Allow Unicode characters in Bind names for Thin mode
1 parent 12a9351 commit a3faee5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/thin/statement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const thinUtil = require("./util.js");
3939
// the dollar sign and the pound sign.
4040
// 5. Non-quoted binds cannot be Oracle Database Reserved Names
4141
// (Server handles this case and returns an appropriate error)
42-
const BIND_PATTERN = /(?<=\:)\s*("[^\"]*"|(([a-zA-Z]|[^\u0020-\u007F\s])([\w\$#]|[^\u0020-\u007F\s\$#])*|\d+))/g;
42+
const BIND_PATTERN = /(?<=:)\s*((?:".*?")|(?:[\p{L}][\p{L}\p{Nd}_\$#]*)|\p{Nd}+)/gu;
4343

4444
// pattern used for detecting a DML returning clause; bind variables in the
4545
// first group are input variables; bind variables in the second group are

test/getStmtInfo.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ describe('162. getStmtInfo.js', function() {
294294
it('162.28 PL/SQL block bindname following newline character', async function() {
295295
const sql = `
296296
-- COMMENTS
297-
select :object_name_in as object_name,
297+
select :兆object_name_in as object_name,
298298
'COMMENT' as object_type,
299299
:schema_name_in as schema_name
300300
from dual
@@ -306,26 +306,26 @@ describe('162. getStmtInfo.js', function() {
306306
owner
307307
from all_constraints
308308
where owner = :schema_name_in
309-
and table_name = :object_name_in
309+
and table_name = :兆object_name_in
310310
and constraint_type = 'R'
311311
union all
312312
313313
-- RLS CONTEXTS
314-
select :object_name_in as object_name,
314+
select :兆object_name_in as object_name,
315315
'RLS_CONTEXT' as object_type,
316316
:schema_name_in as schema_name
317317
from dual
318318
union all
319319
320320
-- RLS GROUP
321-
select :object_name_in as object_name,
321+
select :兆object_name_in as object_name,
322322
'RLS_GROUP' as object_type,
323323
:schema_name_in as schema_name
324324
from dual
325325
union all
326326
327327
-- RLS POLICY
328-
select :object_name_in as object_name,
328+
select :兆object_name_in as object_name,
329329
'RLS_POLICY' as object_type,
330330
:schema_name_in as schema_name
331331
from dual
@@ -337,7 +337,7 @@ describe('162. getStmtInfo.js', function() {
337337
owner
338338
from all_constraints
339339
where owner = :schema_name_in
340-
and table_name = :object_name_in
340+
and table_name = :兆object_name_in
341341
and constraint_type != 'R'
342342
union all
343343
@@ -347,7 +347,7 @@ describe('162. getStmtInfo.js', function() {
347347
owner
348348
from all_indexes
349349
where table_owner = :schema_name_in
350-
and table_name = :object_name_in
350+
and table_name = :兆object_name_in
351351
union all
352352
353353
-- TRIGGERS
@@ -356,18 +356,18 @@ describe('162. getStmtInfo.js', function() {
356356
owner
357357
from all_triggers
358358
where table_owner = :schema_name_in
359-
and table_name = :object_name_in
359+
and table_name = :兆object_name_in
360360
and base_object_type = 'TABLE'
361361
union all
362362
363363
-- OBJECTS GRANTS AS GRANTOR
364-
select :object_name_in,
364+
select :兆object_name_in,
365365
'OBJECT_GRANT_AS_GRANTOR',
366366
:schema_name_in
367367
from dual`;
368368
const connection = await oracledb.getConnection(dbConfig);
369369
const info = await connection.getStatementInfo(sql);
370-
assert.deepStrictEqual(info.bindNames, ['OBJECT_NAME_IN', 'SCHEMA_NAME_IN']);
370+
assert.deepStrictEqual(info.bindNames, ['兆OBJECT_NAME_IN', 'SCHEMA_NAME_IN']);
371371
await connection.close();
372372
}); // 162.28
373373
});

0 commit comments

Comments
 (0)