+2014-06-11 Russ Tyndall <russ@acceleration.net>
+ * databases.lisp, sqlite3-sql.lisp
+ Similar to and overriding the patch 2014-01-30 937a3d, adds a
+ default-encoding variable uses that in places where a nil encoding
+ was being passed. Defaults to :utf-8. This is mostly in place so
+ that uffi and cffi both work similarly (by moving the default into
+ clsql instead of clsql-uffi). This allows my automated build
+ environment to do its job
+
2014-06-10 Russ Tyndall <russ@acceleration.net>
* db-mysql/Makefile - the results of dpkg-buildflags --get LDFLAGS
(sqlite3:sqlite3-column-blob stmt i)
(car types)
:length (sqlite3:sqlite3-column-bytes stmt i)
- :encoding (or (encoding database)
- :utf-8))
+ :encoding (encoding database))
(clsql-uffi:convert-raw-field
(sqlite3:sqlite3-column-text stmt i)
(car types)
- :encoding (or (encoding database)
- :utf-8))))))
+ :encoding (encoding database))))))
(when field-names
(setf col-names (loop for n from 0 below n-col
collect (sqlite3:sqlite3-column-name stmt n))))
(in-package #:clsql-sys)
+(defvar *default-encoding*
+ (or #+sbcl sb-impl::*default-external-format*
+ :utf-8))
(defvar *connect-if-exists* :error
"Default value for the if-exists keyword argument in calls to
(make-default t)
(pool nil)
(database-type *default-database-type*)
- (encoding nil))
+ (encoding *default-encoding*))
"Connects to a database of the supplied DATABASE-TYPE which
defaults to *DEFAULT-DATABASE-TYPE*, using the type-specific
connection specification CONNECTION-SPEC. The value of IF-EXISTS,
(database-list connection-spec database-type))
(defun encoding (db)
- (when (typep db 'database)
- (slot-value db 'encoding)))
+ (or (when (typep db 'database)
+ (slot-value db 'encoding))
+ *default-encoding*))
(defun (setf encoding) (encoding db)
(when (typep db 'database)
-(defun acquire-from-pool (connection-spec database-type &optional pool encoding)
+(defun acquire-from-pool (connection-spec database-type &optional pool (encoding *default-encoding*))
"Try to find a working database connection in the pool or create a new
one if needed. This performs 1 query against the DB to ensure it's still
valid. When possible (postgres, mssql) that query will be a reset