r10922: 03 May 2006 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / sql / expressions.lisp
index e04180c615f662fe077bd9318acd61340b7bab0e..cd1a6d397bc9a2665bf0472a80d5d14aa563e602 100644 (file)
@@ -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))
@@ -902,7 +903,7 @@ uninclusive, and the args from that keyword to the end."
 
 (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)