From 9bbed78051e80e6ab76ae47834136035602bbbf1 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 2 May 2004 02:53:10 +0000 Subject: [PATCH] r9199: fold clsql-base and clsql-base-sys into clsql-base --- ChangeLog | 7 +- base/basic-sql.lisp | 2 +- base/classes.lisp | 2 +- base/conditions.lisp | 2 +- base/database.lisp | 2 +- base/db-interface.lisp | 2 +- base/initialize.lisp | 2 +- base/loop-extension.lisp | 40 +- base/package.lisp | 440 +++++++++--------- base/pool.lisp | 2 +- base/recording.lisp | 2 +- base/time.lisp | 2 +- base/transaction.lisp | 2 +- base/utils.lisp | 2 +- classic/package.lisp | 2 +- db-aodbc/aodbc-package.lisp | 2 +- db-aodbc/aodbc-sql.lisp | 14 +- db-mysql/mysql-loader.lisp | 6 +- db-mysql/mysql-sql.lisp | 14 +- db-odbc/odbc-api.lisp | 6 +- db-odbc/odbc-dbi.lisp | 2 +- db-odbc/odbc-loader.lisp | 6 +- db-odbc/odbc-sql.lisp | 6 +- .../postgresql-socket-api.lisp | 4 +- .../postgresql-socket-sql.lisp | 12 +- db-postgresql/postgresql-loader.lisp | 6 +- db-postgresql/postgresql-sql.lisp | 14 +- db-sqlite/sqlite-loader.lisp | 4 +- db-sqlite/sqlite-package.lisp | 2 +- sql/new-objects.lisp | 2 +- sql/objects.lisp | 28 +- sql/package.lisp | 4 +- sql/sql.lisp | 2 +- tests/test-connection.lisp | 4 +- tests/test-fddl.lisp | 2 +- tests/test-init.lisp | 12 +- 36 files changed, 331 insertions(+), 332 deletions(-) diff --git a/ChangeLog b/ChangeLog index d20f186..42a0b4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,12 @@ * doc/csql.xml: Update def-view-class documentation * test/test-init.lisp: Change old :db-type to :db-kind. Remove old :nulls-ok attributes. - + * sql/objects.lisp: Add new universal-time and bigint + types. Optimize reading of integers using parse-integer + rather than read-from-string. + * */*.lisp: Merge clsql-base-sys and clsql-base packages + into clsql-base package + 1 May 2004 Kevin Rosenberg (kevin@rosenberg.net) * Version 2.10.5: SQLite backend now passes all result-types tests * clsql-sqlite.asd: Depend on clsql-uffi system diff --git a/base/basic-sql.lisp b/base/basic-sql.lisp index bf8ef80..eaccc03 100644 --- a/base/basic-sql.lisp +++ b/base/basic-sql.lisp @@ -12,7 +12,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) ;;; Query diff --git a/base/classes.lisp b/base/classes.lisp index 92254f5..292bb6b 100644 --- a/base/classes.lisp +++ b/base/classes.lisp @@ -18,7 +18,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defclass database () diff --git a/base/conditions.lisp b/base/conditions.lisp index 81a1226..25d4623 100644 --- a/base/conditions.lisp +++ b/base/conditions.lisp @@ -18,7 +18,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) ;;; Conditions (define-condition clsql-condition () diff --git a/base/database.lisp b/base/database.lisp index e4016d3..f5a682e 100644 --- a/base/database.lisp +++ b/base/database.lisp @@ -12,7 +12,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (setf (documentation 'database-name 'function) "Returns the name of a database.") diff --git a/base/db-interface.lisp b/base/db-interface.lisp index 3b84d95..3ddfd89 100644 --- a/base/db-interface.lisp +++ b/base/db-interface.lisp @@ -19,7 +19,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defgeneric database-type-load-foreign (database-type) (:documentation diff --git a/base/initialize.lisp b/base/initialize.lisp index 75d9a0d..3211512 100644 --- a/base/initialize.lisp +++ b/base/initialize.lisp @@ -17,7 +17,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defvar *loaded-database-types* nil "Contains a list of database types which have been defined/loaded.") diff --git a/base/loop-extension.lisp b/base/loop-extension.lisp index fb45905..f8129b5 100644 --- a/base/loop-extension.lisp +++ b/base/loop-extension.lisp @@ -54,7 +54,7 @@ (unless in-phrase (ansi-loop::loop-error "Missing OF or IN iteration path.")) (unless from-phrase - (setq from-phrase '(clsql-base-sys:*default-database*))) + (setq from-phrase '(clsql-base:*default-database*))) (cond ((consp variable) (let ((query-var (ansi-loop::loop-gentemp 'loop-record-)) @@ -63,7 +63,7 @@ 'loop-record-result-set-)) (step-var (ansi-loop::loop-gentemp 'loop-record-step-))) (push `(when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) ansi-loop::*loop-epilogue*) `(((,variable nil ,@(and data-type (list data-type))) (,query-var ,(first in-phrase)) @@ -71,15 +71,15 @@ (,result-set-var nil) (,step-var nil)) ((multiple-value-bind (%rs %cols) - (clsql-base-sys:database-query-result-set ,query-var ,db-var) + (clsql-base:database-query-result-set ,query-var ,db-var) (setq ,result-set-var %rs ,step-var (make-list %cols)))) () () - (not (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,step-var)) + (not (clsql-base:database-store-next-row ,result-set-var ,db-var ,step-var)) (,variable ,step-var) (not ,result-set-var) () - (not (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,step-var)) + (not (clsql-base:database-store-next-row ,result-set-var ,db-var ,step-var)) (,variable ,step-var)))) (t (let ((query-var (ansi-loop::loop-gentemp 'loop-record-)) @@ -87,22 +87,22 @@ (result-set-var (ansi-loop::loop-gentemp 'loop-record-result-set-))) (push `(when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) ansi-loop::*loop-epilogue*) `(((,variable nil ,@(and data-type (list data-type))) (,query-var ,(first in-phrase)) (,db-var ,(first from-phrase)) (,result-set-var nil)) ((multiple-value-bind (%rs %cols) - (clsql-base-sys:database-query-result-set ,query-var ,db-var) + (clsql-base:database-query-result-set ,query-var ,db-var) (setq ,result-set-var %rs ,variable (make-list %cols)))) () () - (not (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,variable)) + (not (clsql-base:database-store-next-row ,result-set-var ,db-var ,variable)) () (not ,result-set-var) () - (not (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,variable)) + (not (clsql-base:database-store-next-row ,result-set-var ,db-var ,variable)) ())))))) #+(or cmu scl sbcl openmcl allegro) @@ -146,7 +146,7 @@ (unless in-phrase (error "Missing OF or IN iteration path.")) (unless from-phrase - (setq from-phrase '(clsql-base-sys:*default-database*))) + (setq from-phrase '(clsql-base:*default-database*))) (cond ((consp iter-var) (let ((query-var (gensym "LOOP-RECORD-")) @@ -162,18 +162,18 @@ (,result-set-var nil) (,step-var nil)) `((multiple-value-bind (%rs %cols) - (clsql-base-sys:database-query-result-set ,query-var ,db-var) + (clsql-base:database-query-result-set ,query-var ,db-var) (setq ,result-set-var %rs ,step-var (make-list %cols)))) () () - `((unless (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,step-var) + `((unless (clsql-base:database-store-next-row ,result-set-var ,db-var ,step-var) (when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) t)) `(,iter-var ,step-var) - `((unless (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,step-var) + `((unless (clsql-base:database-store-next-row ,result-set-var ,db-var ,step-var) (when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) t)) `(,iter-var ,step-var) () @@ -189,18 +189,18 @@ (,db-var ,(first from-phrase)) (,result-set-var nil)) `((multiple-value-bind (%rs %cols) - (clsql-base-sys:database-query-result-set ,query-var ,db-var) + (clsql-base:database-query-result-set ,query-var ,db-var) (setq ,result-set-var %rs ,iter-var (make-list %cols)))) () () - `((unless (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,iter-var) + `((unless (clsql-base:database-store-next-row ,result-set-var ,db-var ,iter-var) (when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) t)) () - `((unless (clsql-base-sys:database-store-next-row ,result-set-var ,db-var ,iter-var) + `((unless (clsql-base:database-store-next-row ,result-set-var ,db-var ,iter-var) (when ,result-set-var - (clsql-base-sys:database-dump-result-set ,result-set-var ,db-var)) + (clsql-base:database-dump-result-set ,result-set-var ,db-var)) t)) () () diff --git a/base/package.lisp b/base/package.lisp index 56cdd57..6b55ef5 100644 --- a/base/package.lisp +++ b/base/package.lisp @@ -23,11 +23,9 @@ ;;;; This file makes the required package definitions for CLSQL's ;;;; core packages. -(eval-when (:compile-toplevel :load-toplevel :execute) -(defpackage #:clsql-base-sys +(defpackage #:clsql-base (:use #:cl) (:export - ;; "Private" exports for use by interface packages #:check-connection-spec #:database-type-load-foreign #:database-type-library-loaded ;; KMR - Tests if foreign library okay @@ -83,229 +81,221 @@ #:convert-to-db-default-case #:ensure-keyword - ;; Shared exports for re-export by 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-access-error - #:clsql-access-error-database-type - #:clsql-access-error-connection-spec - #:clsql-access-error-error - #:clsql-connect-error - #:clsql-connect-error-errno - #: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 - #:clsql-sql-syntax-error - #:clsql-type-error - #:clsql-odbc-error - #:clsql-odbc-error-message - - #:*loaded-database-types* - #:reload-database-types - #:*default-database-type* - #:*initialized-database-types* - #:initialize-database-type - #:*connect-if-exists* - #:*default-database* - #:connected-databases - #:database - #:database-name - #:find-database - #:database-name-from-spec - #:is-database-open - - ;; accessors for database class - #:name - #:connection-spec - #:transaction - #:transaction-level - #:conn-pool - #:command-recording-stream - #:result-recording-stream - #:query-recording-stream - #:view-classes - #:database-type - #:database-state - #:attribute-cache - - ;; utils.lisp - #:number-to-sql-string - #:float-to-sql-string - #:sql-escape-quotes - - ;; time.lisp - #:bad-component - #:current-day - #:current-month - #:current-year - #:day-duration - #:db-timestring - #:decode-duration - #:decode-time - #:duration - #:duration+ - #:duration< - #:duration<= - #:duration= - #:duration> - #:duration>= - #:duration-day - #:duration-hour - #:duration-minute - #:duration-month - #:duration-second - #:duration-year - #:duration-reduce - #:duration-timestring - #:extract-roman - #:format-duration - #:format-time - #:get-time - #:utime->time - #:interval-clear - #:interval-contained - #:interval-data - #:interval-edit - #:interval-end - #:interval-match - #:interval-push - #:interval-relation - #:interval-start - #:interval-type - #:make-duration - #:make-interval - #:make-time - #:merged-time - #:midnight - #:month-name - #:parse-date-time - #:parse-timestring - #:parse-yearstring - #:print-date - #:roll - #:roll-to - #:time - #:time+ - #:time- - #:time-by-adding-duration - #:time-compare - #:time-difference - #:time-dow - #:time-element - #:time-max - #:time-min - #:time-mjd - #:time-msec - #:time-p - #:time-sec - #:time-well-formed - #:time-ymd - #:time< - #:time<= - #:time= - #:time> - #:time>= - #:timezone - #:universal-time - #:wall-time - #:wall-timestring - #:week-containing - #:gregorian-to-mjd - #:mjd-to-gregorian - x - ;; recording.lisp -- SQL I/O Recording - #:record-sql-action - #:add-sql-stream ; recording xx - #:delete-sql-stream ; recording xx - #:list-sql-streams ; recording xx - #:sql-recording-p ; recording xx - #:sql-stream ; recording xx - #:start-sql-recording ; recording xx - #:stop-sql-recording ; recording xx - - ;; database.lisp -- Connection - #:*default-database-type* ; clsql-base xx - #:*default-database* ; classes xx - #:connect ; database xx - #:*connect-if-exists* ; database xx - #:connected-databases ; database xx - #:database ; database xx - #:database-name ; database xx - #:disconnect ; database xx - #:reconnect ; database - #:find-database ; database xx - #:status ; database xx - #:with-database - #:with-default-database - #:disconnect-pooled - #:create-database - #:destroy-database - #:probe-database - #:list-databases - - ;; basic-sql.lisp - #:query - #:execute-command - #:write-large-object - #:read-large-object - #:delete-large-object - #:do-query - #:map-query - #:describe-table - - ;; Transactions - #:with-transaction - #:commit-transaction - #:rollback-transaction - #:add-transaction-commit-hook - #:add-transaction-rollback-hook - #:commit ; transact xx - #:rollback ; transact xx - #:with-transaction ; transact xx . - #:start-transaction ; transact xx - #:in-transaction-p ; transact xx - #:database-start-transaction - #:database-abort-transaction - #:database-commit-transaction - #:transaction-level - #:transaction + #: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-access-error + #:clsql-access-error-database-type + #:clsql-access-error-connection-spec + #:clsql-access-error-error + #:clsql-connect-error + #:clsql-connect-error-errno + #: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 + #:clsql-sql-syntax-error + #:clsql-type-error + #:clsql-odbc-error + #:clsql-odbc-error-message + + #:*loaded-database-types* + #:reload-database-types + #:*default-database-type* + #:*initialized-database-types* + #:initialize-database-type + #:*connect-if-exists* + #:*default-database* + #:connected-databases + #:database + #:database-name + #:find-database + #:database-name-from-spec + #:is-database-open + + ;; accessors for database class + #:name + #:connection-spec + #:transaction + #:transaction-level + #:conn-pool + #:command-recording-stream + #:result-recording-stream + #:query-recording-stream + #:view-classes + #:database-type + #:database-state + #:attribute-cache + + ;; utils.lisp + #:number-to-sql-string + #:float-to-sql-string + #:sql-escape-quotes + + ;; time.lisp + #:bad-component + #:current-day + #:current-month + #:current-year + #:day-duration + #:db-timestring + #:decode-duration + #:decode-time + #:duration + #:duration+ + #:duration< + #:duration<= + #:duration= + #:duration> + #:duration>= + #:duration-day + #:duration-hour + #:duration-minute + #:duration-month + #:duration-second + #:duration-year + #:duration-reduce + #:duration-timestring + #:extract-roman + #:format-duration + #:format-time + #:get-time + #:utime->time + #:interval-clear + #:interval-contained + #:interval-data + #:interval-edit + #:interval-end + #:interval-match + #:interval-push + #:interval-relation + #:interval-start + #:interval-type + #:make-duration + #:make-interval + #:make-time + #:merged-time + #:midnight + #:month-name + #:parse-date-time + #:parse-timestring + #:parse-yearstring + #:print-date + #:roll + #:roll-to + #:time + #:time+ + #:time- + #:time-by-adding-duration + #:time-compare + #:time-difference + #:time-dow + #:time-element + #:time-max + #:time-min + #:time-mjd + #:time-msec + #:time-p + #:time-sec + #:time-well-formed + #:time-ymd + #:time< + #:time<= + #:time= + #:time> + #:time>= + #:timezone + #:universal-time + #:wall-time + #:wall-timestring + #:week-containing + #:gregorian-to-mjd + #:mjd-to-gregorian - ;; Database features specialized by backend - #:db-type-use-column-on-drop-index? - #:db-type-has-views? - #:db-type-has-subqueries? - #:db-type-has-boolean-where? - #:db-type-has-fancy-math? - #:db-type-default-case - #:db-backend-has-create/destroy-db? - #:db-type-transaction-capable? - )) - (:documentation "This is the INTERNAL SQL-Interface package of CLSQL-BASE.")) + ;; recording.lisp -- SQL I/O Recording + #:record-sql-action + #:add-sql-stream ; recording xx + #:delete-sql-stream ; recording xx + #:list-sql-streams ; recording xx + #:sql-recording-p ; recording xx + #:sql-stream ; recording xx + #:start-sql-recording ; recording xx + #:stop-sql-recording ; recording xx -(defpackage #:clsql-base - (:import-from #:clsql-base-sys . #1#) - (:export . #1#) - (:documentation "This is the SQL-Interface package of CLSQL-BASE.")) -);eval-when + ;; database.lisp -- Connection + #:*default-database-type* ; clsql-base xx + #:*default-database* ; classes xx + #:connect ; database xx + #:*connect-if-exists* ; database xx + #:connected-databases ; database xx + #:database ; database xx + #:database-name ; database xx + #:disconnect ; database xx + #:reconnect ; database + #:find-database ; database xx + #:status ; database xx + #:with-database + #:with-default-database + #:disconnect-pooled + #:create-database + #:destroy-database + #:probe-database + #:list-databases + + ;; basic-sql.lisp + #:query + #:execute-command + #:write-large-object + #:read-large-object + #:delete-large-object + #:do-query + #:map-query + #:describe-table + + ;; Transactions + #:with-transaction + #:commit-transaction + #:rollback-transaction + #:add-transaction-commit-hook + #:add-transaction-rollback-hook + #:commit ; transact xx + #:rollback ; transact xx + #:with-transaction ; transact xx . + #:start-transaction ; transact xx + #:in-transaction-p ; transact xx + #:database-start-transaction + #:database-abort-transaction + #:database-commit-transaction + #:transaction-level + #:transaction + + ;; Database features specialized by backend + #:db-type-use-column-on-drop-index? + #:db-type-has-views? + #:db-type-has-subqueries? + #:db-type-has-boolean-where? + #:db-type-has-fancy-math? + #:db-type-default-case + #:db-backend-has-create/destroy-db? + #:db-type-transaction-capable? + ) + (:documentation "This is the INTERNAL SQL-Interface package of CLSQL-BASE.")) diff --git a/base/pool.lisp b/base/pool.lisp index bebe1b6..0564eb0 100644 --- a/base/pool.lisp +++ b/base/pool.lisp @@ -16,7 +16,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defvar *db-pool* (make-hash-table :test #'equal)) (defvar *db-pool-lock* (make-process-lock "DB Pool lock")) diff --git a/base/recording.lisp b/base/recording.lisp index 2f83bf4..fb9fc8d 100644 --- a/base/recording.lisp +++ b/base/recording.lisp @@ -13,7 +13,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defun start-sql-recording (&key (type :commands) (database *default-database*)) "Begin recording SQL command or result traffic. By default the diff --git a/base/time.lisp b/base/time.lisp index 80e5bed..0b70f2c 100644 --- a/base/time.lisp +++ b/base/time.lisp @@ -15,7 +15,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) ;; ------------------------------------------------------------ ;; Months diff --git a/base/transaction.lisp b/base/transaction.lisp index fa4f752..61438ed 100644 --- a/base/transaction.lisp +++ b/base/transaction.lisp @@ -12,7 +12,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defclass transaction () ((commit-hooks :initform () :accessor commit-hooks) diff --git a/base/utils.lisp b/base/utils.lisp index 2e46d7b..8a96df6 100644 --- a/base/utils.lisp +++ b/base/utils.lisp @@ -16,7 +16,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package #:clsql-base-sys) +(in-package #:clsql-base) (defun number-to-sql-string (num) (etypecase num diff --git a/classic/package.lisp b/classic/package.lisp index 42cd973..6789185 100644 --- a/classic/package.lisp +++ b/classic/package.lisp @@ -23,7 +23,7 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (defpackage #:clsql-classic-sys (:nicknames #:clsql-classic) - (:use #:cl #:clsql-base-sys) + (:use #:cl #:clsql-base) (:import-from #:clsql-base . diff --git a/db-aodbc/aodbc-package.lisp b/db-aodbc/aodbc-package.lisp index 32882cf..18c336a 100644 --- a/db-aodbc/aodbc-package.lisp +++ b/db-aodbc/aodbc-package.lisp @@ -25,6 +25,6 @@ (defpackage #:clsql-aodbc (:nicknames #:aodbc) - (:use :cl :clsql-base-sys) + (:use #:cl #:clsql-base) (:export #:aodbc-database) (:documentation "This is the CLSQL interface to Allegro's AODBC")) diff --git a/db-aodbc/aodbc-sql.lisp b/db-aodbc/aodbc-sql.lisp index 87fd0f3..02d6d95 100644 --- a/db-aodbc/aodbc-sql.lisp +++ b/db-aodbc/aodbc-sql.lisp @@ -19,16 +19,16 @@ (in-package #:clsql-aodbc) ;; interface foreign library loading routines -(defmethod clsql-base-sys:database-type-library-loaded ((database-type (eql :aodbc))) +(defmethod clsql-base: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 clsql-base-sys:database-type-load-foreign ((databae-type (eql :aodbc))) +(defmethod clsql-base:database-type-load-foreign ((databae-type (eql :aodbc))) t) (when (find-package :dbi) - (clsql-base-sys:database-type-load-foreign :aodbc)) + (clsql-base:database-type-load-foreign :aodbc)) (defmethod database-initialize-database-type ((database-type (eql :aodbc))) t) @@ -301,6 +301,8 @@ (defmethod db-backend-has-create/destroy-db? ((db-type (eql :aodbc))) nil) -#+ignore -(when (clsql-base-sys:database-type-library-loaded :aodbc) - (clsql-base-sys:initialize-database-type :database-type :aodbc)) +(defmethod database-initialize-database-type ((database-type (eql :aodbc))) + t) + +(when (clsql-base:database-type-library-loaded :aodbc) + (clsql-base:initialize-database-type :database-type :aodbc)) diff --git a/db-mysql/mysql-loader.lisp b/db-mysql/mysql-loader.lisp index 675014f..957c39e 100644 --- a/db-mysql/mysql-loader.lisp +++ b/db-mysql/mysql-loader.lisp @@ -62,10 +62,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-base-sys:database-type-library-loaded ((database-type (eql :mysql))) +(defmethod clsql-base:database-type-library-loaded ((database-type (eql :mysql))) *mysql-library-loaded*) -(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :mysql))) +(defmethod clsql-base:database-type-load-foreign ((database-type (eql :mysql))) (let ((mysql-path (uffi:find-foreign-library *mysql-library-candidate-names* *mysql-library-candidate-directories* @@ -85,5 +85,5 @@ set to the right path before compiling or loading the system.") (setq *mysql-library-loaded* t)) -(clsql-base-sys:database-type-load-foreign :mysql) +(clsql-base:database-type-load-foreign :mysql) diff --git a/db-mysql/mysql-sql.lisp b/db-mysql/mysql-sql.lisp index 0f24ffb..dd62303 100644 --- a/db-mysql/mysql-sql.lisp +++ b/db-mysql/mysql-sql.lisp @@ -14,7 +14,7 @@ ;;;; ************************************************************************* (defpackage #:clsql-mysql - (:use #:common-lisp #:clsql-base-sys #:mysql #:clsql-uffi) + (:use #:common-lisp #:clsql-base #:mysql #:clsql-uffi) (:export #:mysql-database) (:documentation "This is the CLSQL interface to MySQL.")) @@ -392,7 +392,7 @@ (defmethod database-create (connection-spec (type (eql :mysql))) (destructuring-bind (host name user password) connection-spec (multiple-value-bind (output status) - (clsql-base-sys:command-output "mysqladmin create -u~A -p~A -h~A ~A" + (clsql-base:command-output "mysqladmin create -u~A -p~A -h~A ~A" user password (if host host "localhost") name) @@ -408,7 +408,7 @@ (defmethod database-destroy (connection-spec (type (eql :mysql))) (destructuring-bind (host name user password) connection-spec (multiple-value-bind (output status) - (clsql-base-sys:command-output "mysqladmin drop -f -u~A -p~A -h~A ~A" + (clsql-base:command-output "mysqladmin drop -f -u~A -p~A -h~A ~A" user password (if host host "localhost") name) @@ -432,11 +432,11 @@ (let ((database (database-connect (list host "mysql" user password) type))) (unwind-protect (progn - (setf (slot-value database 'clsql-base-sys::state) :open) + (setf (slot-value database 'clsql-base::state) :open) (mapcar #'car (database-query "show databases" database :auto nil))) (progn (database-disconnect database) - (setf (slot-value database 'clsql-base-sys::state) :closed)))))) + (setf (slot-value database 'clsql-base::state) :closed)))))) ;;; Database capabilities @@ -458,6 +458,6 @@ (let ((tuple (car (database-query "SHOW VARIABLES LIKE 'HAVE_INNODB'" database :auto nil)))) (and tuple (string-equal "YES" (second tuple))))) -(when (clsql-base-sys:database-type-library-loaded :mysql) - (clsql-base-sys:initialize-database-type :database-type :mysql)) +(when (clsql-base:database-type-library-loaded :mysql) + (clsql-base:initialize-database-type :database-type :mysql)) diff --git a/db-odbc/odbc-api.lisp b/db-odbc/odbc-api.lisp index e34706c..e51f248 100644 --- a/db-odbc/odbc-api.lisp +++ b/db-odbc/odbc-api.lisp @@ -113,11 +113,11 @@ as possible second argument) to the desired representation of date/time/timestam (progn ,result-code ,@body)) (#.$SQL_INVALID_HANDLE (error - 'clsql-base-sys:clsql-odbc-error + 'clsql-base:clsql-odbc-error :odbc-message "Invalid handle")) (#.$SQL_STILL_EXECUTING (error - 'clsql-base-sys:clsql-odbc-error + 'clsql-base:clsql-odbc-error :odbc-message "Still executing")) (#.$SQL_ERROR (multiple-value-bind (error-message sql-state) @@ -125,7 +125,7 @@ as possible second argument) to the desired representation of date/time/timestam (or ,hdbc +null-handle-ptr+) (or ,hstmt +null-handle-ptr+)) (error - 'clsql-base-sys:clsql-odbc-error + 'clsql-base:clsql-odbc-error :odbc-message error-message :sql-state sql-state))) (otherwise diff --git a/db-odbc/odbc-dbi.lisp b/db-odbc/odbc-dbi.lisp index 4bafb1f..4a6107d 100644 --- a/db-odbc/odbc-dbi.lisp +++ b/db-odbc/odbc-dbi.lisp @@ -357,7 +357,7 @@ the query against." )) "get-free-query finds or makes a nonactive query object, and then sets it to active. This makes the functions db-execute-command and db-query thread safe." (with-slots (queries hdbc) database - (or (clsql-base-sys:without-interrupts + (or (clsql-base:without-interrupts (let ((inactive-query (find-if (lambda (query) (not (query-active-p query))) queries))) diff --git a/db-odbc/odbc-loader.lisp b/db-odbc/odbc-loader.lisp index 63e39d8..45bb6ff 100644 --- a/db-odbc/odbc-loader.lisp +++ b/db-odbc/odbc-loader.lisp @@ -38,15 +38,15 @@ set to the right path before compiling or loading the system.") (defvar *odbc-library-loaded* nil "T if foreign library was able to be loaded successfully") -(defmethod clsql-base-sys:database-type-library-loaded ((database-type (eql :odbc))) +(defmethod clsql-base:database-type-library-loaded ((database-type (eql :odbc))) *odbc-library-loaded*) -(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :odbc))) +(defmethod clsql-base:database-type-load-foreign ((database-type (eql :odbc))) (uffi:load-foreign-library *odbc-library-path* :module "odbc") (setq *odbc-library-loaded* t)) -(clsql-base-sys:database-type-load-foreign :odbc) +(clsql-base:database-type-load-foreign :odbc) diff --git a/db-odbc/odbc-sql.lisp b/db-odbc/odbc-sql.lisp index b43a322..2769bf9 100644 --- a/db-odbc/odbc-sql.lisp +++ b/db-odbc/odbc-sql.lisp @@ -17,7 +17,7 @@ ;;;; ************************************************************************* (defpackage #:clsql-odbc - (:use #:common-lisp #:clsql-base-sys) + (:use #:common-lisp #:clsql-base) (:export #:odbc-database) (:documentation "This is the CLSQL interface to ODBC.")) @@ -355,5 +355,5 @@ ;; nothing to do t) -(when (clsql-base-sys:database-type-library-loaded :odbc) - (clsql-base-sys:initialize-database-type :database-type :odbc)) +(when (clsql-base:database-type-library-loaded :odbc) + (clsql-base:initialize-database-type :database-type :odbc)) diff --git a/db-postgresql-socket/postgresql-socket-api.lisp b/db-postgresql-socket/postgresql-socket-api.lisp index 936f6db..5630f04 100644 --- a/db-postgresql-socket/postgresql-socket-api.lisp +++ b/db-postgresql-socket/postgresql-socket-api.lisp @@ -27,13 +27,13 @@ (:float4 700) (:float8 701))) -(defmethod clsql-base-sys:database-type-library-loaded ((database-type +(defmethod clsql-base: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) -(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :postgresql-socket))) +(defmethod clsql-base:database-type-load-foreign ((database-type (eql :postgresql-socket))) t) diff --git a/db-postgresql-socket/postgresql-socket-sql.lisp b/db-postgresql-socket/postgresql-socket-sql.lisp index 07032b8..180b036 100644 --- a/db-postgresql-socket/postgresql-socket-sql.lisp +++ b/db-postgresql-socket/postgresql-socket-sql.lisp @@ -20,7 +20,7 @@ (in-package #:cl-user) (defpackage :clsql-postgresql-socket - (:use #:common-lisp #:clsql-base-sys #:postgresql-socket) + (:use #:common-lisp #:clsql-base #:postgresql-socket) (:export #:postgresql-socket-database) (:documentation "This is the CLSQL socket interface to PostgreSQL.")) @@ -29,7 +29,7 @@ ;; interface foreign library loading routines -(clsql-base-sys:database-type-load-foreign :postgresql-socket) +(clsql-base:database-type-load-foreign :postgresql-socket) ;; Field type conversion @@ -486,12 +486,12 @@ doesn't depend on UFFI." type))) (unwind-protect (progn - (setf (slot-value database 'clsql-base-sys::state) :open) + (setf (slot-value database 'clsql-base::state) :open) (mapcar #'car (database-query "select datname from pg_database" database :auto nil))) (progn (database-disconnect database) - (setf (slot-value database 'clsql-base-sys::state) :closed)))))) + (setf (slot-value database 'clsql-base::state) :closed)))))) (defmethod database-describe-table ((database postgresql-socket-database) table) @@ -517,5 +517,5 @@ doesn't depend on UFFI." (defmethod db-type-default-case ((db-type (eql :postgresql-socket))) :lower) -(when (clsql-base-sys:database-type-library-loaded :postgresql-socket) - (clsql-base-sys:initialize-database-type :database-type :postgresql-socket)) +(when (clsql-base:database-type-library-loaded :postgresql-socket) + (clsql-base:initialize-database-type :database-type :postgresql-socket)) diff --git a/db-postgresql/postgresql-loader.lisp b/db-postgresql/postgresql-loader.lisp index 48dd433..420c97a 100644 --- a/db-postgresql/postgresql-loader.lisp +++ b/db-postgresql/postgresql-loader.lisp @@ -27,11 +27,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-base-sys:database-type-library-loaded ((database-type +(defmethod clsql-base:database-type-library-loaded ((database-type (eql :postgresql))) *postgresql-library-loaded*) -(defmethod clsql-base-sys:database-type-load-foreign ((database-type +(defmethod clsql-base:database-type-load-foreign ((database-type (eql :postgresql))) (let ((libpath (uffi:find-foreign-library "libpq" @@ -50,5 +50,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-base-sys:database-type-load-foreign :postgresql) +(clsql-base:database-type-load-foreign :postgresql) diff --git a/db-postgresql/postgresql-sql.lisp b/db-postgresql/postgresql-sql.lisp index 47df535..a556831 100644 --- a/db-postgresql/postgresql-sql.lisp +++ b/db-postgresql/postgresql-sql.lisp @@ -16,7 +16,7 @@ (in-package #:cl-user) (defpackage #:clsql-postgresql - (:use #:common-lisp #:clsql-base-sys #:postgresql #:clsql-uffi) + (:use #:common-lisp #:clsql-base #:postgresql #:clsql-uffi) (:export #:postgresql-database) (:documentation "This is the CLSQL interface to PostgreSQL.")) @@ -520,7 +520,7 @@ (destructuring-bind (host name user password) connection-spec (declare (ignore user password)) (multiple-value-bind (output status) - (clsql-base-sys:command-output "createdb -h~A ~A" + (clsql-base:command-output "createdb -h~A ~A" (if host host "localhost") name) (if (or (not (zerop status)) @@ -537,7 +537,7 @@ (destructuring-bind (host name user password) connection-spec (declare (ignore user password)) (multiple-value-bind (output status) - (clsql-base-sys:command-output "dropdb -h~A ~A" + (clsql-base:command-output "dropdb -h~A ~A" (if host host "localhost") name) (if (or (not (zerop status)) @@ -563,12 +563,12 @@ type))) (unwind-protect (progn - (setf (slot-value database 'clsql-base-sys::state) :open) + (setf (slot-value database 'clsql-base::state) :open) (mapcar #'car (database-query "select datname from pg_database" database nil nil))) (progn (database-disconnect database) - (setf (slot-value database 'clsql-base-sys::state) :closed)))))) + (setf (slot-value database 'clsql-base::state) :closed)))))) (defmethod database-describe-table ((database postgresql-database) table) (database-query @@ -618,5 +618,5 @@ (defmethod db-type-default-case ((db-type (eql :postgresql))) :lower) -(when (clsql-base-sys:database-type-library-loaded :postgresql) - (clsql-base-sys:initialize-database-type :database-type :postgresql)) +(when (clsql-base:database-type-library-loaded :postgresql) + (clsql-base:initialize-database-type :database-type :postgresql)) diff --git a/db-sqlite/sqlite-loader.lisp b/db-sqlite/sqlite-loader.lisp index 65d4d53..1cfcf21 100644 --- a/db-sqlite/sqlite-loader.lisp +++ b/db-sqlite/sqlite-loader.lisp @@ -16,7 +16,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package :clsql-sqlite) +(in-package #:clsql-sqlite) (defvar *sqlite-supporting-libraries* '("c") "Used only by CMU. List of library flags needed to be passed to ld @@ -46,7 +46,7 @@ set to the right path before compiling or loading the system.") (setq *sqlite-library-loaded* t) (warn "Can't load SQLite library ~A" libpath)))) -(clsql-base-sys:database-type-load-foreign :sqlite) +(clsql-base:database-type-load-foreign :sqlite) diff --git a/db-sqlite/sqlite-package.lisp b/db-sqlite/sqlite-package.lisp index 0c973a8..2f8e13e 100644 --- a/db-sqlite/sqlite-package.lisp +++ b/db-sqlite/sqlite-package.lisp @@ -19,5 +19,5 @@ (in-package #:cl-user) (defpackage #:clsql-sqlite - (:use #:common-lisp #:clsql-base-sys) + (:use #:common-lisp #:clsql-base) (:export #:sqlite-database)) diff --git a/sql/new-objects.lisp b/sql/new-objects.lisp index 64e9ade..d2013b7 100644 --- a/sql/new-objects.lisp +++ b/sql/new-objects.lisp @@ -611,7 +611,7 @@ DATABASE-NULL-VALUE on the type of the slot.")) (declare (ignore database)) (progv '(*print-circle* *print-array*) '(t t) (let ((escaped (prin1-to-string val))) - (clsql-base-sys::substitute-char-string + (clsql-base::substitute-char-string escaped #\Null " ")))) (defmethod database-output-sql-as-type ((type (eql 'symbol)) val database) diff --git a/sql/objects.lisp b/sql/objects.lisp index 4535978..ef9c0db 100644 --- a/sql/objects.lisp +++ b/sql/objects.lisp @@ -456,7 +456,7 @@ superclass of the newly-defined View Class." (defmethod database-get-type-specifier (type args database) (declare (ignore type args)) - (if (clsql-base-sys::in (database-underlying-type database) + (if (clsql-base::in (database-underlying-type database) :postgresql :postgresql-socket) "VARCHAR" "VARCHAR(255)")) @@ -476,7 +476,7 @@ superclass of the newly-defined View Class." database) (if args (format nil "VARCHAR(~A)" (car args)) - (if (clsql-base-sys::in (database-underlying-type database) + (if (clsql-base::in (database-underlying-type database) :postgresql :postgresql-socket) "VARCHAR" "VARCHAR(255)"))) @@ -485,7 +485,7 @@ superclass of the newly-defined View Class." database) (if args (format nil "VARCHAR(~A)" (car args)) - (if (clsql-base-sys::in (database-underlying-type database) + (if (clsql-base::in (database-underlying-type database) :postgresql :postgresql-socket) "VARCHAR" "VARCHAR(255)"))) @@ -493,7 +493,7 @@ superclass of the newly-defined View Class." (defmethod database-get-type-specifier ((type (eql 'string)) args database) (if args (format nil "VARCHAR(~A)" (car args)) - (if (clsql-base-sys::in (database-underlying-type database) + (if (clsql-base::in (database-underlying-type database) :postgresql :postgresql-socket) "VARCHAR" "VARCHAR(255)"))) @@ -553,7 +553,7 @@ superclass of the newly-defined View Class." (declare (ignore database)) (progv '(*print-circle* *print-array*) '(t t) (let ((escaped (prin1-to-string val))) - (clsql-base-sys::substitute-char-string + (clsql-base::substitute-char-string escaped #\Null " ")))) (defmethod database-output-sql-as-type ((type (eql 'symbol)) val database) @@ -630,22 +630,24 @@ superclass of the newly-defined View Class." (defmethod read-sql-value (val (type (eql 'symbol)) database) (declare (ignore database)) (when (< 0 (length val)) - (unless (string= val (clsql-base-sys:symbol-name-default-case "NIL")) - (intern (clsql-base-sys:symbol-name-default-case val) + (unless (string= val (clsql-base:symbol-name-default-case "NIL")) + (intern (clsql-base:symbol-name-default-case val) (symbol-package *update-context*))))) (defmethod read-sql-value (val (type (eql 'integer)) database) (declare (ignore database)) (etypecase val (string - (parse-integer val)) + (unless (string-equal "NIL" val) + (parse-integer val))) (number val))) (defmethod read-sql-value (val (type (eql 'bigint)) database) (declare (ignore database)) (etypecase val (string - (parse-integer val)) + (unless (string-equal "NIL" val) + (parse-integer val))) (number val))) (defmethod read-sql-value (val (type (eql 'float)) database) @@ -660,10 +662,10 @@ superclass of the newly-defined View Class." (defmethod read-sql-value (val (type (eql 'univeral-time)) database) (declare (ignore database)) (unless (eq 'NULL val) - (etypecase val - (string - (parse-intger val)) - (number val))) + (etypecase val + (string + (parse-integer val)) + (number val)))) (defmethod read-sql-value (val (type (eql 'wall-time)) database) (declare (ignore database)) diff --git a/sql/package.lisp b/sql/package.lisp index d38c55c..5293df9 100644 --- a/sql/package.lisp +++ b/sql/package.lisp @@ -30,7 +30,7 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (defpackage #:clsql-sys - (:use #:common-lisp #:clsql-base-sys + (:use #:common-lisp #:clsql-base #+clsql-sbcl-mop #:sb-mop #+clsql-cmucl-mop #:mop #+allegro #:mop @@ -96,7 +96,7 @@ ) (:import-from - #:clsql-base-sys + #:clsql-base . #1=( ;; conditions diff --git a/sql/sql.lisp b/sql/sql.lisp index 3b575df..8107bd9 100644 --- a/sql/sql.lisp +++ b/sql/sql.lisp @@ -35,7 +35,7 @@ (defun truncate-database (&key (database *default-database*)) (unless (typep database 'database) - (clsql-base-sys::signal-no-database-error database)) + (clsql-base::signal-no-database-error database)) (unless (is-database-open database) (database-reconnect database)) (when (db-type-has-views? (database-underlying-type database)) diff --git a/tests/test-connection.lisp b/tests/test-connection.lisp index f35261e..11d3cc4 100644 --- a/tests/test-connection.lisp +++ b/tests/test-connection.lisp @@ -27,12 +27,12 @@ t) (deftest :connection/2 - (clsql-base-sys::string-to-list-connection-spec + (clsql-base::string-to-list-connection-spec "localhost/dbname/user/passwd") ("localhost" "dbname" "user" "passwd")) (deftest :connection/3 - (clsql-base-sys::string-to-list-connection-spec + (clsql-base::string-to-list-connection-spec "dbname/user@hostname") ("hostname" "dbname" "user")) diff --git a/tests/test-fddl.lisp b/tests/test-fddl.lisp index d047b3f..0dc053b 100644 --- a/tests/test-fddl.lisp +++ b/tests/test-fddl.lisp @@ -112,7 +112,7 @@ t nil) ;; create a view, list its attributes and drop it -(when (clsql-base-sys:db-type-has-views? *test-database-underlying-type*) +(when (clsql-base:db-type-has-views? *test-database-underlying-type*) (deftest :fddl/view/2 (progn (clsql:create-view [lenins-group] :as [select [first-name] [last-name] [email] diff --git a/tests/test-init.lisp b/tests/test-init.lisp index d8eec64..c13f545 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -401,23 +401,23 @@ (let ((test (second test-form))) (cond ((and (null (db-type-has-views? db-underlying-type)) - (clsql-base-sys::in test :fddl/view/1 :fddl/view/2 :fddl/view/3 :fddl/view/4)) + (clsql-base::in test :fddl/view/1 :fddl/view/2 :fddl/view/3 :fddl/view/4)) (push (cons test "views not supported") skip-tests)) ((and (null (db-type-has-boolean-where? db-underlying-type)) - (clsql-base-sys::in test :fdml/select/11 :oodml/select/5)) + (clsql-base::in test :fdml/select/11 :oodml/select/5)) (push (cons test "boolean where not supported") skip-tests)) ((and (null (db-type-has-subqueries? db-underlying-type)) - (clsql-base-sys::in test :fdml/select/5 :fdml/select/10)) + (clsql-base::in test :fdml/select/5 :fdml/select/10)) (push (cons test "subqueries not supported") skip-tests)) ((and (null (db-type-transaction-capable? db-underlying-type *default-database*)) - (clsql-base-sys::in test :fdml/transaction/1 :fdml/transaction/2 :fdml/transaction/3 :fdml/transaction/4)) + (clsql-base::in test :fdml/transaction/1 :fdml/transaction/2 :fdml/transaction/3 :fdml/transaction/4)) (push (cons test "transactions not supported") skip-tests)) ((and (null (db-type-has-fancy-math? db-underlying-type)) - (clsql-base-sys::in test :fdml/select/1)) + (clsql-base::in test :fdml/select/1)) (push (cons test "fancy math not supported") skip-tests)) ((and (eql *test-database-type* :sqlite) - (clsql-base-sys::in test :fddl/view/4 :fdml/select/10)) + (clsql-base::in test :fddl/view/4 :fdml/select/10)) (push (cons test "not supported by sqlite") skip-tests)) (t (push test-form test-forms))))) -- 2.34.1