Skip to content
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

SQL_DECIMAL not mapped in ODBC::ResultSet#read #3

Open
nfesselet opened this issue Jul 17, 2023 · 2 comments
Open

SQL_DECIMAL not mapped in ODBC::ResultSet#read #3

nfesselet opened this issue Jul 17, 2023 · 2 comments

Comments

@nfesselet
Copy link

Hello.
In result_set.cr the col_type value LibODBC::SQL_DECIMAL is not mapped.

This causes a query like select count(*) from table to fail on my informix database.

@naqvis
Copy link
Owner

naqvis commented Jul 17, 2023

@nfesselet Just pushed change to add support for SQL_NUMERIC and SQL_DECIMAL. Make sure you update shard via

shards update

to grab the latest tag.

NB: I don't have access to Informix so unable to validate the changes.

@nfesselet
Copy link
Author

@naqvis , Thanks for your quick answer and fix.
However I feel it’s a pity to loose the decimal’s accuracy in converting the value to a float so I tried to come up with my own conversion piece of code. I’m quite new to odbc and I was surprised at how tricky this was. The "official" way using a SQL_NUMERIC_STRUCT seemed to work with informix but gave very strange results with oracle. In the end I found retrieving and converting the string representation the only viable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants