From 3e3ebf23336b1b35326c5d864e86b7143f20f55d Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 15 Aug 2015 16:02:21 +0200 Subject: [PATCH] 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 --- src/sources/mssql/mssql-cast-rules.lisp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sources/mssql/mssql-cast-rules.lisp b/src/sources/mssql/mssql-cast-rules.lisp index b510408..4e20765 100644 --- a/src/sources/mssql/mssql-cast-rules.lisp +++ b/src/sources/mssql/mssql-cast-rules.lisp @@ -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))))