X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=2a0085f6d3f4dd53f6f7122ef51f418f2b81a894;hb=d528dfe7e23fe5732fdbf1a282498fbec298d6cd;hp=f2d63c9c85c47e9dd810bce8dff46480291692d8;hpb=b08c25a7a9e56fb125caa9f7d7a56a473615007e;p=clsql.git diff --git a/sql/expressions.lisp b/sql/expressions.lisp index f2d63c9..2a0085f 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -578,15 +578,21 @@ uninclusive, and the args from that keyword to the end." (output-sql (apply #'vector selections) database) (when from (write-string " FROM " *sql-stream*) - (typecase from - (list (output-sql (apply #'vector (remove-duplicates - from - :test #'(lambda (a b) - (string-equal (symbol-name (slot-value a 'name)) - (symbol-name (slot-value b 'name)))))) - database)) - (string (write-string from *sql-stream*)) - (t (output-sql from database)))) + (flet ((ident-table-equal (a b) + (and (if (and (eql (type-of a) 'sql-ident-table) + (eql (type-of b) 'sql-ident-table)) + (string-equal (slot-value a 'alias) + (slot-value b 'alias)) + t) + (string-equal (symbol-name (slot-value a 'name)) + (symbol-name (slot-value b 'name)))))) + (typecase from + (list (output-sql (apply #'vector + (remove-duplicates from + :test #'ident-table-equal)) + 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)) @@ -835,7 +841,11 @@ uninclusive, and the args from that keyword to the end." (cons (symbol-name-default-case "NOT") "NOT") (cons (symbol-name-default-case "NULL") "NULL") (cons (symbol-name-default-case "PRIMARY") "PRIMARY") - (cons (symbol-name-default-case "KEY") "KEY"))) + (cons (symbol-name-default-case "KEY") "KEY") + (cons (symbol-name-default-case "UNSIGNED") "UNSIGNED") + (cons (symbol-name-default-case "ZEROFILL") "ZEROFILL") + (cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT") + (cons (symbol-name-default-case "UNIQUE") "UNIQUE"))) ;; ;; Convert type spec to sql syntax