node-oracledb
node-oracledb copied to clipboard
feature: Support bigint parameters in thin mode
Hello. There is a simple change which allow to pass build-in bigint type to parameters in thin node. This allows you to pass large integers without conversion to string in js and CAST on the Oracle side. Ex.:
const {rows} = await conn.execute( 'SELECT null FROM DUAL WHERE :A = (CAST :B AS NUMBER)', {
A: 1_000_000_000_000_001n,
B: 1_000_000_000_000_001n.toString(),
});
equal(rows.length, 1);
Signed-off-by: Sławomir Osoba <[email protected]>
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). The following contributors of this PR have not signed the OCA:
- PR author: @sla100
- [email protected]
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.
When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.
If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.
We would also need to think about how to retrieve data from Oracle Database as bigint datatype as well.
We would also need to think about how to retrieve data from Oracle Database as
bigintdatatype as well.
This translation is already possible for columns.
const fetchTypeHandler = ({dbType, precision, scale}) => {
if (dbType === oracledb.DB_TYPE_NUMBER && scale === 0 && precision > 15) {
return {
type: oracledb.STRING,
converter: (v) => v === null ? null : BigInt(v),
};
}
};
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
@sla100 This has been fixed in the 6.5 release. Thank you for your contribution!