node-oracledb icon indicating copy to clipboard operation
node-oracledb copied to clipboard

feature: Support bigint parameters in thin mode

Open sla100 opened this issue 2 years ago • 5 comments

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]>

sla100 avatar Jun 09 '23 12:06 sla100

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:

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.

sharadraju avatar Jun 13 '23 07:06 sharadraju

We would also need to think about how to retrieve data from Oracle Database as bigint datatype 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),
    };
  }
};

sla100 avatar Jun 13 '23 15:06 sla100

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.

stale[bot] avatar Aug 12 '23 08:08 stale[bot]

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.

stale[bot] avatar Sep 17 '23 18:09 stale[bot]

@sla100 This has been fixed in the 6.5 release. Thank you for your contribution!

sharadraju avatar May 03 '24 04:05 sharadraju