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

Handle fraction of seconds in datetime data types #628

Astrinus opened this Issue Mar 9, 2018 · 0 comments


None yet
2 participants

Astrinus commented Mar 9, 2018

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.

@mloskot mloskot changed the title from Handle fraction of seconds in datetime data types [enhancement] to Handle fraction of seconds in datetime data types Mar 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment