ts-sql-query icon indicating copy to clipboard operation
ts-sql-query copied to clipboard

Column with type `bigint` not working properly with Oracle NUMBER

Open jameschenjav opened this issue 1 year ago • 1 comments

oracledb version is 6.4.0

Table definition:

class Foo extends Table<DBConnection, 'Foo'> {
  id = this.column('id', 'bigint') // NUMBER
}

const tFoo = new Foo();

const bar = await connection
      .selectFrom(tFoo)
      .select({ id: tFoo.id })
      .where(tFoo.id.equals(1000n))
      .executeSelectOne();

It raises exception

ChainedError: NJS-044: bind object must contain one of the following attributes: "dir", "type", "maxSize", or "val"
    at .../node_modules/.pnpm/[email protected]/node_modules/ts-sql-query/queryBuilders/SelectQueryBuilder.js:119:60
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at main (.../app/main.ts:24:16)
Caused By: Error: NJS-044: bind object must contain one of the following attributes: "dir", "type", "maxSize", or "val"
    at Object.throwErr (.../node_modules/.pnpm/[email protected]/node_modules/oracledb/lib/errors.js:617:10)
    ... 5 lines matching cause stack trace ...
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Source: Error: Query executed at
    at SelectQueryBuilder.executeSelectOne (.../node_modules/.pnpm/[email protected]/node_modules/ts-sql-query/queryBuilders/SelectQueryBuilder.js:91:24)
    at main (.../app/main.ts:28:8)

jameschenjav avatar May 06 '24 23:05 jameschenjav

Hi,

Can you update to oracledb 6.5.0? In that version, they added support for bigint.

Release notes: https://node-oracledb.readthedocs.io/en/latest/release_notes.html#node-oracledb-v6-5-0-2-may-2024 (point 8) More information: https://node-oracledb.readthedocs.io/en/latest/user_guide/bind.html#bind-data-type-notes

Let me know if that works for you.

juanluispaz avatar May 10 '24 11:05 juanluispaz