X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=88293b30d360e24207e187e85c54e12bac7d99dd;hp=7f0ad1f82ff601a6556a8d45080fcb481494ba27;hb=aa707c93f55554dc5447c58f24e1b3ad4c01f0b9;hpb=c4e1422d93b72c1ab1be5c913c48860b1f4e39e2 diff --git a/sql/expressions.lisp b/sql/expressions.lisp index 7f0ad1f..88293b3 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -67,7 +67,8 @@ (defmethod print-object ((self %sql-expression) stream) (print-unreadable-object (self stream :type t) - (write-string (sql-output self) stream))) + (write-string (sql-output self) stream)) + self) ;; For straight up strings @@ -91,7 +92,8 @@ (defmethod print-object ((ident sql) stream) (format stream "#<~S \"~A\">" (type-of ident) - (sql-output ident nil))) + (sql-output ident nil)) + ident) ;; For SQL Identifiers of generic type @@ -354,7 +356,7 @@ (defmethod collect-table-refs ((sql sql-function-exp)) (let ((tabs nil)) - (dolist (exp (slot-value sql 'components)) + (dolist (exp (slot-value sql 'args)) (let ((refs (collect-table-refs exp))) (if refs (setf tabs (append refs tabs))))) (remove-duplicates tabs @@ -828,9 +830,9 @@ uninclusive, and the args from that keyword to the end." ;; (defmethod database-output-sql ((str string) database) - (declare (ignore database) - (optimize (speed 3) (safety 1) #+cmu (extensions:inhibit-warnings 3)) - (type (simple-array * (*)) str)) + (declare (optimize (speed 3) (safety 1) + #+cmu (extensions:inhibit-warnings 3)) + (simple-string str)) (let ((len (length str))) (declare (type fixnum len)) (cond ((zerop len) @@ -850,7 +852,11 @@ uninclusive, and the args from that keyword to the end." (setf (aref buf j) #\') (incf j) (setf (aref buf j) #\')) - ((char= char #\\) + ((and (char= char #\\) + ;; MTP: only escape backslash with pgsql/mysql + (member (database-underlying-type database) + '(:postgresql :mysql) + :test #'eq)) (setf (aref buf j) #\\) (incf j) (setf (aref buf j) #\\))