X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=10b1130aa11dd81f38a0dc5199bfa3788c9a5f74;hb=dea46c447f6688f1519a6fbe7f5998d0eab7474c;hp=80d735c1ee07eed15b4a6d13f20d35116382477f;hpb=225c02af1ae1c9c6f0b6c29eaf8319d48caae89f;p=clsql.git diff --git a/sql/expressions.lisp b/sql/expressions.lisp index 80d735c..10b1130 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -186,11 +186,6 @@ sql `(make-instance 'sql-ident-table :name ',name :table-alias ',alias))) -(defun generate-sql (expr database) - (let ((*sql-stream* (make-string-output-stream))) - (output-sql expr database) - (get-output-stream-string *sql-stream*))) - (defmethod output-sql ((expr sql-ident-table) database) (with-slots (name alias) expr @@ -374,12 +369,14 @@ :test (lambda (tab1 tab2) (equal (slot-value tab1 'name) (slot-value tab2 'name)))))) +(defvar *in-subselect* nil) (defmethod output-sql ((expr sql-function-exp) database) (with-slots (name args) expr (output-sql name database) - (when args (output-sql args database))) + (let ((*in-subselect* nil)) ;; aboid double parens + (when args (output-sql args database)))) t) @@ -563,8 +560,6 @@ uninclusive, and the args from that keyword to the end." :group-by group-by :having having :order-by order-by :inner-join inner-join :on on)))))) -(defvar *in-subselect* nil) - (defmethod output-sql ((query sql-query) database) (with-slots (distinct selections from where group-by having order-by limit offset inner-join on all set-operation) @@ -841,16 +836,6 @@ uninclusive, and the args from that keyword to the end." ;; Convert type spec to sql syntax ;; -(defmethod database-constraint-description (constraint database) - (declare (ignore database)) - (let ((output (assoc (symbol-name constraint) *constraint-types* - :test #'equal))) - (if (null output) - (error 'sql-user-error - :message (format nil "unsupported column constraint '~A'" - constraint)) - (cdr output)))) - (defmethod database-constraint-statement (constraint-list database) (declare (ignore database)) (make-constraints-description constraint-list))