r9758: Add tests for syntax and fddl.
authorMarcus Pearce <m.t.pearce@city.ac.uk>
Mon, 12 Jul 2004 23:45:58 +0000 (23:45 +0000)
committerMarcus Pearce <m.t.pearce@city.ac.uk>
Mon, 12 Jul 2004 23:45:58 +0000 (23:45 +0000)
ChangeLog
tests/test-fddl.lisp
tests/test-fdml.lisp
tests/test-init.lisp
tests/test-syntax.lisp

index 1c7215cb0229b574ac1b1af322ad30bf4afecaa1..2841a0dd99720a23d3491d34be43038d03b48918 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+12 Jul 2004 Marcus Pearce <m.t.pearce@city.ac.uk> 
+       * tests/test-syntax.lisp, tests/test-fdml.lisp: add tests for escaping 
+       of single quotes. 
+       * tests/test-fddl.lisp: add tests for column and table constraints 
+       in CREATE-TABLE. Add test for OWNER keyword parameter to 
+       LIST-TABLES (assuming same underlying machinery in other FDDL 
+       functions). 
+       * tests/test-init.lisp: restrict above test to postgresql and oracle. 
+       
 12 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
-       * db-sqlite/sqlite-sql.lisp: Fix condition as reported by Aurelio Bignoli.
+       * db-sqlite/sqlite-sql.lisp: Fix condition as reported by Aurelio 
+       Bignoli.
 
 11 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
        * sql/oodml.lisp, sql/package.lisp, doc/ref-ooddl.lisp, db-mysql/mysql-objects.lisp: Add tinyint type
index c5c305b3828d3d4aa1ac694df734e8949fb5339a..55b2977e3428c750ac5196f5a4292ddae3d0fbfb 100644 (file)
       (clsql:drop-table "MyMixedCase"))
   ((5) (6)))
 
+(deftest :fddl/table/6 
+    (values
+     (clsql:table-exists-p [foo])
+     (progn
+       (let ((*backend-warning-behavior*
+              (if (member *test-database-type* 
+                          '(:postgresql :postgresql-socket))
+                  :ignore
+                  :warn)))
+         (clsql:create-table [foo] 
+                             '(([bar] integer :not-null :unique :primary-key) 
+                               ([baz] string :not-null :unique))))
+       (clsql:table-exists-p [foo]))
+     (progn
+       (clsql:drop-table [foo])
+       (clsql:table-exists-p [foo])))
+  nil t nil)    
+
+(deftest :fddl/table/7 
+    (values
+     (clsql:table-exists-p [foo])
+     (progn
+       (let ((*backend-warning-behavior*
+              (if (member *test-database-type* 
+                          '(:postgresql :postgresql-socket))
+                  :ignore
+                  :warn)))
+         (clsql:create-table [foo] '(([bar] integer :not-null) 
+                                     ([baz] string :not-null))
+                             :constraints '("UNIQUE (bar,baz)" 
+                                            "PRIMARY KEY (bar)")))
+       (clsql:table-exists-p [foo]))
+     (progn
+       (clsql:drop-table [foo])
+       (clsql:table-exists-p [foo])))
+  nil t nil)    
+
 (deftest :fddl/attributes/1
     (apply #'values
            (sort 
             (return nil))))))
   555 t)
 
-          
+(deftest :fddl/owner/1 
+    (and 
+     ;; user tables are an improper subset of all tables 
+     (= (length (intersection (clsql:list-tables :owner nil) 
+                              (clsql:list-tables :owner :all)
+                              :test #'string=))
+        (length (clsql:list-tables :owner nil)))
+     ;; user tables are a proper subset of all tables 
+     (> (length (clsql:list-tables :owner :all)) 
+        (length (clsql:list-tables :owner nil))))
+  t) 
+
 ))
 
 #.(clsql:restore-sql-reader-syntax-state)
index 344e6c5ce49965282dfd844bdf05bce0cef8a3f9..c28632d678cc363721c7e46edc21529650248ae4 100644 (file)
                  :flatp t :result-types nil :field-names nil)))
   ("Lenin" "Stalin" "Trotsky" "Kruschev"))
 
+;; test escaping of single quotes 
+(deftest :fdml/select/35 
+    (clsql:select "What's up doc?" :from [employee] :flatp t :field-names nil)
+  ("What's up doc?" "What's up doc?" "What's up doc?" "What's up doc?"
+   "What's up doc?" "What's up doc?" "What's up doc?" "What's up doc?"
+   "What's up doc?" "What's up doc?"))
+
 (deftest :fdml/do-query/1
     (let ((result '()))
     (clsql:do-query ((name) [select [last-name] :from [employee]
index cb1cec578b3a793cfc4493845ffd1e25f0197c7f..2da19aa2dd46af892edcbe045fff3e28802cefd7 100644 (file)
          ((and (eq *test-database-type* :oracle)
                (clsql-sys:in test :fdml/query/8 :fdml/select/21))
           (push (cons test "syntax not supported") skip-tests))
+          ((and (not (member *test-database-underlying-type* 
+                             '(:postgresql :oracle)))
+                (clsql-sys:in test :fddl/owner/1))
+           (push (cons test "table ownership not supported") skip-tests))
          (t
           (push test-form test-forms)))))
       (values (nreverse test-forms) (nreverse skip-tests))))
index 69265fefde6cc9dd1685c93976d8ad4c79946c7e..04ea99cbe1c3857383fe98d3b6face4079c285ad 100644 (file)
@@ -40,6 +40,9 @@
     (clsql:sql ["SELECT FOO,BAR FROM BAZ"])
   "SELECT FOO,BAR FROM BAZ")
 
+(deftest :syntax/generic/6 
+    (clsql:sql "What's up Doc?") 
+  "'What''s up Doc?'")
 
 (deftest :syntax/ident/1
     (clsql:sql [foo])