The trivial-pooled-database Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-pooled-database Reference Manual

This is the trivial-pooled-database Reference Manual, version 0.1.8, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Apr 08 15:12:18 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Trivial Pooled Database Manual

pipeline status Quicklisp

[in package TRIVIAL-POOLED-DATABASE]

Description

This library provides a multi-threaded DB connection pool.

Working Example

After loading the project one has to first initialize the connection pool by calling INITIALIZE-CONNECTION-POOL, passing it the access credentials and database information.

(let ((username "sql_user")
      (passwd "password")
      (schema "minerva")
      (host "localhost"))
  (trivial-pooled-database:initialize-connection-pool username passwd schema host))

Once the pool is initialized, a SQL command can be executed and all connection handling is hidden inside the pool.

(trivial-pooled-database:select "customers"
				'(:ID :NAME :ADDRESS :GOLD-MEMBER-P :LAST-VISIT)
				(format nil "`GOLD-MEMBER-P`= ~a" gold-member-status)
				:order-by "`NAME` DESC"
				:limit 1)

Installing trivial-pooled-database

This project is available in the latest QuickLisp distribution, so installing it is reduced to calling:

(ql:quickload :trivial-pooled-database)

Note: trivial-pooled-database depends on features from bordeaux-threads which are not yes available in QuickLisp.
Because of this, following step is necessary before loading trivial-pooled-database:

cd $HOME/quicklisp/local-projects
git clone https://github.com/sionescu/bordeaux-threads.git

Exported Symbols

License Information

This library is released under the MIT License. Please refer to the LICENSE to get the full licensing text.

Contributing to this project

Please refer to the CONTRIBUTING document for more information.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-pooled-database

Author

Eric Diethelm <ediethelm@yahoo.com>

License

MIT

Description

A DB multi-threaded connection pool.

Version

0.1.8

Dependencies
Source

trivial-pooled-database.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 trivial-pooled-database.asd

Location

trivial-pooled-database.asd

Systems

trivial-pooled-database (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 trivial-pooled-database/package.lisp

Parent

trivial-pooled-database (system)

Location

package.lisp

Packages

trivial-pooled-database


Next: , Previous: , Up: Lisp files   [Contents][Index]

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

Parent

trivial-pooled-database (system)

Location

trivial-pooled-database.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.4 trivial-pooled-database/documentation.lisp

Parent

trivial-pooled-database (system)

Location

documentation.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 trivial-pooled-database

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

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: @trivial-pooled-database-contributing
Package

trivial-pooled-database

Source

documentation.lisp (file)

Special Variable: @trivial-pooled-database-description
Package

trivial-pooled-database

Source

documentation.lisp (file)

Special Variable: @trivial-pooled-database-examples
Package

trivial-pooled-database

Source

documentation.lisp (file)

Special Variable: @trivial-pooled-database-exported
Package

trivial-pooled-database

Source

documentation.lisp (file)

Special Variable: @trivial-pooled-database-license
Package

trivial-pooled-database

Source

documentation.lisp (file)

Special Variable: @trivial-pooled-database-manual
Package

trivial-pooled-database

Source

documentation.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 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 (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Functions

Function: execute CMD

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

Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

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 (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: acquire-connection CONNECTION-POOL
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: check-connection-and-reconnect-if-necessary CONNECTION
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: connect CONNECTION-PROXY
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: disconnect POOLED-CONNECTION
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: get-connection-pool ()
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: release-connection CONNECTION CONNECTION-POOL
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Function: set-connection-pool POOL
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: connected-p OBJECT
Generic Function: (setf connected-p) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: connected-p (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf connected-p) NEW-VALUE (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: dbi-connection OBJECT
Generic Function: (setf dbi-connection) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: dbi-connection (DBI-CONNECTION-PROXY dbi-connection-proxy)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf dbi-connection) NEW-VALUE (DBI-CONNECTION-PROXY dbi-connection-proxy)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: dbi-connection-proxy OBJECT
Generic Function: (setf dbi-connection-proxy) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: dbi-connection-proxy (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf dbi-connection-proxy) NEW-VALUE (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: dbi-pooled-connection OBJECT
Generic Function: (setf dbi-pooled-connection) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: dbi-pooled-connection (DBI-CONNECTION-PROXY dbi-connection-proxy)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf dbi-pooled-connection) NEW-VALUE (DBI-CONNECTION-PROXY dbi-connection-proxy)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: host OBJECT
Package

trivial-pooled-database

Methods
Method: host (CONNECTION-PARAMETERS connection-parameters)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Generic Function: owner-thread OBJECT
Generic Function: (setf owner-thread) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: owner-thread (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf owner-thread) NEW-VALUE (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: parameters OBJECT
Package

trivial-pooled-database

Methods
Method: parameters (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Generic Function: password OBJECT
Package

trivial-pooled-database

Methods
Method: password (CONNECTION-PARAMETERS connection-parameters)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Generic Function: pool OBJECT
Package

trivial-pooled-database

Methods
Method: pool (CONNECTION-POOL connection-pool)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Generic Function: schema OBJECT
Package

trivial-pooled-database

Methods
Method: schema (CONNECTION-PARAMETERS connection-parameters)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Generic Function: semaphore OBJECT
Generic Function: (setf semaphore) NEW-VALUE OBJECT
Package

trivial-pooled-database

Methods
Method: semaphore (CONNECTION-POOL connection-pool)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: semaphore (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)

Method: (setf semaphore) NEW-VALUE (DBI-POOLED-CONNECTION dbi-pooled-connection)

automatically generated writer method

Source

trivial-pooled-database.lisp (file)

Generic Function: username OBJECT
Package

trivial-pooled-database

Methods
Method: username (CONNECTION-PARAMETERS connection-parameters)

automatically generated reader method

Source

trivial-pooled-database.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: connection-parameters ()
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: username
Type

string

Initargs

:username

Initform

""

Readers

username (generic function)

Slot: password
Type

string

Initargs

:password

Initform

""

Readers

password (generic function)

Slot: schema
Type

string

Initargs

:schema

Initform

""

Readers

schema (generic function)

Slot: host
Type

string

Initargs

:host

Initform

""

Readers

host (generic function)

Class: connection-pool ()
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Direct superclasses

standard-object (class)

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

bordeaux-threads:semaphore

Initargs

:semaphore

Readers

semaphore (generic function)

Slot: connection-pool
Type

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

Initargs

:pool

Readers

pool (generic function)

Class: dbi-connection-proxy ()
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: dbi-connection
Readers

dbi-connection (generic function)

Writers

(setf dbi-connection) (generic function)

Slot: dbi-pooled-connection
Readers

dbi-pooled-connection (generic function)

Writers

(setf dbi-pooled-connection) (generic function)

Class: dbi-pooled-connection ()
Package

trivial-pooled-database

Source

trivial-pooled-database.lisp (file)

Direct superclasses

standard-object (class)

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 (generic function)

Writers

(setf dbi-connection-proxy) (generic function)

Slot: semaphore
Initform

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

Readers

semaphore (generic function)

Writers

(setf semaphore) (generic function)

Slot: connected-p
Type

boolean

Readers

connected-p (generic function)

Writers

(setf connected-p) (generic function)

Slot: owner-thread
Readers

owner-thread (generic function)

Writers

(setf owner-thread) (generic function)

Slot: parameters
Type

trivial-pooled-database::connection-parameters

Initargs

:parameters

Readers

parameters (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-pooled-database.asd: The trivial-pooled-database<dot>asd file
File, Lisp, trivial-pooled-database/documentation.lisp: The trivial-pooled-database/documentation<dot>lisp file
File, Lisp, trivial-pooled-database/package.lisp: The trivial-pooled-database/package<dot>lisp file
File, Lisp, trivial-pooled-database/trivial-pooled-database.lisp: The trivial-pooled-database/trivial-pooled-database<dot>lisp file

L
Lisp File, trivial-pooled-database.asd: The trivial-pooled-database<dot>asd file
Lisp File, trivial-pooled-database/documentation.lisp: The trivial-pooled-database/documentation<dot>lisp file
Lisp File, trivial-pooled-database/package.lisp: The trivial-pooled-database/package<dot>lisp file
Lisp File, trivial-pooled-database/trivial-pooled-database.lisp: The trivial-pooled-database/trivial-pooled-database<dot>lisp file

T
trivial-pooled-database.asd: The trivial-pooled-database<dot>asd file
trivial-pooled-database/documentation.lisp: The trivial-pooled-database/documentation<dot>lisp file
trivial-pooled-database/package.lisp: The trivial-pooled-database/package<dot>lisp file
trivial-pooled-database/trivial-pooled-database.lisp: The trivial-pooled-database/trivial-pooled-database<dot>lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

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): Internal generic functions
(setf connected-p): Internal generic functions
(setf dbi-connection): Internal generic functions
(setf dbi-connection): Internal generic functions
(setf dbi-connection-proxy): Internal generic functions
(setf dbi-connection-proxy): Internal generic functions
(setf dbi-pooled-connection): Internal generic functions
(setf dbi-pooled-connection): Internal generic functions
(setf owner-thread): Internal generic functions
(setf owner-thread): Internal generic functions
(setf semaphore): Internal generic functions
(setf semaphore): Internal generic functions

A
acquire-connection: Internal functions

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

D
dbi-connection: Internal generic functions
dbi-connection: Internal generic functions
dbi-connection-proxy: Internal generic functions
dbi-connection-proxy: Internal generic functions
dbi-pooled-connection: Internal generic functions
dbi-pooled-connection: Internal generic functions
disconnect: Internal functions

E
execute: Exported functions
execute-function: Exported functions

F
Function, acquire-connection: Internal functions
Function, check-connection-and-reconnect-if-necessary: Internal functions
Function, connect: Internal functions
Function, disconnect: Internal functions
Function, execute: Exported functions
Function, execute-function: Exported functions
Function, get-connection-pool: Internal functions
Function, initialize-connection-pool: Exported functions
Function, insert: Exported functions
Function, release-connection: Internal functions
Function, select: Exported functions
Function, set-connection-pool: Internal functions
Function, shutdown-connection-pool: Exported functions
Function, update: Exported functions

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

H
host: Internal generic functions
host: Internal generic functions

I
initialize-connection-pool: Exported functions
insert: Exported functions

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

O
owner-thread: Internal generic functions
owner-thread: Internal generic functions

P
parameters: Internal generic functions
parameters: Internal generic functions
password: Internal generic functions
password: Internal generic functions
pool: Internal generic functions
pool: Internal generic functions

R
release-connection: Internal functions

S
schema: Internal generic functions
schema: Internal generic functions
select: Exported functions
semaphore: Internal generic functions
semaphore: Internal generic functions
semaphore: Internal generic functions
set-connection-pool: Internal functions
shutdown-connection-pool: Exported functions

U
update: Exported functions
username: Internal generic functions
username: Internal generic functions

W
with-connection: Internal macros
within-transaction: Exported macros

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

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   @  
C   D   H   O   P   S   U  
Index Entry  Section

@
@trivial-pooled-database-contributing: Exported special variables
@trivial-pooled-database-description: Exported special variables
@trivial-pooled-database-examples: Exported special variables
@trivial-pooled-database-exported: Exported special variables
@trivial-pooled-database-license: Exported special variables
@trivial-pooled-database-manual: Exported special variables

C
connected-p: Internal classes
connection-pool: Internal classes
connection-pool-semaphore: Internal classes

D
dbi-connection: Internal classes
dbi-connection-proxy: Internal classes
dbi-pooled-connection: Internal classes

H
host: Internal classes

O
owner-thread: Internal classes

P
parameters: Internal classes
password: Internal classes

S
schema: Internal classes
semaphore: Internal classes
Slot, connected-p: Internal classes
Slot, connection-pool: Internal classes
Slot, connection-pool-semaphore: Internal classes
Slot, dbi-connection: Internal classes
Slot, dbi-connection-proxy: Internal classes
Slot, dbi-pooled-connection: Internal classes
Slot, host: Internal classes
Slot, owner-thread: Internal classes
Slot, parameters: Internal classes
Slot, password: Internal classes
Slot, schema: Internal classes
Slot, semaphore: Internal classes
Slot, username: Internal classes
Special Variable, @trivial-pooled-database-contributing: Exported special variables
Special Variable, @trivial-pooled-database-description: Exported special variables
Special Variable, @trivial-pooled-database-examples: Exported special variables
Special Variable, @trivial-pooled-database-exported: Exported special variables
Special Variable, @trivial-pooled-database-license: Exported special variables
Special Variable, @trivial-pooled-database-manual: Exported special variables

U
username: Internal classes

Jump to:   @  
C   D   H   O   P   S   U  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   D   P   S   T  
Index Entry  Section

C
Class, connection-parameters: Internal classes
Class, connection-pool: Internal classes
Class, dbi-connection-proxy: Internal classes
Class, dbi-pooled-connection: Internal classes
connection-parameters: Internal classes
connection-pool: Internal classes

D
dbi-connection-proxy: Internal classes
dbi-pooled-connection: Internal classes

P
Package, trivial-pooled-database: The trivial-pooled-database package

S
System, trivial-pooled-database: The trivial-pooled-database system

T
trivial-pooled-database: The trivial-pooled-database system
trivial-pooled-database: The trivial-pooled-database package

Jump to:   C   D   P   S   T