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-sys
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
137 #:check-connection-spec
138 #:database-initialize-database-type
139 #:database-type-load-foreign
140 #:database-name-from-spec
141 #:database-create-sequence
142 #:database-drop-sequence
143 #:database-sequence-next
144 #:database-set-sequence-position
145 #:database-query-result-set
146 #:database-dump-result-set
147 #:database-store-next-row
148 #:database-get-type-specifier
149 #:database-list-tables
150 #:database-list-views
151 #:database-list-indexes
152 #:database-list-table-indexes
153 #:database-list-sequences
154 #:database-list-attributes
155 #:database-attribute-type
156 #:database-add-attribute
160 #:*loaded-database-types*
161 #:reload-database-types
162 #:*default-database-type*
163 #:*initialized-database-types*
164 #:initialize-database-type
168 #:command-recording-stream
169 #:result-recording-stream
170 #:database-view-classes
176 ;; database.lisp -- Connection
177 #:*default-database-type* ; clsql-base xx
178 #:*default-database* ; classes xx
179 #:connect ; database xx
180 #:*connect-if-exists* ; database xx
181 #:connected-databases ; database xx
182 #:database ; database xx
183 #:database-name ; database xx
184 #:disconnect ; database xx
185 #:reconnect ; database
186 #:find-database ; database xx
187 #:status ; database xx
189 #:with-default-database
202 #:delete-large-object
208 ;; recording.lisp -- SQL I/O Recording
210 #:add-sql-stream ; recording xx
211 #:delete-sql-stream ; recording xx
212 #:list-sql-streams ; recording xx
213 #:sql-recording-p ; recording xx
214 #:sql-stream ; recording xx
215 #:start-sql-recording ; recording xx
216 #:stop-sql-recording ; recording xx
221 #:rollback-transaction
222 #:add-transaction-commit-hook
223 #:add-transaction-rollback-hook
224 #:commit ; transact xx
225 #:rollback ; transact xx
226 #:with-transaction ; transact xx .
227 #:start-transaction ; transact xx
228 #:in-transaction-p ; transact xx
229 #:database-start-transaction
230 #:database-abort-transaction
231 #:database-commit-transaction
235 ;; Database capabilities
236 #:db-type-use-column-on-drop-index?
237 #:db-backend-has-create/destroy-db?
239 #:db-type-has-subqueries?
240 #:db-type-has-boolean-where?
241 #:db-type-transaction-capable?
242 #:db-type-has-fancy-math?
243 #:database-underlying-type
246 ;; "Private" exports for use by interface packages
247 #:check-connection-spec
248 #:database-initialize-database-type
249 #:database-type-load-foreign
250 #:database-name-from-spec
253 #:database-execute-command
254 #:database-create-sequence
255 #:database-drop-sequence
256 #:database-sequence-next
257 #:database-set-sequence-position
258 #:database-query-result-set
259 #:database-dump-result-set
260 #:database-store-next-row
261 #:database-get-type-specifier
262 #:database-list-tables
263 #:database-table-exists-p
264 #:database-list-views
265 #:database-view-exists-p
266 #:database-list-indexes
267 #:database-list-table-indexes
268 #:database-index-exists-p
269 #:database-list-sequences
270 #:database-sequence-exists-p
271 #:database-list-attributes
272 #:database-attribute-type
273 #:database-describe-table
275 #:db-backend-has-create/destroy-db?
277 #:db-type-has-subqueries?
278 #:db-type-has-boolean-where?
279 #:db-type-transaction-capable?
280 #:db-type-has-fancy-math?
281 #:database-underlying-type
284 ;; Shared exports for re-export by CLSQL.
285 ;; I = Implemented, D = Documented
287 ;;====================================================
288 #2=(;;------------------------------------------------
290 ;;------------------------------------------------
292 #:select ; objects xx
293 #:cache-table-queries ;
294 #:*cache-table-queries-default* ;
295 #:delete-records ; sql xx
296 #:insert-records ; sql xx
297 #:update-records ; sql xx
298 #:execute-command ; sql xx
300 #:print-query ; sql xx
305 #:create-table ; table xx
306 #:drop-table ; table xx
307 #:list-tables ; table xx
308 #:table-exists-p ; table xx
309 #:list-attributes ; table xx
310 #:attribute-type ; table xx
311 #:list-attribute-types ; table xx
312 #:create-view ; table xx
313 #:drop-view ; table xx
314 #:create-index ; table xx
315 #:drop-index ; table xx
318 #:standard-db-object ; objects xx
319 #:def-view-class ; objects xx
320 #:create-view-from-class ; objects xx
321 #:drop-view-from-class ; objects xx
323 #:instance-refreshed ;
324 #:update-object-joins ;
325 #:*default-update-objects-max-len* ;
326 #:update-slot-from-record ; objects xx
327 #:update-instance-from-records ; objects xx
328 #:update-records-from-instance ; objects xx
329 #:update-record-from-slot ; objects xx
330 #:update-record-from-slots ; objects xx
331 #:list-classes ; objects xx
332 #:delete-instance-records ; objects xx
333 ;;Symbolic SQL Syntax
335 #:sql-expression ; syntax xx
336 #:sql-operation ; syntax xx
337 #:sql-operator ; syntax xx
338 #:disable-sql-reader-syntax ; syntax xx
339 #:enable-sql-reader-syntax ; syntax xx
340 #:locally-disable-sql-reader-syntax ; syntax xx
341 #:locally-enable-sql-reader-syntax ; syntax xx
342 #:restore-sql-reader-syntax-state ; syntax xx
344 ;;------------------------------------------------
345 ;; Miscellaneous Extensions
346 ;;------------------------------------------------
348 #:*loaded-database-types* ; clsql-base xx
349 #:reload-database-types ; clsql-base xx
350 #:database-type ; database x
353 #:list-views ; table xx
354 #:view-exists-p ; table xx
355 #:list-indexes ; table xx
356 #:list-table-indexes ; table xx
357 #:index-exists-p ; table xx
358 #:create-sequence ; table xx
359 #:drop-sequence ; table xx
360 #:list-sequences ; table xx
361 #:sequence-exists-p ; table xx
362 #:sequence-next ; table xx
363 #:sequence-last ; table xx
364 #:set-sequence-position ; table xx
366 #:view-table ; metaclass x
367 #:create-sequence-from-class ; objects x
368 #:drop-sequence-from-class ; objects x
370 #:add-to-relation ; objects x
371 #:remove-from-relation ; objects x
372 #:read-sql-value ; objects x
373 #:database-output-sql-as-type ; objects x
374 #:database-get-type-specifier ; objects x
375 #:database-output-sql ; sql/class xx
377 ;;-----------------------------------------------
378 ;; Symbolic Sql Syntax
379 ;;-----------------------------------------------
421 (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
424 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
426 (setf *packages-for-warn-on-redefinition*
427 (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
431 (:import-from #:clsql-sys . #2#)
433 (:documentation "This is the SQL-Interface package of CLSQL."))
435 (defpackage #:clsql-user
437 (:import-from #:clsql-sys . #2#)
439 (:documentation "This is the user package with CLSQL symbols."))
441 ;; This is from USQL's pcl-patch
442 #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
444 ;; Note that this will no longer required for cmucl as of version 19a.
445 (in-package #+cmu :pcl #+sbcl :sb-pcl)
446 (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
448 `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
449 (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
450 slot-vars pv-parameters))
451 ,@(mapcar #'(lambda (slot-var) `(declare (ignorable ,slot-var))) slot-vars)
456 (if (find-package 'sb-mop)
457 (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
458 (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
461 (if (find-package 'mop)
462 (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
463 (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))