r2903: *** empty log message ***
[clsql.git] / base / utils.cl
index 99df86c90e38a9285b660ef43986f764b09c813e..1a34f78513a2c039b121b362e5a45ec15e2b2e3e 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:   Kevin M. Rosenberg
 ;;;; Date Started: Mar 2002
 ;;;;
-;;;; $Id: utils.cl,v 1.4 2002/05/27 17:19:30 kevin Exp $
+;;;; $Id: utils.cl,v 1.7 2002/09/30 01:57:32 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 
 (defun float-to-sql-string (num)
   "Convert exponent character for SQL"
-  (substitute #\e #\f (substitute #\e #\d (write-to-string num :readably t))))
+  (let ((str (write-to-string num :readably t)))
+    (cond
+     ((find #\f str)
+      (substitute #\e #\f str))
+     ((find #\d str)
+      (substitute #\e #\d str))
+     ((find #\F str)
+      (substitute #\e #\F str))
+     ((find #\D str)
+      (substitute #\e #\D str))
+     ((find #\S str)
+      (substitute #\e #\S str))
+     (t
+      str))))
 
-(defun sql-escape (identifier)
+  (defun sql-escape (identifier)
   "Change hyphens to underscores, ensure string"
   (let* ((unescaped (etypecase identifier
                       (symbol (symbol-name identifier))