oracle / odpi

ODPI-C: Oracle Database Programming Interface for Drivers and Applications
https://oracle.github.io/odpi/
Other
264 stars 75 forks source link

double and float types in JSON #155

Closed kubo closed 2 years ago

kubo commented 3 years ago

ODPI-C version: 4.1.0 Oracle client version: 21.1

According to this document, Oracle Database extends the set of standard JSON-language types to include double and float. However ODPI-C supports it partially. Is it on purpose?

JSON → Native

Native → JSON

When a JSON value is got from DB and written back, double and float in JSON are converted to Oracle number. (Well, this is a guess. I have no user accounts of Oracle 21c.)

anthony-tuininga commented 3 years ago

You're correct. The values for double and float are converted to Oracle Number -- which has a different range of supported values. I think the reason for doing so was to make driver development simpler -- since they likely deal with Oracle Number for regular columns and rarely (if ever) deal with native doubles and floats. Internally Oracle is capable of storing Oracle Number inside JSON values as well -- and preserving the distinction might be more complex than most people are willing to deal with. I'll discuss with @cjbj and get back to you further on this matter. If you have further comments/suggestions I'd be happy to hear them!

cjbj commented 3 years ago

@kubo do we have a current email address for you? Can you email me if you have a new one?

kubo commented 3 years ago

@cjbj My email address has not been changed for about twenty years.

cjbj commented 3 years ago

@kubo I wonder if mail from oracle.com isn't reaching you? I've just sent you a test email.

stale[bot] commented 3 years ago

This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.

cjbj commented 3 years ago

@anthony-tuininga you gave yourself an action item on this.

anthony-tuininga commented 3 years ago

Apologies for the delay! I took a look and realised that there was no way to pass in native_double/native_float values directly. That has been corrected. Take a look and let me know if that resolves your issue. Thanks!

stale[bot] commented 3 years ago

This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.

kubo commented 2 years ago

@anthony-tuininga Thanks. I forgot to close this.