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)
32 (defpackage #:clsql-sys
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
207 #:create-large-object
210 #:delete-large-object
213 ;; recording.lisp -- SQL I/O Recording
215 #:add-sql-stream ; recording xx
216 #:delete-sql-stream ; recording xx
217 #:list-sql-streams ; recording xx
218 #:sql-recording-p ; recording xx
219 #:sql-stream ; recording xx
220 #:start-sql-recording ; recording xx
221 #:stop-sql-recording ; recording xx
226 #:rollback-transaction
227 #:add-transaction-commit-hook
228 #:add-transaction-rollback-hook
229 #:commit ; transact xx
230 #:rollback ; transact xx
231 #:with-transaction ; transact xx
232 #:start-transaction ; transact xx
233 #:in-transaction-p ; transact xx
234 #:database-start-transaction
235 #:database-abort-transaction
236 #:database-commit-transaction
240 ;; Database capabilities
241 #:db-type-use-column-on-drop-index?
242 #:db-backend-has-create/destroy-db?
244 #:db-type-has-subqueries?
245 #:db-type-has-boolean-where?
246 #:db-type-transaction-capable?
247 #:db-type-has-fancy-math?
248 #:db-type-default-case
249 #:convert-to-db-default-case
250 #:database-underlying-type
253 ;; "Private" exports for use by interface packages
254 #:check-connection-spec
255 #:database-initialize-database-type
256 #:database-type-load-foreign
257 #:database-name-from-spec
260 #:database-execute-command
261 #:database-create-sequence
262 #:database-drop-sequence
263 #:database-sequence-next
264 #:database-set-sequence-position
265 #:database-query-result-set
266 #:database-dump-result-set
267 #:database-store-next-row
268 #:database-get-type-specifier
269 #:database-list-tables
270 #:database-table-exists-p
271 #:database-list-views
272 #:database-view-exists-p
273 #:database-list-indexes
274 #:database-list-table-indexes
275 #:database-index-exists-p
276 #:database-list-sequences
277 #:database-sequence-exists-p
278 #:database-list-attributes
279 #:database-attribute-type
280 #:database-describe-table
282 #:db-backend-has-create/destroy-db?
284 #:db-type-has-subqueries?
285 #:db-type-has-boolean-where?
286 #:db-type-transaction-capable?
287 #:db-type-has-fancy-math?
288 #:db-type-default-case
289 #:database-underlying-type
292 ;; Shared exports for re-export by CLSQL.
293 ;; I = Implemented, D = Documented
295 ;;====================================================
296 #2=(;;------------------------------------------------
298 ;;------------------------------------------------
300 #:select ; objects xx
301 #:cache-table-queries ;
302 #:*cache-table-queries-default* ;
303 #:delete-records ; sql xx
304 #:insert-records ; sql xx
305 #:update-records ; sql xx
306 #:execute-command ; sql xx
308 #:print-query ; sql xx
313 #:create-table ; table xx
314 #:drop-table ; table xx
315 #:list-tables ; table xx
316 #:table-exists-p ; table xx
317 #:list-attributes ; table xx
318 #:attribute-type ; table xx
319 #:list-attribute-types ; table xx
320 #:*cache-table-queries-default*
321 #:create-view ; table xx
322 #:drop-view ; table xx
323 #:create-index ; table xx
324 #:drop-index ; table xx
327 #:standard-db-object ; objects xx
328 #:def-view-class ; objects xx
329 #:create-view-from-class ; objects xx
330 #:drop-view-from-class ; objects xx
332 #:instance-refreshed ; objects xx
333 #:update-object-joins ;
334 #:*default-update-objects-max-len* ;
335 #:update-slot-from-record ; objects xx
336 #:update-instance-from-records ; objects xx
337 #:update-records-from-instance ; objects xx
338 #:update-record-from-slot ; objects xx
339 #:update-record-from-slots ; objects xx
340 #:list-classes ; objects xx
341 #:delete-instance-records ; objects xx
342 ;;Symbolic SQL Syntax
344 #:sql-expression ; syntax xx
345 #:sql-operation ; syntax xx
346 #:sql-operator ; syntax xx
347 #:disable-sql-reader-syntax ; syntax xx
348 #:enable-sql-reader-syntax ; syntax xx
349 #:locally-disable-sql-reader-syntax ; syntax xx
350 #:locally-enable-sql-reader-syntax ; syntax xx
351 #:restore-sql-reader-syntax-state ; syntax xx
353 ;;------------------------------------------------
354 ;; Miscellaneous Extensions
355 ;;------------------------------------------------
357 #:*loaded-database-types* ; clsql-base xx
358 #:reload-database-types ; clsql-base xx
359 #:database-type ; database x
362 #:list-views ; table xx
363 #:view-exists-p ; table xx
364 #:list-indexes ; table xx
365 #:list-table-indexes ; table xx
366 #:index-exists-p ; table xx
367 #:create-sequence ; table xx
368 #:drop-sequence ; table xx
369 #:list-sequences ; table xx
370 #:sequence-exists-p ; table xx
371 #:sequence-next ; table xx
372 #:sequence-last ; table xx
373 #:set-sequence-position ; table xx
375 #:view-table ; metaclass x
376 #:universal-time ; objects xx
379 #:add-to-relation ; objects x
380 #:remove-from-relation ; objects x
381 #:read-sql-value ; objects x
382 #:database-output-sql-as-type ; objects x
383 #:database-get-type-specifier ; objects x
384 #:database-output-sql ; sql/class xx
386 ;;-----------------------------------------------
387 ;; Symbolic Sql Syntax
388 ;;-----------------------------------------------
430 (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
433 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
435 (setf *packages-for-warn-on-redefinition*
436 (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
440 (:import-from #:clsql-sys . #2#)
442 (:documentation "This is the SQL-Interface package of CLSQL."))
444 (defpackage #:clsql-user
446 (:import-from #:clsql-sys . #2#)
448 (:documentation "This is the user package with CLSQL symbols."))
450 ;; This is from USQL's pcl-patch
451 #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
453 ;; Note that this will no longer required for cmucl as of version 19a.
454 (in-package #+cmu :pcl #+sbcl :sb-pcl)
455 (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
457 `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
458 (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
459 slot-vars pv-parameters))
460 ,@(mapcar #'(lambda (slot-var) `(declare (ignorable ,slot-var))) slot-vars)
465 (if (find-package 'sb-mop)
466 (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
467 (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
470 (if (find-package 'mop)
471 (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
472 (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))