r1648: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 24 Mar 2002 04:01:26 +0000 (04:01 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 24 Mar 2002 04:01:26 +0000 (04:01 +0000)
15 files changed:
ChangeLog
VERSION
clsql-mysql.system
clsql-postgresql.system
doc/ref.sgml
interfaces/aodbc/aodbc-sql.cl
interfaces/mysql/mysql-loader.cl
interfaces/mysql/mysql-package.cl
interfaces/mysql/mysql-sql.cl
interfaces/postgresql-socket/postgresql-socket-api.cl
interfaces/postgresql/postgresql-loader.cl
interfaces/postgresql/postgresql-package.cl
sql/package.cl
sql/sql.cl
test-clsql.cl

index 7c405bd237eea90d1cb7ac85837dd4643309c1eb..d5f5b23c342b6b7a6acedda72f9a2a5d55c5cb5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
 23 Mar 2002 Kevin Rosenberg (kevin@rosenberg.net)
-       * Initial Release
        
+       * doc/ref.sgml: Updated MAP-QUERY example to use
+       *read-default-float-format* (John Foderaro)
+       
+       * Extensive work to foreign library loaders and .system files to
+       check for successful loading of foreign libraries.
+
+       * Modified test-clsql.cl to allow more modularity and
+       automated testing in future release.
+
+               
        
diff --git a/VERSION b/VERSION
index 8ea2ddfc77b9f41e373e0591f46fc2fc155eb4ca..aa34b8bbd0ca815472797d24504e2ffe3c8f1aaf 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-0.5.0
+0.5.1
 
index 795d8d914efa341e77a525abeeb3f7b0308a7672..767257557e4bcb5eaaa3e31dab9b86825ac2b620 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: clsql-mysql.system,v 1.2 2002/03/23 17:10:47 kevin Exp $
+;;;; $Id: clsql-mysql.system,v 1.3 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -32,7 +32,7 @@
                 (:file "mysql-sql" :depends-on ("mysql-api")))
     :depends-on (:uffi :clsql)
     :finally-do
-    (progn
+    (when (clsql-sys:database-type-library-loaded :mysql)
       (clsql-sys:initialize-database-type :database-type :mysql)
       (setq clsql:*default-database-type* :mysql)
       (pushnew :mysql cl:*features*)))
index ae3a9a7776fb94caaf6d46adc6194d4ee8cf9bb7..d96a0f555fa1ec1095bb48262ced3a7947dbcafa 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: clsql-postgresql.system,v 1.2 2002/03/23 17:10:47 kevin Exp $
+;;;; $Id: clsql-postgresql.system,v 1.3 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -28,4 +28,9 @@
                 (:file "postgresql-loader" :depends-on ("postgresql-package"))
                 (:file "postgresql-api" :depends-on ("postgresql-loader"))
                 (:file "postgresql-sql" :depends-on ("postgresql-api")))
-    :depends-on (:uffi :clsql))
+    :depends-on (:uffi :clsql)
+    :finally-do
+    (when (clsql-sys:database-type-library-loaded :postgresql)
+      (clsql-sys:initialize-database-type :database-type :postgresql)
+      (pushnew :postgresql cl:*features*)))
+
index e7c17eca2aa2fee7483bd0f56e9263b19090a9a7..0c860c16c838d9d33b7daff2c23092fe15d7786a 100644 (file)
 (map-query '(vector double-float)
           #'(lambda (salary name)
               (declare (ignorable name))
-              (coerce (read-from-string salary) 'double-float))
-          "select salary,name from simple where salary > 8000")
+               (let ((*read-default-float-format* 'double-float))
+                (coerce (read-from-string salary) 'double-float))
+                 "select salary,name from simple where salary > 8000"))
 => #(10000.0d0 8000.5d0)
 (type-of *)
 => (SIMPLE-ARRAY DOUBLE-FLOAT (2))
index c1a74c9f90c80f4d52d2432660b9bb44b594d91a..4fb4f475f7738c983f0c14e1348e0a5ad38b8145 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: aodbc-sql.cl,v 1.1 2002/03/23 14:04:52 kevin Exp $
+;;;; $Id: aodbc-sql.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 (in-package :clsql-aodbc)
 
 
+(defmethod database-type-library-loaded ((database-type (eql :aodbc)))
+  "T if foreign library was able to be loaded successfully. "
+  (when (find-package :dbi) ;; finds Allegro's DBI (AODBC) package
+    t))
+
 (defmethod database-initialize-database-type ((database-type (eql :aodbc)))
   t)
 
index df0bd643915574b513f550d30a7fc40e3802475c..ce8b7ceeb3dec44d87b68e65bc2968f739f2a983 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: mysql-loader.cl,v 1.1 2002/03/23 14:04:52 kevin Exp $
+;;;; $Id: mysql-loader.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 load the MySQL client library succesfully.  If this differs at your site,
 set to the right path before compiling or loading the system.")
 
+(defvar *mysql-library-loaded* nil
+  "T if foreign library was able to be loaded successfully")
 
-
+(defmethod database-type-library-loaded ((database-type (eql :mysql)))
+  *mysql-library-loaded*)
+                                     
 (defmethod database-type-load-foreign ((database-type (eql :mysql)))
-  (uffi:load-foreign-library *mysql-library-filename* 
-                            :module "mysql" 
-                             :supporting-libraries 
-                            *mysql-supporting-libraries*)
-  (uffi:load-foreign-library *clsql-mysql-library-filename* 
-                            :module "clsql-mysql" 
-                             :supporting-libraries 
-                            (append *mysql-supporting-libraries*)))
+  (when
+      (and
+       (uffi:load-foreign-library *mysql-library-filename* 
+                                 :module "mysql" 
+                                 :supporting-libraries 
+                                 *mysql-supporting-libraries*)
+       (uffi:load-foreign-library *clsql-mysql-library-filename* 
+                                 :module "clsql-mysql" 
+                                 :supporting-libraries 
+                                 (append *mysql-supporting-libraries*)))
+    (setq *mysql-library-loaded* t)))
 
 
 (database-type-load-foreign :mysql)
index 450efc287acee8022a001ab596531dc9fddca50a..0dd231abf7e8c7f0ff8165c84d4c46889df9163e 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: mysql-package.cl,v 1.1 2002/03/23 14:04:52 kevin Exp $
+;;;; $Id: mysql-package.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 (in-package :cl-user)
 
 (defpackage :mysql
-    (:use :common-lisp)
+    (:use :common-lisp :clsql-sys)
     (:export 
+     #:database-library-loaded
+     
      #:mysql-socket
      #:mysql-book
      #:mysql-byte
index 37b88eb053a10bbe215f7f82c51332d5d3b948a3..878033c6d4a1d7cadb99a7a5f95b47608a4c99c2 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: mysql-sql.cl,v 1.2 2002/03/23 17:07:40 kevin Exp $
+;;;; $Id: mysql-sql.cl,v 1.3 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -31,6 +31,7 @@
 
 (defpackage :clsql-mysql
     (:use :common-lisp :clsql-sys :mysql)
+    (:export #:mysql-database)
     (:documentation "This is the CLSQL interface to MySQL."))
 
 (in-package :clsql-mysql)
index c97eda18be744cf8a4e8a5455f120bdf83bd5ed8..3d58496de352babdc74d105506dc9ac175aa9128 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;                
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-socket-api.cl,v 1.1 2002/03/23 17:10:48 kevin Exp $
+;;;; $Id: postgresql-socket-api.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
 ;;;;  - Changed CMUCL FFI to UFFI
 ;;;;  - Added necessary (force-output) for socket streams on 
 ;;;;     Allegro and Lispworks
+;;;;  - Added initialization variable
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
 (in-package :postgresql-socket)
 
 
+(defmethod database-type-library-loaded ((database-type
+                                         (eql :postgresql-socket)))
+  "T if foreign library was able to be loaded successfully. Always true for
+socket interface"
+  t)
+                                     
+
 ;;; Message I/O stuff
 
 (defmacro define-message-constants (description &rest clauses)
index 4db5fd426a63054a5e2b6f77075a191380d2fb3c..a2b7988c7bb1513f02850a933c7689bf0b314210 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-loader.cl,v 1.1 2002/03/23 14:04:53 kevin Exp $
+;;;; $Id: postgresql-loader.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 load the PostgresSQL client library succesfully.  If this differs at your site,
 set to the right path before compiling or loading the system.")
 
+(defvar *postgresql-library-loaded* nil
+  "T if foreign library was able to be loaded successfully")
+
+(defmethod database-type-library-loaded ((database-type (eql :postgresql)))
+  *postgresql-library-loaded*)
+                                     
 (defmethod database-type-load-foreign ((database-type (eql :postgresql)))
-  (uffi:load-foreign-library *postgresql-library-filename* 
-                            :module "postgresql"
-                            :supporting-libraries 
-                            *postgresql-supporting-libraries*))
+  (when
+      (uffi:load-foreign-library *postgresql-library-filename* 
+                                :module "postgresql"
+                                :supporting-libraries 
+                                *postgresql-supporting-libraries*)
+    (setq *postgresql-library-loaded* t)))
 
 (database-type-load-foreign :postgresql)
index 48d8d5e73c3bfc92091d02631dd9e2e19d3ce60e..2957cee2efc469566a192811e4ee2528eb24ae50 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-package.cl,v 1.1 2002/03/23 14:04:53 kevin Exp $
+;;;; $Id: postgresql-package.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -21,7 +21,7 @@
 
 (defpackage :postgresql
     (:nicknames :pgsql)
-    (:use :common-lisp)
+    (:use :common-lisp :clsql-sys)
     (:export
      #:pgsql-oid
      #:pgsql-conn-status-type
index 48c5da9875e362a43ca326acb993b923b2ad6d1c..75e68342e0d24525f623ebb4060b21bacafb5fc9 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: package.cl,v 1.1 2002/03/23 14:04:54 kevin Exp $
+;;;; $Id: package.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -32,6 +32,7 @@
      ;; "Private" exports for use by interface packages
      #:check-connection-spec
      #:database-type-load-foreign
+     #:database-type-library-loaded ;; KMR - Tests if foreign library okay
      #:database-initialize-database-type
      #:database-connect
      #:database-disconnect
index 696997409761613c5f513f462a3e7e065e715838..ce3cc56376d2eca6ce991965d2442ad4b2d28259 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: sql.cl,v 1.1 2002/03/23 14:04:54 kevin Exp $
+;;;; $Id: sql.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -148,6 +148,10 @@ although there is an existing connection (~A)."
 (defvar *loaded-database-types* nil
   "Contains a list of database types which have been defined/loaded.")
 
+(defvar *library-loaded-database-types* nil
+  "Contains a list of database types which have had their
+foreign libraries loaded successfully.")
+
 (defun reload-database-types ()
   "Reloads any foreign code for the loaded database types after a dump."
   (mapc #'database-type-load-foreign *loaded-database-types*))
@@ -158,6 +162,13 @@ although there is an existing connection (~A)."
   (:method :after (database-type)
           (pushnew database-type *loaded-database-types*)))
 
+(defgeneric database-type-library-loaded (database-type)
+  (:documentation
+   "The internal generic implementation for checking if
+database type library loaded successfully.")
+  (:method :after (database-type)
+          (pushnew database-type *library-loaded-database-types*)))
+
 (defvar *default-database-type* nil
   "Specifies the default type of database.  Currently only :mysql is
 supported.")
index 7d46988fad8179a34dcf558d0f13a0a78d76e8c2..2f1d960caef5e4347e2ffdd9a3299bb6ebc51b12 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Mar 2002
 ;;;;
-;;;; $Id: test-clsql.cl,v 1.1 2002/03/23 14:04:49 kevin Exp $
+;;;; $Id: test-clsql.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -19,6 +19,7 @@
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
 (in-package :cl-user)
 
+
 (defun get-spec-and-type ()
   (format t "~&Test CLSQL")
   (format t "~&==========~%")
   (let ((type-string (read-line)))
     (if (zerop (length type-string))
        (values nil nil)
-       (let* ((type (read-from-string type-string))
-              (spec (get-spec type
-                              (ecase type
-                                ((:mysql :postgresql :postgresql-socket)
-                                 '("host" "database" "user" "password"))
-                                (:aodbc
-                                 '("dsn" "user" "password"))))))
-         (when (eq type :mysql)
-           (test-clsql-mysql spec))
-         (values spec type)))))
+       (get-spec-for-type (read-from-string type-string)))))
+
+(defun get-spec-for-type (type)
+  (let ((spec (get-spec type
+                       (ecase type
+                         ((:mysql :postgresql :postgresql-socket)
+                          '("host" "database" "user" "password"))
+                         (:aodbc
+                          '("dsn" "user" "password"))))))
+    (values spec type)))))
 
 
 (defun get-spec (type spec-format)
@@ -51,6 +52,8 @@
     (nreverse spec)))
 
 (defun test-clsql (spec type)
+  (when (eq type :mysql)
+    (test-clsql-mysql spec))
   (let ((db (clsql:connect spec :database-type type :if-exists :new)))
     (unwind-protect
        (progn
@@ -85,7 +88,7 @@
     (clsql-mysql::database-execute-command "DROP TABLE test_clsql" db)
     (clsql-mysql::database-disconnect db)))
 
-
+#-non-interactive-test
 (do ((done nil))
     (done)
   (multiple-value-bind (spec type) (get-spec-and-type)