CLSQL Users' Guide


Table of Contents

Preface
1. Introduction
Purpose
History
Prerequisites
ASDF
UFFI
MD5
Supported Common Lisp Implementation
Supported SQL Implementation
Installation
Ensure ASDF is loaded
Build C helper libraries
Add UFFI path
Add MD5 path
Add CLSQL path and load module
Run test suite (optional)
2. CommonSQL Tutorial
Introduction
Data Modeling with CLSQL
Class Relations
Object Creation
Finding Objects
Deleting Objects
Conclusion
I. Connection and Initialisation
DATABASE - The super-type of all CLSQL databases
*CONNECT-IF-EXISTS* - Default value for the if-exists parameter of connect.
*DEFAULT-DATABASE* - The default database object to use.
*DEFAULT-DATABASE-TYPE* - The default database type to use
*INITIALIZED-DATABASE-TYPES* - List of all initialized database types
CONNECT - create a connection to a database.
CONNECTED-DATABASES - Return the list of active database objects.
DATABASE-NAME - Get the name of a database object
DATABASE-NAME-FROM-SPEC - Return the database name string corresponding to the given connection specification.
DATABASE-TYPE - Get the type of a database object.
DISCONNECT - close a database connection
DISCONNECT-POOLED - closes all pooled database connections
FIND-DATABASE - >Locate a database object through it's name.
INITIALIZE-DATABASE-TYPE - Initializes a database type
RECONNECT - Re-establishes the connection between a database object and its RDBMS.
STATUS - Print information about connected databases.
CREATE-DATABASE - create a database
DESTROY-DATABASE - destroys a database
PROBE-DATABASE - tests for existence of a database
LIST-DATABASES - List databases matching the supplied connection spec and database type.
WITH-DATABASE - Execute a body of code with a variable bound to a specified database object.
WITH-DEFAULT-DATABASE - Execute a body of code with *default-database* bound to a specified database.
II. The Symbolic SQL Syntax
ENABLE-SQL-READER-SYNTAX - Globally enable square bracket reader syntax.
DISABLE-SQL-READER-SYNTAX - Globally disable square bracket reader syntax.
LOCALLY-ENABLE-SQL-READER-SYNTAX - Globally enable square bracket reader syntax.
LOCALLY-DISABLE-SQL-READER-SYNTAX - Locally disable square bracket reader syntax.
RESTORE-SQL-READER-SYNTAX-STATE - Restore square bracket reader syntax to its previous state.
SQL - Construct an SQL string from supplied expressions.
SQL-EXPRESSION - Constructs an SQL expression from supplied keyword arguments.
SQL-OPERATION - Constructs an SQL expression from a supplied operator and arguments.
SQL-OPERATOR - Returns the symbol for the supplied SQL operator.
III. Functional Data Definition Language (FDDL)
CREATE-TABLE - Create a database table.
DROP-TABLE - Drop a database table.
LIST-TABLES - Returns a list of database tables.
TABLE-EXISTS-P - Tests for the existence of a database table.
CREATE-VIEW - Create a database view.
DROP-VIEW - Drops a database view.
LIST-VIEWS - Returns a list of database views.
VIEW-EXISTS-P - Tests for the existence of a database view.
CREATE-INDEX - Create a database index.
DROP-INDEX - Drop a database index.
LIST-INDEXES - Returns a list of database indexes.
INDEX-EXISTS-P - Tests for the existence of a database index.
ATTRIBUTE-TYPE - Returns the type of the supplied attribute.
LIST-ATTRIBUTE-TYPES - Returns information about the attribute types of a table.
LIST-ATTRIBUTES - Returns the attributes of a table as a list.
CREATE-SEQUENCE - Create a database sequence.
DROP-SEQUENCE - Drop a database sequence.
LIST-SEQUENCES - Returns a list of database sequences.
SEQUENCE-EXISTS-P - Tests for the existence of a database sequence.
SEQUENCE-LAST - Return the last element in a database sequence.
SEQUENCE-NEXT - Increment the value of a database sequence.
SET-SEQUENCE-POSITION - Sets the position of a database sequence.
IV. Functional Data Manipulation Language (FDML)
*CACHE-TABLE-QUERIES-DEFAULT* -
BIND-PARAMETER -
CACHE-TABLE-QUERIES -
DELETE-RECORDS -
DO-QUERY -
EXECUTE-COMMAND -
FOR-EACH-ROW -
FREE-PREPARED-SQL -
INSERT-RECORDS -
LOOP-FOR-AS-TUPLES - Iterate over all the tuples of a query via a loop clause
MAP-QUERY - Map a function over all the tuples from a query
PREPARE-SQL -
PRINT-QUERY -
QUERY -
RUN-PREPARED-SQL -
SELECT -
TRUNCATE-DATABASE -
UPDATE-RECORDS -
V. Transaction Handling
ADD-TRANSACTION-COMMIT-HOOK -
ADD-TRANSACTION-ROLLBACK-HOOK -
COMMIT -
IN-TRANSACTION-P -
ROLLBACK -
SET-AUTOCOMMIT -
START-TRANSACTION -
WITH-TRANSACTION -
VI. Object Oriented Data Definition Language (OODDL)
STANDARD-DB-OBJECT - Superclass for all CLSQL View Classes.
*DEFAULT-VARCHAR-LENGTH* -
CREATE-VIEW-FROM-CLASS -
DEF-VIEW-CLASS -
DROP-VIEW-FROM-CLASS -
LIST-CLASSES -
VII. Object Oriented Data Manipulation Language (OODML)
*DB-AUTO-SYNC* -
*DEFAULT-UPDATE-OBJECTS-MAX-LEN* -
DELETE-INSTANCE-RECORDS -
INSTANCE-REFRESHED -
UPDATE-INSTANCE-FROM-RECORDS -
UPDATE-OBJECTS-JOINS -
UPDATE-RECORD-FROM-SLOT -
UPDATE-RECORD-FROM-SLOTS -
UPDATE-RECORDS-FROM-INSTANCE -
UPDATE-SLOT-FROM-RECORD -
VIII. SQL I/O Recording
ADD-SQL-STREAM -
DELETE-SQL-STREAM -
LIST-SQL-STREAMS -
SQL-RECORDING-P -
SQL-STREAM -
START-SQL-RECORDING -
STOP-SQL-RECORDING -
IX. CLSQL Condition System
*BACKEND-WARNING-BEHAVIOR* -
SQL-CONDITION - the super-type of all CLSQL-specific conditions
SQL-ERROR - the super-type of all CLSQL-specific errors
SQL-WARNING - the super-type of all CLSQL-specific warnings
SQL-DATABASE-WARNING - Used to warn while accessing a CLSQL database.
SQL-USER-ERROR - condition representing errors because of invalid parameters from the library user.
SQL-DATABASE-ERROR - condition representing errors during query or command execution
SQL-CONNECTION-ERROR - condition representing errors during connection
SQL-DATABASE-DATA-ERROR - Used to signal an error with the SQL data passed to a database.
SQL-TEMPORARY-ERROR - Used to signal a temporary error in the database backend.
SQL-TIMEOUT-ERROR - condition representing errors when a connection times out.
SQL-FATAL-ERROR - condition representing a fatal error in a database connection
X. Large Object Support
CREATE-LARGE-OBJECT -
DELETE-LARGE-OBJECT -
READ-LARGE-OBJECT -
WRITE-LARGE-OBJECT -
XI. CLSQL-SYS
DATABASE-INITIALIZE-DATABASE-TYPE - Back-end part of initialize-database-type.
XII. Index
Alphabetical Index for package CLSQL - Clickable index of all symbols
A. Database Back-ends
PostgreSQL
Libraries
Initialization
Connection Specification
PostgreSQL Socket
Libraries
Initialization
Connection Specification
MySQL
Libraries
Initialization
Connection Specification
ODBC
Libraries
Initialization
Connection Specification
AODBC
Libraries
Initialization
Connection Specification
SQLite
Libraries
Initialization
Connection Specification
Oracle
Libraries
Initialization
Connection Specification
Glossary