(call-next-method)))))
(defmethod output-sql ((expr sql-ident) database)
- (with-slots (name)
- expr
+ (with-slots (name) expr
(write-string
(convert-to-db-default-case
(etypecase name
:type ',type)))
(defmethod output-sql ((expr sql-ident-attribute) database)
- (with-slots (qualifier name type)
- expr
+ (with-slots (qualifier name type) expr
(if (and (not qualifier) (not type))
- (write-string (sql-escape (convert-to-db-default-case
- (symbol-name name) database)) *sql-stream*)
+ (etypecase name
+ ;; Honor care of name
+ (string
+ (write-string name *sql-stream*))
+ (symbol
+ (write-string (sql-escape (convert-to-db-default-case
+ (symbol-name name) database)) *sql-stream*)))
+
;;; KMR: The TYPE field is used by CommonSQL for type conversion -- it
;;; should not be output in SQL statements
#+ignore
(write-string " FROM " *sql-stream*)
(typecase from
(list (output-sql (apply #'vector from) database))
- (string (write-string
- (sql-escape
- (convert-to-db-default-case from database)) *sql-stream*))
+ (string (write-string from *sql-stream*))
(t (output-sql from database))))
(when inner-join
(write-string " INNER JOIN " *sql-stream*)
(with-slots (into attributes values query)
ins
(write-string "INSERT INTO " *sql-stream*)
- (output-sql into database)
+ (output-sql
+ (typecase into
+ (string (sql-expression :attribute into))
+ (t into))
+ database)
(when attributes
(write-char #\Space *sql-stream*)
(output-sql attributes database))
(write-char #\Space *sql-stream*)
(write-string
(if (stringp db-type) db-type ; override definition
- (database-get-type-specifier (car type) (cdr type) database))
+ (database-get-type-specifier (car type) (cdr type) database
+ (database-underlying-type database)))
*sql-stream*)
(let ((constraints (database-constraint-statement
(if (and db-type (symbolp db-type))