soci
soci copied to clipboard
Handle fraction of seconds in datetime data types
Yes, I know that MySQL is ashamingly dropping the fractional part and that Firebird/Interbase isc_* do not support exchange of fractional seconds, even if Interbase DOES support them (in fact, their time
SQL data type is stored in decimilliseconds from midnight!).
The other backends should have no big problems:
- PG poses no problem since the data is serialized as string.
- SQLite is similar to PG.
- ODBC has a
ts->fraction
field ready for use, currently set to zero. - DB2 is similar to ODBC.
- Oracle has a OCIDateTime type to be used instead of char[7], with OCIDateTimeConstruct() for use-type and OCIDateTimeGetDate(), OCIDateTimeGetTime() and OCIDateTimeGetTimeZoneName() / OCIDateTimeGetTimeZoneOffset() for into-type.
A possible candidate could be boost::posix_time::ptime
, since SOCI already support integration with Boost.DateTime. This should however be considered a top-level type to be handled at backend level rather than a type conversion to std::tm
or std::string
.