r9359: Fixes for PRINT-QUERY and sql concatenation operator (||).
[clsql.git] / sql / syntax.lisp
index bf3ce15484487696cd7e8fb1d6e4b5da5aa4fab1..7a619f0c05b3b9ed848c2b977f8efdd51ed3ee82 100644 (file)
@@ -14,7 +14,6 @@
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;; *************************************************************************
 
-
 (in-package #:clsql-sys)
 
 (defvar *original-reader-enter* nil)
@@ -85,9 +84,11 @@ syntax is disabled."
 (defun sql-reader-open (stream char)
   (declare (ignore char))
   (let ((sqllist (read-delimited-list #\] stream t)))
-    (if (sql-operator (car sqllist))
-       (cons (sql-operator (car sqllist)) (cdr sqllist))
-      (apply #'generate-sql-reference sqllist))))
+    (cond ((string= (write-to-string (car sqllist)) "||")
+           (cons (sql-operator 'concat) (cdr sqllist)))
+          ((sql-operator (car sqllist))
+           (cons (sql-operator (car sqllist)) (cdr sqllist)))
+          (t (apply #'generate-sql-reference sqllist)))))
 
 ;; Internal function that disables the close syntax when leaving sql context.
 (defun disable-sql-close-syntax ()
@@ -158,7 +159,7 @@ attribute and type."
 for the operator."
   (typecase operation
     (string nil)
-    (symbol (gethash (string-upcase (symbol-name operation))
+    (symbol (gethash (symbol-name-default-case (symbol-name operation))
                      *sql-op-table*))))
 
 (defun sql-operation (operation &rest rest)