oracle / node-oracledb

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

feature: Support bigint parameters in thin mode #1572

Closed sla100 closed 5 months ago

sla100 commented 1 year ago

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 <you@example.org>
oracle-contributor-agreement[bot] commented 1 year ago

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.

sharadraju commented 1 year ago

We would also need to think about how to retrieve data from Oracle Database as bigint datatype as well.

sla100 commented 1 year ago

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),
    };
  }
};
stale[bot] commented 1 year ago

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] commented 1 year ago

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.

sharadraju commented 5 months ago

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