From e25a98d30a030b33bcb78d1903811b6e71963216 Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Thu, 24 Feb 2011 13:39:02 -0500 Subject: [PATCH] fixed :from clauses to not throw errors when presented with a string or string expression --- sql/expressions.lisp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sql/expressions.lisp b/sql/expressions.lisp index efb54bb..b808064 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -602,14 +602,16 @@ uninclusive, and the args from that keyword to the end." (output-sql (apply #'vector selections) database)) (when from (write-string " FROM " *sql-stream*) - (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 (sql-escape (slot-value a 'name)) - (sql-escape (slot-value b 'name)))))) + (labels ((ident-string-val (a) + (typecase a + (sql-ident + (or (ignore-errors (slot-value a 'alias)) + (ignore-errors (slot-value a 'name)))) + (string a))) + (ident-table-equal (a b) + ;; The things should be type compatable + (string-equal (ident-string-val a) + (ident-string-val b)))) (typecase from (list (output-sql (apply #'vector (remove-duplicates from -- 2.34.1