r10146: 09 Nov 2004 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / sql / fdml.lisp
index 470ad37d195b7f2df46feea74ca724b2ee54f3a4..9b0e8b75a50e28dac3e968e90c6c04b7c87cc4d5 100644 (file)
@@ -192,117 +192,6 @@ are nil and AV-PAIRS is an alist of (attribute value) pairs."
     (execute-command stmt :database database)))
 
 
-;; output-sql
-
-(defmethod database-output-sql ((str string) database)
-  (declare (ignore database)
-           (optimize (speed 3) (safety 1) #+cmu (extensions:inhibit-warnings 3))
-           (type (simple-array * (*)) str))
-  (let ((len (length str)))
-    (declare (type fixnum len))
-    (cond ((zerop len)
-           +empty-string+)
-          ((and (null (position #\' str))
-                (null (position #\\ str)))
-           (concatenate 'string "'" str "'"))
-          (t
-           (let ((buf (make-string (+ (* len 2) 2) :initial-element #\')))
-             (do* ((i 0 (incf i))
-                   (j 1 (incf j)))
-                  ((= i len) (subseq buf 0 (1+ j)))
-               (declare (type fixnum i j))
-               (let ((char (aref str i)))
-                (declare (character char))
-                 (cond ((char= char #\')
-                        (setf (aref buf j) #\')
-                        (incf j)
-                        (setf (aref buf j) #\'))
-                       ((char= char #\\)
-                        (setf (aref buf j) #\\)
-                        (incf j)
-                        (setf (aref buf j) #\\))
-                       (t
-                        (setf (aref buf j) char))))))))))
-
-(let ((keyword-package (symbol-package :foo)))
-  (defmethod database-output-sql ((sym symbol) database)
-    (convert-to-db-default-case
-     (if (equal (symbol-package sym) keyword-package)
-        (concatenate 'string "'" (string sym) "'")
-        (symbol-name sym))
-     database)))
-
-(defmethod database-output-sql ((tee (eql t)) database)
-  (declare (ignore database))
-  "'Y'")
-
-(defmethod database-output-sql ((num number) database)
-  (declare (ignore database))
-  (princ-to-string num))
-
-(defmethod database-output-sql ((arg list) database)
-  (if (null arg)
-      "NULL"
-      (format nil "(~{~A~^,~})" (mapcar #'(lambda (val)
-                                            (sql-output val database))
-                                        arg))))
-
-(defmethod database-output-sql ((arg vector) database)
-  (format nil "~{~A~^,~}" (map 'list #'(lambda (val)
-                                        (sql-output val database))
-                              arg)))
-
-(defmethod database-output-sql ((self wall-time) database)
-  (declare (ignore database))
-  (db-timestring self))
-
-(defmethod database-output-sql ((self duration) database)
-  (declare (ignore database))
-  (format nil "'~a'" (duration-timestring self)))
-
-(defmethod database-output-sql (thing database)
-  (if (or (null thing)
-         (eq 'null thing))
-      "NULL"
-    (error 'sql-user-error
-           :message
-          (format nil
-                  "No type conversion to SQL for ~A is defined for DB ~A."
-                  (type-of thing) (type-of database)))))
-
-
-(defmethod output-sql-hash-key ((arg vector) database)
-  (list 'vector (map 'list (lambda (arg)
-                             (or (output-sql-hash-key arg database)
-                                 (return-from output-sql-hash-key nil)))
-                     arg)))
-
-(defmethod output-sql (expr database)
-  (write-string (database-output-sql expr database) *sql-stream*)
-  (values))
-
-(defmethod output-sql ((expr list) database)
-  (if (null expr)
-      (write-string +null-string+ *sql-stream*)
-      (progn
-        (write-char #\( *sql-stream*)
-        (do ((item expr (cdr item)))
-            ((null (cdr item))
-             (output-sql (car item) database))
-          (output-sql (car item) database)
-          (write-char #\, *sql-stream*))
-        (write-char #\) *sql-stream*)))
-  t)
-
-#+nil
-(defmethod add-storage-class ((self database) (class symbol) &key (sequence t))
-  (let ((tablename (view-table (find-class class))))
-    (unless (tablep tablename)
-      (create-view-from-class class)
-      (when sequence
-        (create-sequence-from-class class)))))
-
 ;;; Iteration
 
 (defmacro do-query (((&rest args) query-expression
@@ -562,6 +451,7 @@ A type can be
   :int
   :double
   :null
+  (:blob n)
   (:string n)
 "
   (unless (db-type-has-prepared-stmt? (database-type database))