+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
(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)
: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]
((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))))
(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])