LispWorks 5.0 compatibility

Edi Weitz <[email protected]> Sun, 31 Dec 2006 00:41:05 +0100
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
--=-=-=

LispWorks 5.0 introduces a system package called "POSTGRESQL" which
conflicts with CLSQL.  Although it is only used in the Enterprise
Edition, it is present in the Professional Edition as well and will
most likely also be in the upcoming Personal Edition.  Because of
this, CLSQL-POSTGRESQL won't compile out of the box on LW 5.0.

I don't think we'll be able to convince LispWorks to rename this
package as CLSQL is in direct competition with (and in parts
imitating) their CommonSQL which is part of the Enterprise Edition, so
if the PostgreSQL part of CLSQL wants to remain usable for LispWorks
users, I think there are basically two ways to deal with this:

1. Enable CLSQL to modify the LispWorks system package "POSTGRESQL".
   This is attached as the "simple" patch and is obviously the least
   intrusive for CLSQL itself.  It is potentially dangerous for LW
   users, though, especially for those of the Enterprise Edition.  If
   you decide to go this way, I'd at least add a corresponding note to
   the manual.

2. Switch the role of the package name and the nickname for CLSQL's
   "POSTGRESQL" package (and skip the nickname for LispWorks 5.0).
   This is only mildly intrusive for the CLSQL code base and should be
   fully backwards compatible with virtually all code using CLSQL.
 
   This is attached as the "full" patch.

I'd obviously prefer the second alternative.

Cheers,
Edi.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=postgresql-simple.diff

--- clsql-3.7.9/clsql-postgresql.asd.orig	2006-12-31 00:15:27.534204800 +0100
+++ clsql-3.7.9/clsql-postgresql.asd	2006-12-31 00:13:40.480268800 +0100
@@ -21,6 +21,9 @@
 
 #+(and allegro macosx) (push "so" excl::*load-foreign-types*)
 
+#+(and :lispworks (not :lispworks4))
+(lw:removef hcl:*packages-for-warn-on-redefinition* "POSTGRESQL" :test #'string=)
+
 (defsystem clsql-postgresql
   :name "cl-sql-postgresql"
   :author "Kevin M. Rosenberg <[email protected]>"

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=postgresql-full.diff

diff -ru clsql-3.7.9.orig/db-postgresql/postgresql-api.lisp clsql-3.7.9/db-postgresql/postgresql-api.lisp
--- clsql-3.7.9.orig/db-postgresql/postgresql-api.lisp	2006-12-30 14:37:44.000000000 +0100
+++ clsql-3.7.9/db-postgresql/postgresql-api.lisp	2006-12-31 00:20:44.379806400 +0100
@@ -18,7 +18,7 @@
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;; *************************************************************************
 
-(in-package #:postgresql)
+(in-package #:pgsql)
 
 
 ;;;; This file implements as little of the FFI bindings to the
diff -ru clsql-3.7.9.orig/db-postgresql/postgresql-loader.lisp clsql-3.7.9/db-postgresql/postgresql-loader.lisp
--- clsql-3.7.9.orig/db-postgresql/postgresql-loader.lisp	2006-12-30 14:37:44.000000000 +0100
+++ clsql-3.7.9/db-postgresql/postgresql-loader.lisp	2006-12-31 00:21:08.674740800 +0100
@@ -16,7 +16,7 @@
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;; *************************************************************************
 
-(in-package #:postgresql)
+(in-package #:pgsql)
 
 
 (defvar *postgresql-supporting-libraries* '("crypt" "c")
diff -ru clsql-3.7.9.orig/db-postgresql/postgresql-package.lisp clsql-3.7.9/db-postgresql/postgresql-package.lisp
--- clsql-3.7.9.orig/db-postgresql/postgresql-package.lisp	2006-12-30 14:37:44.000000000 +0100
+++ clsql-3.7.9/db-postgresql/postgresql-package.lisp	2006-12-31 00:19:46.606732800 +0100
@@ -18,8 +18,9 @@
 
 (in-package #:cl-user)
 
-(defpackage #:postgresql
-    (:nicknames #:pgsql)
+(defpackage #:pgsql
+    #-(and :lispworks (not :lispworks4))
+    (:nicknames #:postgresql)
     (:use #:cl #:clsql-uffi)
     (:export
      #:pgsql-oid
diff -ru clsql-3.7.9.orig/db-postgresql/postgresql-sql.lisp clsql-3.7.9/db-postgresql/postgresql-sql.lisp
--- clsql-3.7.9.orig/db-postgresql/postgresql-sql.lisp	2006-12-30 14:37:46.000000000 +0100
+++ clsql-3.7.9/db-postgresql/postgresql-sql.lisp	2006-12-31 00:21:56.413385600 +0100
@@ -16,7 +16,7 @@
 (in-package #:cl-user)
 
 (defpackage #:clsql-postgresql
-    (:use #:common-lisp #:clsql-sys #:postgresql #:clsql-uffi)
+    (:use #:common-lisp #:clsql-sys #:pgsql #:clsql-uffi)
     (:export #:postgresql-database)
     (:documentation "This is the CLSQL interface to PostgreSQL."))
 
@@ -306,7 +306,7 @@
 
 (defmethod database-create-large-object ((database postgresql-database))
   (lo-create (database-conn-ptr database)
-	     (logior postgresql::+INV_WRITE+ postgresql::+INV_READ+)))
+	     (logior pgsql::+INV_WRITE+ pgsql::+INV_READ+)))
 
 
 #+mb-original
@@ -318,7 +318,7 @@
     (with-transaction (:database database)
        (unwind-protect
 	  (progn 
-	    (setf fd (lo-open ptr object-id postgresql::+INV_WRITE+))
+	    (setf fd (lo-open ptr object-id pgsql::+INV_WRITE+))
 	    (when (>= fd 0)
 	      (when (= (lo-write ptr fd data length) length)
 		(setf result t))))
@@ -336,7 +336,7 @@
     (database-execute-command "begin" database)
     (unwind-protect
 	(progn 
-	  (setf fd (lo-open ptr object-id postgresql::+INV_WRITE+))
+	  (setf fd (lo-open ptr object-id pgsql::+INV_WRITE+))
 	  (when (>= fd 0)
 	    (when (= (lo-write ptr fd data length) length)
 	      (setf result t))))
@@ -357,7 +357,7 @@
     (unwind-protect
        (progn
 	 (database-execute-command "begin" database)
-	 (setf fd (lo-open ptr object-id postgresql::+INV_READ+))
+	 (setf fd (lo-open ptr object-id pgsql::+INV_READ+))
 	 (when (>= fd 0)
 	   (setf length (lo-lseek ptr fd 0 2))
 	   (lo-lseek ptr fd 0 0)
@@ -429,7 +429,7 @@
       (coerce-string db)
       (coerce-string user)
       (let ((connection (PQsetdbLogin host port options tty db user password)))
-        (declare (type postgresql::pgsql-conn-ptr connection))
+        (declare (type pgsql::pgsql-conn-ptr connection))
         (unless (eq (PQstatus connection)
 		    pgsql-conn-status-type#connection-ok)
           ;; Connect failed

--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
CLSQL-Devel mailing list
[email protected]
http://lists.b9.com/mailman/listinfo/clsql-devel

--=-=-=--