oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.25k stars 1.08k forks source link

Bug with cyrillic symbols in bind params on oracledb 6.0.0 (DPI-1019) #1555

Closed verside2 closed 1 year ago

verside2 commented 1 year ago

Versions: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production DbCharset: CL8MSWIN1251 oracledb 6.0.0 win32 (Windows 10 x64) nodejs v18.16.0 oracle instant client 21.10.0.0.0

Hello!

After upgrading to oracle db 6.0.0, queries stopped being executed, to which strings containing Cyrillic characters are binded. Everything works on oracledb version 5.5.0.

If I search by English characters, everything works without problems on both versions.

When executing code on oracledb version 6.0.0, I get an error:

Error: DPI-1019: buffer size of 8 is too small                                                                                                                                    
    at async sql (file:///C:/.../tt.js:27:16) {                                                                                                         
  errorNum: 0,                                                                                                                                                                    
  offset: 0,                                                                                                                                                                      
  code: 'DPI-1019'                                                                                                                                                                
}

Script code below:

import oracledb from "oracledb";

let oracleClient;

oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;
oracledb.fetchAsString = [oracledb.CLOB];

try {
    oracledb.initOracleClient({
     libDir: "c:/instantclient_21_10"
    });
} catch {

}

sql();

async function sql() {
    oracleClient = await oracledb.getConnection({
        user          : "***",
        password      : "***",
        connectString : "***.local:1521/ORCL"
    });

    try {
        let websql = await oracleClient.execute(`select * from missiontype where f_missiontype_name = :nn`, {
            nn: {
                dir: oracledb.BIND_IN,
                type: oracledb.DB_TYPE_VARCHAR,
                val: "Сбор ВГХ"
            },
        });

        console.log(websql.rows);
    } catch (err) {
        console.error(err);
    }

    await oracleClient.close();
}
Table MISSIONTYPE: ID NAME
1 Сбор ВГХ
2 Установка оборудования
Name                  Type          Nullable Default Comments                        
--------------------- ------------- -------- ------- ------------------------------- 
ID                    INTEGER                           
NAME                  VARCHAR2(255)           

Can you tell me how to solve this problem?

anthony-tuininga commented 1 year ago

This is a duplicate of #1554 so will close this one. You can see the patch there which should resolve the issue for you. It will be included in the next release of node-oracledb!