diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-07-03 12:27:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-07-03 12:27:59 +0200 |
commit | 548f0b10aa3adfc722198bf31f773ba85047f344 (patch) | |
tree | 11cde003ea7cc0f1525220430099124a7e846051 /doc/manual.xhtml | |
parent | 8ea4fbe58746170c95431b418e8bf50cf57845da (diff) |
Document sub-second precision support in MySQL
Diffstat (limited to 'doc/manual.xhtml')
-rw-r--r-- | doc/manual.xhtml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml index c879248..2746a0c 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -20264,6 +20264,38 @@ class person }; </pre> + <p>Starting with MySQL version 5.6.4 it is possible to store fractional + seconds up to microsecond precision in <code>TIME</code>, + <code>DATETIME</code>, and <code>TIMESTAMP</code> columns. However, + to enable sub-second precision, the corresponding type with the + desired precision has to be specified explicitly, as shown in the + following example:</p> + + <pre class="cxx"> +#pragma db object +class person +{ + ... + #pragma db type("DATETIME(6)") // Microsecond precision. + boost::posix_time::ptime updated_; +}; + </pre> + + <p>Alternatively, you can enable sub-second precision on the per-type + basis, for example:</p> + + <pre class="cxx"> +#pragma db value(boost::posix_time::ptime) type("DATETIME(6)") + +#pragma db object +class person +{ + ... + boost::posix_time::ptime created_; // Microsecond precision. + boost::posix_time::ptime updated_; // Microsecond precision. +}; + </pre> + <p>Some valid Boost date-time values cannot be stored in a MySQL database. An attempt to persist any Boost date-time special value other than <code>date_time::not_a_date_time</code> will result in the @@ -21414,6 +21446,38 @@ class Person }; </pre> + <p>Starting with MySQL version 5.6.4 it is possible to store fractional + seconds up to microsecond precision in <code>TIME</code>, + <code>DATETIME</code>, and <code>TIMESTAMP</code> columns. However, + to enable sub-second precision, the corresponding type with the + desired precision has to be specified explicitly, as shown in the + following example:</p> + + <pre class="cxx"> +#pragma db object +class Person +{ + ... + #pragma db type("DATETIME(3)") // Millisecond precision. + QDateTime updated_; +}; + </pre> + + <p>Alternatively, you can enable sub-second precision on the per-type + basis, for example:</p> + + <pre class="cxx"> +#pragma db value(QDateTime) type("DATETIME(3)") + +#pragma db object +class Person +{ + ... + QDateTime created_; // Millisecond precision. + QDateTime updated_; // Millisecond precision. +}; + </pre> + <p>Some valid Qt date-time values cannot be stored in a MySQL database. An attempt to persist a Qt date-time value that is out of the MySQL type range will result in the <code>out_of_range</code> exception. Refer to |