+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.
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.
;;;; 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)
+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
;;; 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")
;; 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")