r10839: 15 Nov 2005 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / sql / utils.lisp
index 362d16c178529ae67659996c181bbe5f2e4aac73..d0402e8954a7fb7b85a96f77887a5f0ad62cdd08 100644 (file)
@@ -21,7 +21,7 @@
 (defun number-to-sql-string (num)
   (etypecase num
     (integer
-     num)
+     (princ-to-string num))
     (rational
      (float-to-sql-string (coerce num 'double-float)))
     (number
 
 (defun sql-escape (identifier)
   "Change hyphens to underscores, ensure string"
-  (let* ((unescaped (etypecase identifier
-                      (symbol (symbol-name identifier))
-                      (string identifier)))
-         (escaped (make-string (length unescaped))))
+  (let ((unescaped (etypecase identifier
+                    (symbol (symbol-name identifier))
+                    (string identifier))))
     (substitute #\_ #\- unescaped)))
 
-(dotimes (i (length unescaped))
-      (setf (char escaped i)
-            (cond ((equal (char unescaped i) #\-)
-                   #\_)
-                  ;; ...
-                  (t
-                   (char unescaped i)))))
-    escaped))
-
 (defmacro without-interrupts (&body body)
   #+allegro `(mp:without-scheduling ,@body)
   #+clisp `(progn ,@body)