handling mssql datetimeoffset (#1113)

This commit is contained in:
Rudi Bruchez 2020-03-27 23:50:35 +01:00 committed by GitHub
parent b3cd5f28d6
commit c2b9f79413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -99,7 +99,8 @@
:syb-datetime4
:syb-msdate
:syb-mstime
:syb-msdatetime2)
:syb-msdatetime2
:syb-msdatetimeoffset)
(with-foreign-pointer (%buf +numeric-buf-sz+)
(let ((count
(%dbconvert %dbproc

View File

@ -64,7 +64,8 @@
(:source (:type "smalldatetime") :target (:type "timestamptz"))
(:source (:type "datetime") :target (:type "timestamptz"))
(:source (:type "datetime2") :target (:type "timestamptz")))
(:source (:type "datetime2") :target (:type "timestamptz"))
(:source (:type "datetimeoffset") :target (:type "timestamptz")))
"Data Type Casting to migrate from MSSQL to PostgreSQL")
;;;

View File

@ -168,11 +168,12 @@
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))
(:datetime2 (format nil "convert(varchar, [~a], 126)" name))
(:smalldatetime (format nil "convert(varchar, [~a], 126)" name))
(:date (format nil "convert(varchar, [~a], 126)" name))
(:time (format nil "convert(varchar(30), [~a], 114)" name))
(:datetime (format nil "convert(varchar(30), [~a], 126)" name))
(:datetime2 (format nil "convert(varchar(30), [~a], 126)" name))
(:datetimeoffset (format nil "convert(varchar(35), [~a], 127)" name))
(:smalldatetime (format nil "convert(varchar(30), [~a], 126)" name))
(:date (format nil "convert(varchar(30), [~a], 126)" name))
(:bigint (format nil "cast([~a] as numeric)" name))
(t (format nil "[~a]" name))))