r11657: 25 Apr 2007 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / sql / package.lisp
index 4c82b0a..8ef8381 100644 (file)
@@ -6,7 +6,7 @@
 ;;;; Purpose:       Package definition for SQL interface
 ;;;;
 ;;;; $Id$
 ;;;; Purpose:       Package definition for SQL interface
 ;;;;
 ;;;; $Id$
-;;;; 
+;;;;
 ;;;; This file is part of CLSQL.
 ;;;;
 ;;;; CLSQL users are granted the rights to distribute and use this software
 ;;;; This file is part of CLSQL.
 ;;;;
 ;;;; CLSQL users are granted the rights to distribute and use this software
@@ -24,7 +24,7 @@
   (if (find-package 'sb-mop)
       (pushnew :clsql-sbcl-mop cl:*features*)
       (pushnew :clsql-sbcl-pcl cl:*features*))
   (if (find-package 'sb-mop)
       (pushnew :clsql-sbcl-mop cl:*features*)
       (pushnew :clsql-sbcl-pcl cl:*features*))
-  
+
   #+cmu
   (if (eq (symbol-package 'pcl:find-class)
          (find-package 'common-lisp))
   #+cmu
   (if (eq (symbol-package 'pcl:find-class)
          (find-package 'common-lisp))
          #+lispworks #:clos
          #+scl #:clos
          #+openmcl #:openmcl-mop)
          #+lispworks #:clos
          #+scl #:clos
          #+openmcl #:openmcl-mop)
-    
+
     #+allegro
     #+allegro
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:excl)
     #+clisp
      #:excl)
     #+clisp
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:clos)
     #+lispworks
      #:clos)
     #+lispworks
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:clos)
      #:clos)
-    #+clsql-sbcl-mop 
-    (:shadowing-import-from 
+    #+clsql-sbcl-mop
+    (:shadowing-import-from
      #:sb-pcl
      #:generic-function-lambda-list)
     #+clsql-sbcl-pcl
      #:sb-pcl
      #:generic-function-lambda-list)
     #+clsql-sbcl-pcl
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:sb-pcl
      #:name
      #:class-direct-slots
      #:sb-pcl
      #:name
      #:class-direct-slots
      #:class-precedence-list #:slot-definition-type
      #:class-direct-superclasses
      #:compute-class-precedence-list)
      #:class-precedence-list #:slot-definition-type
      #:class-direct-superclasses
      #:compute-class-precedence-list)
-    #+clsql-cmucl-mop 
-    (:shadowing-import-from 
+    #+clsql-cmucl-mop
+    (:shadowing-import-from
      #:pcl
      #:generic-function-lambda-list)
     #+clsql-cmucl-pcl
      #:pcl
      #:generic-function-lambda-list)
     #+clsql-cmucl-pcl
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:pcl
      #:class-direct-slots
      #:name
      #:pcl
      #:class-direct-slots
      #:name
      #:class-direct-superclasses
      #:compute-class-precedence-list)
     #+scl
      #:class-direct-superclasses
      #:compute-class-precedence-list)
     #+scl
-    (:shadowing-import-from 
+    (:shadowing-import-from
      #:clos
      #:class-prototype  ;; note: make-method-lambda is not fbound
      )
      #:clos
      #:class-prototype  ;; note: make-method-lambda is not fbound
      )
-    
+
     (:export
      ;; "Private" exports for use by interface packages
      #:check-connection-spec
     (:export
      ;; "Private" exports for use by interface packages
      #:check-connection-spec
      #:database-destroy
      #:database-probe
      #:database-list
      #:database-destroy
      #:database-probe
      #:database-list
-     
+
      #:db-backend-has-create/destroy-db?
      #:db-type-has-views?
      #:db-type-has-bigint?
      #:db-backend-has-create/destroy-db?
      #:db-type-has-views?
      #:db-type-has-bigint?
      #:db-type-transaction-capable?
      #:db-type-has-fancy-math?
      #:db-type-default-case
      #:db-type-transaction-capable?
      #:db-type-has-fancy-math?
      #:db-type-default-case
-     #:db-type-use-column-on-drop-index? 
+     #:db-type-use-column-on-drop-index?
      #:db-type-use-fully-qualified-column-on-drop-index?
      #:db-type-has-intersect?
      #:db-type-has-except?
      #:db-type-use-fully-qualified-column-on-drop-index?
      #:db-type-has-intersect?
      #:db-type-has-except?
      #:reload-database-types
      #:is-database-open
 
      #:reload-database-types
      #:is-database-open
 
-     ;; Large objects 
+     ;; Large objects
      #:database-create-large-object
      #:database-write-large-object
      #:database-read-large-object
      #:database-create-large-object
      #:database-write-large-object
      #:database-read-large-object
      #:number-to-sql-string
      #:float-to-sql-string
      #:sql-escape-quotes
      #:number-to-sql-string
      #:float-to-sql-string
      #:sql-escape-quotes
-     #:sql-escape 
+     #:sql-escape
      #:in
 
      ;; Generic backends
      #:generic-postgresql-database
      #:generic-odbc-database
 
      #:in
 
      ;; Generic backends
      #:generic-postgresql-database
      #:generic-odbc-database
 
-         ;; Subclasses of sql-expresssion (expressions.lisp) 
+         ;; Subclasses of sql-expresssion (expressions.lisp)
          #:sql-function-exp
          #:sql-function-exp
-         #:sql-value-exp 
-         #:sql-set-exp 
-         #:sql-query-modifier-exp 
-         #:sql-relational-exp 
-         #:sql-upcase-like 
-         #:sql-assignment-exp 
-         #:sql-typecast-exp 
-         #:sql-between-exp 
-         #:sql-ident 
+         #:sql-value-exp
+         #:sql-set-exp
+         #:sql-query-modifier-exp
+         #:sql-relational-exp
+         #:sql-upcase-like
+         #:sql-assignment-exp
+         #:sql-typecast-exp
+         #:sql-between-exp
+         #:sql-ident
          #:sql-ident-attribute
          #:sql-ident-attribute
-         #:sql-ident-table 
+         #:sql-ident-table
 
      .
 
 
      .
 
-     ;; Shared exports for re-export by CLSQL package. 
+     ;; Shared exports for re-export by CLSQL package.
      #1=(
 
          ;; foreign library loading
          #:*foreign-library-search-paths*
          #:push-library-path
 
      #1=(
 
          ;; foreign library loading
          #:*foreign-library-search-paths*
          #:push-library-path
 
-        ;; Condition system (conditions.lisp) 
+        ;; Condition system (conditions.lisp)
         #:sql-user-error
         #:sql-database-error
         #:sql-database-data-error
         #:sql-connection-error
         #:sql-temporary-error
         #:sql-user-error
         #:sql-database-error
         #:sql-database-data-error
         #:sql-connection-error
         #:sql-temporary-error
-         #:sql-timeout-error 
-         #:sql-fatal-error 
+         #:sql-timeout-error
+         #:sql-fatal-error
         #:sql-error-error-id
         #:sql-error-secondary-error-id
         #:sql-error-database-message
         #:sql-error-error-id
         #:sql-error-secondary-error-id
         #:sql-error-database-message
         #:sql-error
         #:sql-warning
         #:sql-database-warning
         #:sql-error
         #:sql-warning
         #:sql-database-warning
-         #:sql-error-database 
-         #:sql-error-database-type 
-         #:sql-error-connection-spec 
-         #:sql-error-expression 
-         #:sql-warning-database 
-         #:sql-user-error-message 
+         #:sql-error-database
+         #:sql-error-database-type
+         #:sql-error-connection-spec
+         #:sql-error-expression
+         #:sql-warning-database
+         #:sql-user-error-message
          #:*backend-warning-behavior*
 
          #:*backend-warning-behavior*
 
-         ;; Connection/initialisation (base-classes.lisp, database.lisp, 
+         ;; Connection/initialisation (base-classes.lisp, database.lisp,
          ;;   initialize.lisp)
          ;;   initialize.lisp)
-         #:*default-database-type*       
-         #:*default-database*           
+         #:*default-database-type*
+         #:*default-database*
          #:*initialized-database-types*
          #:initialize-database-type
          #:*initialized-database-types*
          #:initialize-database-type
-         #:connect                     
-         #:disconnect                 
-         #:*connect-if-exists*        
-         #:connected-databases        
-         #:database                   
-         #:database-name               
-         #:reconnect                   
-         #:find-database               
-         #:status                      
-         ;; CLSQL Extensions 
+         #:connect
+         #:disconnect
+         #:*connect-if-exists*
+         #:connected-databases
+         #:database
+         #:database-name
+         #:reconnect
+         #:find-database
+         #:status
+         ;; CLSQL Extensions
          #:database-name-from-spec
          #:database-name-from-spec
-         #:database-type 
+         #:database-type
          #:with-database
          #:with-default-database
          #:disconnect-pooled
          #:with-database
          #:with-default-database
          #:disconnect-pooled
          #:destroy-database
          #:probe-database
 
          #:destroy-database
          #:probe-database
 
-         ;; I/O Recording (recording.lisp) 
-         #:add-sql-stream             
-         #:delete-sql-stream         
-         #:list-sql-streams          
-         #:sql-recording-p           
-         #:sql-stream                  
-         #:start-sql-recording         
-         #:stop-sql-recording          
-
-        ;; FDDL (fddl.lisp) 
-        #:create-table                   
-        #:drop-table                     
-        #:list-tables                    
-        #:table-exists-p                 
-        #:list-attributes                
-        #:attribute-type                 
-        #:list-attribute-types           
-        #:create-view                    
-        #:drop-view                      
-        #:create-index                   
-        #:drop-index                     
-         ;; CLSQL Extensions 
+         ;; I/O Recording (recording.lisp)
+         #:add-sql-stream
+         #:delete-sql-stream
+         #:list-sql-streams
+         #:sql-recording-p
+         #:sql-stream
+         #:start-sql-recording
+         #:stop-sql-recording
+
+        ;; FDDL (fddl.lisp)
+        #:create-table
+        #:drop-table
+        #:list-tables
+        #:table-exists-p
+        #:list-attributes
+        #:attribute-type
+        #:list-attribute-types
+        #:create-view
+        #:drop-view
+        #:create-index
+        #:drop-index
+         ;; CLSQL Extensions
          #:truncate-database
          #:truncate-database
-        #:list-views                  
-        #:view-exists-p               
-        #:list-indexes                
-        #:index-exists-p              
-        #:create-sequence             
-        #:drop-sequence               
-        #:list-sequences              
-        #:sequence-exists-p           
-        #:sequence-next               
-        #:sequence-last               
-        #:set-sequence-position       
-
-         ;; FDML (fdml.lisp) 
-        #:select 
-        #:cache-table-queries     
+        #:list-views
+        #:view-exists-p
+        #:list-indexes
+        #:index-exists-p
+        #:create-sequence
+        #:drop-sequence
+        #:list-sequences
+        #:sequence-exists-p
+        #:sequence-next
+        #:sequence-last
+        #:set-sequence-position
+
+         ;; FDML (fdml.lisp)
+        #:select
+        #:cache-table-queries
         #:*cache-table-queries-default*
         #:*cache-table-queries-default*
-        #:delete-records               
-        #:insert-records               
-        #:update-records               
-        #:execute-command              
-        #:query                        
-        #:print-query                  
-        #:do-query                     
-        #:map-query                    
+        #:delete-records
+        #:insert-records
+        #:update-records
+        #:execute-command
+        #:query
+        #:print-query
+        #:do-query
+        #:map-query
         #:loop
         #:loop
-         ;; CLSQL Extensions 
+         ;; CLSQL Extensions
         #:prepare-sql
         #:bind-parameter
         #:run-prepared-sql
         #:free-prepared-sql
 
         #:prepare-sql
         #:bind-parameter
         #:run-prepared-sql
         #:free-prepared-sql
 
-         ;; Transaction handling (transaction.lisp) 
+         ;; Transaction handling (transaction.lisp)
          #:with-transaction
          #:with-transaction
-         #:commit                        
-         #:rollback                     
-         ;; CLSQL Extensions 
+         #:commit
+         #:rollback
+         ;; CLSQL Extensions
          #:add-transaction-commit-hook
          #:add-transaction-rollback-hook
          #:add-transaction-commit-hook
          #:add-transaction-rollback-hook
-         #:start-transaction             
-         #:in-transaction-p              
+         #:start-transaction
+         #:in-transaction-p
         #:set-autocommit
 
         #:set-autocommit
 
-        ;; OODDL (ooddl.lisp) 
-        #:standard-db-object               
-        #:def-view-class                   
-        #:create-view-from-class           
-        #:drop-view-from-class             
-        #:list-classes                     
-        #:universal-time    
-         ;; CLSQL Extensions 
-        #:view-table        
+        ;; OODDL (ooddl.lisp)
+        #:standard-db-object
+        #:def-view-class
+        #:create-view-from-class
+        #:drop-view-from-class
+        #:list-classes
+        #:universal-time
+         ;; CLSQL Extensions
+        #:view-table
         #:bigint
         #:varchar
         #:generalized-boolean
         #:bigint
         #:varchar
         #:generalized-boolean
         #:tinyint
         #:*default-string-length*
 
         #:tinyint
         #:*default-string-length*
 
-        ;; OODML (oodml.lisp) 
-        #:instance-refreshed               
-        #:update-objects-joins             
-        #:*default-update-objects-max-len* 
+        ;; OODML (oodml.lisp)
+        #:instance-refreshed
+        #:update-objects-joins
+        #:*default-update-objects-max-len*
         #:*default-caching*
         #:*default-caching*
-        #:update-slot-from-record          
-        #:update-instance-from-records     
-        #:update-records-from-instance     
-        #:update-record-from-slot          
-        #:update-record-from-slots         
-        #:delete-instance-records          
-        ;; CLSQL Extensions 
-        #:*db-auto-sync*    
+        #:update-slot-from-record
+        #:update-instance-from-records
+        #:update-records-from-instance
+        #:update-record-from-slot
+        #:update-record-from-slots
+        #:delete-instance-records
+        ;; CLSQL Extensions
+        #:*db-auto-sync*
         #:write-instance-to-stream
         #:read-instance-from-stream
         #:write-instance-to-stream
         #:read-instance-from-stream
-        
-        ;; Symbolic SQL Syntax (syntax.lisp) 
-        #:sql                              
-        #:sql-expression                   
-        #:sql-operation                    
-        #:sql-operator                     
-        #:disable-sql-reader-syntax        
-        #:enable-sql-reader-syntax         
+
+        ;; Symbolic SQL Syntax (syntax.lisp)
+        #:sql
+        #:sql-expression
+        #:sql-operation
+        #:sql-operator
+        #:disable-sql-reader-syntax
+        #:enable-sql-reader-syntax
         #:locally-disable-sql-reader-syntax
         #:locally-disable-sql-reader-syntax
-        #:locally-enable-sql-reader-syntax 
-        #:restore-sql-reader-syntax-state  
-        
-        ;; SQL operations (operations.lisp) 
+        #:locally-enable-sql-reader-syntax
+        #:restore-sql-reader-syntax-state
+
+        ;; SQL operations (operations.lisp)
         #:sql-query
         #:sql-object-query
         #:sql-any
         #:sql-query
         #:sql-object-query
         #:sql-any
-         #:sql-some 
+         #:sql-some
         #:sql-all
         #:sql-not
         #:sql-union
         #:sql-intersect
         #:sql-minus
         #:sql-all
         #:sql-not
         #:sql-union
         #:sql-intersect
         #:sql-minus
-         #:sql-except 
-         #:sql-order-by 
+         #:sql-except
+         #:sql-order-by
         #:sql-null
         #:sql-*
         #:sql-+
         #:sql-null
         #:sql-*
         #:sql-+
         #:sql-and
         #:sql-or
         #:sql-in
         #:sql-and
         #:sql-or
         #:sql-in
-         #:sql-substr 
-         #:sql-concat-op 
+         #:sql-substr
+         #:sql-concat-op
         #:sql-=
         #:sql-<
          #:sql->
         #:sql-=
         #:sql-<
          #:sql->
          #:sql-min
          #:sql-avg
          #:sql-sum
          #:sql-min
          #:sql-avg
          #:sql-sum
-         #:sql-function 
-         #:sql-between 
-         #:sql-distinct 
-         #:sql-nvl 
+         #:sql-function
+         #:sql-between
+         #:sql-distinct
+         #:sql-nvl
          #:sql-slot-value
          #:sql-slot-value
-         #:sql-userenv 
-         ;; CLSQL Extensions 
+         #:sql-userenv
+         ;; CLSQL Extensions
         #:sql-concat
         #:sql-concat
-         #:sql-substring 
-         #:sql-limit 
+         #:sql-substring
+         #:sql-limit
         #:sql-group-by
         #:sql-having
         #:sql-not-null
         #:sql-group-by
         #:sql-having
         #:sql-not-null
         #:sql-uplike
         #:sql-is
         #:sql-==
         #:sql-uplike
         #:sql-is
         #:sql-==
-         #:sql-the 
-         #:sql-coalesce 
+         #:sql-the
+         #:sql-coalesce
          #:sql-view-class
 
          #:sql-view-class
 
-         ;; Time handling (time.lisp) 
+         ;; Time handling (time.lisp)
          #:bad-component
          #:current-day
          #:current-month
          #:bad-component
          #:current-day
          #:current-month
          #:duration-month
          #:duration-second
          #:duration-year
          #:duration-month
          #:duration-second
          #:duration-year
-         #:duration-reduce 
+         #:duration-reduce
          #:duration-timestring
          #:duration-timestring
-         #:extract-roman 
+         #:extract-roman
          #:format-duration
          #:format-time
         #:format-date
          #:format-duration
          #:format-time
         #:format-date
          #:week-containing
          #:gregorian-to-mjd
          #:mjd-to-gregorian
          #:week-containing
          #:gregorian-to-mjd
          #:mjd-to-gregorian
+         #:iso-timestring
          ))
     (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
 
          ))
     (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
 
   (:export . #1#)
   (:documentation "This is the user package with CLSQL symbols."))
 
   (:export . #1#)
   (:documentation "This is the user package with CLSQL symbols."))
 
-  ;; This is from USQL's pcl-patch  
+  ;; This is from USQL's pcl-patch
   #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
   (progn
   #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
   (progn
-    ;; Note that this will no longer required for cmucl as of version 19a. 
+    ;; Note that this will no longer required for cmucl as of version 19a.
     (in-package #+cmu :pcl #+sbcl :sb-pcl)
     (in-package #+cmu :pcl #+sbcl :sb-pcl)
-    (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars) 
+    (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
                           &body body)
       `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
        (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
                           &body body)
       `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
        (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
 
 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
 #+lispworks
 
 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
 #+lispworks
-(setf *packages-for-warn-on-redefinition* 
+(setf *packages-for-warn-on-redefinition*
       (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
 
   #+sbcl
   (if (find-package 'sb-mop)
       (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
       (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
       (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
 
   #+sbcl
   (if (find-package 'sb-mop)
       (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
       (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
-  
+
   #+cmu
   (if (find-package 'mop)
       (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
       (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))
 
   #+cmu
   (if (find-package 'mop)
       (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
       (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))
 
-) ;eval-when                                      
+) ;eval-when