r2078: Changes to finish separating clsql-base form clsql
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 27 May 2002 17:19:45 +0000 (17:19 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 27 May 2002 17:19:45 +0000 (17:19 +0000)
19 files changed:
base/classes.cl
base/conditions.cl
base/db-interface.cl
base/initialize.cl
base/package.cl
base/utils.cl
clsql-aodbc.system
clsql.system
interfaces/aodbc/aodbc-package.cl
interfaces/aodbc/aodbc-sql.cl
interfaces/mysql/mysql-loader.cl
interfaces/mysql/mysql-sql.cl
interfaces/mysql/mysql-usql.cl
interfaces/postgresql-socket/postgresql-socket-sql.cl
interfaces/postgresql/postgresql-loader.cl
interfaces/postgresql/postgresql-sql.cl
sql/package.cl [new file with mode: 0644]
sql/transactions.cl
sql/usql.cl

index 0a91a16db682ddd7afb54c82c86a7937757b3da6..e23993ea1728a21cd31844ece9c48d1e62e8bea7 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: classes.cl,v 1.1 2002/05/13 16:22:08 kevin Exp $
+;;;; $Id: classes.cl,v 1.2 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -19,7 +19,7 @@
 ;;;; *************************************************************************
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :clsql-sys)
+(in-package :clsql-base-sys)
 
 
 (defclass database ()
index 5785653646501327585df2f434cfccb828ce3f33..e902ab08c0c20fe11cfa0b18b744d7abd4e448ea 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: conditions.cl,v 1.1 2002/05/13 16:22:08 kevin Exp $
+;;;; $Id: conditions.cl,v 1.2 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -19,7 +19,7 @@
 ;;;; *************************************************************************
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :clsql-sys)
+(in-package :clsql-base-sys)
 
 ;;; Conditions
 (define-condition clsql-condition ()
index f779159d8b96b36f70f57e89e2d70973240af268..d90d566bac8674e3de196663bfb6a254884d9970 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;                onShoreD to support UncommonSQL front-end 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: db-interface.cl,v 1.1 2002/05/13 16:22:08 kevin Exp $
+;;;; $Id: db-interface.cl,v 1.2 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai, and onShoreD
@@ -20,7 +20,7 @@
 ;;;; *************************************************************************
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :clsql-sys)
+(in-package :clsql-base-sys)
 
 (defgeneric database-type-load-foreign (database-type)
   (:documentation
    "The internal generic implementation for checking if
 database type library loaded successfully."))
 
-(defgeneric database-type (database-type)
+(defgeneric database-type (database)
   (:documentation
    "Returns database type")
-  (:method (database-type)
-          (declare (ignore database-type))
+  (:method (database)
           (signal-nodb-error database)))
 
 
index 067dfa7ae1cd26e7a3313bc92e82e322c849a453..e522d02fcc6a90c7246d0a492c13f9f6a680852f 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg 
 ;;;; Date Started:  May 2002
 ;;;;
-;;;; $Id: initialize.cl,v 1.1 2002/05/14 16:23:37 kevin Exp $
+;;;; $Id: initialize.cl,v 1.2 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -18,7 +18,7 @@
 ;;;; *************************************************************************
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :clsql-sys)
+(in-package :clsql-base-sys)
 
 (defvar *loaded-database-types* nil
   "Contains a list of database types which have been defined/loaded.")
index 326e19687ec6e7b5fcb4b24259a383e7a3d5c093..62199ce23bc7f0ecf44674300249bf7d169f4b03 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: package.cl,v 1.5 2002/05/20 17:46:34 kevin Exp $
+;;;; $Id: package.cl,v 1.6 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -25,7 +25,7 @@
 ;;;; core packages.
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-(defpackage :clsql-sys
+(defpackage :clsql-base-sys
   (:use :common-lisp)
   (:export
      ;; "Private" exports for use by interface packages
@@ -59,8 +59,7 @@
      #:database-read-large-object
      #:database-delete-large-object
      
-     ;; Shared exports for re-export by CLSQL
-
+     ;; Shared exports for re-export by CLSQL-BASE
      .
      #1=(#:clsql-condition
         #:clsql-error
@@ -91,6 +90,7 @@
         #:clsql-exists-error
         #:clsql-closed-error
         #:clsql-closed-error-database
+        
         #:*loaded-database-types*
         #:reload-database-types
         #:*default-database-type*
         #:closed-database
         #:find-database
         #:database-name-from-spec
-        #:connect
-        #:disconnect
-        #:query
-        #:execute-command
-        #:map-query
-        #:do-query
 
-        ;; functional.cl
-        #:insert-records
-        #:delete-records
-        #:update-records
-        #:with-database
+        ;; accessors for database class
+        #:name
+        #:connection-spec
+        #:transaction
+        #:transaction-level
+        #:conn-pool
         
         ;; utils.cl
         #:number-to-sql-string
         #:float-to-sql-string
         #:sql-escape-quotes
-
-        ;; For UncommonSQL support
-        #:sql-ident
-        #:list-tables
-        #:list-attributes
-        #:attribute-type
-        #:create-sequence 
-        #:drop-sequence
-        #:sequence-next
-
-        ;; Pooled connections
-        #:disconnect-pooled
-        #:find-or-create-connection-pool
-
-        ;; Transactions
-        #:with-transaction
-        #:commit-transaction
-        #:rollback-transaction
-        #:add-transaction-commit-hook
-        #:add-transaction-rollback-hook
-
-        ;; Large objects (Marc B)
-        #:create-large-object
-        #:write-large-object
-        #:read-large-object
-        #:delete-large-object
         ))
-    (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
+    (:documentation "This is the INTERNAL SQL-Interface package of CLSQL-BASE."))
 
-(defpackage #:clsql
-    (:import-from #:clsql-sys . #1#)
+(defpackage #:clsql-base
+    (:import-from :clsql-base-sys . #1#)
     (:export . #1#)
-    (:documentation "This is the SQL-Interface package of CLSQL."))
+    (:documentation "This is the SQL-Interface package of CLSQL-BASE."))
 );eval-when
 
-(defpackage #:clsql-user
-    (:use #:common-lisp #:clsql)
-    (:documentation "This is the user package for experimenting with CLSQL."))
+
index de028aaf6e4cfcd238a84ae70f3ec144dcbe2699..99df86c90e38a9285b660ef43986f764b09c813e 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:   Kevin M. Rosenberg
 ;;;; Date Started: Mar 2002
 ;;;;
-;;;; $Id: utils.cl,v 1.3 2002/05/19 16:05:22 kevin Exp $
+;;;; $Id: utils.cl,v 1.4 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -17,7 +17,7 @@
 ;;;; *************************************************************************
 
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :clsql-sys)
+(in-package :clsql-base-sys)
 
 (defun number-to-sql-string (num)
   (etypecase num
index d80acf766f1184a814ba22de67548973fed7b31b..4cb2fe638fbb70628a7aed25d2d2c352529b6a07 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: clsql-aodbc.system,v 1.5 2002/05/18 17:37:48 kevin Exp $
+;;;; $Id: clsql-aodbc.system,v 1.6 2002/05/27 17:19:29 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -25,6 +25,6 @@
     :binary-pathname "CL-LIBRARY:clsql;interfaces;aodbc;bin;"
     :components ((:file "aodbc-package")
                 (:file "aodbc-sql" :depends-on ("aodbc-package")))
-    :depends-on (:clsql))
+    :depends-on (:clsql-base))
 
     
index aa1356e845630af6d5fffe26c89c71b098d3832d..9efc2ad8a038b8a3d22a92c4847af72aac370fcf 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: clsql.system,v 1.14 2002/05/15 17:19:42 kevin Exp $
+;;;; $Id: clsql.system,v 1.15 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -31,7 +31,8 @@
     :source-pathname "CL-LIBRARY:clsql;sql;"
     :source-extension "cl"
     :binary-pathname "CL-LIBRARY:clsql;sql;bin;"
-    :components ((:file "pool")
+    :components ((:file "package")
+                (:file "pool" :depends-on ("package"))
                 (:file "loop-extension")
                 (:file "sql" :depends-on ("pool"))
                 (:file "transactions" :depends-on ("sql"))
index 3bfaee8153fe0321124289dd197c0eefed635dfa..14f099505f900a40751066ec32a55b0c9a3192f0 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: aodbc-package.cl,v 1.1 2002/03/23 14:04:52 kevin Exp $
+;;;; $Id: aodbc-package.cl,v 1.2 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -26,6 +26,6 @@
 
 (defpackage :clsql-aodbc
     (:nicknames :aodbc)
-    (:use :common-lisp :clsql-sys)
+    (:use :common-lisp :clsql-base-sys)
     (:export #:aodbc-database)
     (:documentation "This is the CLSQL interface to Allegro's AODBC"))
index e493918aec218ee2260602c580c41f36191b09cb..5eaa960da3d81b6befe01a77196dd9ef5325e3ab 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: aodbc-sql.cl,v 1.10 2002/05/13 22:05:21 kevin Exp $
+;;;; $Id: aodbc-sql.cl,v 1.11 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
   (when (find-package :dbi) ;; finds Allegro's DBI (AODBC) package
     t))
 
-(defmethod clsql-sys:database-type-load-foreign ((databae-type (eql :aodbc)))
+(defmethod clsql-base-sys:database-type-load-foreign ((databae-type (eql :aodbc)))
   t)
 
 (when (find-package :dbi)
-  (clsql-sys:database-type-load-foreign :aodbc)) 
+  (clsql-base-sys:database-type-load-foreign :aodbc)) 
 
 (defmethod database-initialize-database-type ((database-type (eql :aodbc)))
   t)
        list))))
 
                       
-(when (clsql-sys:database-type-library-loaded :aodbc)
-  (clsql-sys:initialize-database-type :database-type :aodbc))
+(when (clsql-base-sys:database-type-library-loaded :aodbc)
+  (clsql-base-sys:initialize-database-type :database-type :aodbc))
index a241d2d465874a043b0b594c2989ad8dd5b7946e..75dd094e59f7a5b2cd21a294c2a3459174c9b42b 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: mysql-loader.cl,v 1.17 2002/05/18 17:37:48 kevin Exp $
+;;;; $Id: mysql-loader.cl,v 1.18 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -65,10 +65,10 @@ 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 clsql-sys:database-type-library-loaded ((database-type (eql :mysql)))
+(defmethod clsql-base-sys:database-type-library-loaded ((database-type (eql :mysql)))
   *mysql-library-loaded*)
                                      
-(defmethod clsql-sys:database-type-load-foreign ((database-type (eql :mysql)))
+(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :mysql)))
   (let ((mysql-path
         (uffi:find-foreign-library *mysql-library-candidate-names*
                                    *mysql-library-candidate-directories*
@@ -92,5 +92,5 @@ set to the right path before compiling or loading the system.")
            mysql-path *clsql-mysql-library-filename*))))
 
 
-(clsql-sys:database-type-load-foreign :mysql)
+(clsql-base-sys:database-type-load-foreign :mysql)
 
index d608d8be3408f97d8ced5d29b79614afad2f845f..652fb33e9f7e841a4c1e8f2bc6e2d5351c10c634 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: mysql-sql.cl,v 1.21 2002/05/25 15:57:28 kevin Exp $
+;;;; $Id: mysql-sql.cl,v 1.22 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -33,7 +33,7 @@
 ;;;; Added field types
 
 (defpackage :clsql-mysql
-    (:use :common-lisp :clsql-sys :mysql :clsql-uffi)
+    (:use :common-lisp :clsql-base-sys :mysql :clsql-uffi)
     (:export #:mysql-database)
     (:documentation "This is the CLSQL interface to MySQL."))
 
       list)))
 
 
-(when (clsql-sys:database-type-library-loaded :mysql)
-  (clsql-sys:initialize-database-type :database-type :mysql)
-  (setq clsql:*default-database-type* :mysql)
+(when (clsql-base-sys:database-type-library-loaded :mysql)
+  (clsql-base-sys:initialize-database-type :database-type :mysql)
   (pushnew :mysql cl:*features*))
index 59a23b44f2a46e8bcd4e14bfe03dff71ea876242..311bf67df13ef78b561ffa5533e15e4d7811848c 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg and onShore Development Inc\r
 ;;;; Date Started:  Mar 2002\r
 ;;;;\r
-;;;; $Id: mysql-usql.cl,v 1.5 2002/04/27 21:48:08 kevin Exp $\r
+;;;; $Id: mysql-usql.cl,v 1.6 2002/05/27 17:19:30 kevin Exp $\r
 ;;;;\r
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg\r
 ;;;; and by onShore Development Inc.\r
@@ -80,6 +80,7 @@
 \r
 ;; Misc USQL functions\r
 \r
+#|\r
 #+ignore\r
 (defmethod database-output-sql ((expr clsql-sys::sql-typecast-exp) \r
                                (database mysql-database))\r
     (make-instance 'clsql-sys::sql-typecast-exp\r
                    :modifier 'int8\r
                    :components val)))\r
+|#\r
index 6c517f1a18623e7b4c3f4e6aa4d0f1146326a5a7..f1a6ca470243afa71fed759d00fddcf6d13cf465 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-socket-sql.cl,v 1.12 2002/05/13 22:05:21 kevin Exp $
+;;;; $Id: postgresql-socket-sql.cl,v 1.13 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -22,7 +22,7 @@
 (in-package :cl-user)
 
 (defpackage :clsql-postgresql-socket
-    (:use :common-lisp :clsql-sys :postgresql-socket)
+    (:use :common-lisp :clsql-base-sys :postgresql-socket)
     (:export #:postgresql-socket-database)
     (:documentation "This is the CLSQL socket interface to PostgreSQL."))
 
 (defmethod database-type-library-loaded ((database-type (eql :postgresql-socket)))
   t)
 
-(defmethod clsql-sys:database-type-load-foreign ((database-type (eql :postgresql-socket)))
+(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :postgresql-socket)))
   t)
 
-(clsql-sys:database-type-load-foreign :postgresql-socket)
+(clsql-base-sys:database-type-load-foreign :postgresql-socket)
 
 
 ;; Field type conversion
@@ -305,5 +305,5 @@ doesn't depend on UFFI."
            (setf (postgresql-socket-result-set-done result-set) t)
            (wait-for-query-results (database-connection database)))))))
 
-(when (clsql-sys:database-type-library-loaded :postgresql-socket)
-  (clsql-sys:initialize-database-type :database-type :postgresql-socket))
+(when (clsql-base-sys:database-type-library-loaded :postgresql-socket)
+  (clsql-base-sys:initialize-database-type :database-type :postgresql-socket))
index ff95f08bbc2b622986ebe63235b7d1586343eaca..bfdf60dd44e0daf60bcf57ea9feaf98156cbe8c6 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-loader.cl,v 1.11 2002/05/18 17:37:49 kevin Exp $
+;;;; $Id: postgresql-loader.cl,v 1.12 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -28,11 +28,11 @@ 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 clsql-sys:database-type-library-loaded ((database-type
+(defmethod clsql-base-sys:database-type-library-loaded ((database-type
                                                    (eql :postgresql)))
   *postgresql-library-loaded*)
                                      
-(defmethod clsql-sys:database-type-load-foreign ((database-type
+(defmethod clsql-base-sys:database-type-load-foreign ((database-type
                                                  (eql :postgresql)))
   (let ((libpath (uffi:find-foreign-library 
                  "libpq"
@@ -48,5 +48,5 @@ set to the right path before compiling or loading the system.")
        (setq *postgresql-library-loaded* t)
       (warn "Can't load PostgreSQL client library ~A" libpath))))
 
-(clsql-sys:database-type-load-foreign :postgresql)
+(clsql-base-sys:database-type-load-foreign :postgresql)
 
index 41b43bf7673245c5adbc3c40c39a599a411f2b6e..cb02f60bf3489d9781423e3f55a916ee7e419fd7 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: postgresql-sql.cl,v 1.17 2002/05/14 16:29:53 kevin Exp $
+;;;; $Id: postgresql-sql.cl,v 1.18 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -22,7 +22,7 @@
 (in-package :cl-user)
 
 (defpackage :clsql-postgresql
-    (:use :common-lisp :clsql-sys :postgresql :clsql-uffi)
+    (:use :common-lisp :clsql-base-sys :postgresql :clsql-uffi)
     (:export #:postgresql-database)
     (:documentation "This is the CLSQL interface to PostgreSQL."))
 
   (lo-create (database-conn-ptr database)
             (logior postgresql::+INV_WRITE+ postgresql::+INV_READ+)))
 
+
+#+mb-original
 (defmethod database-write-large-object (object-id (data string) (database postgresql-database))
   (let ((ptr (database-conn-ptr database))
        (length (length data))
           )))
     result))
 
+(defmethod database-write-large-object (object-id (data string) (database postgresql-database))
+  (let ((ptr (database-conn-ptr database))
+       (length (length data))
+       (result nil)
+       (fd nil))
+    (database-execute-command "begin" database)
+    (unwind-protect
+       (progn 
+         (setf fd (lo-open ptr object-id postgresql::+INV_WRITE+))
+         (when (>= fd 0)
+           (when (= (lo-write ptr fd data length) length)
+             (setf result t))))
+      (progn
+       (when (and fd (>= fd 0))
+         (lo-close ptr fd))
+       (database-execute-command (if result "commit" "rollback") database)))
+    result))
+
 ;; (MB) the begin/commit/rollback stuff will be removed when with-transaction wil be implemented
+;; (KMR) Can't use with-transaction since that function is in high-level code
 (defmethod database-read-large-object (object-id (database postgresql-database))
   (let ((ptr (database-conn-ptr database))
        (buffer nil)
 (defmethod database-delete-large-object (object-id (database postgresql-database))
   (lo-unlink (database-conn-ptr database) object-id))
 
-(when (clsql-sys:database-type-library-loaded :postgresql)
-  (clsql-sys:initialize-database-type :database-type :postgresql)
+(when (clsql-base-sys:database-type-library-loaded :postgresql)
+  (clsql-base-sys:initialize-database-type :database-type :postgresql)
   (pushnew :postgresql cl:*features*))
diff --git a/sql/package.cl b/sql/package.cl
new file mode 100644 (file)
index 0000000..01cbe61
--- /dev/null
@@ -0,0 +1,127 @@
+;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;; *************************************************************************
+;;;; FILE IDENTIFICATION
+;;;;
+;;;; Name:          package.cl
+;;;; Purpose:       Package definition for CLSQL (high-level) interface
+;;;; Programmers:   Kevin M. Rosenberg based on
+;;;;                Original code by Pierre R. Mai 
+;;;; Date Started:  Feb 2002
+;;;;
+;;;; $Id: package.cl,v 1.16 2002/05/27 17:19:45 kevin Exp $
+;;;;
+;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
+;;;;
+;;;; CLSQL users are granted the rights to distribute and use this software
+;;;; as governed by the terms of the Lisp Lesser GNU Public License
+;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
+;;;; *************************************************************************
+
+(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
+(in-package :cl-user)
+
+
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defpackage :clsql-sys
+    (:nicknames :clsql)
+    (:use :common-lisp :clsql-base-sys)
+    (:import-from 
+     :clsql-base
+     .
+     #1=(
+        #:clsql-condition
+        #:clsql-error
+        #:clsql-simple-error
+        #:clsql-warning
+        #:clsql-simple-warning
+        #:clsql-invalid-spec-error
+        #:clsql-invalid-spec-error-connection-spec
+        #:clsql-invalid-spec-error-database-type
+        #:clsql-invalid-spec-error-template
+        #:clsql-connect-error
+        #:clsql-connect-error-database-type
+        #:clsql-connect-error-connection-spec
+        #:clsql-connect-error-errno
+        #:clsql-connect-error-error
+        #:clsql-sql-error
+        #:clsql-sql-error-database
+        #:clsql-sql-error-expression
+        #:clsql-sql-error-errno
+        #:clsql-sql-error-error
+        #:clsql-database-warning
+        #:clsql-database-warning-database
+        #:clsql-database-warning-message
+        #:clsql-exists-condition
+        #:clsql-exists-condition-new-db
+        #:clsql-exists-condition-old-db
+        #:clsql-exists-warning
+        #:clsql-exists-error
+        #:clsql-closed-error
+        #:clsql-closed-error-database
+        
+        #:*loaded-database-types*
+        #:reload-database-types
+        #:*default-database-type*
+        #:*initialized-database-types*
+        #:initialize-database-type
+        
+        #:database
+        #:database-name
+        #:closed-database
+        #:database-name-from-spec))
+    (:export
+     ;; sql.cl
+     #:*connect-if-exists*
+     #:connected-databases
+     #:*default-database*
+     #:find-database
+     #:connect
+     #:disconnect
+     #:query
+     #:execute-command
+     #:map-query
+     #:do-query
+     
+     ;; functional.cl
+     #:insert-records
+     #:delete-records
+     #:update-records
+     #:with-database
+     
+     ;; For High-level UncommonSQL compatibility
+     #:sql-ident
+     #:list-tables
+     #:list-attributes
+     #:attribute-type
+     #:create-sequence 
+     #:drop-sequence
+     #:sequence-next
+     
+     ;; Pooled connections
+     #:disconnect-pooled
+     #:find-or-create-connection-pool
+     
+     ;; Transactions
+     #:with-transaction
+     #:commit-transaction
+     #:rollback-transaction
+     #:add-transaction-commit-hook
+     #:add-transaction-rollback-hook
+     
+     ;; Large objects (Marc B)
+     #:create-large-object
+     #:write-large-object
+     #:read-large-object
+     #:delete-large-object
+     
+     .
+     #1#
+     )
+    (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
+  
+  )                                    ;eval-when
+
+(defpackage #:clsql-user
+  (:use #:common-lisp #:clsql)
+  (:documentation "This is the user package for experimenting with CLSQL."))
index 693e7a5738e907eee5d9242debd2d94ffb7132d1..c45d0214802c675ac36f5b0522b37676e009f6c5 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Marc Battyani
 ;;;; Date Started:  Apr 2002
 ;;;;
-;;;; $Id: transactions.cl,v 1.4 2002/05/13 16:55:07 marc.battyani Exp $
+;;;; $Id: transactions.cl,v 1.5 2002/05/27 17:19:30 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -27,7 +27,7 @@
    (status :initform nil :accessor status))) ;can be nil :rolled-back or :commited
 
 (defmethod database-start-transaction ((database closed-database))
-  (signal-closed-database-error database))
+  (error 'clsql-closed-database-error database))
 
 (defmethod database-start-transaction (database)
   (unless (transaction database)
@@ -40,7 +40,7 @@
       (execute-command "BEGIN" :database database))))
 
 (defmethod database-end-transaction ((database closed-database))
-  (signal-closed-database-error database))
+  (error 'clsql-closed-database-error database))
 
 (defmethod database-end-transaction (database)
   (if (> (transaction-level database) 0)
@@ -66,9 +66,9 @@
   (when (and (transaction database)(not (status (transaction database))))
     (setf (status (transaction database)) :commited)))
 
-(defun add-transaction-commit-hook (database abort-hook)
+(defun add-transaction-commit-hook (database commit-hook)
   (when (transaction database)
-    (push abort-hook (abort-hooks (transaction database)))))
+    (push commit-hook (commit-hooks (transaction database)))))
 
 (defun add-transaction-rollback-hook (database rollback-hook)
   (when (transaction database)
index 432a80347ba1eddc4493c067297f424f836752bf..2951dbccaff3836033648e00bbcecd4490efff28 100644 (file)
@@ -8,7 +8,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg and onShore Development Inc
 ;;;; Date Started:  Mar 2002
 ;;;;
-;;;; $Id: usql.cl,v 1.8 2002/05/19 16:26:06 kevin Exp $
+;;;; $Id: usql.cl,v 1.9 2002/05/27 17:19:31 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and onShore Development Inc
@@ -45,35 +45,6 @@ keyword argument :database specifies the database to query, defaulting
 to *default-database*."
   (database-attribute-type attribute table database))
 
-(defun add-attribute (table attribute &key (database *default-database*))
-  "Add the ATTRIBUTE to TABLE.  The ATTRIBUTE sepcification must
-include a type argument.  The optional keyword argument :database
-specifies the database to operation on, defaulting to
-*default-database*."
-  (database-add-attribute table attribute database))
-
-(defun rename-attribute (table oldatt newname
-                              &key (database *default-database*))
-  (error "(rename-attribute ~a ~a ~a ~a) is not implemented" table oldatt newname database))
-
-
-(defclass %sql-expression ()
-    ())
-
-;; For SQL Identifiers of generic type
-(defclass sql-ident (%sql-expression)
-  ((name
-    :initarg :name
-    :initform "NULL"))
-  (:documentation "An SQL identifer."))
-
-(defmethod make-load-form ((sql sql-ident) &optional environment)
-  (declare (ignore environment))
-  (with-slots (name)
-    sql
-    `(make-instance 'sql-ident :name ',name)))
-
-
 (defun create-sequence (name &key (database *default-database*))
   (database-create-sequence name database))
 
@@ -83,51 +54,4 @@ specifies the database to operation on, defaulting to
 (defun sequence-next (name &key (database *default-database*))
   (database-sequence-next name database))
 
-(defclass sql-value-exp (%sql-expression)
-  ((modifier
-    :initarg :modifier
-    :initform nil)
-   (components
-    :initarg :components
-    :initform nil))
-  (:documentation
-   "An SQL value expression.")
-  )
-
-(defclass sql-typecast-exp (sql-value-exp)
-  ()
-  (:documentation
-   "An SQL typecast expression.")
-  )
-(defvar +null-string+ "NULL")
-
-(defvar *sql-stream* nil
-  "stream which accumulates SQL output")
-
-(defmethod output-sql ((expr %sql-expression) &optional
-                       (database *default-database*))
-  (declare (ignore database))
-  (write-string +null-string+ *sql-stream*))
-
-(defmethod sql-output ((expr t))
-  (declare (ignore expr))  
-  "")
-
-(defmethod print-object ((self %sql-expression) stream)
-  (print-unreadable-object
-   (self stream :type t)
-   (write-string (sql-output self) stream)))
-
-
-;; Methods for translating high-level table classes to low-level functions
-
-(defmethod database-list-attributes ((table sql-ident) database)
-  (database-list-attributes (string-downcase
-                            (symbol-name (slot-value table 'name)))
-                           database)
-  )
 
-(defmethod database-attribute-type (attribute (table sql-ident) database)
-  (database-attribute-type attribute (string-downcase
-                                     (symbol-name (slot-value table 'name)))
-                          database))