-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Losing decimal places #406
Comments
@markdirish do you have any solution for this? Help appreciated |
I’d be willing to pay if someone can help me solve this problem. |
@kadler can you help? |
Can you please provide a trace of the problem? |
Hi @kadler, The query starts at row 138. |
Ok. From the trace, I see that for vk_1, this is described by the driver as a NUMERIC(9, 2). We bind this as SQL_C_CHAR with a buffer of length 11 (9 total digits + decimal separator + null terminator). The relevant trace info is:
This should be enough room to successfully retrieve the converted data. Unfortunately, ODBC trace does not show the data that was retrieved. I would say that perhaps this is a driver issue, but as isql shows the correct data and it also uses SQL_C_CHAR (albeit with SQLGetData, not SQLBindCol, but I don't think that would matter) it's probably not that. Looks like our SQL_NUMERIC handling converts to a number via |
One potential fix would be to comment out these lines and rebuild: node-odbc/src/odbc_connection.cpp Lines 3382 to 3389 in 3694c4d
This would cause the data to be bound as a |
Thank you for your help.
no, the number is stored with a “.” (dot) in the database. Regarding your second response, I will give it a try and get back to you. |
Over the past few days, I tested everything thoroughly. Your solution, with commenting out the conversation as you suggested, works perfectly—100%! Thank you so much for your help; it’s been incredibly useful. Is there any other way I can thank you besides expressing my gratitude here? Best Regards |
Thanks, glad it worked! I'm gonna re-open to track making the change here. |
Here's a workaround that worked for us: multiply the column by 1.0. Example: instead of
do
|
Perhaps this is related: |
Describe your system
Running on Fedora Linux 38 (Workstation Edition)
Kernal Version: Linux 6.2.9-300.fc38.x86_64
odbc
Package Version: ^2.4.9Describe the bug
When I query any database table where the rows contain decimal numbers I lose the decimal places
Example:
column X contains 3.5, when I query this column the result is only 3.
column result definition is
Expected behavior
Result should be 3.5 instead of 3
If I do the same query with
isql
I get the result3.5
Best Regards
Tell
The text was updated successfully, but these errors were encountered: