X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fgeneric-odbc.lisp;h=d64db208b1b3a62b190b4773624ab67cd8adb12b;hp=4995c25ff420a51112e5c553fcc6cec3e43f1545;hb=f103c1a5416d2f22820d66020e4f9c18c766d894;hpb=30186614582039bdc3d3f86bc5165ef300c5d3e0 diff --git a/sql/generic-odbc.lisp b/sql/generic-odbc.lisp index 4995c25..d64db20 100644 --- a/sql/generic-odbc.lisp +++ b/sql/generic-odbc.lisp @@ -72,25 +72,20 @@ ;;; Type methods -(defmethod database-get-type-specifier ((type (eql 'wall-time)) args database +(defmethod database-get-type-specifier ((type symbol) args database (db-type (eql :mssql))) - (declare (ignore args database)) - "DATETIME") - -(defmethod database-get-type-specifier ((type (eql 'date)) args database - (db-type (eql :mssql))) - (declare (ignore args database)) - "SMALLDATETIME") - -(defmethod database-get-type-specifier ((type (eql 'boolean)) args database - (db-type (eql :mssql))) - (declare (ignore args database)) - "BIT") - -(defmethod database-get-type-specifier ((type (eql 'generalized-boolean)) args database - (db-type (eql :mssql))) - (declare (ignore args database)) - "BIT") + "Special database types for MSSQL backends" + (declare (ignore database db-type args)) + (case type + (wall-time "DATETIME") + (date "SMALLDATETIME") + ((generalized-boolean boolean) "BIT") + ((longchar text) "ntext") + ((varchar string) + (if args + (format nil "NVARCHAR(~A)" (car args)) + (format nil "NVARCHAR(~D)" *default-string-length*))) + (t (call-next-method)))) ;;; Generation of SQL strings from lisp expressions @@ -99,16 +94,6 @@ (:mssql "1") (t "'Y'"))) -(defmethod database-output-sql-as-type ((type (eql 'boolean)) val database - (db-type (eql :mssql))) - (declare (ignore database)) - (if val 1 0)) - -(defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database - (db-type (eql :mssql))) - (declare (ignore database)) - (if val 1 0)) - ;;; Database backend capabilities (defmethod db-type-use-fully-qualified-column-on-drop-index? ((db-type (eql :mssql)))