The trivial-pooled-database Reference Manual

This is the trivial-pooled-database Reference Manual, version 0.1.11, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:57:06 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 trivial-pooled-database

A DB multi-threaded connection pool.

Author

Eric Diethelm <>

License

MIT

Version

0.1.11

Dependencies
  • trivial-utilities (system).
  • trivial-object-lock (system).
  • log4cl (system).
  • bordeaux-threads (system).
  • iterate (system).
  • cl-dbi (system).
  • parse-number (system).
Source

trivial-pooled-database.asd.

Child Components

3 Files

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


3.1 Lisp


3.1.1 trivial-pooled-database/trivial-pooled-database.asd

Source

trivial-pooled-database.asd.

Parent Component

trivial-pooled-database (system).

ASDF Systems

trivial-pooled-database.


3.1.3 trivial-pooled-database/trivial-pooled-database.lisp

Source

trivial-pooled-database.asd.

Parent Component

trivial-pooled-database (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 trivial-pooled-database

trivial-pooled-database provides a multi-threaded DB connection pool.

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: within-transaction (&body body)

Execute all statements in **BODY** within a DB transaction using a single connection. NOTE: Does nothing at the moment; implementation missing!

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.


5.1.2 Ordinary functions

Function: execute (cmd)

Allows for execution of a freely defined SQL command *CMD*.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: execute-function (fn-name &rest parameters)

Executes a DB stored function identified by *FN-NAME* with the given *PARAMETERS* (if any) and returns it’s value.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: initialize-connection-pool (user pwd schema host &key initial-pool-size max-pool-size)

Initialize the connection pool by providing access credentials to the database and additionaly pool size information. *USER* - user name
*PWD* - user password
*SCHEMA* - database schema to use
*HOST* - database host name or IP address
*INITIAL-POOL-SIZE* - the number of connections to be created at initialization
*MAX-POOL-SIZE* - Maximal number of connections allowed

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: insert (table fields values)

Inserts a new entry into the database *TABLE* assigning each element in *VALUES* to its corresponding *FIELD*.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: pool-initialized-p ()
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: select (table fields where &key limit order-by)

Selects all entries from *TABLE* matching the *WHERE* clause returning the *FIELDS* (might be ’*’ to select all fields of the table). Optionally *LIMIT* indicates the maximum number of entries to return and *ORDER-BY* defines the ordering of the result.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: shutdown-connection-pool (connection-pool)

Disconnects all database connections and shuts down the connection pool.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: update (table fields values where)

Updates an entry of the table *TABLE* matching the *WHERE* clause. Each element in *VALUES* is assigned to its corresponding *FIELD*.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.


5.2 Internals


5.2.1 Macros

Macro: with-connection ((connection-name) connection-pool &body body)

Allows for safe acquisition and release of a pooled connection. In BODY a connection named be the symbol CONNECTION can be used.

Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.


5.2.2 Ordinary functions

Function: acquire-connection (connection-pool)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: check-connection-and-reconnect-if-necessary (connection)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: connect (connection-proxy)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: disconnect (pooled-connection)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: get-connection-pool ()
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: release-connection (connection connection-pool)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Function: set-connection-pool (pool)
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.


5.2.3 Generic functions

Generic Reader: connected-p (object)
Package

trivial-pooled-database.

Methods
Reader Method: connected-p ((dbi-pooled-connection dbi-pooled-connection))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

connected-p.

Generic Writer: (setf connected-p) (object)
Package

trivial-pooled-database.

Methods
Writer Method: (setf connected-p) ((dbi-pooled-connection dbi-pooled-connection))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

connected-p.

Generic Reader: dbi-connection (object)
Package

trivial-pooled-database.

Methods
Reader Method: dbi-connection ((dbi-connection-proxy dbi-connection-proxy))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-connection.

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

trivial-pooled-database.

Methods
Writer Method: (setf dbi-connection) ((dbi-connection-proxy dbi-connection-proxy))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-connection.

Generic Reader: dbi-connection-proxy (object)
Package

trivial-pooled-database.

Methods
Reader Method: dbi-connection-proxy ((dbi-pooled-connection dbi-pooled-connection))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-connection-proxy.

Generic Writer: (setf dbi-connection-proxy) (object)
Package

trivial-pooled-database.

Methods
Writer Method: (setf dbi-connection-proxy) ((dbi-pooled-connection dbi-pooled-connection))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-connection-proxy.

Generic Reader: dbi-pooled-connection (object)
Package

trivial-pooled-database.

Methods
Reader Method: dbi-pooled-connection ((dbi-connection-proxy dbi-connection-proxy))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-pooled-connection.

Generic Writer: (setf dbi-pooled-connection) (object)
Package

trivial-pooled-database.

Methods
Writer Method: (setf dbi-pooled-connection) ((dbi-connection-proxy dbi-connection-proxy))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

dbi-pooled-connection.

Generic Reader: host (object)
Package

trivial-pooled-database.

Methods
Reader Method: host ((connection-parameters connection-parameters))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

host.

Generic Reader: owner-thread (object)
Package

trivial-pooled-database.

Methods
Reader Method: owner-thread ((dbi-pooled-connection dbi-pooled-connection))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

owner-thread.

Generic Writer: (setf owner-thread) (object)
Package

trivial-pooled-database.

Methods
Writer Method: (setf owner-thread) ((dbi-pooled-connection dbi-pooled-connection))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

owner-thread.

Generic Reader: parameters (object)
Package

trivial-pooled-database.

Methods
Reader Method: parameters ((dbi-pooled-connection dbi-pooled-connection))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

parameters.

Generic Reader: password (object)
Package

trivial-pooled-database.

Methods
Reader Method: password ((connection-parameters connection-parameters))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

password.

Generic Reader: pool (object)
Package

trivial-pooled-database.

Methods
Reader Method: pool ((connection-pool connection-pool))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

connection-pool.

Generic Reader: schema (object)
Package

trivial-pooled-database.

Methods
Reader Method: schema ((connection-parameters connection-parameters))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

schema.

Generic Reader: semaphore (object)
Package

trivial-pooled-database.

Methods
Reader Method: semaphore ((connection-pool connection-pool))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

connection-pool-semaphore.

Reader Method: semaphore ((dbi-pooled-connection dbi-pooled-connection))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

semaphore.

Generic Writer: (setf semaphore) (object)
Package

trivial-pooled-database.

Methods
Writer Method: (setf semaphore) ((dbi-pooled-connection dbi-pooled-connection))

automatically generated writer method

Source

trivial-pooled-database.lisp.

Target Slot

semaphore.

Generic Reader: username (object)
Package

trivial-pooled-database.

Methods
Reader Method: username ((connection-parameters connection-parameters))

automatically generated reader method

Source

trivial-pooled-database.lisp.

Target Slot

username.


5.2.4 Classes

Class: connection-parameters
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Direct methods
Direct slots
Slot: username
Type

string

Initform

""

Initargs

:username

Readers

username.

Writers

This slot is read-only.

Slot: password
Type

string

Initform

""

Initargs

:password

Readers

password.

Writers

This slot is read-only.

Slot: schema
Type

string

Initform

""

Initargs

:schema

Readers

schema.

Writers

This slot is read-only.

Slot: host
Type

string

Initform

""

Initargs

:host

Readers

host.

Writers

This slot is read-only.

Class: connection-pool
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Direct methods
Direct slots
Slot: connection-pool-semaphore
Type

bordeaux-threads:semaphore

Initform

(error "this instance needs an explicit semaphore initialization")

Initargs

:semaphore

Readers

semaphore.

Writers

This slot is read-only.

Slot: connection-pool
Type

(simple-array trivial-pooled-database::dbi-pooled-connection *)

Initform

(error "this instance needs an explicit array initialization")

Initargs

:pool

Readers

pool.

Writers

This slot is read-only.

Class: dbi-connection-proxy
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Direct methods
Direct slots
Slot: dbi-connection
Readers

dbi-connection.

Writers

(setf dbi-connection).

Slot: dbi-pooled-connection
Readers

dbi-pooled-connection.

Writers

(setf dbi-pooled-connection).

Class: dbi-pooled-connection
Package

trivial-pooled-database.

Source

trivial-pooled-database.lisp.

Direct methods
Direct slots
Slot: dbi-connection-proxy
Type

trivial-pooled-database::dbi-connection-proxy

Initform

(make-instance (quote trivial-pooled-database::dbi-connection-proxy))

Readers

dbi-connection-proxy.

Writers

(setf dbi-connection-proxy).

Slot: semaphore
Initform

(bordeaux-threads:make-semaphore :count 1)

Readers

semaphore.

Writers

(setf semaphore).

Slot: connected-p
Type

boolean

Readers

connected-p.

Writers

(setf connected-p).

Slot: owner-thread
Readers

owner-thread.

Writers

(setf owner-thread).

Slot: parameters
Type

trivial-pooled-database::connection-parameters

Initargs

:parameters

Readers

parameters.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   D   E   F   G   H   I   M   O   P   R   S   U   W  
Index Entry  Section

(
(setf connected-p): Private generic functions
(setf connected-p): Private generic functions
(setf dbi-connection): Private generic functions
(setf dbi-connection): Private generic functions
(setf dbi-connection-proxy): Private generic functions
(setf dbi-connection-proxy): Private generic functions
(setf dbi-pooled-connection): Private generic functions
(setf dbi-pooled-connection): Private generic functions
(setf owner-thread): Private generic functions
(setf owner-thread): Private generic functions
(setf semaphore): Private generic functions
(setf semaphore): Private generic functions

A
acquire-connection: Private ordinary functions

C
check-connection-and-reconnect-if-necessary: Private ordinary functions
connect: Private ordinary functions
connected-p: Private generic functions
connected-p: Private generic functions

D
dbi-connection: Private generic functions
dbi-connection: Private generic functions
dbi-connection-proxy: Private generic functions
dbi-connection-proxy: Private generic functions
dbi-pooled-connection: Private generic functions
dbi-pooled-connection: Private generic functions
disconnect: Private ordinary functions

E
execute: Public ordinary functions
execute-function: Public ordinary functions

F
Function, acquire-connection: Private ordinary functions
Function, check-connection-and-reconnect-if-necessary: Private ordinary functions
Function, connect: Private ordinary functions
Function, disconnect: Private ordinary functions
Function, execute: Public ordinary functions
Function, execute-function: Public ordinary functions
Function, get-connection-pool: Private ordinary functions
Function, initialize-connection-pool: Public ordinary functions
Function, insert: Public ordinary functions
Function, pool-initialized-p: Public ordinary functions
Function, release-connection: Private ordinary functions
Function, select: Public ordinary functions
Function, set-connection-pool: Private ordinary functions
Function, shutdown-connection-pool: Public ordinary functions
Function, update: Public ordinary functions

G
Generic Function, (setf connected-p): Private generic functions
Generic Function, (setf dbi-connection): Private generic functions
Generic Function, (setf dbi-connection-proxy): Private generic functions
Generic Function, (setf dbi-pooled-connection): Private generic functions
Generic Function, (setf owner-thread): Private generic functions
Generic Function, (setf semaphore): Private generic functions
Generic Function, connected-p: Private generic functions
Generic Function, dbi-connection: Private generic functions
Generic Function, dbi-connection-proxy: Private generic functions
Generic Function, dbi-pooled-connection: Private generic functions
Generic Function, host: Private generic functions
Generic Function, owner-thread: Private generic functions
Generic Function, parameters: Private generic functions
Generic Function, password: Private generic functions
Generic Function, pool: Private generic functions
Generic Function, schema: Private generic functions
Generic Function, semaphore: Private generic functions
Generic Function, username: Private generic functions
get-connection-pool: Private ordinary functions

H
host: Private generic functions
host: Private generic functions

I
initialize-connection-pool: Public ordinary functions
insert: Public ordinary functions

M
Macro, with-connection: Private macros
Macro, within-transaction: Public macros
Method, (setf connected-p): Private generic functions
Method, (setf dbi-connection): Private generic functions
Method, (setf dbi-connection-proxy): Private generic functions
Method, (setf dbi-pooled-connection): Private generic functions
Method, (setf owner-thread): Private generic functions
Method, (setf semaphore): Private generic functions
Method, connected-p: Private generic functions
Method, dbi-connection: Private generic functions
Method, dbi-connection-proxy: Private generic functions
Method, dbi-pooled-connection: Private generic functions
Method, host: Private generic functions
Method, owner-thread: Private generic functions
Method, parameters: Private generic functions
Method, password: Private generic functions
Method, pool: Private generic functions
Method, schema: Private generic functions
Method, semaphore: Private generic functions
Method, semaphore: Private generic functions
Method, username: Private generic functions

O
owner-thread: Private generic functions
owner-thread: Private generic functions

P
parameters: Private generic functions
parameters: Private generic functions
password: Private generic functions
password: Private generic functions
pool: Private generic functions
pool: Private generic functions
pool-initialized-p: Public ordinary functions

R
release-connection: Private ordinary functions

S
schema: Private generic functions
schema: Private generic functions
select: Public ordinary functions
semaphore: Private generic functions
semaphore: Private generic functions
semaphore: Private generic functions
set-connection-pool: Private ordinary functions
shutdown-connection-pool: Public ordinary functions

U
update: Public ordinary functions
username: Private generic functions
username: Private generic functions

W
with-connection: Private macros
within-transaction: Public macros