1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
6 ;;;; Package definitions for CLSQL.
8 ;;;; This file is part of CLSQL.
10 ;;;; CLSQL users are granted the rights to distribute and use this software
11 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
12 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
13 ;;;; *************************************************************************
15 (in-package #:cl-user)
17 (eval-when (:compile-toplevel :load-toplevel :execute)
20 (if (find-package 'sb-mop)
21 (pushnew :clsql-sbcl-mop cl:*features*)
22 (pushnew :clsql-sbcl-pcl cl:*features*))
25 (if (eq (symbol-package 'pcl:find-class)
26 (find-package 'common-lisp))
27 (pushnew :clsql-cmucl-mop cl:*features*)
28 (pushnew :clsql-cmucl-pcl cl:*features*)))
31 (eval-when (:compile-toplevel :load-toplevel :execute)
33 (:use #:common-lisp #:clsql-base
34 #+clsql-sbcl-mop #:sb-mop
35 #+clsql-cmucl-mop #:mop
39 #+openmcl #:openmcl-mop)
42 (:shadowing-import-from
45 (:shadowing-import-from
48 (:shadowing-import-from
50 #:generic-function-lambda-list)
52 (:shadowing-import-from
56 #:class-of #:class-name #:class-slots #:find-class
59 #:slot-definition-name #:finalize-inheritance
60 #:standard-direct-slot-definition
61 #:standard-effective-slot-definition #:validate-superclass
62 #:direct-slot-definition-class #:compute-effective-slot-definition
63 #:effective-slot-definition-class
64 #:slot-value-using-class
65 #:class-prototype #:generic-function-method-class #:intern-eql-specializer
66 #:make-method-lambda #:generic-function-lambda-list
67 #:class-precedence-list #:slot-definition-type
68 #:class-direct-superclasses
69 #:compute-class-precedence-list)
71 (:shadowing-import-from
73 #:generic-function-lambda-list)
75 (:shadowing-import-from
79 #:class-of #:class-name #:class-slots #:find-class #:standard-class
81 #:slot-definition-name #:finalize-inheritance
82 #:standard-direct-slot-definition #:standard-effective-slot-definition
83 #:validate-superclass #:direct-slot-definition-class
84 #:effective-slot-definition-class
85 #:compute-effective-slot-definition
86 #:slot-value-using-class
87 #:class-prototype #:generic-function-method-class #:intern-eql-specializer
88 #:make-method-lambda #:generic-function-lambda-list
89 #:class-precedence-list #:slot-definition-type
90 #:class-direct-superclasses
91 #:compute-class-precedence-list)
93 (:shadowing-import-from
95 #:class-prototype ;; note: make-method-lambda is not fbound
107 #:clsql-simple-warning
108 #:clsql-invalid-spec-error
109 #:clsql-invalid-spec-error-connection-spec
110 #:clsql-invalid-spec-error-database-type
111 #:clsql-invalid-spec-error-template
113 #:clsql-access-error-database-type
114 #:clsql-access-error-connection-spec
115 #:clsql-access-error-error
116 #:clsql-connect-error
117 #:clsql-connect-error-errno
119 #:clsql-sql-error-database
120 #:clsql-sql-error-expression
121 #:clsql-sql-error-errno
122 #:clsql-sql-error-error
123 #:clsql-database-warning
124 #:clsql-database-warning-database
125 #:clsql-database-warning-message
126 #:clsql-exists-condition
127 #:clsql-exists-condition-new-db
128 #:clsql-exists-condition-old-db
129 #:clsql-exists-warning
132 #:clsql-closed-error-database
134 #:clsql-sql-syntax-error
135 #:*backend-warning-behavior*
138 #:check-connection-spec
139 #:database-initialize-database-type
140 #:database-type-load-foreign
141 #:database-name-from-spec
142 #:database-create-sequence
143 #:database-drop-sequence
144 #:database-sequence-next
145 #:database-set-sequence-position
146 #:database-query-result-set
147 #:database-dump-result-set
148 #:database-store-next-row
149 #:database-get-type-specifier
150 #:database-list-tables
151 #:database-list-views
152 #:database-list-indexes
153 #:database-list-table-indexes
154 #:database-list-sequences
155 #:database-list-attributes
156 #:database-attribute-type
157 #:database-add-attribute
161 #:*loaded-database-types*
162 #:reload-database-types
163 #:*initialized-database-types*
164 #:initialize-database-type
168 #:command-recording-stream
169 #:result-recording-stream
170 #:database-view-classes
177 ;; database.lisp -- Connection
178 #:*default-database-type* ; database xx
179 #:*default-database* ; database xx
180 #:connect ; database xx
181 #:*connect-if-exists* ; database xx
182 #:connected-databases ; database xx
183 #:database ; database xx
184 #:database-name ; database xx
185 #:disconnect ; database xx
186 #:reconnect ; database xx
187 #:find-database ; database xx
188 #:status ; database xx
190 #:with-default-database
203 #:delete-large-object
205 #:create-large-object
208 #:delete-large-object
211 ;; recording.lisp -- SQL I/O Recording
213 #:add-sql-stream ; recording xx
214 #:delete-sql-stream ; recording xx
215 #:list-sql-streams ; recording xx
216 #:sql-recording-p ; recording xx
217 #:sql-stream ; recording xx
218 #:start-sql-recording ; recording xx
219 #:stop-sql-recording ; recording xx
224 #:rollback-transaction
225 #:add-transaction-commit-hook
226 #:add-transaction-rollback-hook
227 #:commit ; transact xx
228 #:rollback ; transact xx
229 #:with-transaction ; transact xx
230 #:start-transaction ; transact xx
231 #:in-transaction-p ; transact xx
232 #:database-start-transaction
233 #:database-abort-transaction
234 #:database-commit-transaction
238 ;; Database capabilities
239 #:db-type-use-column-on-drop-index?
240 #:db-backend-has-create/destroy-db?
242 #:db-type-has-subqueries?
243 #:db-type-has-boolean-where?
244 #:db-type-transaction-capable?
245 #:db-type-has-fancy-math?
246 #:db-type-default-case
247 #:convert-to-db-default-case
248 #:database-underlying-type
273 #:duration-timestring
304 #:time-by-adding-duration
331 ;; "Private" exports for use by interface packages
332 #:check-connection-spec
333 #:database-initialize-database-type
334 #:database-type-load-foreign
335 #:database-name-from-spec
338 #:database-execute-command
339 #:database-create-sequence
340 #:database-drop-sequence
341 #:database-sequence-next
342 #:database-set-sequence-position
343 #:database-query-result-set
344 #:database-dump-result-set
345 #:database-store-next-row
346 #:database-get-type-specifier
347 #:database-list-tables
348 #:database-table-exists-p
349 #:database-list-views
350 #:database-view-exists-p
351 #:database-list-indexes
352 #:database-list-table-indexes
353 #:database-index-exists-p
354 #:database-list-sequences
355 #:database-sequence-exists-p
356 #:database-list-attributes
357 #:database-attribute-type
358 #:database-describe-table
360 #:db-backend-has-create/destroy-db?
362 #:db-type-has-subqueries?
363 #:db-type-has-boolean-where?
364 #:db-type-transaction-capable?
365 #:db-type-has-fancy-math?
366 #:db-type-default-case
367 #:database-underlying-type
370 ;; Shared exports for re-export by CLSQL-USER.
371 ;; I = Implemented, D = Documented
373 ;;====================================================
374 #2=(;;------------------------------------------------
376 ;;------------------------------------------------
378 #:select ; objects xx
379 #:cache-table-queries ;
380 #:*cache-table-queries-default* ;
381 #:delete-records ; sql xx
382 #:insert-records ; sql xx
383 #:update-records ; sql xx
384 #:execute-command ; sql xx
386 #:print-query ; sql xx
391 #:create-table ; table xx
392 #:drop-table ; table xx
393 #:list-tables ; table xx
394 #:table-exists-p ; table xx
395 #:list-attributes ; table xx
396 #:attribute-type ; table xx
397 #:list-attribute-types ; table xx
398 #:*cache-table-queries-default*
399 #:create-view ; table xx
400 #:drop-view ; table xx
401 #:create-index ; table xx
402 #:drop-index ; table xx
405 #:standard-db-object ; objects xx
406 #:def-view-class ; objects xx
407 #:create-view-from-class ; objects xx
408 #:drop-view-from-class ; objects xx
410 #:instance-refreshed ; objects xx
411 #:update-object-joins ;
412 #:*default-update-objects-max-len* ;
413 #:update-slot-from-record ; objects xx
414 #:update-instance-from-records ; objects xx
415 #:update-records-from-instance ; objects xx
416 #:update-record-from-slot ; objects xx
417 #:update-record-from-slots ; objects xx
418 #:list-classes ; objects xx
419 #:delete-instance-records ; objects xx
420 ;;Symbolic SQL Syntax
422 #:sql-expression ; syntax xx
423 #:sql-operation ; syntax xx
424 #:sql-operator ; syntax xx
425 #:disable-sql-reader-syntax ; syntax xx
426 #:enable-sql-reader-syntax ; syntax xx
427 #:locally-disable-sql-reader-syntax ; syntax xx
428 #:locally-enable-sql-reader-syntax ; syntax xx
429 #:restore-sql-reader-syntax-state ; syntax xx
431 ;;------------------------------------------------
432 ;; Miscellaneous Extensions
433 ;;------------------------------------------------
435 #:*loaded-database-types* ; clsql-base xx
436 #:reload-database-types ; clsql-base xx
437 #:database-type ; database x
440 #:list-views ; table xx
441 #:view-exists-p ; table xx
442 #:list-indexes ; table xx
443 #:list-table-indexes ; table xx
444 #:index-exists-p ; table xx
445 #:create-sequence ; table xx
446 #:drop-sequence ; table xx
447 #:list-sequences ; table xx
448 #:sequence-exists-p ; table xx
449 #:sequence-next ; table xx
450 #:sequence-last ; table xx
451 #:set-sequence-position ; table xx
453 #:view-table ; metaclass x
454 #:universal-time ; objects xx
457 #:*db-auto-sync* ; objects xx
458 #:add-to-relation ; objects x
459 #:remove-from-relation ; objects x
460 #:read-sql-value ; objects x
461 #:database-output-sql-as-type ; objects x
462 #:database-get-type-specifier ; objects x
463 #:database-output-sql ; sql/class xx
465 ;;-----------------------------------------------
466 ;; Symbolic Sql Syntax
467 ;;-----------------------------------------------
513 (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
516 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
518 (setf *packages-for-warn-on-redefinition*
519 (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
521 (defpackage #:clsql-user
523 (:import-from #:clsql . #2#)
525 (:documentation "This is the user package with CLSQL symbols."))
527 ;; This is from USQL's pcl-patch
528 #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
530 ;; Note that this will no longer required for cmucl as of version 19a.
531 (in-package #+cmu :pcl #+sbcl :sb-pcl)
532 (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
534 `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
535 (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
536 slot-vars pv-parameters))
537 ,@(mapcar #'(lambda (slot-var) `(declare (ignorable ,slot-var))) slot-vars)
542 (if (find-package 'sb-mop)
543 (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
544 (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
547 (if (find-package 'mop)
548 (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
549 (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))