From dffae1b4af3755b52904e5ba20cd3d0c93786d3d Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sat, 15 Dec 2012 06:56:44 +0000 Subject: [PATCH] Issue #3003: Add support for microseconds in some temporal datatypes of MariaDB 5.3+ and MySQL 5.6, at least in the table editor. TODO: Support that in data grid editor too. --- source/dbconnection.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index b591720d..11bb22cd 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -1385,7 +1385,7 @@ end; procedure TMySQLConnection.DoAfterConnect; var TZI: TTimeZoneInformation; - Minutes, Hours: Integer; + Minutes, Hours, i: Integer; Offset: String; begin inherited; @@ -1413,6 +1413,16 @@ begin Offset := Offset + Format('%.2d:%.2d', [Abs(Hours), Abs(Minutes)]); Query('SET time_zone='+EscapeString(Offset)); end; + + // Support microseconds in some temporal datatypes of MariaDB 5.3+ and MySQL 5.6 + if ((ServerVersionInt >= 50300) and Parameters.IsMariaDB) or + ((ServerVersionInt >= 50604) and (not Parameters.IsMariaDB)) then begin + for i:=Low(FDatatypes) to High(FDatatypes) do begin + if FDatatypes[i].Index in [dtDatetime, dtTime, dtTimestamp] then + FDatatypes[i].HasLength := True; + end; + end; + end;