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
214 #:add-sql-stream ; recording xx
215 #:delete-sql-stream ; recording xx
216 #:list-sql-streams ; recording xx
217 #:sql-recording-p ; recording xx
218 #:sql-stream ; recording xx
219 #:start-sql-recording ; recording xx
220 #:stop-sql-recording ; recording xx
225 #:rollback-transaction
226 #:add-transaction-commit-hook
227 #:add-transaction-rollback-hook
228 #:commit ; transact xx
229 #:rollback ; transact xx
230 #:with-transaction ; transact xx
231 #:start-transaction ; transact xx
232 #:in-transaction-p ; transact xx
233 #:database-start-transaction
234 #:database-abort-transaction
235 #:database-commit-transaction
239 ;; Database capabilities
240 #:db-type-use-column-on-drop-index?
241 #:db-backend-has-create/destroy-db?
243 #:db-type-has-subqueries?
244 #:db-type-has-boolean-where?
245 #:db-type-transaction-capable?
246 #:db-type-has-fancy-math?
247 #:db-type-default-case
248 #:convert-to-db-default-case
249 #:database-underlying-type
274 #:duration-timestring
305 #:time-by-adding-duration
332 ;; "Private" exports for use by interface packages
333 #:check-connection-spec
334 #:database-initialize-database-type
335 #:database-type-load-foreign
336 #:database-name-from-spec
339 #:database-execute-command
340 #:database-create-sequence
341 #:database-drop-sequence
342 #:database-sequence-next
343 #:database-set-sequence-position
344 #:database-query-result-set
345 #:database-dump-result-set
346 #:database-store-next-row
347 #:database-get-type-specifier
348 #:database-list-tables
349 #:database-table-exists-p
350 #:database-list-views
351 #:database-view-exists-p
352 #:database-list-indexes
353 #:database-list-table-indexes
354 #:database-index-exists-p
355 #:database-list-sequences
356 #:database-sequence-exists-p
357 #:database-list-attributes
358 #:database-attribute-type
359 #:database-describe-table
361 #:db-backend-has-create/destroy-db?
363 #:db-type-has-subqueries?
364 #:db-type-has-boolean-where?
365 #:db-type-transaction-capable?
366 #:db-type-has-fancy-math?
367 #:db-type-default-case
368 #:database-underlying-type
371 ;; Shared exports for re-export by CLSQL-USER.
372 ;; I = Implemented, D = Documented
374 ;;====================================================
375 #2=(;;------------------------------------------------
377 ;;------------------------------------------------
379 #:select ; objects xx
380 #:cache-table-queries ;
381 #:*cache-table-queries-default* ;
382 #:delete-records ; sql xx
383 #:insert-records ; sql xx
384 #:update-records ; sql xx
385 #:execute-command ; sql xx
387 #:print-query ; sql xx
392 #:create-table ; table xx
393 #:drop-table ; table xx
394 #:list-tables ; table xx
395 #:table-exists-p ; table xx
396 #:list-attributes ; table xx
397 #:attribute-type ; table xx
398 #:list-attribute-types ; table xx
399 #:*cache-table-queries-default*
400 #:create-view ; table xx
401 #:drop-view ; table xx
402 #:create-index ; table xx
403 #:drop-index ; table xx
406 #:standard-db-object ; objects xx
407 #:def-view-class ; objects xx
408 #:create-view-from-class ; objects xx
409 #:drop-view-from-class ; objects xx
411 #:instance-refreshed ; objects xx
412 #:update-object-joins ;
413 #:*default-update-objects-max-len* ;
414 #:update-slot-from-record ; objects xx
415 #:update-instance-from-records ; objects xx
416 #:update-records-from-instance ; objects xx
417 #:update-record-from-slot ; objects xx
418 #:update-record-from-slots ; objects xx
419 #:list-classes ; objects xx
420 #:delete-instance-records ; objects xx
421 ;;Symbolic SQL Syntax
423 #:sql-expression ; syntax xx
424 #:sql-operation ; syntax xx
425 #:sql-operator ; syntax xx
426 #:disable-sql-reader-syntax ; syntax xx
427 #:enable-sql-reader-syntax ; syntax xx
428 #:locally-disable-sql-reader-syntax ; syntax xx
429 #:locally-enable-sql-reader-syntax ; syntax xx
430 #:restore-sql-reader-syntax-state ; syntax xx
432 ;;------------------------------------------------
433 ;; Miscellaneous Extensions
434 ;;------------------------------------------------
436 #:*loaded-database-types* ; clsql-base xx
437 #:reload-database-types ; clsql-base xx
438 #:database-type ; database x
441 #:list-views ; table xx
442 #:view-exists-p ; table xx
443 #:list-indexes ; table xx
444 #:list-table-indexes ; table xx
445 #:index-exists-p ; table xx
446 #:create-sequence ; table xx
447 #:drop-sequence ; table xx
448 #:list-sequences ; table xx
449 #:sequence-exists-p ; table xx
450 #:sequence-next ; table xx
451 #:sequence-last ; table xx
452 #:set-sequence-position ; table xx
454 #:view-table ; metaclass x
455 #:universal-time ; objects xx
458 #:*db-auto-sync* ; objects xx
459 #:add-to-relation ; objects x
460 #:remove-from-relation ; objects x
461 #:read-sql-value ; objects x
462 #:database-output-sql-as-type ; objects x
463 #:database-get-type-specifier ; objects x
464 #:database-output-sql ; sql/class xx
466 ;;-----------------------------------------------
467 ;; Symbolic Sql Syntax
468 ;;-----------------------------------------------
514 (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
517 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
519 (setf *packages-for-warn-on-redefinition*
520 (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
522 (defpackage #:clsql-user
524 (:import-from #:clsql . #2#)
526 (:documentation "This is the user package with CLSQL symbols."))
528 ;; This is from USQL's pcl-patch
529 #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
531 ;; Note that this will no longer required for cmucl as of version 19a.
532 (in-package #+cmu :pcl #+sbcl :sb-pcl)
533 (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
535 `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
536 (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
537 slot-vars pv-parameters))
538 ,@(mapcar #'(lambda (slot-var) `(declare (ignorable ,slot-var))) slot-vars)
543 (if (find-package 'sb-mop)
544 (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
545 (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
548 (if (find-package 'mop)
549 (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
550 (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))