From 026988a3144e3ed7f48552b5567c34448fef51bc Mon Sep 17 00:00:00 2001 From: Marcus Pearce Date: Sat, 15 May 2004 12:22:31 +0000 Subject: [PATCH] r9360: Strings as table identifiers in SELECT. --- ChangeLog | 6 ++++++ TODO | 4 ++++ sql/classes.lisp | 7 ++++--- sql/operations.lisp | 4 ---- tests/test-fdml.lisp | 8 ++++++++ 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f877f91..6fe98ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +15 May 2004 Marcus Pearce (m.t.pearce@city.ac.uk) + * sql/classes.lisp: SELECT now accepts table identifiers as strings + for CommonSQL compliance. + * tests/test-fdml.lisp: added test for table identifiers as strings + in SELECT. + 15 May 2004 Marcus Pearce (m.t.pearce@city.ac.uk) * sql/sql.lisp: PRINT-QUERY now calls QUERY with result-types and field-names set to nil. diff --git a/TODO b/TODO index 29e242c..8f59a61 100644 --- a/TODO +++ b/TODO @@ -38,6 +38,10 @@ UPDATE-OBJECT-JOINS: object, to meet CommonSQL spec need to generate a single query to read values for all objects, up to max-len count. +COMMIT,ROLLBACK,START-TRANSACTION: + When COMMIT or ROLLBACK are called outside of WITH-TRANSACTION, an sql + transaction must be explicitly started first with START-TRANSACTION. + OPTIMIZATIONS * Revisit result-type list creation,perhaps caching diff --git a/sql/classes.lisp b/sql/classes.lisp index a829d38..4e697ca 100644 --- a/sql/classes.lisp +++ b/sql/classes.lisp @@ -579,9 +579,10 @@ uninclusive, and the args from that keyword to the end." (output-sql (apply #'vector selections) database) (when from (write-string " FROM " *sql-stream*) - (if (listp from) - (output-sql (apply #'vector from) database) - (output-sql from database))) + (typecase from + (list (output-sql (apply #'vector from) database)) + (string (write-string from *sql-stream*)) + (t (output-sql from database)))) (when inner-join (write-string " INNER JOIN " *sql-stream*) (output-sql inner-join database)) diff --git a/sql/operations.lisp b/sql/operations.lisp index d453254..bdbb929 100644 --- a/sql/operations.lisp +++ b/sql/operations.lisp @@ -139,10 +139,6 @@ (make-instance 'sql-relational-exp :operator 'in :sub-expressions rest)) -;; (defsql sql-concat (:symbol "||") (&rest rest) -;; (make-instance 'sql-relational-exp -;; :operator '\|\| :sub-expressions rest)) - (defsql sql-concat (:symbol "concat") (&rest rest) (make-instance 'sql-relational-exp :operator '\|\| :sub-expressions rest)) diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index ca491ac..8f9fd3f 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -374,6 +374,14 @@ ("Boris" "Josef" "Konstantin" "Leon" "Leonid" "Mikhail" "Nikita" "Vladamir" "Yuri")) +(deftest :fdml/select/25 + (clsql:select [first-name] :from "employee" :flatp t :distinct t + :field-names nil + :result-types nil + :order-by [first-name]) + ("Boris" "Josef" "Konstantin" "Leon" "Leonid" "Mikhail" "Nikita" "Vladamir" + "Yuri")) + ;(deftest :fdml/select/11 ; (clsql:select [emplid] :from [employee] ; :where [= [emplid] [any [select [companyid] :from [company]]]] -- 2.34.1