r10789: Automated commit for Debian build of clsql upstream-version-3.3.1
[clsql/s11.git] / sql / package.lisp
blobad785ecabba8260cea21d0591e2b2f65bde5abde
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name: package.lisp
6 ;;;; Purpose: Package definition for SQL interface
7 ;;;;
8 ;;;; $Id$
9 ;;;;
10 ;;;; This file is part of CLSQL.
11 ;;;;
12 ;;;; CLSQL users are granted the rights to distribute and use this software
13 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
14 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ;;;; *************************************************************************
17 (in-package #:cl-user)
19 ;;;; This file makes the required package definitions for CLSQL's
20 ;;;; core packages.
22 (eval-when (:compile-toplevel :load-toplevel :execute)
23 #+sbcl
24 (if (find-package 'sb-mop)
25 (pushnew :clsql-sbcl-mop cl:*features*)
26 (pushnew :clsql-sbcl-pcl cl:*features*))
28 #+cmu
29 (if (eq (symbol-package 'pcl:find-class)
30 (find-package 'common-lisp))
31 (pushnew :clsql-cmucl-mop cl:*features*)
32 (pushnew :clsql-cmucl-pcl cl:*features*)))
35 (eval-when (:compile-toplevel :load-toplevel :execute)
36 (defpackage #:clsql-sys
37 (:use #:common-lisp
38 #+clsql-sbcl-mop #:sb-mop
39 #+clsql-cmucl-mop #:mop
40 #+allegro #:mop
41 #+clisp #:clos
42 #+lispworks #:clos
43 #+scl #:clos
44 #+openmcl #:openmcl-mop)
46 #+allegro
47 (:shadowing-import-from
48 #:excl)
49 #+clisp
50 (:shadowing-import-from
51 #:clos)
52 #+lispworks
53 (:shadowing-import-from
54 #:clos)
55 #+clsql-sbcl-mop
56 (:shadowing-import-from
57 #:sb-pcl
58 #:generic-function-lambda-list)
59 #+clsql-sbcl-pcl
60 (:shadowing-import-from
61 #:sb-pcl
62 #:name
63 #:class-direct-slots
64 #:class-of #:class-name #:class-slots #:find-class
65 #:slot-boundp
66 #:standard-class
67 #:slot-definition-name #:finalize-inheritance
68 #:standard-direct-slot-definition
69 #:standard-effective-slot-definition #:validate-superclass
70 #:direct-slot-definition-class #:compute-effective-slot-definition
71 #:effective-slot-definition-class
72 #:slot-value-using-class
73 #:class-prototype #:generic-function-method-class #:intern-eql-specializer
74 #:make-method-lambda #:generic-function-lambda-list
75 #:class-precedence-list #:slot-definition-type
76 #:class-direct-superclasses
77 #:compute-class-precedence-list)
78 #+clsql-cmucl-mop
79 (:shadowing-import-from
80 #:pcl
81 #:generic-function-lambda-list)
82 #+clsql-cmucl-pcl
83 (:shadowing-import-from
84 #:pcl
85 #:class-direct-slots
86 #:name
87 #:class-of #:class-name #:class-slots #:find-class #:standard-class
88 #:slot-boundp
89 #:slot-definition-name #:finalize-inheritance
90 #:standard-direct-slot-definition #:standard-effective-slot-definition
91 #:validate-superclass #:direct-slot-definition-class
92 #:effective-slot-definition-class
93 #:compute-effective-slot-definition
94 #:slot-value-using-class
95 #:class-prototype #:generic-function-method-class #:intern-eql-specializer
96 #:make-method-lambda #:generic-function-lambda-list
97 #:class-precedence-list #:slot-definition-type
98 #:class-direct-superclasses
99 #:compute-class-precedence-list)
100 #+scl
101 (:shadowing-import-from
102 #:clos
103 #:class-prototype ;; note: make-method-lambda is not fbound
106 (:export
107 ;; "Private" exports for use by interface packages
108 #:check-connection-spec
109 #:database-initialize-database-type
110 #:database-type-load-foreign
111 #:database-connect
112 #:database-disconnect
113 #:database-reconnect
114 #:database-query
115 #:database-execute-command
116 #:database-create-sequence
117 #:database-drop-sequence
118 #:database-sequence-next
119 #:database-set-sequence-position
120 #:database-query-result-set
121 #:database-dump-result-set
122 #:database-store-next-row
123 #:database-list-tables
124 #:database-list-tables-and-sequences
125 #:database-table-exists-p
126 #:database-list-views
127 #:database-view-exists-p
128 #:database-list-indexes
129 #:database-list-table-indexes
130 #:database-index-exists-p
131 #:database-list-sequences
132 #:database-sequence-last
133 #:database-sequence-exists-p
134 #:database-list-attributes
135 #:database-attribute-type
136 #:database-type-library-loaded
137 #:database-create
138 #:database-destroy
139 #:database-probe
140 #:database-list
142 #:db-backend-has-create/destroy-db?
143 #:db-type-has-views?
144 #:db-type-has-bigint?
145 #:db-type-has-union?
146 #:db-type-has-prepared-stmt?
147 #:db-type-has-subqueries?
148 #:db-type-has-boolean-where?
149 #:db-type-transaction-capable?
150 #:db-type-has-fancy-math?
151 #:db-type-default-case
152 #:db-type-use-column-on-drop-index?
153 #:database-underlying-type
154 #:database-get-type-specifier
155 #:read-sql-value
156 #:database-output-sql-as-type
157 #:*loaded-database-types*
158 #:reload-database-types
159 #:is-database-open
161 ;; Large objects
162 #:database-create-large-object
163 #:database-write-large-object
164 #:database-read-large-object
165 #:database-delete-large-object
166 #:create-large-object
167 #:write-large-object
168 #:read-large-object
169 #:delete-large-object
171 ;; Prepared statments
172 #:database-prepare
173 #:database-run-prepared
174 #:database-bind-parameter
175 #:database-free-prepared
177 ;; accessors for database class
178 #:name
179 #:connection-spec
180 #:transaction
181 #:transaction-level
182 #:conn-pool
183 #:command-recording-stream
184 #:result-recording-stream
185 #:record-caches
186 #:view-classes
187 #:database-state
188 #:attribute-cache
189 #:database-autocommit
191 ;; utils.lisp
192 #:without-interrupts
193 #:make-process-lock
194 #:with-process-lock
195 #:command-output
196 #:symbol-name-default-case
197 #:convert-to-db-default-case
198 #:ensure-keyword
199 #:getenv
200 #:number-to-sql-string
201 #:float-to-sql-string
202 #:sql-escape-quotes
203 #:sql-escape
204 #:in
206 ;; Generic backends
207 #:generic-postgresql-database
208 #:generic-odbc-database
210 ;; Subclasses of sql-expresssion (expressions.lisp)
211 #:sql-function-exp
212 #:sql-value-exp
213 #:sql-set-exp
214 #:sql-query-modifier-exp
215 #:sql-relational-exp
216 #:sql-upcase-like
217 #:sql-assignment-exp
218 #:sql-typecast-exp
219 #:sql-between-exp
220 #:sql-ident
221 #:sql-ident-attribute
222 #:sql-ident-table
226 ;; Shared exports for re-export by CLSQL package.
227 #1=(
229 ;; foreign library loading
230 #:*foreign-library-search-paths*
231 #:push-library-path
233 ;; Condition system (conditions.lisp)
234 #:sql-user-error
235 #:sql-database-error
236 #:sql-database-data-error
237 #:sql-connection-error
238 #:sql-temporary-error
239 #:sql-timeout-error
240 #:sql-fatal-error
241 #:sql-error-error-id
242 #:sql-error-secondary-error-id
243 #:sql-error-database-message
244 ;; CLSQL Extensions
245 #:sql-condition
246 #:sql-error
247 #:sql-warning
248 #:sql-database-warning
249 #:sql-error-database
250 #:sql-error-database-type
251 #:sql-error-connection-spec
252 #:sql-error-expression
253 #:sql-warning-database
254 #:sql-user-error-message
255 #:*backend-warning-behavior*
257 ;; Connection/initialisation (base-classes.lisp, database.lisp,
258 ;; initialize.lisp)
259 #:*default-database-type*
260 #:*default-database*
261 #:*initialized-database-types*
262 #:initialize-database-type
263 #:connect
264 #:disconnect
265 #:*connect-if-exists*
266 #:connected-databases
267 #:database
268 #:database-name
269 #:reconnect
270 #:find-database
271 #:status
272 ;; CLSQL Extensions
273 #:database-name-from-spec
274 #:database-type
275 #:with-database
276 #:with-default-database
277 #:disconnect-pooled
278 #:list-databases
279 #:create-database
280 #:destroy-database
281 #:probe-database
283 ;; I/O Recording (recording.lisp)
284 #:add-sql-stream
285 #:delete-sql-stream
286 #:list-sql-streams
287 #:sql-recording-p
288 #:sql-stream
289 #:start-sql-recording
290 #:stop-sql-recording
292 ;; FDDL (fddl.lisp)
293 #:create-table
294 #:drop-table
295 #:list-tables
296 #:table-exists-p
297 #:list-attributes
298 #:attribute-type
299 #:list-attribute-types
300 #:create-view
301 #:drop-view
302 #:create-index
303 #:drop-index
304 ;; CLSQL Extensions
305 #:truncate-database
306 #:list-views
307 #:view-exists-p
308 #:list-indexes
309 #:index-exists-p
310 #:create-sequence
311 #:drop-sequence
312 #:list-sequences
313 #:sequence-exists-p
314 #:sequence-next
315 #:sequence-last
316 #:set-sequence-position
318 ;; FDML (fdml.lisp)
319 #:select
320 #:cache-table-queries
321 #:*cache-table-queries-default*
322 #:delete-records
323 #:insert-records
324 #:update-records
325 #:execute-command
326 #:query
327 #:print-query
328 #:do-query
329 #:map-query
330 #:loop
331 ;; CLSQL Extensions
332 #:prepare-sql
333 #:bind-parameter
334 #:run-prepared-sql
335 #:free-prepared-sql
337 ;; Transaction handling (transaction.lisp)
338 #:with-transaction
339 #:commit
340 #:rollback
341 ;; CLSQL Extensions
342 #:add-transaction-commit-hook
343 #:add-transaction-rollback-hook
344 #:start-transaction
345 #:in-transaction-p
346 #:set-autocommit
348 ;; OODDL (ooddl.lisp)
349 #:standard-db-object
350 #:def-view-class
351 #:create-view-from-class
352 #:drop-view-from-class
353 #:list-classes
354 #:universal-time
355 ;; CLSQL Extensions
356 #:view-table
357 #:bigint
358 #:varchar
359 #:generalized-boolean
360 #:mediumint
361 #:smallint
362 #:tinyint
363 #:*default-string-length*
365 ;; OODML (oodml.lisp)
366 #:instance-refreshed
367 #:update-objects-joins
368 #:*default-update-objects-max-len*
369 #:*default-caching*
370 #:update-slot-from-record
371 #:update-instance-from-records
372 #:update-records-from-instance
373 #:update-record-from-slot
374 #:update-record-from-slots
375 #:delete-instance-records
376 ;; CLSQL Extensions
377 #:*db-auto-sync*
378 #:write-instance-to-stream
379 #:read-instance-from-stream
381 ;; Symbolic SQL Syntax (syntax.lisp)
382 #:sql
383 #:sql-expression
384 #:sql-operation
385 #:sql-operator
386 #:disable-sql-reader-syntax
387 #:enable-sql-reader-syntax
388 #:locally-disable-sql-reader-syntax
389 #:locally-enable-sql-reader-syntax
390 #:restore-sql-reader-syntax-state
392 ;; SQL operations (operations.lisp)
393 #:sql-query
394 #:sql-object-query
395 #:sql-any
396 #:sql-some
397 #:sql-all
398 #:sql-not
399 #:sql-union
400 #:sql-intersect
401 #:sql-minus
402 #:sql-except
403 #:sql-order-by
404 #:sql-null
405 #:sql-*
406 #:sql-+
407 #:sql-/
408 #:sql--
409 #:sql-like
410 #:sql-and
411 #:sql-or
412 #:sql-in
413 #:sql-substr
414 #:sql-concat-op
415 #:sql-=
416 #:sql-<
417 #:sql->
418 #:sql->=
419 #:sql-<=
420 #:sql-<>
421 #:sql-count
422 #:sql-max
423 #:sql-min
424 #:sql-avg
425 #:sql-sum
426 #:sql-function
427 #:sql-between
428 #:sql-distinct
429 #:sql-nvl
430 #:sql-slot-value
431 #:sql-userenv
432 ;; CLSQL Extensions
433 #:sql-concat
434 #:sql-substring
435 #:sql-limit
436 #:sql-group-by
437 #:sql-having
438 #:sql-not-null
439 #:sql-exists
440 #:sql-uplike
441 #:sql-is
442 #:sql-==
443 #:sql-the
444 #:sql-coalesce
445 #:sql-view-class
447 ;; Time handling (time.lisp)
448 #:bad-component
449 #:current-day
450 #:current-month
451 #:current-year
452 #:day-duration
453 #:db-timestring
454 #:db-datestring
455 #:decode-duration
456 #:decode-time
457 #:decode-date
458 #:duration
459 #:duration+
460 #:duration<
461 #:duration<=
462 #:duration=
463 #:duration>
464 #:duration>=
465 #:duration-day
466 #:duration-hour
467 #:duration-minute
468 #:duration-month
469 #:duration-second
470 #:duration-year
471 #:duration-reduce
472 #:duration-timestring
473 #:extract-roman
474 #:format-duration
475 #:format-time
476 #:format-date
477 #:get-time
478 #:get-date
479 #:utime->time
480 #:interval-clear
481 #:interval-contained
482 #:interval-data
483 #:interval-edit
484 #:interval-end
485 #:interval-match
486 #:interval-push
487 #:interval-relation
488 #:interval-start
489 #:interval-type
490 #:make-duration
491 #:make-interval
492 #:make-time
493 #:make-date
494 #:merged-time
495 #:midnight
496 #:month-name
497 #:parse-date-time
498 #:parse-timestring
499 #:parse-datestring
500 #:parse-yearstring
501 #:print-date
502 #:roll
503 #:roll-to
504 #:time
505 #:time+
506 #:time-
507 #:time-by-adding-duration
508 #:time-compare
509 #:time-difference
510 #:time-dow
511 #:time-element
512 #:time-max
513 #:time-min
514 #:time-mjd
515 #:time-msec
516 #:time-p
517 #:time-sec
518 #:time-well-formed
519 #:time-ymd
520 #:time<
521 #:time<=
522 #:time=
523 #:time>
524 #:time>=
525 #:date
526 #:date+
527 #:date-
528 #:date-difference
529 #:date-compare
530 #:date-dow
531 #:date-element
532 #:date-max
533 #:date-min
534 #:date-mjd
535 #:date-p
536 #:date-ymd
537 #:date<
538 #:date<=
539 #:date=
540 #:date>
541 #:date>=
542 #:timezone
543 #:universal-time
544 #:wall-time
545 #:wall-timestring
546 #:week-containing
547 #:gregorian-to-mjd
548 #:mjd-to-gregorian
550 (:documentation "This is the INTERNAL SQL-Interface package of CLSQL."))
553 (defpackage #:clsql
554 (:use #:common-lisp)
555 (:import-from #:clsql-sys . #1#)
556 (:export . #1#)
557 (:documentation "This is the user package with CLSQL symbols."))
559 (defpackage #:clsql-user
560 (:use #:common-lisp)
561 (:import-from #:clsql-sys . #1#)
562 (:export . #1#)
563 (:documentation "This is the user package with CLSQL symbols."))
565 ;; This is from USQL's pcl-patch
566 #+(or clsql-sbcl-pcl clsql-cmucl-pcl)
567 (progn
568 ;; Note that this will no longer required for cmucl as of version 19a.
569 (in-package #+cmu :pcl #+sbcl :sb-pcl)
570 (defmacro pv-binding1 ((pv calls pv-table-symbol pv-parameters slot-vars)
571 &body body)
572 `(pv-env (,pv ,calls ,pv-table-symbol ,pv-parameters)
573 (let (,@(mapcar #'(lambda (slot-var p) `(,slot-var (get-slots-or-nil ,p)))
574 slot-vars pv-parameters))
575 ,@(mapcar #'(lambda (slot-var) `(declare (ignorable ,slot-var))) slot-vars)
576 ,@body))))
578 ;; see http://thread.gmane.org/gmane.lisp.lispworks.general/681
579 #+lispworks
580 (setf *packages-for-warn-on-redefinition*
581 (delete "SQL" *packages-for-warn-on-redefinition* :test 'string=))
583 #+sbcl
584 (if (find-package 'sb-mop)
585 (setq cl:*features* (delete :clsql-sbcl-mop cl:*features*))
586 (setq cl:*features* (delete :clsql-sbcl-pcl cl:*features*)))
588 #+cmu
589 (if (find-package 'mop)
590 (setq cl:*features* (delete :clsql-cmucl-mop cl:*features*))
591 (setq cl:*features* (delete :clsql-cmucl-pcl cl:*features*)))
593 ) ;eval-when