[ODBC-133] Incorrect return values for decimal data type Created: 2018-01-31  Updated: 2020-08-25  Resolved: 2018-03-25

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.0.2
Fix Version/s: 3.0.4, 2.0.17

Type: Bug Priority: Minor
Reporter: Shiya Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 1
Labels: datatype
Environment:

Windows 2012 R2 64
MariaDB ODBC 3.0 Driver (MAODBC.DLL, 3.00.02.00)
MS SQL Server 2008 R2 SP3 X64
MySQL ODBC 5.3 ANSI Driver (MYODBC5A.DLL, 5.03.07.00)


Attachments: Text File MAODBC.LOG     Text File odbctrace_MariaDB_SQL.LOG     Text File odbctrace_MySQLDB_SQL.LOG    

 Description   

I'm experiencing issues with with DECIMAL data types using the MariaDB ODBC driver (tested using MS SQL Linked Server and MS Vbscript - ADODB.Connection).

select *
from openquery( cdr1, 'select cast(1 as decimal(19,4))' )

Returns "0.0001"

Using the MySQL ODBC 5.3 Driver running the same query returns "1.0000"

I'm experiencing the same issue using the MariaDB driver to return a column of datatype DECIMAL(19,4) - if the column contains '1' then it's returned as '0.0001'.

Having similar issues inserting data into MariaDB using MS SQL Linked Server for columns cast as DECIMAL(19,4).
If the column's value is '99.0' then the insert fails with "[ma-3.0.2][5.5.56-MariaDB]Numeric value out of range"

Updating data using the MariaDB connector for the DECIMAL data type returns the following error:
"Row cannot be located for updating. Some values may have been changed since it was last read."



 Comments   
Comment by Lawrin Novitsky [ 2018-01-31 ]

Thank you for your report, and especially for providing all traces!

Comment by Lawrin Novitsky [ 2018-03-21 ]

Would it possible to try with 3.0.3 version? There were couple of patches in 3.0.3 concerning SQL_C_NUMERIC. And I can see that it returns correct value for your case, not with requested scale, though.
Also, would it be possible to provide ODBC trace for that 2nd issue with error while inserting using MS SQL linked server?

Comment by Lawrin Novitsky [ 2018-03-25 ]

The issue has ben mainly fixed in 3.0.3. Now I only added NUMERIC to be always returned with requested scale. And testcsases.
Commit 16b954111075f8869421bdd339b5b0725eced6ad has been pushed to odbc-3.0 branch, will be later cherry-picked to 2.0

Generated at Thu Feb 08 03:26:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.