From 548f0b10aa3adfc722198bf31f773ba85047f344 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 3 Jul 2013 12:27:59 +0200 Subject: Document sub-second precision support in MySQL --- doc/manual.xhtml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'doc') 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 }; +

Starting with MySQL version 5.6.4 it is possible to store fractional + seconds up to microsecond precision in TIME, + DATETIME, and TIMESTAMP 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:

+ +
+#pragma db object
+class person
+{
+  ...
+  #pragma db type("DATETIME(6)")     // Microsecond precision.
+  boost::posix_time::ptime updated_;
+};
+  
+ +

Alternatively, you can enable sub-second precision on the per-type + basis, for example:

+ +
+#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.
+};
+  
+

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 date_time::not_a_date_time will result in the @@ -21414,6 +21446,38 @@ class Person }; +

Starting with MySQL version 5.6.4 it is possible to store fractional + seconds up to microsecond precision in TIME, + DATETIME, and TIMESTAMP 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:

+ +
+#pragma db object
+class Person
+{
+  ...
+  #pragma db type("DATETIME(3)") // Millisecond precision.
+  QDateTime updated_;
+};
+  
+ +

Alternatively, you can enable sub-second precision on the per-type + basis, for example:

+ +
+#pragma db value(QDateTime) type("DATETIME(3)")
+
+#pragma db object
+class Person
+{
+  ...
+  QDateTime created_; // Millisecond precision.
+  QDateTime updated_; // Millisecond precision.
+};
+  
+

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 out_of_range exception. Refer to -- cgit v1.1