Add support for MS SQL smalldatatime data type.

Availability of a test case for MS SQL allows to make progress on this
limitation and add support to the smalldatetime data type. It is
converted server-side with the same CONVERT expression as the longer
datetime datatype.

Fixes #431.
This commit is contained in:
Dimitri Fontaine 2017-01-28 18:08:55 +01:00
parent a799cd5f5f
commit 6bd17f45da
3 changed files with 6 additions and 4 deletions

View File

@ -94,7 +94,7 @@
(:syb-int4 (unsigned-to-signed (mem-ref data :unsigned-int) 4))
(:syb-int8 (mem-ref data :int8))
(:syb-flt8 (mem-ref data :double))
(:syb-datetime
((:syb-datetime :syb-datetime4)
(with-foreign-pointer (%buf +numeric-buf-sz+)
(let ((count
(%dbconvert %dbproc

View File

@ -59,6 +59,7 @@
(:source (:type "varbinary") :target (:type "bytea")
:using pgloader.transforms::byte-vector-to-bytea)
(:source (:type "smalldatetime") :target (:type "timestamptz"))
(:source (:type "datetime") :target (:type "timestamptz"))
(:source (:type "datetime2") :target (:type "timestamptz")))
"Data Type Casting to migrate from MSSQL to PostgreSQL")

View File

@ -283,6 +283,7 @@ ORDER BY KCU1.CONSTRAINT_NAME, KCU1.ORDINAL_POSITION"
Mostly we just use the name, and make try to avoid parsing dates."
(case (intern (string-upcase type) "KEYWORD")
(:datetime (format nil "convert(varchar, [~a], 126)" name))
(:smalldatetime (format nil "convert(varchar, [~a], 126)" name))
(:bigint (format nil "cast([~a] as numeric)" name))
(t (format nil "[~a]" name))))