Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
see https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/201
BigInt as a safe default is good, but I often find it quite impractical, because mariadb returns BIGINT from various operations like COUNT or col + 1 (note CAST(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 to number manually or we can use bigIntAsNumber: 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 to true, the driver throws and error if DECIMAL/BIGINT can't be converted safely to number.
The option is only effective when one of insertIdAsNumber/decimalAsNumber/bigIntAsNumber is true.
Defaults to false for BC reasons.