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

Segfault while trying to print a float #19

Closed
mexus opened this issue Nov 21, 2019 · 3 comments
Closed

Segfault while trying to print a float #19

mexus opened this issue Nov 21, 2019 · 3 comments

Comments

@mexus
Copy link

mexus commented Nov 21, 2019

Dear Kubo-san,

First of all, thanks for the great wrapper library!

However, there is a small issue with Object::get_by_attr method: when using FLOAT data type, a call to dpiObject_getAttributeValue results in a segfault, because internally ODPI-C library treats FLOAT as a subtype of NUMBER and expects a buffer in asBytes.ptr, which is currently set only when the attr.oratype is OracleType::Number (.. which corresponds to NUMBER, but not to FLOAT).

I am unsure whether it is a bug in oracle's documentation of dpiObject_getAttributeValue which only mentions DPI_ORACLE_TYPE_NUMBER or not, but nevertheless is seems like we need to utilize dpiData_setBytes also for attr.oratype being OracleType::Number.

We made a local circumvention by migrating from FLOAT to NUMBER in our database, so unfortunately we can't test whether adding a simple if condition for OracleType::Float would work, hence we are not providing a PR, sorry :(

@kubo
Copy link
Owner

kubo commented Nov 21, 2019

Thanks for your reporting the issue.
It isn't a bug in the document of dpiObject_getAttributeValue. It is a bug in rust-oracle.
Rust-oracle distinguishes NUMBER and FLOAT. On the other hand ODPI treats both as DPI_ORACLE_TYPE_NUMBER.

I'll release 0.3.2 in a few days.

@mexus
Copy link
Author

mexus commented Nov 21, 2019

Sounds great, thanks! ;)

@kubo
Copy link
Owner

kubo commented Nov 24, 2019

0.3.2 was released.

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