Fix numeric casting support for MS SQL.

It's possible to get a numeric column with nil precision and scale, and
the code wasn't ready for this situation. Bug found while seeing about
This commit is contained in:
Dimitri Fontaine 2015-08-15 16:02:21 +02:00
parent 5e7e5391ef
commit 3e3ebf2333

View File

@ -92,10 +92,13 @@
((member type '("decimal" "numeric" ) :test #'string=)
;; https://msdn.microsoft.com/en-us/library/ms187746.aspx
(format nil "~a(~a,~a)"
type
(mssql-column-numeric-precision col)
(mssql-column-numeric-scale col)))
(cond ((null (mssql-column-numeric-precision col))
type)
(t
(format nil "~a(~a,~a)"
type
(mssql-column-numeric-precision col)
(or (mssql-column-numeric-scale col) 0)))))
(t type))))