Re: CLSQL integration of CLSQL-USQL

Ng Pheng Siong <[email protected]> Wed, 14 Apr 2004 00:55:15 +0800
Newsgroups gmane.lisp.uncommon-sql,gmane.lisp.clsql.general,gmane.lisp.clsql.devel
Message-ID <[email protected]>
On Wed, Apr 07, 2004 at 12:05:26PM -0600, Kevin Rosenberg wrote:
> For people who have used the original, but orphaned, UncommonSQL
> library, please use the CLSQL mail lists to send feature requests, bug
> reports, and comments. 
> [...]
> The new version of CLSQL, v2.3.0, is now available for download at

The version I downloaded says v2.6.4.

Here's a simple patch to db-sqlite/sqlite-sql.lisp:

--- sqlite-sql.lisp.org	Wed Apr 14 00:15:36 2004
+++ sqlite-sql.lisp	Wed Apr 14 00:21:12 2004
@@ -298,7 +298,9 @@
 
 (defmethod database-probe (connection-spec (type (eql :sqlite)))
   (destructuring-bind (name) connection-spec
-    ;; TODO: Add a test that this file is a real sqlite database 
-    (and (probe-file name) t)))
+    ;; Name ":memory:" means what it says: database in RAM. 
+    (or (string-equal ":memory:" name)
+	;; TODO: Add a test that this file is a real sqlite database
+	(and (probe-file name) t))))
 
Yes, specifying a name ":memory:" gives you an SQLite database in RAM.
Such a database is, of course, very fast and offers all kinds of
interesting possibilities.
 
Still on SQLite, for multithreaded operations SQLite _requires_ one
connection per thread. Based on the last public USQL release I've
implemented an SQLite backend which has some macros and :around methods
that use per-process connections instead of *default-database*. 

On LW my application code sticks the connections in process plists. 

I'm checking out this release of CLSQL (in my copious spare time) and I'll
be happy to supply a patch to add my thread-safety stuff, although I'd
prefer to wait till the latest USQL code has been integrated.

Cheers.

-- 
Ng Pheng Siong <[email protected]> 

http://firewall.rulemaker.net -+- Firewall Change Management & Version Control
http://sandbox.rulemaker.net/ngps -+- ZServerSSL/Zope Windows Installers