Closed urugator closed 2 years ago
Right, i think that can be a nice addition to and a very practical option. I've create https://jira.mariadb.org/browse/CONJS-198 for that. This will be part of next release.
closing, since done in develop branch and will be part of 3.0.1
Thank you for the feature! I think you forget to add the new option to types: https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/types/index.d.ts Should I open new issue?
BigInt
as a safe default is good, but I often find it quite impractical, becausemariadb
returns BIGINT from various operations likeCOUNT(*)
orcol + 1
(noteCAST(aBigInt AS INT)
still results in BIGINT). At the moment we can either choose to use the default safe behavior, but then we have to check the range and cast these tonumber
manually or we can usebigIntAsNumber: true
for convinience, but risk an invalid behavior in edge cases. I propose introducing a new option, which would provide conviniency, but would fail loudly in case of possible error:checkNumberRange: boolean
When set totrue
, the driver throws an error if DECIMAL/BIGINT can't be converted safely tonumber
. The option is only effective when one ofinsertIdAsNumber
/decimalAsNumber
/bigIntAsNumber
istrue
. Defaults tofalse
for BC reasons.