r2059: cleanup sql-escape* functions
[clsql.git] / sql / usql.cl
index c140fc40b6338f905a75d595b9830cb007c55fda..1a870984ff49907f5b681549ef91c4edf9a356ed 100644 (file)
@@ -8,7 +8,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg and onShore Development Inc
 ;;;; Date Started:  Mar 2002
 ;;;;
-;;;; $Id: usql.cl,v 1.5 2002/04/06 22:41:37 kevin Exp $
+;;;; $Id: usql.cl,v 1.7 2002/05/19 16:05:23 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and onShore Development Inc
@@ -74,22 +74,6 @@ specifies the database to operation on, defaulting to
     `(make-instance 'sql-ident :name ',name)))
 
 
-;; KMR -- change aref to more specific char
-(defun sql-escape (identifier)
-  (let* ((unescaped (etypecase identifier
-                      (symbol (symbol-name identifier))
-                      (string identifier)))
-         (escaped (make-string (length unescaped))))
-    (dotimes (i (length unescaped))
-      (setf (char escaped i)
-            (cond ((equal (char unescaped i) #\-)
-                   #\_)
-                  ;; ...
-                  (t
-                   (char unescaped i)))))
-    escaped))
-
-
 (defun create-sequence (name &key (database *default-database*))
   (database-create-sequence name database))
 
@@ -130,3 +114,16 @@ specifies the database to operation on, defaulting to
    (self stream :type t)
    (write-string (sql-output self) stream)))
 
+
+;; Methods for translating high-level table classes to low-level functions
+
+(defmethod database-list-attributes ((table sql-ident) database)
+  (database-list-attributes (string-downcase
+                            (symbol-name (slot-value table 'name)))
+                           database)
+  )
+
+(defmethod database-attribute-type (attribute (table sql-ident) database)
+  (database-attribute-type attribute (string-downcase
+                                     (symbol-name (slot-value table 'name)))
+                          database))