From 801d8a6e0939579b4a00de5011712af4d5738cd0 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 23 Nov 2018 10:43:58 +0100 Subject: [PATCH] Add support for MS SQL time data type. As for the other datetime types we have to use CONVERT at the SQL level in order to get a format that PostgreSQL understands. This time the magic number for it is 114. --- src/monkey/mssql.lisp | 2 +- src/sources/mssql/mssql-schema.lisp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/monkey/mssql.lisp b/src/monkey/mssql.lisp index ce2abf6..5790b17 100644 --- a/src/monkey/mssql.lisp +++ b/src/monkey/mssql.lisp @@ -95,7 +95,7 @@ (:syb-int8 (mem-ref data :int8)) (:syb-real (mem-ref data :float)) (:syb-flt8 (mem-ref data :double)) - ((:syb-datetime :syb-datetime4 :syb-msdate) + ((:syb-datetime :syb-datetime4 :syb-msdate :syb-mstime) (with-foreign-pointer (%buf +numeric-buf-sz+) (let ((count (%dbconvert %dbproc diff --git a/src/sources/mssql/mssql-schema.lisp b/src/sources/mssql/mssql-schema.lisp index 89be6ff..c743647 100644 --- a/src/sources/mssql/mssql-schema.lisp +++ b/src/sources/mssql/mssql-schema.lisp @@ -201,6 +201,7 @@ Mostly we just use the name, and make try to avoid parsing dates." (case (intern (string-upcase type) "KEYWORD") + (:time (format nil "convert(varchar, [~a], 114)" name)) (:datetime (format nil "convert(varchar, [~a], 126)" name)) (:smalldatetime (format nil "convert(varchar, [~a], 126)" name)) (:date (format nil "convert(varchar, [~a], 126)" name))