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
Parameters data truncation from SQL_C_CHAR to SQL_INTEGER or SQL_DECIMAL [ODBC38] #38
Comments
Commented by: @alexpotapchenko How I can reproduce it? Do you have a simple test case? |
Commented by: Domfe (domfe_tiscali.it) Here is a test case program to reproduce the bug. Output from the program: SELECT CAST(? AS DECIMAL(9,3)) FROM sales Value: 123456.700 Output expected (MySQL driver handles correctly): SELECT CAST(? AS DECIMAL(9,3)) FROM sales Value: 123456.789 |
Modified by: Domfe (domfe_tiscali.it)Attachment: testcase1.c [ 11170 ] |
Commented by: @alexpotapchenko Please test this build (in the attachment) and inform me results. |
Modified by: @alexpotapchenkoAttachment: OdbcFb.zip [ 11171 ] |
Modified by: @alexpotapchenkoassignee: Vladimir Tsvigun [ praktik ] => Alexander Potapchenko [ lightfore ] |
Commented by: Domfe (domfe_tiscali.it) Hi Alexander, |
Commented by: @alexpotapchenko But not for me. I have rebuilt driver and included your test-case with my modifications, but I dont think that the problem in it. I use VS 2005 SP1. |
Modified by: @alexpotapchenkoAttachment: OdbcFb.zip [ 11172 ] |
Commented by: Domfe (domfe_tiscali.it) Ok. I've made a fresh install. Problem disappeared. SELECT CAST(? AS DECIMAL(9,3)) FROM sales Value: 123456.789 And also for INTEGER cast. Param value 1234567895, was: Value: 123456789 Now: Value: 1234567895 Thank you! |
Commented by: @alexpotapchenko Well, this fix will be included into Odbc driver 2.0.148 RC1 which is getting out in the near future. Please inform me if there will be any problems with the driver work. |
Modified by: @alexpotapchenkostatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.0 Beta [ 10043 ] |
Modified by: @alexpotapchenkostatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Domfe (domfe_tiscali.it)
Attachments:
testcase1.c
OdbcFb.zip
OdbcFb.zip
When a parameter is of type SQL_INTEGER, SQL_DECIMAL or SQL_NUMERIC data truncation occurs if the C type is SQL_C_CHAR.
The truncation affects number at the maximum size for the column.
SQL_C_CHAR -> SQL_INTEGER
+1234567895 -> 123456789
the last 5 is lost (123456789): it seems that the driver uses only the first ten character and not the first ten digits.
SQL_C_CHAR -> SQL_DECIMAL (9,3)
-123456.789 -> -123456.700
lost 2 digits: again the driver uses only the first nine character regardless if they were digits or not (sign or decimal dot)
Commits: 6b0a4ef 5a58c5b
The text was updated successfully, but these errors were encountered: