X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=44cde13d4b57c6b271be8241b1597e017a23678b;hp=e04180c615f662fe077bd9318acd61340b7bab0e;hb=ace0f0f5b9311e10f4638a206e60f601554ee102;hpb=89b40554349ff77e986d1c6f584b9c9a28cf36af diff --git a/sql/expressions.lisp b/sql/expressions.lisp index e04180c..44cde13 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -589,15 +589,16 @@ uninclusive, and the args from that keyword to the end." (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)))))) + (string-equal (sql-escape (slot-value a 'name)) + (sql-escape (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))))) + (t (let ((*in-subselect* t)) + (output-sql from database)))))) (when inner-join (write-string " INNER JOIN " *sql-stream*) (output-sql inner-join database)) @@ -897,12 +898,21 @@ uninclusive, and the args from that keyword to the end." database)))) (defmethod database-output-sql ((tee (eql t)) database) + (if database + (let ((val (database-output-sql-as-type 'boolean t database (database-type database)))) + (when val + (typecase val + (string (format nil "'~A'" val)) + (integer (format nil "~A" val))))) + "'Y'")) + +#+nil(defmethod database-output-sql ((tee (eql t)) database) (declare (ignore database)) "'Y'") (defmethod database-output-sql ((num number) database) (declare (ignore database)) - (princ-to-string num)) + (number-to-sql-string num)) (defmethod database-output-sql ((arg list) database) (if (null arg)