X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fclasses.lisp;h=872830f7ebf1bba5e39e66fb5e568a73c77eb35a;hb=21ffe5f820036726c6353a16dfb478fb41aa700c;hp=e7bc74e2934fd311b7808f083571ad21db8cb077;hpb=71ac7a8d3e5bea99472b07fa2a089c7173abb1f7;p=clsql.git diff --git a/sql/classes.lisp b/sql/classes.lisp index e7bc74e..872830f 100644 --- a/sql/classes.lisp +++ b/sql/classes.lisp @@ -13,7 +13,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql) +(in-package #:clsql-sys) (defvar +empty-string+ "''") @@ -160,7 +160,10 @@ (convert-to-db-default-case (symbol-name type) database))) (format *sql-stream* "~@[~A.~]~A" (when qualifier - (convert-to-db-default-case (sql-escape qualifier) database)) + (typecase qualifier + (string (format nil "~s" qualifier)) + (t (convert-to-db-default-case (sql-escape qualifier) + database)))) (sql-escape (convert-to-db-default-case name database)))) t)) @@ -515,7 +518,9 @@ (defvar *select-arguments* '(:all :database :distinct :flatp :from :group-by :having :order-by :order-by-descending :set-operation :where :offset :limit - :inner-join :on)) + :inner-join :on + ;; below keywords are not a SQL argument, but these keywords may terminate select + :caching :refresh)) (defun query-arg-p (sym) (member sym *select-arguments*)) @@ -577,9 +582,12 @@ 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 + (sql-escape + (convert-to-db-default-case from database)) *sql-stream*)) + (t (output-sql from database)))) (when inner-join (write-string " INNER JOIN " *sql-stream*) (output-sql inner-join database)) @@ -626,6 +634,7 @@ uninclusive, and the args from that keyword to the end." t) (defmethod output-sql ((query sql-object-query) database) + (declare (ignore database)) (with-slots (objects) query (when objects