r9464: * db-oracle/oracle-sql.lisp: Don't trim trailing spaces
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 25 May 2004 03:25:07 +0000 (03:25 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 25 May 2004 03:25:07 +0000 (03:25 +0000)
ChangeLog
db-oracle/oracle-sql.lisp

index 2e835f2940cb0af0952dd427ee83cfdc3b9b0ef6..37edf69944c346921e997c04b3153866e1722c15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * CONTRIBUTORS: Add note about Marcus' excellent work
        * sql/oodml.lisp: Removed old stub function     
        * clsql.asd: Use module names in current package rather than keyword package
+       * db-oracle/oracle-sql.lisp: Don't trim trailing spaces
        
 24 May 2004: Marcus Pearce (m.t.pearce@city.ac.uk) 
        * db-postgresql-socket/postgresql-socket-sql.lisp: replace 
index dfc3a155ae59a333f8255a95b50e57ddaf2723ed..9a7db75de7461afe46687ec1510a27819c177c38 100644 (file)
@@ -196,36 +196,21 @@ the length of that format.")
   (setf debug::*debug-print-length* nil))
 
 
-;;;; the OCI library, part V: converting from OCI representations to Lisp
-;;;; representations
-
 ;; Return the INDEXth string of the OCI array, represented as Lisp
 ;; SIMPLE-STRING. SIZE is the size of the fixed-width fields used by
 ;; Oracle to store strings within the array.
 
-;; In the wild world of databases, trailing spaces aren't generally
-;; significant, since e.g. "LARRY " and "LARRY    " are the same string
-;; stored in different fixed-width fields. OCI drops trailing spaces
-;; for us in some cases but apparently not for fields of fixed
-;; character width, e.g.
-;;
-;;   (dbi:sql "create table employees (name char(15), job char(15), city
-;;            char(15), rate float)" :db orcl :types :auto)
-;; In order to map the "same string" property above onto Lisp equality,
-;; we drop trailing spaces in all cases:
-
 (uffi:def-type string-pointer (* :unsigned-char))
 
 (defun deref-oci-string (arrayptr string-index size)
   (declare (type string-pointer arrayptr))
   (declare (type (mod #.+n-buf-rows+) string-index))
   (declare (type (and unsigned-byte fixnum) size))
-  (let* ((raw (uffi:convert-from-foreign-string 
-              (uffi:make-pointer
-               (+ (uffi:pointer-address arrayptr) (* string-index size))
-               :unsigned-char)))
-        (trimmed (string-trim " " raw)))
-     (if (equal trimmed "NULL") nil trimmed)))
+  (let ((str (uffi:convert-from-foreign-string 
+             (uffi:make-pointer
+              (+ (uffi:pointer-address arrayptr) (* string-index size))
+              :unsigned-char))))
+    (if (string-equal str "NULL") nil str)))
 
 ;; the OCI library, part Z: no-longer used logic to convert from
 ;; Oracle's binary date representation to Common Lisp's native date