The cl-dbi Reference Manual

This is the cl-dbi Reference Manual, version 0.9.5, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:08:19 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-dbi

Author

Eitaro Fukamachi

License

LLGPL

Version

0.9.5

Dependency

dbi (system).

Source

cl-dbi.asd.


2.2 dbi

Database independent interface for Common Lisp

Author

Eitaro Fukamachi

License

LLGPL

Version

0.9.5

Dependencies
  • split-sequence (system).
  • closer-mop (system).
  • bordeaux-threads (system)., for feature (:or :abcl (:and :allegro :multiprocessing) (:and :clasp :threads) (:and :clisp :mt) (:and :ccl :openmcl-native-threads) (:and :cmu :mp) :corman (:and :ecl :threads) :mkcl :lispworks (:and :sbcl :sb-thread) :scl)
Source

dbi.asd.

Child Components

3 Modules

Modules are listed depth-first from the system components tree.


3.1 dbi/src

Dependency

src/utils.lisp (file).

Source

dbi.asd.

Parent Component

dbi (system).

Child Components

3.2 dbi/src/cache

Source

dbi.asd.

Parent Component

src (module).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 cl-dbi/cl-dbi.asd

Source

cl-dbi.asd.

Parent Component

cl-dbi (system).

ASDF Systems

cl-dbi.


4.1.2 dbi/dbi.asd

Source

dbi.asd.

Parent Component

dbi (system).

ASDF Systems

dbi.


4.1.3 dbi/src/dbi.lisp

Dependencies
Source

dbi.asd.

Parent Component

src (module).

Packages

dbi.

Public Interface
Internals

4.1.4 dbi/src/driver.lisp

Dependency

error.lisp (file).

Source

dbi.asd.

Parent Component

src (module).

Packages

dbi.driver.

Public Interface
Internals

4.1.5 dbi/src/cache/thread.lisp

If Feature

(:or :abcl (:and :allegro :multiprocessing) (:and :clasp :threads) (:and :clisp :mt) (:and :ccl :openmcl-native-threads) (:and :cmu :mp) :corman (:and :ecl :threads) :mkcl :lispworks (:and :sbcl :sb-thread) :scl)

Source

dbi.asd.

Parent Component

cache (module).

Packages

dbi.cache.thread.

Public Interface
Internals

4.1.6 dbi/src/cache/single.lisp

If Feature

(:not (:or :abcl (:and :allegro :multiprocessing) (:and :clasp :threads) (:and :clisp :mt) (:and :ccl :openmcl-native-threads) (:and :cmu :mp) :corman (:and :ecl :threads) :mkcl :lispworks (:and :sbcl :sb-thread) :scl))

Source

dbi.asd.

Parent Component

cache (module).


4.1.7 dbi/src/logger.lisp

Source

dbi.asd.

Parent Component

src (module).

Packages

dbi.logger.

Public Interface

4.1.8 dbi/src/error.lisp

Source

dbi.asd.

Parent Component

src (module).

Packages

dbi.error.

Public Interface

4.1.9 dbi/src/utils.lisp

Source

dbi.asd.

Parent Component

dbi (system).

Packages

dbi.utils.

Public Interface

5 Packages

Packages are listed by definition order.


5.1 dbi

Source

dbi.lisp.

Nickname

cl-dbi

Use List
Public Interface
Internals

5.2 dbi.utils

Source

src/utils.lisp.

Use List

common-lisp.

Used By List
Public Interface

5.3 dbi.cache.thread

Source

thread.lisp.

Nickname

dbi.cache

Use List

common-lisp.

Used By List

dbi.

Public Interface
Internals

5.4 dbi.driver

Source

driver.lisp.

Use List
Public Interface
Internals

5.5 dbi.error

Source

error.lisp.

Use List
Used By List

dbi.

Public Interface

5.6 dbi.logger

Source

logger.lisp.

Use List

common-lisp.

Public Interface

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Special variables

Special Variable: *sql-execution-hooks*
Package

dbi.logger.

Source

logger.lisp.


6.1.2 Macros

Macro: defclass/a (name superclasses slots &rest class-options)
Package

dbi.utils.

Source

src/utils.lisp.

Macro: define-condition/a (name parent-types slots &body options)
Package

dbi.utils.

Source

src/utils.lisp.

Macro: with-connection ((conn-sym &rest rest) &body body)
Package

dbi.

Source

dbi.lisp.

Macro: with-savepoint (conn &body body)
Package

dbi.driver.

Source

driver.lisp.

Macro: with-took-usec (var &body body)
Package

dbi.logger.

Source

logger.lisp.

Macro: with-transaction (conn &body body)

Start a transaction and commit at the end of this block. If the evaluation ‘body‘ is interrupted, the transaction is rolled back automatically.

Package

dbi.driver.

Source

driver.lisp.


6.1.3 Ordinary functions

Function: cleanup-cache-pool (pool)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: connect (driver-name &rest params &key database-name &allow-other-keys)

Open a connection to the database which corresponds to ‘driver-name‘.

Package

dbi.

Source

dbi.lisp.

Function: connect-cached (&rest connect-args)
Package

dbi.

Source

dbi.lisp.

Function: find-driver (driver-name)

Find a driver class named as ‘driver-name‘.
‘driver-name‘ is a string designer.
Driver should be named like ’DBD-SOMETHING’ for a database ’something’.

Package

dbi.driver.

Source

driver.lisp.

Function: get-object (pool key)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: (setf get-object) (pool key)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: in-transaction (conn)

Returns True if called inside a transaction block.

Package

dbi.driver.

Source

driver.lisp.

Function: list-all-drivers ()

Return a list of direct subclasses for ‘dbi-driver‘.

Package

dbi.driver.

Source

driver.lisp.

Function: make-cache-pool (&key hash lock cleanup-fn)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: prepare-cached (conn sql &key query-class)

Same as PREPARE except reusing the created query object.

Package

dbi.driver.

Source

driver.lisp.

Function: simple-sql-logger (sql params row-count took-usec)
Package

dbi.logger.

Source

logger.lisp.

Function: sql-log (sql params row-count took-usec)
Package

dbi.logger.

Source

logger.lisp.

Function: steal-cache-table (pool &optional thread)
Package

dbi.cache.thread.

Source

thread.lisp.


6.1.4 Generic functions

Generic Function: begin-transaction (conn)

Start a transaction.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: begin-transaction :around ((conn <dbi-connection>))

Turn ‘auto-commit‘ off automatically before starting a transaction.

Method: begin-transaction ((conn <dbi-connection>))
Generic Function: commit (conn)

Commit changes and end the current transaction.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: commit ((conn <dbi-connection>))
Method: commit :around ((conn <dbi-connection>))
Generic Reader: connection-database-name (object)
Package

dbi.driver.

Methods
Reader Method: connection-database-name ((dbi-connection <dbi-connection>))

automatically generated reader method

Source

driver.lisp.

Target Slot

database-name.

Generic Writer: (setf connection-database-name) (object)
Package

dbi.driver.

Methods
Writer Method: (setf connection-database-name) ((dbi-connection <dbi-connection>))

automatically generated writer method

Source

driver.lisp.

Target Slot

database-name.

Generic Function: connection-driver-type (conn)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: connection-driver-type ((conn <dbi-connection>))
Generic Reader: connection-established-at (object)
Package

dbi.driver.

Methods
Reader Method: connection-established-at ((dbi-connection <dbi-connection>))

automatically generated reader method

Source

driver.lisp.

Target Slot

established-at.

Generic Writer: (setf connection-established-at) (object)
Package

dbi.driver.

Methods
Writer Method: (setf connection-established-at) ((dbi-connection <dbi-connection>))

automatically generated writer method

Source

driver.lisp.

Target Slot

established-at.

Generic Reader: connection-handle (object)
Package

dbi.driver.

Methods
Reader Method: connection-handle ((dbi-connection <dbi-connection>))

automatically generated reader method

Source

driver.lisp.

Target Slot

%handle.

Generic Writer: (setf connection-handle) (object)
Package

dbi.driver.

Methods
Writer Method: (setf connection-handle) ((dbi-connection <dbi-connection>))

automatically generated writer method

Source

driver.lisp.

Target Slot

%handle.

Generic Reader: database-error-code (condition)
Package

dbi.error.

Methods
Reader Method: database-error-code ((condition <dbi-database-error>))
Source

error.lisp.

Target Slot

error-code.

Generic Reader: database-error-message (condition)
Package

dbi.error.

Methods
Reader Method: database-error-message ((condition <dbi-database-error>))
Source

error.lisp.

Target Slot

message.

Generic Function: disconnect (conn)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: disconnect ((conn <dbi-connection>))
Method: disconnect :after ((conn <dbi-connection>))
Generic Function: do-sql (conn sql &optional params)

Do preparation and execution at once. This method may be overrided by subclasses.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: do-sql ((conn <dbi-connection>) (sql string) &optional params)
Method: do-sql :around ((conn <dbi-connection>) sql &optional params)
Generic Function: escape-sql (conn sql)

Return escaped ‘sql‘.
This method may be overrided by subclasses when needed.
For example, in case of MySQL and PostgreSQL, backslashes must be escaped by doubling it.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: escape-sql ((conn <dbi-connection>) (sql string))
Generic Function: execute (query &optional params)

Execute ‘query‘ with ‘params‘ and return the results.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: execute ((query <dbi-query>) &optional params)
Generic Function: execute-using-connection (conn query params)

Execute ‘query‘ in ‘conn‘.
This method must be implemented in each drivers.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: execute-using-connection ((conn <dbi-connection>) (query <dbi-query>) params)
Generic Function: fetch (query)

Fetch the first row from ‘query‘ which is returned by ‘execute‘.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: fetch ((query <dbi-query>))
Generic Function: fetch-all (query)

Fetch all rest rows from ‘query‘.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: fetch-all ((query <dbi-query>))
Generic Function: fetch-using-connection (conn query)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: fetch-using-connection ((conn <dbi-connection>) (query <dbi-query>))
Generic Function: free-query-resources (query)

Free the resources (e.g. foreign, heap allocated memory)
associated with this query. The default method currently has empty body.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: free-query-resources (query)
Method: free-query-resources :after (query)
Generic Function: make-connection (driver &key)

Create a instance of ‘dbi-connection‘ for the ‘driver‘. This method must be implemented in each drivers.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: make-connection ((driver dbi-driver) &key)
Generic Function: ping (conn)

Check if the database server is still running and the connection to it is still working.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: ping ((conn <dbi-connection>))
Generic Function: prepare (conn sql &key query-class)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: prepare ((conn <dbi-connection>) (sql string) &key query-class)

Preparing executing SQL statement and returns a instance of ‘dbi-query‘. This method may be overrided by subclasses.

Generic Reader: query-cached-p (object)
Package

dbi.driver.

Methods
Reader Method: query-cached-p ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

cached.

Generic Writer: (setf query-cached-p) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-cached-p) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

cached.

Generic Reader: query-connection (object)
Package

dbi.driver.

Methods
Reader Method: query-connection ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

connection.

Generic Writer: (setf query-connection) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-connection) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

connection.

Generic Reader: query-prepared (object)
Package

dbi.driver.

Methods
Reader Method: query-prepared ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

prepared.

Generic Writer: (setf query-prepared) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-prepared) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

prepared.

Generic Reader: query-results (object)
Package

dbi.driver.

Methods
Reader Method: query-results ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

results.

Generic Writer: (setf query-results) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-results) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

results.

Generic Reader: query-row-count (object)
Package

dbi.driver.

Methods
Reader Method: query-row-count ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

row-count.

Generic Writer: (setf query-row-count) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-row-count) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

row-count.

Generic Reader: query-sql (object)
Package

dbi.driver.

Methods
Reader Method: query-sql ((dbi-query <dbi-query>))

automatically generated reader method

Source

driver.lisp.

Target Slot

sql.

Generic Writer: (setf query-sql) (object)
Package

dbi.driver.

Methods
Writer Method: (setf query-sql) ((dbi-query <dbi-query>))

automatically generated writer method

Source

driver.lisp.

Target Slot

sql.

Generic Function: release-savepoint (conn &optional identifier)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: release-savepoint ((conn <dbi-connection>) &optional identifier)
Method: release-savepoint :around ((conn <dbi-connection>) &optional identifier)
Generic Function: rollback (conn)

Rollback all changes and end the current transaction.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: rollback ((conn <dbi-connection>))
Method: rollback :around ((conn <dbi-connection>))
Generic Function: rollback-savepoint (conn &optional identifier)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: rollback-savepoint ((conn <dbi-connection>) &optional identifier)
Method: rollback-savepoint :around ((conn <dbi-connection>) &optional identifier)
Generic Function: row-count (conn)

Return the number of counts modified by the last executed INSERT/UPDATE/DELETE query.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: row-count ((conn <dbi-connection>))
Generic Function: savepoint (conn identifier)
Package

dbi.driver.

Source

driver.lisp.

Methods
Method: savepoint ((conn <dbi-connection>) identifier)

6.1.5 Conditions

Condition: <dbi-already-commited-error>

This exception occur when there is a programming error and you are trying to commit a transaction twice.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Condition: <dbi-already-rolled-back-error>

This exception occur when there is a programming error and you are trying to rollback a transaction twice.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Condition: <dbi-data-error>

Exception for errors due to problems with the processed
data such as division for zero, numeric value out of range, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: <dbi-database-error>

Exception for errors related to the database.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Direct subclasses
Direct methods
Direct slots
Slot: message
Initargs

:message

Readers

database-error-message.

Writers

This slot is read-only.

Slot: error-code
Initargs

:error-code

Readers

database-error-code.

Writers

This slot is read-only.

Condition: <dbi-error>

Base class of all other error exceptions. Use this to catch all DBI errors.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: <dbi-integrity-error>

Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: <dbi-interface-error>

Exception for errors related to the DBI interface rather than the database itself.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Direct subclasses

<dbi-unimplemented-error>.

Condition: <dbi-internal-error>

Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: <dbi-notsupported-error>

Exception raised if e.g. commit() is called for a database which do not support transactions.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Direct slots
Slot: method-name
Initargs

:method-name

Condition: <dbi-operational-error>

Exception for errors related to the database’s operation which are not necessarily under the control of the programmer. This includes such things as unexpected disconnect, datasource name not found, transaction could not be processed, a memory allocation error occured during processing, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: <dbi-programming-error>

Exception raised for programming errors, e.g. table not found or already exists, syntax error in SQL statement, wrong number of parameters specified, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: <dbi-unimplemented-error>

Exception raised if the DBD driver has not specified a mandatory method.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-interface-error>.

Direct slots
Slot: method-name
Initargs

:method-name

Condition: <dbi-warning>

For important warnings like data truncation, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

simple-warning.

Condition: dbi-already-commited-error

This exception occur when there is a programming error and you are trying to commit a transaction twice.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Condition: dbi-already-rolled-back-error

This exception occur when there is a programming error and you are trying to rollback a transaction twice.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Condition: dbi-data-error

Exception for errors due to problems with the processed
data such as division for zero, numeric value out of range, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: dbi-database-error

Exception for errors related to the database.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Direct subclasses
Direct methods
Direct slots
Slot: message
Initargs

:message

Readers

database-error-message.

Writers

This slot is read-only.

Slot: error-code
Initargs

:error-code

Readers

database-error-code.

Writers

This slot is read-only.

Condition: dbi-error

Base class of all other error exceptions. Use this to catch all DBI errors.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: dbi-integrity-error

Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: dbi-interface-error

Exception for errors related to the DBI interface rather than the database itself.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

dbi-error.

Direct subclasses

<dbi-unimplemented-error>.

Condition: dbi-internal-error

Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: dbi-notsupported-error

Exception raised if e.g. commit() is called for a database which do not support transactions.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Direct slots
Slot: method-name
Initargs

:method-name

Condition: dbi-operational-error

Exception for errors related to the database’s operation which are not necessarily under the control of the programmer. This includes such things as unexpected disconnect, datasource name not found, transaction could not be processed, a memory allocation error occured during processing, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: dbi-programming-error

Exception raised for programming errors, e.g. table not found or already exists, syntax error in SQL statement, wrong number of parameters specified, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-database-error>.

Condition: dbi-unimplemented-error

Exception raised if the DBD driver has not specified a mandatory method.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

<dbi-interface-error>.

Direct slots
Slot: method-name
Initargs

:method-name

Condition: dbi-warning

For important warnings like data truncation, etc.

Package

dbi.error.

Source

error.lisp.

Direct superclasses

simple-warning.


6.1.6 Classes

Class: <dbi-connection>

Base class for managing DB connection.

Package

dbi.driver.

Source

driver.lisp.

Direct methods
Direct slots
Slot: auto-commit
Type

boolean

Initform

t

Initargs

:auto-commit

Slot: database-name
Initargs

:database-name

Readers

connection-database-name.

Writers

(setf connection-database-name).

Slot: %handle
Initargs

:handle

Readers

connection-handle.

Writers

(setf connection-handle).

Slot: query-cache
Initform

(make-hash-table :test (quote equal))

Readers

connection-query-cache.

Writers

(setf connection-query-cache).

Slot: established-at
Initform

(get-internal-real-time)

Initargs

:established-at

Readers

connection-established-at.

Writers

(setf connection-established-at).

Class: <dbi-driver>

Base class for DB driver.

Package

dbi.driver.

Source

driver.lisp.

Direct methods

make-connection.

Class: <dbi-query>

Class that represents a prepared DB query.

Package

dbi.driver.

Source

driver.lisp.

Direct methods
Direct slots
Slot: connection
Type

dbi.driver:dbi-connection

Initargs

:connection

Readers

query-connection.

Writers

(setf query-connection).

Slot: sql
Type

string

Initargs

:sql

Readers

query-sql.

Writers

(setf query-sql).

Slot: prepared
Initargs

:prepared

Readers

query-prepared.

Writers

(setf query-prepared).

Slot: results
Initargs

:results

Readers

query-results.

Writers

(setf query-results).

Slot: row-count
Type

(or integer null)

Initargs

:row-count

Readers

query-row-count.

Writers

(setf query-row-count).

Slot: cached
Initargs

:cached

Readers

query-cached-p.

Writers

(setf query-cached-p).

Class: dbi-connection

Base class for managing DB connection.

Package

dbi.driver.

Source

driver.lisp.

Direct methods
Direct slots
Slot: auto-commit
Type

boolean

Initform

t

Initargs

:auto-commit

Slot: database-name
Initargs

:database-name

Readers

connection-database-name.

Writers

(setf connection-database-name).

Slot: %handle
Initargs

:handle

Readers

connection-handle.

Writers

(setf connection-handle).

Slot: query-cache
Initform

(make-hash-table :test (quote equal))

Readers

connection-query-cache.

Writers

(setf connection-query-cache).

Slot: established-at
Initform

(get-internal-real-time)

Initargs

:established-at

Readers

connection-established-at.

Writers

(setf connection-established-at).

Class: dbi-driver

Base class for DB driver.

Package

dbi.driver.

Source

driver.lisp.

Direct methods

make-connection.

Class: dbi-query

Class that represents a prepared DB query.

Package

dbi.driver.

Source

driver.lisp.

Direct methods
Direct slots
Slot: connection
Type

dbi.driver:dbi-connection

Initargs

:connection

Readers

query-connection.

Writers

(setf query-connection).

Slot: sql
Type

string

Initargs

:sql

Readers

query-sql.

Writers

(setf query-sql).

Slot: prepared
Initargs

:prepared

Readers

query-prepared.

Writers

(setf query-prepared).

Slot: results
Initargs

:results

Readers

query-results.

Writers

(setf query-results).

Slot: row-count
Type

(or integer null)

Initargs

:row-count

Readers

query-row-count.

Writers

(setf query-row-count).

Slot: cached
Initargs

:cached

Readers

query-cached-p.

Writers

(setf query-cached-p).


6.2 Internals


6.2.1 Special variables

Special Variable: *connection-cache-seconds*
Package

dbi.

Source

dbi.lisp.

Special Variable: *threads-connection-pool*
Package

dbi.

Source

dbi.lisp.

Special Variable: *transaction-state*

A stack of transaction and savepoint states.

Package

dbi.driver.

Source

driver.lisp.


6.2.2 Macros

Macro: %with-transaction (conn &body body)
Package

dbi.driver.

Source

driver.lisp.

Macro: finalize-savepoint (new-state &body body)
Package

dbi.driver.

Source

driver.lisp.

Macro: with-autoload-on-missing (&body body)
Package

dbi.

Source

dbi.lisp.


6.2.3 Ordinary functions

Function: assert-transaction-is-in-progress (transaction-state)
Package

dbi.driver.

Source

driver.lisp.

Reader: cache-pool-cleanup-fn (instance)
Writer: (setf cache-pool-cleanup-fn) (instance)
Package

dbi.cache.thread.

Source

thread.lisp.

Target Slot

cleanup-fn.

Reader: cache-pool-hash (instance)
Writer: (setf cache-pool-hash) (instance)
Package

dbi.cache.thread.

Source

thread.lisp.

Target Slot

hash.

Reader: cache-pool-lock (instance)
Writer: (setf cache-pool-lock) (instance)
Package

dbi.cache.thread.

Source

thread.lisp.

Target Slot

lock.

Function: cache-pool-p (object)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: copy-cache-pool (instance)
Package

dbi.cache.thread.

Source

thread.lisp.

Function: generate-random-savepoint ()
Package

dbi.driver.

Source

driver.lisp.

Function: get-transaction-state (conn)

Returns an object representing transaction’s state
if called inside a transaction block or nil otherwise.

Package

dbi.driver.

Source

driver.lisp.

Function: load-driver (driver-name)
Package

dbi.

Source

dbi.lisp.

Function: make-cache-table (&optional test-fn)
Package

dbi.cache.thread.

Source

thread.lisp.


6.2.4 Generic functions

Generic Reader: connection-query-cache (object)
Package

dbi.driver.

Methods
Reader Method: connection-query-cache ((dbi-connection <dbi-connection>))

automatically generated reader method

Source

driver.lisp.

Target Slot

query-cache.

Generic Writer: (setf connection-query-cache) (object)
Package

dbi.driver.

Methods
Writer Method: (setf connection-query-cache) ((dbi-connection <dbi-connection>))

automatically generated writer method

Source

driver.lisp.

Target Slot

query-cache.

Generic Reader: get-conn (object)
Package

dbi.driver.

Methods
Reader Method: get-conn ((transaction-state transaction-state))

automatically generated reader method

Source

driver.lisp.

Target Slot

conn.

Generic Reader: get-identifier (object)
Package

dbi.driver.

Methods
Reader Method: get-identifier ((savepoint-state savepoint-state))

automatically generated reader method

Source

driver.lisp.

Target Slot

identifier.

Generic Reader: get-state (object)
Package

dbi.driver.

Methods
Reader Method: get-state ((transaction-state transaction-state))

automatically generated reader method

Source

driver.lisp.

Target Slot

state.

Generic Writer: (setf get-state) (object)
Package

dbi.driver.

Methods
Writer Method: (setf get-state) ((transaction-state transaction-state))

automatically generated writer method

Source

driver.lisp.

Target Slot

state.

Generic Function: prepare-sql (conn sql)

Create a function that takes parameters, binds them into a query and returns SQL as a string.

Package

dbi.driver.

Source

driver.lisp.

Methods
Method: prepare-sql ((conn <dbi-connection>) (sql string))

6.2.5 Conditions

Condition: transaction-done-condition
Package

dbi.driver.

Source

driver.lisp.

Direct superclasses

condition.


6.2.6 Structures

Structure: cache-pool
Package

dbi.cache.thread.

Source

thread.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: hash
Initform

(make-hash-table :test (quote eq))

Readers

cache-pool-hash.

Writers

(setf cache-pool-hash).

Slot: lock
Initform

(bordeaux-threads-2:make-lock :name "cache-pool-lock")

Readers

cache-pool-lock.

Writers

(setf cache-pool-lock).

Slot: cleanup-fn
Readers

cache-pool-cleanup-fn.

Writers

(setf cache-pool-cleanup-fn).


6.2.7 Classes

Class: savepoint-state
Package

dbi.driver.

Source

driver.lisp.

Direct superclasses

transaction-state.

Direct methods

get-identifier.

Direct slots
Slot: identifier
Type

string

Initform

(dbi.driver::generate-random-savepoint)

Readers

get-identifier.

Writers

This slot is read-only.

Class: transaction-state
Package

dbi.driver.

Source

driver.lisp.

Direct subclasses

savepoint-state.

Direct methods
Direct slots
Slot: conn
Type

dbi.driver:dbi-connection

Initargs

:conn

Readers

get-conn.

Writers

This slot is read-only.

Slot: state
Type

(member :in-progress :commited :rolled-back)

Initform

:in-progress

Readers

get-state.

Writers

(setf get-state).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   B   C   D   E   F   G   I   L   M   P   Q   R   S   W  
Index Entry  Section

%
%with-transaction: Private macros

(
(setf cache-pool-cleanup-fn): Private ordinary functions
(setf cache-pool-hash): Private ordinary functions
(setf cache-pool-lock): Private ordinary functions
(setf connection-database-name): Public generic functions
(setf connection-database-name): Public generic functions
(setf connection-established-at): Public generic functions
(setf connection-established-at): Public generic functions
(setf connection-handle): Public generic functions
(setf connection-handle): Public generic functions
(setf connection-query-cache): Private generic functions
(setf connection-query-cache): Private generic functions
(setf get-object): Public ordinary functions
(setf get-state): Private generic functions
(setf get-state): Private generic functions
(setf query-cached-p): Public generic functions
(setf query-cached-p): Public generic functions
(setf query-connection): Public generic functions
(setf query-connection): Public generic functions
(setf query-prepared): Public generic functions
(setf query-prepared): Public generic functions
(setf query-results): Public generic functions
(setf query-results): Public generic functions
(setf query-row-count): Public generic functions
(setf query-row-count): Public generic functions
(setf query-sql): Public generic functions
(setf query-sql): Public generic functions

A
assert-transaction-is-in-progress: Private ordinary functions

B
begin-transaction: Public generic functions
begin-transaction: Public generic functions
begin-transaction: Public generic functions

C
cache-pool-cleanup-fn: Private ordinary functions
cache-pool-hash: Private ordinary functions
cache-pool-lock: Private ordinary functions
cache-pool-p: Private ordinary functions
cleanup-cache-pool: Public ordinary functions
commit: Public generic functions
commit: Public generic functions
commit: Public generic functions
connect: Public ordinary functions
connect-cached: Public ordinary functions
connection-database-name: Public generic functions
connection-database-name: Public generic functions
connection-driver-type: Public generic functions
connection-driver-type: Public generic functions
connection-established-at: Public generic functions
connection-established-at: Public generic functions
connection-handle: Public generic functions
connection-handle: Public generic functions
connection-query-cache: Private generic functions
connection-query-cache: Private generic functions
copy-cache-pool: Private ordinary functions

D
database-error-code: Public generic functions
database-error-code: Public generic functions
database-error-message: Public generic functions
database-error-message: Public generic functions
defclass/a: Public macros
define-condition/a: Public macros
disconnect: Public generic functions
disconnect: Public generic functions
disconnect: Public generic functions
do-sql: Public generic functions
do-sql: Public generic functions
do-sql: Public generic functions

E
escape-sql: Public generic functions
escape-sql: Public generic functions
execute: Public generic functions
execute: Public generic functions
execute-using-connection: Public generic functions
execute-using-connection: Public generic functions

F
fetch: Public generic functions
fetch: Public generic functions
fetch-all: Public generic functions
fetch-all: Public generic functions
fetch-using-connection: Public generic functions
fetch-using-connection: Public generic functions
finalize-savepoint: Private macros
find-driver: Public ordinary functions
free-query-resources: Public generic functions
free-query-resources: Public generic functions
free-query-resources: Public generic functions
Function, (setf cache-pool-cleanup-fn): Private ordinary functions
Function, (setf cache-pool-hash): Private ordinary functions
Function, (setf cache-pool-lock): Private ordinary functions
Function, (setf get-object): Public ordinary functions
Function, assert-transaction-is-in-progress: Private ordinary functions
Function, cache-pool-cleanup-fn: Private ordinary functions
Function, cache-pool-hash: Private ordinary functions
Function, cache-pool-lock: Private ordinary functions
Function, cache-pool-p: Private ordinary functions
Function, cleanup-cache-pool: Public ordinary functions
Function, connect: Public ordinary functions
Function, connect-cached: Public ordinary functions
Function, copy-cache-pool: Private ordinary functions
Function, find-driver: Public ordinary functions
Function, generate-random-savepoint: Private ordinary functions
Function, get-object: Public ordinary functions
Function, get-transaction-state: Private ordinary functions
Function, in-transaction: Public ordinary functions
Function, list-all-drivers: Public ordinary functions
Function, load-driver: Private ordinary functions
Function, make-cache-pool: Public ordinary functions
Function, make-cache-table: Private ordinary functions
Function, prepare-cached: Public ordinary functions
Function, simple-sql-logger: Public ordinary functions
Function, sql-log: Public ordinary functions
Function, steal-cache-table: Public ordinary functions

G
generate-random-savepoint: Private ordinary functions
Generic Function, (setf connection-database-name): Public generic functions
Generic Function, (setf connection-established-at): Public generic functions
Generic Function, (setf connection-handle): Public generic functions
Generic Function, (setf connection-query-cache): Private generic functions
Generic Function, (setf get-state): Private generic functions
Generic Function, (setf query-cached-p): Public generic functions
Generic Function, (setf query-connection): Public generic functions
Generic Function, (setf query-prepared): Public generic functions
Generic Function, (setf query-results): Public generic functions
Generic Function, (setf query-row-count): Public generic functions
Generic Function, (setf query-sql): Public generic functions
Generic Function, begin-transaction: Public generic functions
Generic Function, commit: Public generic functions
Generic Function, connection-database-name: Public generic functions
Generic Function, connection-driver-type: Public generic functions
Generic Function, connection-established-at: Public generic functions
Generic Function, connection-handle: Public generic functions
Generic Function, connection-query-cache: Private generic functions
Generic Function, database-error-code: Public generic functions
Generic Function, database-error-message: Public generic functions
Generic Function, disconnect: Public generic functions
Generic Function, do-sql: Public generic functions
Generic Function, escape-sql: Public generic functions
Generic Function, execute: Public generic functions
Generic Function, execute-using-connection: Public generic functions
Generic Function, fetch: Public generic functions
Generic Function, fetch-all: Public generic functions
Generic Function, fetch-using-connection: Public generic functions
Generic Function, free-query-resources: Public generic functions
Generic Function, get-conn: Private generic functions
Generic Function, get-identifier: Private generic functions
Generic Function, get-state: Private generic functions
Generic Function, make-connection: Public generic functions
Generic Function, ping: Public generic functions
Generic Function, prepare: Public generic functions
Generic Function, prepare-sql: Private generic functions
Generic Function, query-cached-p: Public generic functions
Generic Function, query-connection: Public generic functions
Generic Function, query-prepared: Public generic functions
Generic Function, query-results: Public generic functions
Generic Function, query-row-count: Public generic functions
Generic Function, query-sql: Public generic functions
Generic Function, release-savepoint: Public generic functions
Generic Function, rollback: Public generic functions
Generic Function, rollback-savepoint: Public generic functions
Generic Function, row-count: Public generic functions
Generic Function, savepoint: Public generic functions
get-conn: Private generic functions
get-conn: Private generic functions
get-identifier: Private generic functions
get-identifier: Private generic functions
get-object: Public ordinary functions
get-state: Private generic functions
get-state: Private generic functions
get-transaction-state: Private ordinary functions

I
in-transaction: Public ordinary functions

L
list-all-drivers: Public ordinary functions
load-driver: Private ordinary functions

M
Macro, %with-transaction: Private macros
Macro, defclass/a: Public macros
Macro, define-condition/a: Public macros
Macro, finalize-savepoint: Private macros
Macro, with-autoload-on-missing: Private macros
Macro, with-connection: Public macros
Macro, with-savepoint: Public macros
Macro, with-took-usec: Public macros
Macro, with-transaction: Public macros
make-cache-pool: Public ordinary functions
make-cache-table: Private ordinary functions
make-connection: Public generic functions
make-connection: Public generic functions
Method, (setf connection-database-name): Public generic functions
Method, (setf connection-established-at): Public generic functions
Method, (setf connection-handle): Public generic functions
Method, (setf connection-query-cache): Private generic functions
Method, (setf get-state): Private generic functions
Method, (setf query-cached-p): Public generic functions
Method, (setf query-connection): Public generic functions
Method, (setf query-prepared): Public generic functions
Method, (setf query-results): Public generic functions
Method, (setf query-row-count): Public generic functions
Method, (setf query-sql): Public generic functions
Method, begin-transaction: Public generic functions
Method, begin-transaction: Public generic functions
Method, commit: Public generic functions
Method, commit: Public generic functions
Method, connection-database-name: Public generic functions
Method, connection-driver-type: Public generic functions
Method, connection-established-at: Public generic functions
Method, connection-handle: Public generic functions
Method, connection-query-cache: Private generic functions
Method, database-error-code: Public generic functions
Method, database-error-message: Public generic functions
Method, disconnect: Public generic functions
Method, disconnect: Public generic functions
Method, do-sql: Public generic functions
Method, do-sql: Public generic functions
Method, escape-sql: Public generic functions
Method, execute: Public generic functions
Method, execute-using-connection: Public generic functions
Method, fetch: Public generic functions
Method, fetch-all: Public generic functions
Method, fetch-using-connection: Public generic functions
Method, free-query-resources: Public generic functions
Method, free-query-resources: Public generic functions
Method, get-conn: Private generic functions
Method, get-identifier: Private generic functions
Method, get-state: Private generic functions
Method, make-connection: Public generic functions
Method, ping: Public generic functions
Method, prepare: Public generic functions
Method, prepare-sql: Private generic functions
Method, query-cached-p: Public generic functions
Method, query-connection: Public generic functions
Method, query-prepared: Public generic functions
Method, query-results: Public generic functions
Method, query-row-count: Public generic functions
Method, query-sql: Public generic functions
Method, release-savepoint: Public generic functions
Method, release-savepoint: Public generic functions
Method, rollback: Public generic functions
Method, rollback: Public generic functions
Method, rollback-savepoint: Public generic functions
Method, rollback-savepoint: Public generic functions
Method, row-count: Public generic functions
Method, savepoint: Public generic functions

P
ping: Public generic functions
ping: Public generic functions
prepare: Public generic functions
prepare: Public generic functions
prepare-cached: Public ordinary functions
prepare-sql: Private generic functions
prepare-sql: Private generic functions

Q
query-cached-p: Public generic functions
query-cached-p: Public generic functions
query-connection: Public generic functions
query-connection: Public generic functions
query-prepared: Public generic functions
query-prepared: Public generic functions
query-results: Public generic functions
query-results: Public generic functions
query-row-count: Public generic functions
query-row-count: Public generic functions
query-sql: Public generic functions
query-sql: Public generic functions

R
release-savepoint: Public generic functions
release-savepoint: Public generic functions
release-savepoint: Public generic functions
rollback: Public generic functions
rollback: Public generic functions
rollback: Public generic functions
rollback-savepoint: Public generic functions
rollback-savepoint: Public generic functions
rollback-savepoint: Public generic functions
row-count: Public generic functions
row-count: Public generic functions

S
savepoint: Public generic functions
savepoint: Public generic functions
simple-sql-logger: Public ordinary functions
sql-log: Public ordinary functions
steal-cache-table: Public ordinary functions

W
with-autoload-on-missing: Private macros
with-connection: Public macros
with-savepoint: Public macros
with-took-usec: Public macros
with-transaction: Public macros


A.3 Variables

Jump to:   %   *  
A   C   D   E   H   I   L   M   P   Q   R   S  
Index Entry  Section

%
%handle: Public classes
%handle: Public classes

*
*connection-cache-seconds*: Private special variables
*sql-execution-hooks*: Public special variables
*threads-connection-pool*: Private special variables
*transaction-state*: Private special variables

A
auto-commit: Public classes
auto-commit: Public classes

C
cached: Public classes
cached: Public classes
cleanup-fn: Private structures
conn: Private classes
connection: Public classes
connection: Public classes

D
database-name: Public classes
database-name: Public classes

E
error-code: Public conditions
error-code: Public conditions
established-at: Public classes
established-at: Public classes

H
hash: Private structures

I
identifier: Private classes

L
lock: Private structures

M
message: Public conditions
message: Public conditions
method-name: Public conditions
method-name: Public conditions
method-name: Public conditions
method-name: Public conditions

P
prepared: Public classes
prepared: Public classes

Q
query-cache: Public classes
query-cache: Public classes

R
results: Public classes
results: Public classes
row-count: Public classes
row-count: Public classes

S
Slot, %handle: Public classes
Slot, %handle: Public classes
Slot, auto-commit: Public classes
Slot, auto-commit: Public classes
Slot, cached: Public classes
Slot, cached: Public classes
Slot, cleanup-fn: Private structures
Slot, conn: Private classes
Slot, connection: Public classes
Slot, connection: Public classes
Slot, database-name: Public classes
Slot, database-name: Public classes
Slot, error-code: Public conditions
Slot, error-code: Public conditions
Slot, established-at: Public classes
Slot, established-at: Public classes
Slot, hash: Private structures
Slot, identifier: Private classes
Slot, lock: Private structures
Slot, message: Public conditions
Slot, message: Public conditions
Slot, method-name: Public conditions
Slot, method-name: Public conditions
Slot, method-name: Public conditions
Slot, method-name: Public conditions
Slot, prepared: Public classes
Slot, prepared: Public classes
Slot, query-cache: Public classes
Slot, query-cache: Public classes
Slot, results: Public classes
Slot, results: Public classes
Slot, row-count: Public classes
Slot, row-count: Public classes
Slot, sql: Public classes
Slot, sql: Public classes
Slot, state: Private classes
Special Variable, *connection-cache-seconds*: Private special variables
Special Variable, *sql-execution-hooks*: Public special variables
Special Variable, *threads-connection-pool*: Private special variables
Special Variable, *transaction-state*: Private special variables
sql: Public classes
sql: Public classes
state: Private classes


A.4 Data types

Jump to:   <  
C   D   E   F   L   M   P   S   T  
Index Entry  Section

<
<dbi-already-commited-error>: Public conditions
<dbi-already-rolled-back-error>: Public conditions
<dbi-connection>: Public classes
<dbi-data-error>: Public conditions
<dbi-database-error>: Public conditions
<dbi-driver>: Public classes
<dbi-error>: Public conditions
<dbi-integrity-error>: Public conditions
<dbi-interface-error>: Public conditions
<dbi-internal-error>: Public conditions
<dbi-notsupported-error>: Public conditions
<dbi-operational-error>: Public conditions
<dbi-programming-error>: Public conditions
<dbi-query>: Public classes
<dbi-unimplemented-error>: Public conditions
<dbi-warning>: Public conditions

C
cache: The dbi/src/cache module
cache-pool: Private structures
cl-dbi: The cl-dbi system
cl-dbi.asd: The cl-dbi/cl-dbi․asd file
Class, <dbi-connection>: Public classes
Class, <dbi-driver>: Public classes
Class, <dbi-query>: Public classes
Class, dbi-connection: Public classes
Class, dbi-driver: Public classes
Class, dbi-query: Public classes
Class, savepoint-state: Private classes
Class, transaction-state: Private classes
Condition, <dbi-already-commited-error>: Public conditions
Condition, <dbi-already-rolled-back-error>: Public conditions
Condition, <dbi-data-error>: Public conditions
Condition, <dbi-database-error>: Public conditions
Condition, <dbi-error>: Public conditions
Condition, <dbi-integrity-error>: Public conditions
Condition, <dbi-interface-error>: Public conditions
Condition, <dbi-internal-error>: Public conditions
Condition, <dbi-notsupported-error>: Public conditions
Condition, <dbi-operational-error>: Public conditions
Condition, <dbi-programming-error>: Public conditions
Condition, <dbi-unimplemented-error>: Public conditions
Condition, <dbi-warning>: Public conditions
Condition, dbi-already-commited-error: Public conditions
Condition, dbi-already-rolled-back-error: Public conditions
Condition, dbi-data-error: Public conditions
Condition, dbi-database-error: Public conditions
Condition, dbi-error: Public conditions
Condition, dbi-integrity-error: Public conditions
Condition, dbi-interface-error: Public conditions
Condition, dbi-internal-error: Public conditions
Condition, dbi-notsupported-error: Public conditions
Condition, dbi-operational-error: Public conditions
Condition, dbi-programming-error: Public conditions
Condition, dbi-unimplemented-error: Public conditions
Condition, dbi-warning: Public conditions
Condition, transaction-done-condition: Private conditions

D
dbi: The dbi system
dbi: The dbi package
dbi-already-commited-error: Public conditions
dbi-already-rolled-back-error: Public conditions
dbi-connection: Public classes
dbi-data-error: Public conditions
dbi-database-error: Public conditions
dbi-driver: Public classes
dbi-error: Public conditions
dbi-integrity-error: Public conditions
dbi-interface-error: Public conditions
dbi-internal-error: Public conditions
dbi-notsupported-error: Public conditions
dbi-operational-error: Public conditions
dbi-programming-error: Public conditions
dbi-query: Public classes
dbi-unimplemented-error: Public conditions
dbi-warning: Public conditions
dbi.asd: The dbi/dbi․asd file
dbi.cache.thread: The dbi․cache․thread package
dbi.driver: The dbi․driver package
dbi.error: The dbi․error package
dbi.lisp: The dbi/src/dbi․lisp file
dbi.logger: The dbi․logger package
dbi.utils: The dbi․utils package
driver.lisp: The dbi/src/driver․lisp file

E
error.lisp: The dbi/src/error․lisp file

F
File, cl-dbi.asd: The cl-dbi/cl-dbi․asd file
File, dbi.asd: The dbi/dbi․asd file
File, dbi.lisp: The dbi/src/dbi․lisp file
File, driver.lisp: The dbi/src/driver․lisp file
File, error.lisp: The dbi/src/error․lisp file
File, logger.lisp: The dbi/src/logger․lisp file
File, single.lisp: The dbi/src/cache/single․lisp file
File, src/utils.lisp: The dbi/src/utils․lisp file
File, thread.lisp: The dbi/src/cache/thread․lisp file

L
logger.lisp: The dbi/src/logger․lisp file

M
Module, cache: The dbi/src/cache module
Module, src: The dbi/src module

P
Package, dbi: The dbi package
Package, dbi.cache.thread: The dbi․cache․thread package
Package, dbi.driver: The dbi․driver package
Package, dbi.error: The dbi․error package
Package, dbi.logger: The dbi․logger package
Package, dbi.utils: The dbi․utils package

S
savepoint-state: Private classes
single.lisp: The dbi/src/cache/single․lisp file
src: The dbi/src module
src/utils.lisp: The dbi/src/utils․lisp file
Structure, cache-pool: Private structures
System, cl-dbi: The cl-dbi system
System, dbi: The dbi system

T
thread.lisp: The dbi/src/cache/thread․lisp file
transaction-done-condition: Private conditions
transaction-state: Private classes