aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-07-03 12:27:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-07-03 12:27:59 +0200
commit548f0b10aa3adfc722198bf31f773ba85047f344 (patch)
tree11cde003ea7cc0f1525220430099124a7e846051
parent8ea4fbe58746170c95431b418e8bf50cf57845da (diff)
Document sub-second precision support in MySQL
-rw-r--r--NEWS8
-rw-r--r--doc/manual.xhtml64
2 files changed, 72 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 225a38a..720834c 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,14 @@ Version 2.3.0
to the ODB compiler command line interface documentation (man pages) for
details.
+ * Starting with MySQL version 5.6.4 it is possible to store fractional
+ seconds up to microsecond precision in TIME, DATETIME, and TIMESTAMP
+ columns. Both Boost and Qt profiles have been updated to support this
+ new functionality. Note, however, that to enable sub-second precision,
+ the corresponding type with the desired precision has to be specified
+ explicitly. For details, refer to the "MySQL Database Type Mapping"
+ sections in the Boost and Qt profile chapters.
+
* New SQLite-specific exception, odb::sqlite::forced_rollback, which is
thrown if SQLite forces a transaction to roll back. For more information,
refer to Section 16.5.6, "Forced Rollback" in the ODB manual.
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