refactored database-get-type-specifier for postgres and mssql
[clsql.git] / tests / test-fddl.lisp
index a1044045a2b2035f51e16370081379def3a11042..83eada9f1074e699b6e584d90360be9e884be957 100644 (file)
@@ -1,23 +1,22 @@
 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
-;;;; ======================================================================
-;;;; File:     test-fddl.lisp
-;;;; Authors:  Marcus Pearce <m.t.pearce@city.ac.uk> and Kevin Rosenberg
-;;;; Created:  30/03/2004
-;;;; Updated:  $Id$
+;;;; *************************************************************************
+;;;; FILE IDENTIFICATION
 ;;;;
-;;;; Tests for the CLSQL Functional Data Definition Language
-;;;; (FDDL).
+;;;; Name:     test-fddl.lisp
+;;;; Purpose:  Tests for the CLSQL Functional Data Definition Language
+;;;; Authors:  Marcus Pearce and Kevin M. Rosenberg
+;;;; Created:  March 2004
 ;;;;
 ;;;; This file is part of CLSQL.
 ;;;;
 ;;;; CLSQL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
-;;;; ======================================================================
+;;;; *************************************************************************
 
-(in-package #:clsql-tests)
 
-#.(clsql:locally-enable-sql-reader-syntax)
+(in-package #:clsql-tests)
+(clsql-sys:file-enable-sql-reader-syntax)
 
 (def-dataset *ds-fddl*
   (:setup (lambda ()
@@ -169,12 +168,14 @@ B varchar(32))")
     (with-dataset *ds-fddl*
       (multiple-value-bind (type length scale nullable)
          (clsql:attribute-type [c] [alpha])
-       (values (clsql-sys:in type :varchar :varchar2) length scale nullable)))
+       (values (clsql-sys:in type :varchar :varchar2 :nvarchar)
+                length scale nullable)))
   t 30 nil 1)
 
 (deftest :fddl/attributes/5
     (with-dataset *ds-fddl*
-      (and (member (clsql:attribute-type [d] [alpha]) '(:datetime :timestamp :date)) t))
+      (and (member (clsql:attribute-type [d] [alpha])
+                   '(:datetime :timestamp :date :smalldatetime)) t))
   t)
 
 (deftest :fddl/attributes/6
@@ -236,7 +237,7 @@ B varchar(32))")
             (let ((result
                    (list
                     ;; Shouldn't exist
-                    (clsql:select [a] [c] 
+                    (clsql:select [a] [c]
                                   :from [v1]
                                   :where [= [a] -1])
                     ;; Should exist
@@ -263,11 +264,11 @@ B varchar(32))")
                                   (clsql:list-attributes [v1]))
                           #'string<)
                     ;; Shouldn't exist
-                    (clsql:select [x] [y] 
+                    (clsql:select [x] [y]
                                   :from [v1]
                                   :where [= [x] -1])
                     ;; Should exist
-                    (car (clsql:select [x] [y] 
+                    (car (clsql:select [x] [y]
                                        :from [v1]
                                        :where [= [x] 1])))))
 
@@ -402,7 +403,7 @@ B varchar(32))")
               (clsql:index-exists-p [bar] )
               (clsql:index-exists-p [bar] :owner *test-database-user*)
               (clsql:index-exists-p [bar] :owner *test-false-database-user*)
-              
+
               (length (clsql-sys:list-indexes :on [alpha]))
               (length (clsql-sys:list-indexes :on [alpha] :owner *test-database-user*))
               (length (clsql-sys:list-indexes :on [alpha] :owner *test-false-database-user*))
@@ -421,7 +422,7 @@ B varchar(32))")
            (clsql:sequence-exists-p [foo])
            (clsql:sequence-exists-p [foo] :owner *test-database-user*)
            (clsql:sequence-exists-p [foo] :owner *test-false-database-user*)
-           
+
            (progn
              (clsql:drop-sequence [foo] :if-does-not-exist :ignore)
              (clsql:sequence-exists-p [foo] ))))
@@ -449,5 +450,3 @@ B varchar(32))")
   (nil (t nil) t (t nil)))
 
   ))
-
-#.(clsql:restore-sql-reader-syntax-state)