Closed abmusse closed 4 years ago
resolved with commit 1b4d8d1
idb-connector v1.2.5 is released to fix this issue.
Nice!
I think we should also add test cases selecting and fetching Min and Max values for DOUBLE, FLOAT, REAL
types to confirm the behavior. Similar to how we have done here.
Note that precision and scale returned for REAL
and DOUBLE
columns is not the same as for DECIMAL
/NUMERIC
columns. It does not contain the number of digits, but instead precision will be either 4 (REAL
) or 8 (DOUBLE
), which is the size in bytes that it takes up.
Code like this is not correct https://github.com/IBM/nodejs-idb-connector/blob/1b4d8d19b0230e553f542c1b2ea74c0ce5e52231/src/db2ia/dbstmt.cc#L2099-L2103 https://github.com/IBM/nodejs-idb-connector/blob/1b4d8d19b0230e553f542c1b2ea74c0ce5e52231/src/db2ia/dbstmt.cc#L2269-L2272
Hello, @kadler commit bcb1962 fixed it. @abmusse the above commit added the test cases.
Describe the solution you'd like Enable returning
SQL_DOUBLE
type as aJS Number
instead of aJS String
ifdbstmt.asNumber(true)
is set.Contiuation of #64
Currently only
SQL_INTEGER
,SQL_SMALLINT
,SQL_DECIMAL
, andSQL_NUMERIC
types will be returned as JS Number whendbstmt.asNumber(true)
is set.Additional context
Source
According to the docs:
JavaScript Number has the following min and max values:
Number.MAX_VALUE =
1.7976931348623157e+308
Number.MIN_VALUE =
5e-324
Seems like the JS Number Class will be able to hold the
SQL_DOUBLE
type.We can probably just add a case for
SQL_DOUBLE
here@dmabupt @kadler @markdirish @ThePrez Do you think this would work?