Version 5.0.0: International character sets support
authorKevin Rosenberg <kevin@rosenberg.net>
Sun, 7 Feb 2010 09:50:17 +0000 (02:50 -0700)
committerKevin Rosenberg <kevin@rosenberg.net>
Sun, 7 Feb 2010 09:50:17 +0000 (02:50 -0700)
First release of CLSQL to formally and consistently support non-ASCII
strings with encoding of external formats for SQL strings.

UFFI version 1.8.1 is higher is required.

This change may introduce some differences in string handling for
people who are using non-ASCII encoded characters.  Thus, because of
the risk of BACKWARD INCOMPATIBILITY, the major version number was
incremented with this release.

ChangeLog
db-mysql/mysql-sql.lisp
debian/changelog
tests/test-i18n.lisp

index d00e9dbb784c4347e69379a70dfcd0b506246661..0c26481df018b09ed0c08a999215838e17ae9b08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-06  Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 5.0.0: First release of CLSQL to formally and
+       consistently support non-ASCII strings with encoding of external
+       formats for SQL strings. UFFI version 1.8.1 is higher is required.
+
+       This change may introduce some differences in string handling for
+       people who are using non-ASCII encoded characters.  Thus, because
+       of the risk of BACKWARD INCOMPATIBILITY, the major version number
+       was incremented with this release.
+
 2010-02-06  Kevin Rosenberg <kevin@rosenberg.net>
        * tests/test-i18n.lisp: Bind UFFI:*DEFAULT-EXTERNAL-FORMAT*
        for testing multibyte encodings.
@@ -14,7 +24,7 @@
        testing on postgres.
 
 2010-02-05  Kevin Rosenberg <kevin@rosenberg.net>
-       * clsql-test.asd, tests/{test-i18n,test-init}.lisp: 
+       * clsql-test.asd, tests/{test-i18n,test-init}.lisp:
        Load test-i18n.lisp and use its tests as long as 'uffi:no-i18n is
        not present in cl:*features*. This requires UFFI 1.7.2 or above.
 
index 0ca15cfe3a3cf11d4e907011138cdc87669a555f..4bf3543a29b380c07476db0e91818fd65c1de4e1 100644 (file)
@@ -6,7 +6,7 @@
 ;;;; Purpose:       High-level MySQL interface using UFFI
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; This file, part of CLSQL, is Copyright (c) 2002-2009 by Kevin M. Rosenberg
+;;;; This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
 ;;;;
 ;;;; CLSQL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 
 (in-package #:clsql-mysql)
 
-;; if we have :sb-unicode, UFFI will treat :cstring as a UTF-8 string
-(defun expression-length (query-expression)
-  (length #+sb-unicode (sb-ext:string-to-octets query-expression
-                                                :external-format :utf8)
-          #-sb-unicode query-expression))
-
 ;;; Field conversion functions
 
 (defun result-field-names (res-ptr)
                                            :mysql-ptr mysql-ptr))
                            (cmd "SET SESSION sql_mode='ANSI'"))
                       (uffi:with-cstring (cmd-cs cmd)
-                        (if (zerop (mysql-real-query mysql-ptr cmd-cs (expression-length cmd)))
+                        (if (zerop (mysql-real-query mysql-ptr cmd-cs (uffi:foreign-encoded-string-octets cmd)))
                             db
                             (progn
                               (warn "Error setting ANSI mode for MySQL.")
     (let ((mysql-ptr (database-mysql-ptr database)))
       (declare (type mysql-mysql-ptr-def mysql-ptr))
       (if (zerop (mysql-real-query mysql-ptr sql-native
-                                   (expression-length sql-expression)))
+                                   (uffi:foreign-encoded-string-octets sql-expression)))
           t
         (error 'sql-database-data-error
                :database database
              :message (mysql-error-string mysql-ptr)))
 
     (uffi:with-cstring (native-query sql-stmt)
-      (unless (zerop (mysql-stmt-prepare stmt native-query (expression-length sql-stmt)))
+      (unless (zerop (mysql-stmt-prepare stmt native-query (uffi:foreign-encoded-string-octets sql-stmt)))
         (mysql-stmt-close stmt)
         (error 'sql-database-error
                :error-id (mysql-errno mysql-ptr)
index 691689f26cb1e44516cefec03e5f80d240068550..758f2ca6e0e197def6eb8980445fb3d17b02f30f 100644 (file)
@@ -1,3 +1,9 @@
+cl-sql (5.0.0-1) unstable; urgency=low
+
+  * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sun, 07 Feb 2010 02:48:20 -0700
+
 cl-sql (4.3.3-1) unstable; urgency=low
 
   * New upstream
index 4a6cf67d42bc3a068a961a33994e2455535d031d..92aa8d069e7cd1199da5df8c7880195527c47526 100644 (file)
@@ -23,7 +23,7 @@
 ;;; UTF-8 for example can handle these easily.
 ;; I show this as a 20char string and 27 bytes in utf-8
 (deftest :basic/i18n/1
- (let ((uffi:*default-external-format* :utf-8))
+ (let ((uffi:*default-foreign-encoding* :utf-8))
    (first (query "SELECT 'Iñtërnâtiônàlizætiøn'"
                  :flatp t :field-names nil)))
  "Iñtërnâtiônàlizætiøn")
@@ -31,7 +31,7 @@
 ;; the z in this one is even stronger
 ;; I show this as a 20char string and 28 bytes in utf-8
 (deftest :basic/i18n/2
- (let ((uffi:*default-external-format* :utf-8))
+ (let ((uffi:*default-foreign-encoding* :utf-8))
    (first (query "SELECT 'Iñtërnâtiônàližætiøn'"
                  :flatp t :field-names nil)))
  "Iñtërnâtiônàližætiøn")