SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.41k stars 477 forks source link

Oracle incorrect DDL handling #1087

Open Sildra opened 11 months ago

Sildra commented 11 months ago

I sent a std::numeric_limits<long long>::max() in a table created with the ddl, type dt_long_long (value 9223372036854775807), in the database, the value is -9223372036854775808.

Sildra commented 11 months ago

Proposal for the fix : https://github.com/Sildra/soci/commit/63d20b5f892812e3e1ca4cbeeb2106f09fa4d383

SOCI may truncate integer with 10 digits. SOCI may ignore the sign of unsigned long long (integer with 20 digits). SOCI handle doubles perfectly.

vadz commented 11 months ago

Using binary_double for double columns looks like a good idea (as an aside, we should drop get_double_sql_type() and just use SQLT_BDOUBLE, it seems useless to keep compatibility with Oracle 9.x and earlier which is surely not used any more?) and so does using the correct precision for number, so please don't hesitate to make a PR with your changes.

If I could wish for something here, it would be to make the test code simpler to understand as it's really difficult to follow. Generally speaking, the more straightforward the testing code is, easier it is to fix any problems when it breaks, so it would be nice to keep it as simple as possible even at the price of making it less generic/complete.

TIA!