r11657: 25 Apr 2007 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / sql / expressions.lisp
index cd1a6d397bc9a2665bf0472a80d5d14aa563e602..93c97d94d8731924210e6c761b482024c859592e 100644 (file)
@@ -22,7 +22,7 @@
 (defvar *sql-stream* nil
   "stream which accumulates SQL output")
 
-(defun sql-output (sql-expr &optional database)
+(defun sql-output (sql-expr &optional (database *default-database*))
   "Top-level call for generating SQL strings. Returns an SQL
   string appropriate for DATABASE which corresponds to the
   supplied lisp expression SQL-EXPR."
   (:documentation "An SQL between expression."))
 
 (defmethod output-sql ((expr sql-between-exp) database)
-  (with-slots (name args)
+  (with-slots (args)
       expr
     (output-sql (first args) database)
     (write-string " BETWEEN " *sql-stream*)
@@ -898,6 +898,15 @@ uninclusive, and the args from that keyword to the end."
        database))))
 
 (defmethod database-output-sql ((tee (eql t)) database)
+  (if database
+      (let ((val (database-output-sql-as-type 'boolean t database (database-type database))))
+        (when val
+          (typecase val
+            (string (format nil "'~A'" val))
+            (integer (format nil "~A" val)))))
+    "'Y'"))
+
+#+nil(defmethod database-output-sql ((tee (eql t)) database)
   (declare (ignore database))
   "'Y'")