The clsql Reference Manual

This is the clsql Reference Manual, version 6.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Aug 15 04:40:56 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 clsql

Common Lisp SQL Interface library

Maintainer

Kevin M. Rosenberg <>

Author

Kevin Rosenberg <>

License

Lessor Lisp General Public License

Long Description

A Common Lisp interface to SQL RDBMS based on
the Xanalys CommonSQL interface for Lispworks. It provides low-level database interfaces as well as a functional and an object oriented interface.

Version

6.4

Source

clsql.asd.

Child Component

sql (module).


3 Modules

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


3.1 clsql/sql

Source

clsql.asd.

Parent Component

clsql (system).

Child Components

3.2 clsql/sql/base

Source

clsql.asd.

Parent Component

sql (module).

Child Components

3.3 clsql/sql/database

Dependency

base (module).

Source

clsql.asd.

Parent Component

sql (module).

Child Components

3.4 clsql/sql/syntax

Dependency

database (module).

Source

clsql.asd.

Parent Component

sql (module).

Child Components

3.5 clsql/sql/functional

Dependency

syntax (module).

Source

clsql.asd.

Parent Component

sql (module).

Child Components

3.6 clsql/sql/object

Dependency

functional (module).

Source

clsql.asd.

Parent Component

sql (module).

Child Components

3.7 clsql/sql/generic

Dependency

functional (module).

Source

clsql.asd.

Parent Component

sql (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 clsql/clsql.asd

Source

clsql.asd.

Parent Component

clsql (system).

ASDF Systems

clsql.

Packages

clsql-system.


4.1.2 clsql/sql/base/cmucl-compat.lisp

Source

clsql.asd.

Parent Component

base (module).

Packages

cmucl-compat.

Public Interface

4.1.3 clsql/sql/base/package.lisp

Source

clsql.asd.

Parent Component

base (module).

Packages

4.1.4 clsql/sql/base/kmr-mop.lisp

Dependency

package.lisp (file).

Source

clsql.asd.

Parent Component

base (module).

Internals

4.1.5 clsql/sql/base/base-classes.lisp

Dependency

package.lisp (file).

Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.6 clsql/sql/base/conditions.lisp

Dependency

base-classes.lisp (file).

Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.7 clsql/sql/base/db-interface.lisp

Dependency

conditions.lisp (file).

Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.8 clsql/sql/base/decimals.lisp

Dependencies
Source

clsql.asd.

Parent Component

base (module).

Packages

decimals.

Public Interface
Internals

4.1.9 clsql/sql/base/utils.lisp

Dependencies
Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.10 clsql/sql/base/time.lisp

Dependencies
Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.11 clsql/sql/base/generics.lisp

Dependency

package.lisp (file).

Source

clsql.asd.

Parent Component

base (module).

Public Interface
Internals

4.1.12 clsql/sql/database/initialize.lisp

Source

clsql.asd.

Parent Component

database (module).

Public Interface

4.1.13 clsql/sql/database/database.lisp

Dependency

initialize.lisp (file).

Source

clsql.asd.

Parent Component

database (module).

Public Interface
Internals

4.1.14 clsql/sql/database/recording.lisp

Dependency

database.lisp (file).

Source

clsql.asd.

Parent Component

database (module).

Public Interface
Internals

4.1.15 clsql/sql/database/pool.lisp

Dependency

database.lisp (file).

Source

clsql.asd.

Parent Component

database (module).

Public Interface
Internals

4.1.16 clsql/sql/syntax/expressions.lisp

Source

clsql.asd.

Parent Component

syntax (module).

Public Interface
Internals

4.1.17 clsql/sql/syntax/operations.lisp

Dependency

expressions.lisp (file).

Source

clsql.asd.

Parent Component

syntax (module).

Public Interface
Internals

4.1.18 clsql/sql/syntax/syntax.lisp

Dependency

operations.lisp (file).

Source

clsql.asd.

Parent Component

syntax (module).

Public Interface
Internals

4.1.19 clsql/sql/functional/fdml.lisp

Source

clsql.asd.

Parent Component

functional (module).

Public Interface
Internals

4.1.20 clsql/sql/functional/transaction.lisp

Dependency

fdml.lisp (file).

Source

clsql.asd.

Parent Component

functional (module).

Public Interface
Internals

4.1.21 clsql/sql/functional/loop-extension.lisp

Dependency

fdml.lisp (file).

Source

clsql.asd.

Parent Component

functional (module).

Packages

ansi-loop.

Internals

4.1.22 clsql/sql/functional/fddl.lisp

Dependency

fdml.lisp (file).

Source

clsql.asd.

Parent Component

functional (module).

Public Interface
Internals

%table-exists-p (method).


4.1.23 clsql/sql/object/metaclasses.lisp

Source

clsql.asd.

Parent Component

object (module).

Public Interface
Internals

4.1.24 clsql/sql/object/ooddl.lisp

Dependency

metaclasses.lisp (file).

Source

clsql.asd.

Parent Component

object (module).

Public Interface
Internals

4.1.25 clsql/sql/object/oodml.lisp

Dependency

ooddl.lisp (file).

Source

clsql.asd.

Parent Component

object (module).

Public Interface
Internals

4.1.26 clsql/sql/generic/generic-postgresql.lisp

Source

clsql.asd.

Parent Component

generic (module).

Public Interface
Internals

4.1.27 clsql/sql/generic/generic-odbc.lisp

Source

clsql.asd.

Parent Component

generic (module).

Public Interface
Internals

4.1.28 clsql/sql/generic/sequences.lisp

Source

clsql.asd.

Parent Component

generic (module).

Public Interface
Internals

4.1.29 clsql/sql/generic/command-object.lisp

Source

clsql.asd.

Parent Component

generic (module).

Public Interface

5 Packages

Packages are listed by definition order.


5.1 cmucl-compat

Source

cmucl-compat.lisp.

Use List

common-lisp.

Public Interface

5.2 ansi-loop

Source

loop-extension.lisp.

Internals

loop-gentemp (function).


5.3 clsql-sys

This is the INTERNAL SQL-Interface package of CLSQL.

Source

package.lisp.

Use List
  • common-lisp.
  • sb-mop.
Public Interface
Internals

5.4 clsql-user

This is the user package with CLSQL symbols.

Source

package.lisp.

Use List

common-lisp.


5.5 decimals

Source

decimals.lisp.

Use List

common-lisp.

Public Interface
Internals

5.6 clsql

This is the user package with CLSQL symbols.

Source

package.lisp.

Use List

common-lisp.


5.7 clsql-system

Source

clsql.asd.

Use List
  • asdf/interface.
  • common-lisp.

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: *backend-warning-behavior*

Action to perform on warning messages from backend. Default is to :warn. May also be set to :error to signal an error
or :ignore/nil to silently ignore the warning.

Package

clsql-sys.

Source

conditions.lisp.

Special Variable: *cache-table-queries-default*

Specifies the default behaivour for caching of attribute types. Meaningful values are t, nil and :flush as described for the action argument to CACHE-TABLE-QUERIES.

Package

clsql-sys.

Source

fddl.lisp.

Special Variable: *connect-if-exists*

Default value for the if-exists keyword argument in calls to CONNECT. Meaningful values are :new, :warn-new, :error, :warn-old and :old.

Package

clsql-sys.

Source

database.lisp.

Special Variable: *db-auto-sync*

A non-nil value means that creating View Class instances or setting their slots automatically creates/updates the corresponding records in the underlying database.

Package

clsql-sys.

Source

ooddl.lisp.

Special Variable: *db-pool-max-free-connections*

Threshold of free-connections in the pool before we disconnect a database rather than returning it to the pool. NIL for no limit. This is really a heuristic that should, on avg keep the free connections about this size.

Package

clsql-sys.

Source

pool.lisp.

Special Variable: *default-caching*

Controls whether SELECT caches objects by default. The CommonSQL specification states caching is on by default.

Package

clsql-sys.

Source

oodml.lisp.

Special Variable: *default-database*

Specifies the default database to be used.

Package

clsql-sys.

Source

database.lisp.

Special Variable: *default-database-type*

Designates the default database type which is initialised by the function INITIALISE-DATABASE-TYPE.

Package

clsql-sys.

Source

initialize.lisp.

Special Variable: *default-string-length*

The length of a string which does not have a user-specified length.

Package

clsql-sys.

Source

ooddl.lisp.

Special Variable: *default-update-objects-max-len*

The default value to use for the MAX-LEN keyword argument to UPDATE-OBJECT-JOINS.

Package

clsql-sys.

Source

oodml.lisp.

Special Variable: *foreign-library-search-paths*

A list of pathnames denoting directories where CLSQL will look for foreign libraries (in addition to the default places).

Package

clsql-sys.

Source

db-interface.lisp.

Special Variable: *initialized-database-types*

A list of database types which have currently been initialised by calling INITIALIZE-DATABASE-TYPE.

Package

clsql-sys.

Source

initialize.lisp.

Special Variable: *loaded-database-types*

Contains a list of database types which have been defined/loaded.

Package

clsql-sys.

Source

initialize.lisp.

Special Variable: *old-sequence-names*

Should CLSQL use its old sequence naming scheme _CLSQL_SEQ_{table} instead of the current scheme {table}_CLSQL_SEQ

Package

clsql-sys.

Source

sequences.lisp.


6.1.2 Macros

Macro: check-connection-spec (connection-spec database-type template)

Check the connection specification against the provided template, and signal an sql-user-error if they don’t match. This function is called by database backends.

Package

clsql-sys.

Source

database.lisp.

Macro: def-view-class (class supers slots &rest cl-options)

Creates a View Class called CLASS whose slots SLOTS can map onto the attributes of a table in a database. If SUPERS is nil then the superclass of CLASS will be STANDARD-DB-OBJECT, otherwise SUPERS is a list of superclasses for CLASS which must include STANDARD-DB-OBJECT or a descendent of this class. The syntax of DEFCLASS is extended through the addition of a class option :base-table which defines the database table onto which the View Class maps and which defaults to CLASS. The DEFCLASS syntax is also extended through additional slot
options. The :db-kind slot option specifies the kind of DB mapping which is performed for this slot and defaults to :base which indicates that the slot maps to an ordinary column of the database table. A :db-kind value of :key indicates that this slot is a special kind of :base slot which maps onto a column which is one of the unique keys for the database table, the value :join indicates this slot represents a join onto another View Class which contains View Class objects, and the value :virtual indicates a standard CLOS slot which does not map onto columns of the database table. If a slot is specified with :db-kind :join, the slot option :db-info contains a list which specifies the nature of the join. For slots of :db-kind :base or :key,
the :type slot option has a special interpretation such that Lisp types, such as string, integer and float are automatically converted into appropriate SQL types for the column onto which the slot maps. This behaviour may be over-ridden using
the :db-type slot option which is a string specifying the vendor-specific database type for this slot’s column definition in the database. The :column slot option specifies the name of the SQL column which the slot maps onto, if :db-kind is
not :virtual, and defaults to the slot name. The :void-value slot option specifies the value to store if the SQL value is NULL and defaults to NIL. The :db-constraints slot option is a string representing an SQL table constraint expression or a list of such strings.

Package

clsql-sys.

Source

ooddl.lisp.

Macro: define-decimal-formatter (name &body keyword-arguments)

Define a decimal number formatter function to use with the ‘~/‘
directive of ‘cl:format‘. The valid format is this:

(define-decimal-formatter name
(:keyword form)
...)

_Name_ is the symbol that names the function. _Keyword_ must be a valid keyword argument for the ‘format-decimal-number‘ function (see its documentation for more information). _Form_ is evaluated and the value
is used with the _keyword_ argument. Macro’s side effect is that global function _name_ is defined. It can be used with the ‘~/‘ directive of ‘cl:format‘ function.

Examples:

(define-decimal-formatter my-formatter
(:round-magnitude -6)
(:decimal-separator ",")
(:integer-group-separator " ")
(:integer-minimum-width 4)
(:fractional-group-separator " ")
(:fractional-minimum-width 10)
(:show-trailing-zeros t))
=> MY-FORMATTER

(format nil "~/my-formatter/" 10/6)
=> " 1,666 667 "

(format nil "~/my-formatter/" 100/8)
=> " 12,500 000 "

The ‘~/‘ directive function call can optionally take up to three arguments to override the defaults:

~round-magnitude,integer-minimum-width,fractional-minimum-width/FUNCTION/

For example:

(format nil "~-2,3,4/my-formatter/" 10/6)
=> " 1,67 "

Package

decimals.

Source

decimals.lisp.

Macro: disable-sql-reader-syntax ()

Turns off the SQL reader syntax setting the syntax state such that if the syntax is subsequently enabled, RESTORE-SQL-READER-SYNTAX-STATE will disable it again.

Package

clsql-sys.

Source

syntax.lisp.

Macro: do-query (((&rest args) query-expression &key database result-types) &body body)

Repeatedly executes BODY within a binding of ARGS on the fields of each row selected by the SQL query QUERY-EXPRESSION, which may be a string or a symbolic SQL expression, in DATABASE which defaults to *DEFAULT-DATABASE*. The values returned by the execution of BODY are returned. RESULT-TYPES is a list of symbols which specifies the lisp type for each field returned by QUERY-EXPRESSION. If RESULT-TYPES is nil all results are returned as strings whereas the default value of :auto means that the lisp types are automatically computed for each field.

Package

clsql-sys.

Source

fdml.lisp.

Macro: enable-sql-reader-syntax ()

Turns on the SQL reader syntax setting the syntax state such that if the syntax is subsequently disabled, RESTORE-SQL-READER-SYNTAX-STATE will enable it again.

Package

clsql-sys.

Source

syntax.lisp.

Macro: file-enable-sql-reader-syntax ()

Turns on the SQL reader syntax for the rest of the file. The CL spec says that when finished loading a file the original *readtable* is restored. clhs COMPILE-FILE

Package

clsql-sys.

Source

syntax.lisp.

Macro: in (obj &rest choices)
Package

clsql-sys.

Source

utils.lisp.

Macro: locally-disable-sql-reader-syntax ()

Turns off the SQL reader syntax without changing the syntax state such that RESTORE-SQL-READER-SYNTAX-STATE will re-establish the current syntax state.

Package

clsql-sys.

Source

syntax.lisp.

Macro: locally-enable-sql-reader-syntax ()

Turns on the SQL reader syntax without changing the syntax state such that RESTORE-SQL-READER-SYNTAX-STATE will re-establish the current syntax state.

Package

clsql-sys.

Source

syntax.lisp.

Macro: restore-sql-reader-syntax-state ()

Enables the SQL reader syntax if ENABLE-SQL-READER-SYNTAX has been called more recently than DISABLE-SQL-READER-SYNTAX and otherwise disables the SQL reader syntax. By default, the SQL reader syntax is disabled.

Package

clsql-sys.

Source

syntax.lisp.

Macro: shrink-vector (vec len)
Package

cmucl-compat.

Source

cmucl-compat.lisp.

Macro: with-database ((db-var connection-spec &key make-default pool if-exists database-type encoding) &body body)

Evaluate the body in an environment, where DB-VAR is bound to the database connection given by CONNECTION-SPEC and CONNECT-ARGS. The connection is automatically closed or released to the pool on exit from the body. MAKE-DEFAULT has a default value of NIL.

Package

clsql-sys.

Source

database.lisp.

Macro: with-default-database ((database) &rest body)

Perform BODY with DATABASE bound as *default-database*.

Package

clsql-sys.

Source

database.lisp.

Macro: with-process-lock ((lock desc) &body body)
Package

clsql-sys.

Source

utils.lisp.

Macro: with-transaction ((&key database) &body body)

Starts a transaction in the database specified by DATABASE, which is *DEFAULT-DATABASE* by default, and executes BODY within that transaction. If BODY aborts or throws, DATABASE is rolled back and otherwise the transaction is committed.

Package

clsql-sys.

Source

transaction.lisp.

Macro: without-interrupts (&body body)
Package

clsql-sys.

Source

utils.lisp.


6.1.3 Ordinary functions

Function: add-sql-stream (stream &key type database)

Adds the supplied stream STREAM (or T for *standard-output*) as a component of the recording broadcast stream for the SQL recording type specified by TYPE on DATABASE which defaults to *DEFAULT-DATABASE*. TYPE must be one of :commands, :results, or :both, defaulting to :commands, depending on whether the stream is to be added for recording SQL commands, results or both.

Package

clsql-sys.

Source

recording.lisp.

Function: add-transaction-commit-hook (commit-hook &key database)

Adds COMMIT-HOOK, which should a designator for a function with no required arguments, to the list of hooks run when COMMIT is called on DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

transaction.lisp.

Function: add-transaction-rollback-hook (rollback-hook &key database)

Adds ROLLBACK-HOOK, which should a designator for a function with no required arguments, to the list of hooks run when ROLLBACK is called on DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

transaction.lisp.

Function: attribute-type (attribute table &key owner database)

Returns a keyword representing the vendor-specific field type of the supplied attribute ATTRIBUTE in the table specified by TABLE in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that the attribute specified by ATTRIBUTE, if it exists, must be user owned else nil is returned. If OWNER is a string denoting a user name, the attribute, if it exists, must be owned by OWNER else nil is returned, whereas if OWNER is :all then the attribute, if it exists, will be returned regardless of its owner.

Package

clsql-sys.

Source

fddl.lisp.

Function: bind-parameter (prepared-stmt position value)

Sets the value of a parameter is in prepared statement.

Package

clsql-sys.

Source

fdml.lisp.

Function: cache-table-queries (table &key action database)

Controls the caching of attribute type information on the table specified by TABLE in DATABASE which defaults to *DEFAULT-DATABASE*. ACTION specifies the caching behaviour to adopt. If its value is t then attribute type information is cached whereas if its value is nil then attribute type information is not cached. If ACTION is :flush then all existing type information in the cache for TABLE is removed, but caching is still enabled. TABLE may be a string representing a table for which the caching action is to be taken while the caching action is applied to all tables if TABLE is t. Alternativly, when TABLE is :default, the default caching action specified by *CACHE-TABLE-QUERIES-DEFAULT* is applied to all table for which a caching action has not been explicitly set.

Package

clsql-sys.

Source

fddl.lisp.

Function: command-object (expression &optional parameters prepared-name)
Package

clsql-sys.

Source

command-object.lisp.

Function: command-output (control-string &rest args)
Package

clsql-sys.

Source

utils.lisp.

Function: commit (&key database)

If DATABASE, which defaults to *DEFAULT-DATABASE*, is currently within the scope of a transaction, commits changes made since the transaction began.

Package

clsql-sys.

Source

transaction.lisp.

Function: connect (connection-spec &key if-exists make-default pool database-type encoding)

Connects to a database of the supplied DATABASE-TYPE which defaults to *DEFAULT-DATABASE-TYPE*, using the type-specific connection specification CONNECTION-SPEC. The value of IF-EXISTS, which defaults to *CONNECT-IF-EXISTS*, determines what happens if a connection to the database specified by CONNECTION-SPEC is already established. A value of :new means create a new connection. A value of :warn-new means warn the user and create a new connect. A value of :warn-old means warn the user and use the old connection. A value of :error means fail, notifying the user. A value of :old means return the old connection. MAKE-DEFAULT is t by default which means that *DEFAULT-DATABASE* is set to the new connection, otherwise *DEFAULT-DATABASE* is not changed. If POOL is t the connection will be taken from the general pool, if POOL is a CONN-POOL object the connection will be taken from this pool.

Package

clsql-sys.

Source

database.lisp.

Function: connected-databases ()

Returns the list of active database objects.

Package

clsql-sys.

Source

database.lisp.

Function: convert-to-db-default-case (str database)
Package

clsql-sys.

Source

utils.lisp.

Function: create-database (connection-spec &key database-type)

This function creates a database in the database system specified by DATABASE-TYPE.

Package

clsql-sys.

Source

database.lisp.

Function: create-index (name &key on unique attributes database)

Creates an index called NAME on the table specified by ON in DATABASE which default to *DEFAULT-DATABASE*. The table attributes to use in constructing the index NAME are specified by ATTRIBUTES. The UNIQUE argument is nil by default but if it has a non-nil value then the indexed attributes must have unique values.

Package

clsql-sys.

Source

fddl.lisp.

Function: create-large-object (&key database)

Creates a new large object in the database and returns the object identifier

Package

clsql-sys.

Source

fdml.lisp.

Function: create-sequence (name &key database)

Creates a sequence called NAME in DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

fddl.lisp.

Function: create-table (name description &key database constraints transactions)

Creates a table called NAME, which may be a string, symbol or SQL table identifier, in DATABASE which defaults to *DEFAULT-DATABASE*. DESCRIPTION is a list whose elements are lists containing the attribute names, types, and other constraints such as not-null or primary-key for each column in the table. CONSTRAINTS is a string representing an SQL table constraint expression or a list of such strings. With MySQL databases, if TRANSACTIONS is t an InnoDB table is created which supports transactions.

Package

clsql-sys.

Source

fddl.lisp.

Function: create-view (name &key as column-list with-check-option database)

Creates a view called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. The view is created using the query AS and the columns of the view may be specified using the COLUMN-LIST parameter. The WITH-CHECK-OPTION is nil by default but if it has a non-nil value, then all insert/update commands on the view are checked to ensure that the new data satisfy the query AS.

Package

clsql-sys.

Source

fddl.lisp.

Function: create-view-from-class (view-class-name &key database transactions)

Creates a table as defined by the View Class VIEW-CLASS-NAME in DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

ooddl.lisp.

Function: current-day ()
Package

clsql-sys.

Source

time.lisp.

Function: current-month ()
Package

clsql-sys.

Source

time.lisp.

Function: current-year ()
Package

clsql-sys.

Source

time.lisp.

Function: date+ (date &rest durations)

Add each DURATION to DATE, returning a new date value.
Note that (barring daylight saving time) 12h + 12h will result in a new day, but doing
it as separate calculations will not, as the time is chopped to a date before being returned.

Package

clsql-sys.

Source

time.lisp.

Function: date- (date &rest durations)

Subtract each DURATION to DATE, returning a new date value.
Note that (barring daylight saving time) 12h + 12h will result in a new day, but doing
it as separate calculations will not, as the time is chopped to a date before being returned.

Package

clsql-sys.

Source

time.lisp.

Function: date-compare (date-a date-b)
Package

clsql-sys.

Source

time.lisp.

Function: date-difference (date1 date2)

Returns a DURATION representing the difference between TIME1 and TIME2.

Package

clsql-sys.

Source

time.lisp.

Function: date-dow (date)
Package

clsql-sys.

Source

time.lisp.

Function: date-element (date element)
Package

clsql-sys.

Source

time.lisp.

Function: date-max (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: date-min (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Reader: date-mjd (instance)
Writer: (setf date-mjd) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

mjd.

Function: date-p (object)
Package

clsql-sys.

Source

time.lisp.

Function: date-ymd (date)
Package

clsql-sys.

Source

time.lisp.

Function: date< (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: date<= (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: date= (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: date> (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: date>= (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: db-datestring (date)
Package

clsql-sys.

Source

time.lisp.

Function: db-timestring (time &key stream)

return the string to store the given time in the database

Package

clsql-sys.

Source

time.lisp.

Function: decode-date (date)

returns the decoded date as multiple values: day month year integer day-of-week

Package

clsql-sys.

Source

time.lisp.

Function: decode-time (time)

returns the decoded time as multiple values: usec, second, minute, hour, day, month, year, integer day-of-week

Package

clsql-sys.

Source

time.lisp.

Function: delete-large-object (object-id &key database)

Deletes the large object in the database

Package

clsql-sys.

Source

fdml.lisp.

Function: delete-records (&key from where database)

Deletes records satisfying the SQL expression WHERE from the table specified by FROM in DATABASE specifies a database which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

fdml.lisp.

Function: delete-sql-stream (stream &key type database)

Removes the supplied stream STREAM from the recording broadcast stream for the SQL recording type specified by TYPE on DATABASE which defaults to *DEFAULT-DATABASE*. TYPE must be one
of :commands, :results, or :both, defaulting to :commands, depending on whether the stream is to be added for recording SQL commands, results or both.

Package

clsql-sys.

Source

recording.lisp.

Function: destroy-database (connection-spec &key database-type)

This function destroys a database in the database system specified by DATABASE-TYPE.

Package

clsql-sys.

Source

database.lisp.

Function: disconnect (&key database error)

Closes the connection to DATABASE and resets *DEFAULT-DATABASE* if that database was disconnected. If DATABASE is a database instance, this object is closed. If DATABASE is a string, then a connected database whose name matches DATABASE is sought in the list of connected databases. If no matching database is found and ERROR and DATABASE are both non-nil an error is signaled, otherwise nil is returned. If the database is from a pool it will be released to this pool.

Package

clsql-sys.

Source

database.lisp.

Function: disconnect-pooled (&optional clear)

Disconnects all connections in the pool. When clear, also deletes the pool objects.

Package

clsql-sys.

Source

pool.lisp.

Function: drop-index (name &key if-does-not-exist on database)

Drops the index called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. If the index does not exist and IF-DOES-NOT-EXIST is :ignore then DROP-INDEX returns nil whereas an error is signalled if IF-DOES-NOT-EXIST is :error. The argument ON allows the optional specification of a table to drop the index from.

Package

clsql-sys.

Source

fddl.lisp.

Function: drop-sequence (name &key if-does-not-exist database)

Drops the sequence called NAME from DATABASE which defaults to *DEFAULT-DATABASE*. If the sequence does not exist and IF-DOES-NOT-EXIST is :ignore then DROP-SEQUENCE returns nil whereas an error is signalled if IF-DOES-NOT-EXIST is :error.

Package

clsql-sys.

Source

fddl.lisp.

Function: drop-table (name &key if-does-not-exist database owner)

Drops the table called NAME from DATABASE which defaults to *DEFAULT-DATABASE*. If the table does not exist and IF-DOES-NOT-EXIST is :ignore then DROP-TABLE returns nil whereas an error is signalled if IF-DOES-NOT-EXIST is :error.

Package

clsql-sys.

Source

fddl.lisp.

Function: drop-view (name &key if-does-not-exist database)

Drops the view called NAME from DATABASE which defaults to *DEFAULT-DATABASE*. If the view does not exist and IF-DOES-NOT-EXIST is :ignore then DROP-VIEW returns nil whereas an error is signalled if IF-DOES-NOT-EXIST is :error.

Package

clsql-sys.

Source

fddl.lisp.

Function: drop-view-from-class (view-class-name &key database owner)

Removes a table defined by the View Class VIEW-CLASS-NAME from DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

ooddl.lisp.

Function: duration+ (time &rest durations)

Add each DURATION to TIME, returning a new wall-time value.

Package

clsql-sys.

Source

time.lisp.

Reader: duration-day (instance)
Writer: (setf duration-day) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

day.

Reader: duration-hour (instance)
Writer: (setf duration-hour) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

hour.

Reader: duration-minute (instance)
Writer: (setf duration-minute) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

minute.

Reader: duration-month (instance)
Writer: (setf duration-month) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

month.

Function: duration-reduce (duration precision &optional round)
Package

clsql-sys.

Source

time.lisp.

Reader: duration-second (instance)
Writer: (setf duration-second) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

second.

Function: duration-timestring (duration)
Package

clsql-sys.

Source

time.lisp.

Reader: duration-year (instance)
Writer: (setf duration-year) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

year.

Function: duration< (duration-a duration-b)
Package

clsql-sys.

Source

time.lisp.

Function: duration<= (duration-a duration-b)
Package

clsql-sys.

Source

time.lisp.

Function: duration= (duration-a duration-b)
Package

clsql-sys.

Source

time.lisp.

Function: duration> (x y)
Package

clsql-sys.

Source

time.lisp.

Function: duration>= (x y)
Package

clsql-sys.

Source

time.lisp.

Function: encoding (db)
Package

clsql-sys.

Source

database.lisp.

Function: (setf encoding) (db)
Package

clsql-sys.

Source

database.lisp.

Function: ensure-keyword (name)

Returns keyword for a name.

Package

clsql-sys.

Source

utils.lisp.

Function: extract-roman (string)
Package

clsql-sys.

Source

time.lisp.

Function: find-database (database &key errorp db-type)

Returns the connected databases of type DB-TYPE whose names match the string DATABASE. If DATABASE is a database object, it is returned. If DB-TYPE is nil all databases matching the string DATABASE are considered. If no matching databases are found and ERRORP is nil then nil is returned. If ERRORP is nil and one or more matching databases are found, then the most recently connected database is returned as a first value and the number of matching databases is returned as a second value. If no, or more than one, matching databases are found and ERRORP is true, an error is signalled.

Package

clsql-sys.

Source

database.lisp.

Function: float-to-sql-string (num)

Convert exponent character for SQL

Package

clsql-sys.

Source

utils.lisp.

Function: format-date (stream date &key format date-separator internal-separator)

produces on stream the datestring corresponding to the date with the given options

Package

clsql-sys.

Source

time.lisp.

Function: format-decimal-number (number &key round-magnitude rounder decimal-separator integer-group-separator integer-group-digits integer-minimum-width integer-pad-char fractional-group-separator fractional-group-digits fractional-minimum-width fractional-pad-char show-trailing-zeros positive-sign negative-sign zero-sign)

Apply specified decimal number formatting rules to _number_ and return a formatted string.

The second return value is (almost) the same formatted string divided into four strings. It’s a list of four strings: sign, integer part, decimal separator and fractional part. Formatting arguments _integer-minimum-width_ and _fractional-minimum-width_ do not apply to the second return value. Everything else does.

_Number_ must be of type ‘real‘. This function uses ‘rational‘ types internally. If the given _number_ is a ‘float‘ it is first turned into ‘rational‘ by calling ‘cl:rational‘.

Formatting rules are specified with keyword arguments, as described below. The default value is in parentheses.

* ‘round-magnitude (0)‘

This is the order of magnitude used for rounding. The value must be an integer and it is interpreted as a power of 10.

* ‘show-trailing-zeros (nil)‘

If the value is non-nil print all trailing zeros in fractional part. Examples:

(format-decimal-number 1/5 :round-magnitude -3 :show-trailing-zeros nil)
=> "0.2"

(format-decimal-number 1/5 :round-magnitude -3 :show-trailing-zeros t)
=> "0.200"

* ‘rounder (#’round-half-away-from-zero)‘

The value must be a function (or a symbol naming a function). It is used to round the number to the specified round magnitude. The function must work like ‘cl:truncate‘, ‘cl:floor‘, ‘cl:ceiling‘ and ‘cl:round‘, that is, take two arguments, a number and a divisor, and return the quotient as the first value.

This package introduces another rounding function, ‘round-half-away-from-zero‘, which is used by default. See its documentation for more information.

* ‘decimal-separator (#\.)‘

If the value is non-nil the ‘princ‘ output of the value will be added between integer and fractional parts. Probably the most useful types are ‘character‘ and ‘string‘.

* ‘integer-group-separator (nil)‘
* ‘fractional-group-separator (nil)‘

If the value is non-nil the digits in integer or fractional parts are put in groups. The ‘princ‘ output of the value will be added between digit groups.

* ‘integer-group-digits (3)‘
* ‘fractional-group-digits (3)‘

The value is a positive integer defining the number of digits in groups.

* ‘integer-minimum-width (0)‘
* ‘fractional-minimum-width (0)‘

Format integer or fractional part using minimum of this amount of characters, possibly using some padding characters (see below). _positive-sign_, _negative-sign_ or _zero-sign_ (see below) is included when calculating the width of the integer part. Similarly _decimal-separator_ is included when calculating the width of the fractional part.

* ‘integer-pad-char (#\Space)‘
* ‘fractional-pad-char (#\Space)‘

The value is the padding character which is used to fill _integer-minimum-width_ or _fractional-minimum-width_.

* ‘positive-sign (nil)‘
* ‘negative-sign (#\-)‘
* ‘zero-sign (nil)‘

If values are non-nil these are used as the leading sign for positive, negative and zero numbers. The ‘princ‘ output of the value is used.

Package

decimals.

Source

decimals.lisp.

Function: format-duration (stream duration &key precision)
Package

clsql-sys.

Source

time.lisp.

Function: format-time (stream time &key format date-separator time-separator internal-separator)

produces on stream the timestring corresponding to the wall-time with the given options

Package

clsql-sys.

Source

time.lisp.

Function: free-prepared-sql (prepared-stmt)

Delete the objects associated with a prepared statement.

Package

clsql-sys.

Source

fdml.lisp.

Function: get-date ()

Returns a date for today

Package

clsql-sys.

Source

time.lisp.

Function: get-time ()

Return a pair: (GREGORIAN DAY . TIME-OF-DAY)

Package

clsql-sys.

Source

time.lisp.

Function: getenv (var)

Return the value of the environment variable.

Package

clsql-sys.

Source

utils.lisp.

Function: gregorian-to-mjd (month day year)
Package

clsql-sys.

Source

time.lisp.

Function: in-transaction-p (&key database)

A predicate to test whether DATABASE, which defaults to *DEFAULT-DATABASE*, is currently within the scope of a transaction.

Package

clsql-sys.

Source

transaction.lisp.

Function: index-exists-p (name &key owner database)

Tests for the existence of an SQL index called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only indexes owned by users are examined. If OWNER is a string denoting a user name, only indexes owned by OWNER are examined. If OWNER is :all then all indexes are examined.

Package

clsql-sys.

Source

fddl.lisp.

Function: initialize-database-type (&key database-type)

Initializes the supplied DATABASE-TYPE, if it is not already initialized, as indicated by *INITIALIZED-DATABASE-TYPES* and returns DATABASE-TYPE. *DEFAULT-DATABASE-TYPE* is set to DATABASE-TYPE and, if DATABASE-TYPE has not been initialised, it is added to *INITIALIZED-DATABASE-TYPES*.

Package

clsql-sys.

Source

initialize.lisp.

Function: insert-records (&key into attributes values av-pairs query database)

Inserts records into the table specified by INTO in DATABASE
which defaults to *DEFAULT-DATABASE*. There are five ways of
specifying the values inserted into each row.

In the first VALUES contains a list of values to insert and ATTRIBUTES, AV-PAIRS and QUERY are nil. This can be used when values are supplied for all attributes in INTO.

In the second, ATTRIBUTES is a list of column names, VALUES is a corresponding list of values and AV-PAIRS and QUERY are nil.

In the third, ATTRIBUTES, VALUES and QUERY are nil and AV-PAIRS is a list of (attribute value) pairs, or attribute-value-pair objects.

In the fourth, VALUES, AV-PAIRS and ATTRIBUTES are nil and QUERY is a symbolic SQL query expression in which the selected columns also exist in INTO.

In the fifth method, VALUES and AV-PAIRS are nil and ATTRIBUTES is a list of column names and QUERY is a symbolic SQL query expression which returns values for the specified columns.

Package

clsql-sys.

Source

fdml.lisp.

Function: interval-clear (list time)
Package

clsql-sys.

Source

time.lisp.

Reader: interval-contained (instance)
Writer: (setf interval-contained) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

contained.

Reader: interval-data (instance)
Writer: (setf interval-data) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

data.

Function: interval-edit (list time start end &optional tag)

Attempts to modify the most deeply nested interval in list which begins at time. If no changes are made, returns nil.

Package

clsql-sys.

Source

time.lisp.

Reader: interval-end (instance)
Writer: (setf interval-end) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

end.

Function: interval-match (list time)

Return the index of the first interval in list containing time

Package

clsql-sys.

Source

time.lisp.

Function: interval-push (interval-list interval &optional container-rule)
Package

clsql-sys.

Source

time.lisp.

Function: interval-relation (x y)

Compare the relationship of node x to node y. Returns either :contained :contains :follows :overlaps or :precedes.

Package

clsql-sys.

Source

time.lisp.

Reader: interval-start (instance)
Writer: (setf interval-start) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

start.

Reader: interval-type (instance)
Writer: (setf interval-type) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

type.

Function: is-database-open (database)
Package

clsql-sys.

Source

database.lisp.

Function: iso-timestring (time &key stream)
Package

clsql-sys.

Source

time.lisp.

Function: list-attribute-types (table &key owner database)

Returns a list containing information about the SQL types of each of the attributes in the table specified by TABLE in DATABASE which has a default value of *DEFAULT-DATABASE*. OWNER is nil by default which means that only attributes owned by users are listed. If OWNER is a string denoting a user name, only attributes owned by OWNER are listed. If OWNER is :all then all attributes are listed. The elements of the returned list are lists where the first element is the name of the attribute, the second element is its SQL type, the third is the type precision, the fourth is the scale of the attribute and the fifth is 1 if the attribute accepts null values and otherwise 0.

Package

clsql-sys.

Source

fddl.lisp.

Function: list-attributes (name &key owner database)

Returns a list of strings representing the attributes of table NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only attributes owned by users are listed. If OWNER is a string denoting a user name, only attributes owned by OWNER are listed. If OWNER is :all then all attributes are listed.

Package

clsql-sys.

Source

fddl.lisp.

Function: list-classes (&key test root-class database)

Returns a list of all the View Classes which are connected to DATABASE, which defaults to *DEFAULT-DATABASE*, and which descend from the class ROOT-CLASS and which satisfy the function TEST. By default ROOT-CLASS is STANDARD-DB-OBJECT and TEST is IDENTITY.

Package

clsql-sys.

Source

ooddl.lisp.

Function: list-databases (connection-spec &key database-type)

This function returns a list of databases existing in the database system specified by DATABASE-TYPE.

Package

clsql-sys.

Source

database.lisp.

Function: list-indexes (&key owner database on)

Returns a list of strings representing index names in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only indexes owned by users are listed. If OWNER is a string denoting a user name, only indexes owned by OWNER are listed. If OWNER is :all then all indexes are listed. The keyword argument ON limits the results to indexes on the specified tables. Meaningful values for ON are nil (the default) which means that all tables are considered, a string, symbol or SQL expression representing a table name in DATABASE or a list of such table identifiers.

Package

clsql-sys.

Source

fddl.lisp.

Function: list-sequences (&key owner database)

Returns a list of strings representing sequence names in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only sequences owned by users are listed. If OWNER is a string denoting a user name, only sequences owned by OWNER are listed. If OWNER is :all then all sequences are listed.

Package

clsql-sys.

Source

fddl.lisp.

Function: list-sql-streams (&key type database)

Returns the list of component streams for the broadcast stream recording SQL commands sent to and/or results returned from DATABASE which defaults to *DEFAULT-DATABASE*. TYPE must be one of :commands, :results, or :both, defaulting to :commands, and determines whether the listed streams contain those recording SQL commands, results or both.

Package

clsql-sys.

Source

recording.lisp.

Function: list-tables (&key owner database)

Returns a list of strings representing table names in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only tables owned by users are listed. If OWNER is a string denoting a user name, only tables owned by OWNER are listed. If OWNER is :all then all tables are listed.

Package

clsql-sys.

Source

fddl.lisp.

Function: list-views (&key owner database)

Returns a list of strings representing view names in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only views owned by users are listed. If OWNER is a string denoting a user name, only views owned by OWNER are listed. If OWNER is :all then all views are listed.

Package

clsql-sys.

Source

fddl.lisp.

Function: make-date (&key year month day hour minute second usec offset)
Package

clsql-sys.

Source

time.lisp.

Function: make-duration (&key year month day hour minute second usec)
Package

clsql-sys.

Source

time.lisp.

Function: make-interval (&key start end name contained type data)
Package

clsql-sys.

Source

time.lisp.

Function: make-process-lock (name)
Package

clsql-sys.

Source

utils.lisp.

Function: make-sequence-of-type (type length)

Returns a sequence of the given TYPE and LENGTH.

Package

cmucl-compat.

Source

cmucl-compat.lisp.

Function: make-time (&key year month day hour minute second usec offset)
Package

clsql-sys.

Source

time.lisp.

Function: map-query (output-type-spec function query-expression &key database result-types)

Map the function FUNCTION over the attribute values of each row selected by the SQL query QUERY-EXPRESSION, which may be a string or a symbolic SQL expression, in DATABASE which defaults to *DEFAULT-DATABASE*. The results of the function are collected as specified in OUTPUT-TYPE-SPEC and returned like in
MAP. RESULT-TYPES is a list of symbols which specifies the lisp type for each field returned by QUERY-EXPRESSION. If RESULT-TYPES is nil all results are returned as strings whereas the default value of :auto means that the lisp types are automatically computed for each field.

Package

clsql-sys.

Source

fdml.lisp.

Function: merged-time (day time-of-day)
Package

clsql-sys.

Source

time.lisp.

Function: mjd-to-gregorian (mjd)
Package

clsql-sys.

Source

time.lisp.

Function: month-name (month-index)
Package

clsql-sys.

Source

time.lisp.

Function: number-to-sql-string (num)
Package

clsql-sys.

Source

utils.lisp.

Function: parse-date-time (string)

parses date like 08/08/01, 8.8.2001, eg

Package

clsql-sys.

Source

time.lisp.

Function: parse-datestring (datestring &key start end junk-allowed)

parse a ISO 8601 timestring and return the corresponding date.
Will throw a hissy fit if the date string is a duration. Will ignore any precision beyond day (hour/min/sec/usec).

Package

clsql-sys.

Source

time.lisp.

Function: parse-decimal-number (string &key decimal-separator positive-sign negative-sign start end)

Examine _string_ (or its substring from _start_ to _end_) for a decimal number. Assume that the decimal number is exact and return it as a rational number.

Rules for parsing: First all leading and trailing ‘#\Space‘ characters are stripped. The resulting string may start with a _positive-sign_ or a _negative-sign_ character. The latter causes this function to assume a negative number. The following characters in the string must include one or more digit characters and it may include one _decimal-separator_ character which separates integer and fractional parts. All other characters are illegal. If these rules are not met a ‘decimal-parse-error‘ condition is signaled.

Examples:

(parse-decimal-number "0.2") => 1/5
(parse-decimal-number ".2") => 1/5
(parse-decimal-number "+3.") => 3
(parse-decimal-number " -7 ") => -7

(parse-decimal-number "−12,345"
:decimal-separator #\,
:negative-sign #\−)
=> -2469/200

Package

decimals.

Source

decimals.lisp.

Function: parse-timestring (timestring &key start end junk-allowed)

parse a timestring and return the corresponding wall-time. If the timestring starts with P, read a duration; otherwise read an ISO 8601 formatted date string.

Package

clsql-sys.

Source

time.lisp.

Function: parse-yearstring (string)
Package

clsql-sys.

Source

time.lisp.

Function: prepare-sql (sql-stmt types &key database result-types field-names)

Prepares a SQL statement for execution. TYPES contains a list of types corresponding to the input parameters. Returns a prepared-statement object.

A type can be
:int
:double
:null
(:blob n)
(:string n)

Package

clsql-sys.

Source

fdml.lisp.

Function: print-date (time &optional style)
Package

clsql-sys.

Source

time.lisp.

Function: print-query (query-exp &key titles formats sizes stream database)

Prints a tabular report of the results returned by the SQL query QUERY-EXP, which may be a symbolic SQL expression or a string, in DATABASE which defaults to *DEFAULT-DATABASE*. The report is printed onto STREAM which has a default value of t which means that *STANDARD-OUTPUT* is used. The TITLE argument, which defaults to nil, allows the specification of a list of strings to use as column titles in the tabular output. SIZES accepts a list of column sizes, one for each column selected by QUERY-EXP, to use in formatting the tabular report. The default value of t means that minimum sizes are computed. FORMATS is a list of format strings to be used for printing each column selected by QUERY-EXP. The default value of FORMATS is t meaning that ~A is used to format all columns or ~VA if column sizes are used.

Package

clsql-sys.

Source

fdml.lisp.

Function: probe-database (connection-spec &key database-type)

This function tests for the existence of a database in the database system specified by DATABASE-TYPE.

Package

clsql-sys.

Source

database.lisp.

Function: push-library-path (path)

Adds the pathspec PATH (which should denote a directory) to the list *FOREIGN-LIBRARY-SEARCH-PATHS*.

Package

clsql-sys.

Source

db-interface.lisp.

Function: read-instance-from-stream (stream)
Package

clsql-sys.

Source

oodml.lisp.

Function: read-large-object (object-id &key database)

Reads the large object content

Package

clsql-sys.

Source

fdml.lisp.

Function: reconnect (&key database error force)

Reconnects DATABASE which defaults to *DEFAULT-DATABASE* to the underlying database management system. On success, t is returned and the variable *DEFAULT-DATABASE* is set to the newly reconnected database. If DATABASE is a database instance, this object is closed. If DATABASE is a string, then a connected database whose name matches DATABASE is sought in the list of connected databases. If no matching database is found and ERROR and DATABASE are both non-nil an error is signaled, otherwise nil is returned. When the current database connection cannot be closed, if FORCE is non-nil, as it is by default, the connection is closed and errors are suppressed. If force is nil and the database connection cannot be closed, an error is signalled.

Package

clsql-sys.

Source

database.lisp.

Function: reload-database-types ()

Reloads any foreign code for the loaded database types after a dump.

Package

clsql-sys.

Source

initialize.lisp.

Function: required-argument ()
Package

cmucl-compat.

Source

cmucl-compat.lisp.

Function: reset-command-object (co)

Resets the command object to have no name and to be unprepared
(This is useful if you want to run a command against a second database)

Package

clsql-sys.

Source

command-object.lisp.

Function: result-type-or-lose (type nil-ok)
Package

cmucl-compat.

Source

cmucl-compat.lisp.

Function: roll (date &key year month day second hour minute usec destructive)
Package

clsql-sys.

Source

time.lisp.

Function: roll-to (date size position)
Package

clsql-sys.

Source

time.lisp.

Function: rollback (&key database)

If DATABASE, which defaults to *DEFAULT-DATABASE*, is currently within the scope of a transaction, rolls back changes made since the transaction began.

Package

clsql-sys.

Source

transaction.lisp.

Function: round-half-away-from-zero (number &optional divisor)

Divide _number_ by _divisor_ and round the result to the nearest integer. If the result is half-way between two integers round away from zero. Two values are returned: quotient and remainder.

This is similar to ‘cl:round‘ function except that ‘cl:round‘ rounds to an even integer when number is exactly between two integers. Examples:

(round-half-away-from-zero 3/2) => 2, -1/2
(round 3/2) => 2, -1/2

(round-half-away-from-zero 5/2) => 3, -1/2
(round 5/2) => 2, 1/2

Package

decimals.

Source

decimals.lisp.

Function: run-prepared-sql (prepared-stmt)

Execute the prepared sql statment. All input parameters must be bound.

Package

clsql-sys.

Source

fdml.lisp.

Function: select (&rest select-all-args)

Executes a query on DATABASE, which has a default value of *DEFAULT-DATABASE*, specified by the SQL expressions supplied using the remaining arguments in SELECT-ALL-ARGS. The SELECT argument can be used to generate queries in both functional and object oriented contexts.

In the functional case, the required arguments specify the columns selected by the query and may be symbolic SQL expressions or strings representing attribute identifiers. Type modified identifiers indicate that the values selected from the specified column are converted to the specified lisp type. The keyword arguments ALL, DISTINCT, FROM, GROUP-by, HAVING, ORDER-BY, SET-OPERATION and WHERE are used to specify, using the symbolic SQL syntax, the corresponding components of the SQL query generated by the call to SELECT. RESULT-TYPES is a list of symbols which specifies the lisp type for each field returned by the query. If RESULT-TYPES is nil all results are returned as strings whereas the default value of :auto means that the lisp types are automatically computed for each field. FIELD-NAMES is t by default which means that the second value returned is a list of strings representing the columns selected by the query. If FIELD-NAMES is nil, the list of column names is not returned as a second value.

In the object oriented case, the required arguments to SELECT are symbols denoting View Classes which specify the database tables to query. In this case, SELECT returns a list of View Class instances whose slots are set from the attribute values of the records in the specified table. Slot-value is a legal operator which can be employed as part of the symbolic SQL syntax used in the WHERE keyword argument to SELECT. REFRESH is nil by default which means that the View Class instances returned are retrieved from a cache if an equivalent call to SELECT has previously been issued. If REFRESH is true, the View Class instances returned are updated as necessary from the database and the generic function INSTANCE-REFRESHED is called to perform any necessary operations on the updated instances.

In both object oriented and functional contexts, FLATP has a default value of nil which means that the results are returned as a list of lists. If FLATP is t and only one result is returned for each record selected in the query, the results are returned as elements of a list.

Package

clsql-sys.

Source

oodml.lisp.

Function: sequence-exists-p (name &key owner database)

Tests for the existence of an SQL sequence called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only sequences owned by users are examined. If OWNER is a string denoting a user name, only sequences owned by OWNER are examined. If OWNER is :all then all sequences are examined.

Package

clsql-sys.

Source

fddl.lisp.

Function: sequence-last (name &key database)

Return the last value allocated in the sequence called NAME in DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

fddl.lisp.

Function: sequence-next (name &key database)

Increment and return the next value in the sequence called NAME in DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

fddl.lisp.

Function: set-autocommit (value &key database)

Turns autocommit off for DATABASE if VALUE is NIL, and otherwise turns it on. Returns the old value of autocommit flag. For RDBMS (such as Oracle) which don’t automatically commit changes, turning autocommit on has the effect of explicitly committing changes made whenever SQL statements are executed. Autocommit is turned on by default.

Package

clsql-sys.

Source

transaction.lisp.

Function: set-sequence-position (name position &key database)

Explicitly set the the position of the sequence called NAME in DATABASE, which defaults to *DEFAULT-DATABASE*, to POSITION which is returned.

Package

clsql-sys.

Source

fddl.lisp.

Function: sql (&rest args)

Returns an SQL string generated from the expressions ARGS. The expressions are translated into SQL strings and then concatenated with a single space delimiting each expression. An error of type SQL-USER-ERROR is signalled if any element in ARGS is not of the supported types (a symbol, string, number or symbolic SQL expression) or a list or vector containing only these supported types.

Package

clsql-sys.

Source

syntax.lisp.

Function: sql-* (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-+ (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-- (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-/ (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-< (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-<= (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-<> (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-= (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-== (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-> (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql->= (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-all (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-and (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-any (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-avg (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-between (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-coalesce (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-concat (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-concat-op (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-count (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-distinct (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-escape (identifier)

Change hyphens to underscores, ensure string

Package

clsql-sys.

Source

utils.lisp.

Function: sql-escape-quotes (s)

Escape quotes for SQL string writing

Package

clsql-sys.

Source

utils.lisp.

Function: sql-except (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-exists (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-expression (&key string table alias attribute type)

Returns an SQL expression constructed from the supplied arguments which may be combined as follows: ATTRIBUTE and TYPE; ATTRIBUTE; ALIAS or TABLE and ATTRIBUTE and TYPE; ALIAS or TABLE and ATTRIBUTE; TABLE, ATTRIBUTE and TYPE; TABLE and ATTRIBUTE; TABLE and ALIAS; TABLE; and STRING. An error of type SQL-USER-ERROR is signalled if an unsupported combination of keyword arguments is specified.

Package

clsql-sys.

Source

syntax.lisp.

Function: sql-function (&rest args)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-group-by (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-having (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-in (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-intersect (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-is (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-like (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-limit (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-max (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-min (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-minus (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-not (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-not-null (&optional not-null-thing)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-null (&optional not-null-thing)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-nvl (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-operation (operator &rest args)

Returns an SQL expression constructed from the supplied symbol OPERATOR representing an SQL operator or function and its arguments ARGS. An error of type SQL-USER-ERROR is signalled if OPERATOR is not a symbol representing a supported SQL operator. If OPERATOR is passed the symbol FUNCTION then the first value in ARGS must be a string representing a valid SQL function and the remaining values in ARGS its arguments as strings.

Package

clsql-sys.

Source

syntax.lisp.

Function: sql-operator (operator)

Returns the Lisp symbol corresponding to the SQL operator represented by the symbol OPERATOR. If OPERATOR does not represent a supported SQL operator or is not a symbol, nil is returned.

Package

clsql-sys.

Source

syntax.lisp.

Function: sql-or (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-order-by (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-query (&rest args)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-recording-p (&key type database)

Predicate to test whether the SQL recording specified by TYPE
is currently enabled for DATABASE which defaults to *DEFAULT-DATABASE*. TYPE may be one of :commands, :results, :both or :either, defaulting to :commands, otherwise nil is returned.

Package

clsql-sys.

Source

recording.lisp.

Function: sql-slot-value (classname slot &optional value database)
Package

clsql-sys.

Source

oodml.lisp.

Function: sql-some (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-stream (&key type database)

Returns the broadcast stream used for recording SQL commands sent to or results returned from DATABASE which defaults to *DEFAULT-DATABASE*. TYPE must be one of :commands or :results, defaulting to :commands, and determines whether the stream returned is that used for recording SQL commands or results.

Package

clsql-sys.

Source

recording.lisp.

Function: sql-substr (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-substring (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-sum (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-the (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-union (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-uplike (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-userenv (&rest rest)
Package

clsql-sys.

Source

operations.lisp.

Function: sql-view-class (classname &optional database)
Package

clsql-sys.

Source

oodml.lisp.

Function: start-sql-recording (&key type database)

Starts recording of SQL commands sent to and/or results returned from DATABASE which defaults to *DEFAULT-DATABASE*. The SQL is output on one or more broadcast streams, initially just *STANDARD-OUTPUT*, and the functions ADD-SQL-STREAM and DELETE-SQL-STREAM may be used to add or delete command or result recording streams. The default value of TYPE is :commands which means that SQL commands sent to DATABASE are recorded. If TYPE is :results then SQL results returned from DATABASE are recorded. Both commands and results may be recorded by passing TYPE value of :both.

Package

clsql-sys.

Source

recording.lisp.

Function: start-transaction (&key database)

Starts a transaction block on DATABASE which defaults to *DEFAULT-DATABASE* and which continues until ROLLBACK or COMMIT are called.

Package

clsql-sys.

Source

transaction.lisp.

Function: status (&optional full)

Prints information about the currently connected databases to *STANDARD-OUTPUT*. The argument FULL is nil by default and a value of t means that more detailed information about each database is printed.

Package

clsql-sys.

Source

database.lisp.

Function: stop-sql-recording (&key type database)

Stops recording of SQL commands sent to and/or results returned from DATABASE which defaults to *DEFAULT-DATABASE*. The default value of TYPE is :commands which means that SQL commands sent to DATABASE will no longer be recorded. If TYPE is :results then SQL results returned from DATABASE will no longer be recorded. Recording may be stopped for both commands and results by passing TYPE value of :both.

Package

clsql-sys.

Source

recording.lisp.

Function: symbol-name-default-case (str)
Package

clsql-sys.

Source

utils.lisp.

Function: table-exists-p (name &key owner database)

Tests for the existence of an SQL table called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only tables owned by users are examined. If OWNER is a string denoting a user name, only tables owned by OWNER are examined. If OWNER is :all then all tables are examined.

Package

clsql-sys.

Source

fddl.lisp.

Function: time+ (time &rest durations)

Add each DURATION to TIME, returning a new wall-time value.

Package

clsql-sys.

Source

time.lisp.

Function: time- (time &rest durations)

Subtract each DURATION from TIME, returning a new wall-time value.

Package

clsql-sys.

Source

time.lisp.

Function: time-compare (time-a time-b)
Package

clsql-sys.

Source

time.lisp.

Function: time-difference (time1 time2)

Returns a DURATION representing the difference between TIME1 and TIME2.

Package

clsql-sys.

Source

time.lisp.

Function: time-dow (time)

Return the 0 indexed Day of the week starting with Sunday

Package

clsql-sys.

Source

time.lisp.

Function: time-element (time element)
Package

clsql-sys.

Source

time.lisp.

Function: time-max (number &rest more-numbers)

Returns the greatest of its arguments.

Package

clsql-sys.

Source

time.lisp.

Function: time-min (number &rest more-numbers)

Returns the least of its arguments.

Package

clsql-sys.

Source

time.lisp.

Reader: time-mjd (instance)
Writer: (setf time-mjd) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

mjd.

Function: time-ymd (time)
Package

clsql-sys.

Source

time.lisp.

Function: time< (number &rest more-numbers)

Returns T if its arguments are in strictly increasing order, NIL otherwise.

Package

clsql-sys.

Source

time.lisp.

Function: time<= (number &rest more-numbers)

Returns T if arguments are in strictly non-decreasing order, NIL otherwise.

Package

clsql-sys.

Source

time.lisp.

Function: time= (number &rest more-numbers)

Returns T if all of its arguments are numerically equal, NIL otherwise.

Package

clsql-sys.

Source

time.lisp.

Function: time> (number &rest more-numbers)

Returns T if its arguments are in strictly decreasing order, NIL otherwise.

Package

clsql-sys.

Source

time.lisp.

Function: time>= (number &rest more-numbers)

Returns T if arguments are in strictly non-increasing order, NIL otherwise.

Package

clsql-sys.

Source

time.lisp.

Function: truncate-database (&key database)

Drops all tables, views, indexes and sequences in DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

fddl.lisp.

Function: update-objects-joins (objects &key slots force-p class-name max-len)

Updates from the records of the appropriate database tables the join slots specified by SLOTS in the supplied list of View Class instances OBJECTS.

A simpler method of causing a join-slot to be requeried is to set it to unbound, then request it again. This function has efficiency gains where join-objects are shared among the ‘objects‘ (querying all join-objects, then attaching them appropriately to each of the ‘objects‘)

SLOTS can be one of:

* :immediate (DEFAULT) - refresh join slots created with :retrieval :immediate * :deferred - refresh join slots created with :retrieval :deferred
* :all,t - refresh all join slots regardless of :retrieval
* list of symbols - which explicit slots to refresh
* a single symobl - what slot to refresh

CLASS-NAME is used to specify the View Class of all instance in OBJECTS and default to nil which means that the class of the first instance in OBJECTS is used.

FORCE-P is t by default which means that all join slots are updated whereas a value of nil means that only unbound join slots are updated.

MAX-LEN defaults to *DEFAULT-UPDATE-OBJECTS-MAX-LEN* When non-nil this is essentially a batch size for the max number of objects to query from the database at a time. If we need more than max-len we loop till we have all the objects

Package

clsql-sys.

Source

oodml.lisp.

Function: update-records (table &key attributes values av-pairs where database)

Updates the attribute values of existing records satsifying the SQL expression WHERE in the table specified by TABLE in DATABASE which defaults to *DEFAULT-DATABASE*. There are three ways of specifying the values to update for each row. In the first, VALUES contains a list of values to use in the update and ATTRIBUTES and AV-PAIRS are nil. This can be used when values are supplied for all attributes in TABLE. In the second, ATTRIBUTES is a list of column names, VALUES is a corresponding list of values and AV-PAIRS is nil. In the third, ATTRIBUTES and VALUES are nil and AV-PAIRS is an alist of (attribute value) pairs.

Package

clsql-sys.

Source

fdml.lisp.

Function: utime->time (utime)

Return a pair: (GREGORIAN DAY . TIME-OF-DAY)

Package

clsql-sys.

Source

time.lisp.

Function: view-exists-p (name &key owner database)

Tests for the existence of an SQL view called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default which means that only views owned by users are examined. If OWNER is a string denoting a user name, only views owned by OWNER are examined. If OWNER is :all then all views are examined.

Package

clsql-sys.

Source

fddl.lisp.

Function: week-containing (time)
Package

clsql-sys.

Source

time.lisp.

Function: write-instance-to-stream (obj stream)

Writes an instance to a stream where it can be later be read.
NOTE: an error will occur if a slot holds a value which can not be written readably.

Package

clsql-sys.

Source

oodml.lisp.

Function: write-large-object (object-id data &key database)

Writes data to the large object

Package

clsql-sys.

Source

fdml.lisp.


6.1.4 Generic functions

Generic Reader: attribute-cache (object)
Generic Writer: (setf attribute-cache) (object)
Package

clsql-sys.

Methods
Reader Method: attribute-cache ((database database))
Writer Method: (setf attribute-cache) ((database database))

Internal cache of table attributes. It is keyed by table-name. Values
are a list of ACTION specified for table and any cached value of list-attributes-types.

Source

base-classes.lisp.

Target Slot

attribute-cache.

Generic Reader: bad-component (condition)
Package

clsql-sys.

Methods
Reader Method: bad-component ((condition iso-8601-syntax-error))
Source

time.lisp.

Target Slot

bad-component.

Generic Reader: command-recording-stream (object)
Package

clsql-sys.

Methods
Reader Method: command-recording-stream ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

command-recording-stream.

Generic Writer: (setf command-recording-stream) (object)
Package

clsql-sys.

Methods
Writer Method: (setf command-recording-stream) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

command-recording-stream.

Generic Reader: conn-pool (object)
Package

clsql-sys.

Methods
Reader Method: conn-pool ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

conn-pool.

Generic Writer: (setf conn-pool) (object)
Package

clsql-sys.

Methods
Writer Method: (setf conn-pool) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

conn-pool.

Generic Reader: connection-spec (object)
Package

clsql-sys.

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

automatically generated reader method

Source

pool.lisp.

Target Slot

connection-spec.

Reader Method: connection-spec ((database database))

Required to use connection pool.

Source

base-classes.lisp.

Target Slot

connection-spec.

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

clsql-sys.

Methods
Writer Method: (setf connection-spec) ((conn-pool conn-pool))

automatically generated writer method

Source

pool.lisp.

Target Slot

connection-spec.

Generic Reader: database (condition)
Generic Writer: (setf database) (condition)
Package

clsql-sys.

Methods
Reader Method: database ((condition sql-value-conversion-error))
Writer Method: (setf database) ((condition sql-value-conversion-error))
Source

conditions.lisp.

Target Slot

database.

Reader Method: database ((postgresql-stmt postgresql-stmt))

automatically generated reader method

Source

generic-postgresql.lisp.

Target Slot

database.

Generic Function: database-acquire-from-conn-pool (database)

Acquire a database connection from the pool. This
is a chance to test the connection for validity before returning it to the user. If this function returns NIL or throws an error that database connection is considered bad and we make a new one.

Database objects have a chance to specialize, otherwise the default method uses the database-underlying-type and tries to do something appropriate.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-acquire-from-conn-pool (database)
Source

pool.lisp.

Generic Function: database-attribute-type (attribute table database &key owner)

Return the type of ATTRIBUTE in TABLE. Returns multiple values of TYPE_NAME (keyword) PRECISION SCALE NULLABLE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-attribute-type ((attribute %database-identifier) (table %database-identifier) (database generic-odbc-database) &key owner)
Source

generic-odbc.lisp.

Method: database-attribute-type ((attribute %database-identifier) (table %database-identifier) (database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-attribute-type (attribute table (database database) &key owner)
Method: database-attribute-type (attribute table database &key owner)
Generic Reader: database-autocommit (object)
Package

clsql-sys.

Methods
Reader Method: database-autocommit ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

autocommit.

Generic Writer: (setf database-autocommit) (object)
Package

clsql-sys.

Methods
Writer Method: (setf database-autocommit) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

autocommit.

Generic Function: database-bind-parameter (prepared-stmt position value)

Bind a parameter for a prepared statement.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-bind-parameter ((stmt postgresql-stmt) position value)
Source

generic-postgresql.lisp.

Method: database-bind-parameter (pstmt position value)
Generic Function: database-connect (connection-spec database-type)

Internal generic implementation of connect.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-create (connection-spec type)

Creates a database, returns T if successfull or signals an error.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-create-large-object (database)

Creates a new large object in the database and returns the object identifier

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-create-sequence (name database)

Create a sequence in DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-create-sequence (sequence-name database)
Source

sequences.lisp.

Method: database-create-sequence (sequence-name (database generic-postgresql-database))
Source

generic-postgresql.lisp.

Generic Function: database-delete-large-object (object-id database)

Deletes the large object in the database

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-destroy (connection-spec type)

Destroys (drops) a database, returns T if successfull or signals an error if unable to destory.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-disconnect (database)

Internal generic implementation of disconnect.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-disconnect ((database generic-odbc-database))
Source

generic-odbc.lisp.

Method: database-disconnect :before ((database database))
Method: database-disconnect (database)
Generic Function: database-drop-sequence (name database)

Drop a sequence from DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-drop-sequence (sequence-name database)
Source

sequences.lisp.

Method: database-drop-sequence (sequence-name (database generic-postgresql-database))
Source

generic-postgresql.lisp.

Generic Function: database-dump-result-set (result-set database)

Dumps the received result-set.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-dump-result-set (result-set (database generic-odbc-database))
Source

generic-odbc.lisp.

Method: database-dump-result-set :before (result-set (database database))
Method: database-dump-result-set (result-set database)
Method: database-dump-result-set (result-set (database database))
Generic Function: database-execute-command (sql-expression database)

Internal generic implementation of execute-command.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-execute-command (sql-expression (database generic-odbc-database))
Source

generic-odbc.lisp.

Method: database-execute-command :before (sql-expression (database database))
Method: database-execute-command (sql-expression database)
Method: database-execute-command (sql-expression (database database))
Generic Function: database-free-prepared (prepared-stmt)

Free the resources of a prepared statement.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-free-prepared (pstmt)
Generic Function: database-get-type-specifier (type args database db-underlying-type)

Return the type SQL type specifier as a string, for the given lisp type and parameters.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-get-type-specifier ((type symbol) args database (db-type (eql :mssql)))

Special database types for MSSQL backends

Source

generic-odbc.lisp.

Method: database-get-type-specifier ((type symbol) args database (db-type (eql :postgresql)))

Special database types for POSTGRESQL backends

Source

generic-postgresql.lisp.

Method: database-get-type-specifier ((type symbol) args database db-type)
Source

oodml.lisp.

Method: database-get-type-specifier ((type string) args database db-type)

Pass through the literal type as defined in the type string

Source

oodml.lisp.

Generic Function: database-initialize-database-type (database-type)

The internal generic implementation of initialize-database-type.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-last-auto-increment-id (database table column)
Package

clsql-sys.

Source

generics.lisp.

Methods
Method: database-last-auto-increment-id ((database generic-odbc-database) table column)
Source

generic-odbc.lisp.

Method: database-last-auto-increment-id ((database generic-postgresql-database) table column)
Source

generic-postgresql.lisp.

Generic Function: database-list (connection-spec type)

Lists all databases found for TYPE. May signal an error if unable to communicate with database server.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list (connection-spec (type (eql :postgresql-socket)))
Source

generic-postgresql.lisp.

Method: database-list (connection-spec (type (eql :postgresql)))
Source

generic-postgresql.lisp.

Method: database-list (spec type)
Generic Function: database-list-attributes (table database &key owner)

List all attributes in TABLE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-attributes ((table %database-identifier) (database generic-odbc-database) &key owner)
Source

generic-odbc.lisp.

Method: database-list-attributes ((table %database-identifier) (database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-list-attributes (table (database database) &key owner)
Method: database-list-attributes (table database &key owner)
Generic Function: database-list-indexes (database &key owner)

List all indexes in the DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-indexes ((database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-list-indexes ((database database) &key owner)
Method: database-list-indexes (database &key owner)
Generic Function: database-list-sequences (database &key owner)

List all sequences in DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-sequences (database &key owner)
Source

sequences.lisp.

Method: database-list-sequences ((database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Generic Function: database-list-table-indexes (table database &key owner)

List all indexes for a table in the DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-table-indexes (table (database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-list-table-indexes (table (database database) &key owner)
Method: database-list-table-indexes (table database &key owner)
Generic Function: database-list-tables (database &key owner)

List all tables in the given database

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-tables ((database generic-odbc-database) &key owner)

Since ODBC doesn’t expose the owner we use that parameter to filter on schema since that’s what tends to be exposed. Some DBs like mssql 2000 conflate the two so at least there it works nicely.

Source

generic-odbc.lisp.

Method: database-list-tables ((database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-list-tables ((database database) &key owner)
Method: database-list-tables (database &key owner)
Generic Function: database-list-tables-and-sequences (database &key owner)

List all tables in the given database, may include seqeneces

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-tables-and-sequences (database &key owner)
Method: database-list-tables-and-sequences ((database database) &key owner)
Generic Function: database-list-views (database &key owner)

List all views in the DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-list-views ((database generic-odbc-database) &key owner)

Since ODBC doesn’t expose the owner we use that parameter to filter on schema since that’s what tends to be exposed. Some DBs like mssql 2000 conflate the two so at least there it works nicely.

Source

generic-odbc.lisp.

Method: database-list-views ((database generic-postgresql-database) &key owner)
Source

generic-postgresql.lisp.

Method: database-list-views ((database database) &key owner)
Method: database-list-views (database &key owner)
Generic Reader: database-name (object)

Returns the name of a database.

Package

clsql-sys.

Methods
Reader Method: database-name ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

name.

Generic Function: database-name-from-spec (connection-spec database-type)

Returns the name of the database that would be created if connect was called with the connection-spec.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-output-sql-as-type (type val database db-type)
Package

clsql-sys.

Source

generics.lisp.

Methods
Method: database-output-sql-as-type (type val database db-type)
Source

oodml.lisp.

Generic Function: database-prepare (stmt types database result-types field-names)

Prepare a statement for later execution.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-prepare (sql-stmt types (database generic-postgresql-database) result-types field-names)
Source

generic-postgresql.lisp.

Method: database-prepare (stmt types database result-types field-names)
Method: database-prepare (stmt types (database database) result-types field-names)
Generic Function: database-probe (connection-spec type)

Probes for the existence of a database, returns T if database found or NIL if not found. May signal an error if unable to communicate with database server.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-probe (spec type)
Generic Function: database-query (query-expression database result-types field-names)

Internal generic implementation of query.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-query (query-expression (database generic-odbc-database) result-types field-names)
Source

generic-odbc.lisp.

Method: database-query :before (query-expression (database database) result-set field-names)
Method: database-query (query-expression database result-types field-names)
Method: database-query (query-expression (database database) result-types field-names)
Generic Function: database-query-result-set (query-expression database &key full-set result-types)

Internal generic implementation of query mapping. Starts the query specified by query-expression on the given database and returns a result-set to be used with database-store-next-row and database-dump-result-set to access the returned data. The second value is the number of columns in the result-set, if there are any. If full-set is true, the number of rows in the result-set is returned as a third value, if this is possible (otherwise nil is returned for the third value). This might have memory and resource usage implications, since many databases will require the query to be executed in full to answer this question. If the query produced no results then nil is returned for all values that would have been returned otherwise. If an error occurs during query execution, the function should signal a sql-database-data-error.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-query-result-set ((query-expression string) (database generic-odbc-database) &key full-set result-types)
Source

generic-odbc.lisp.

Method: database-query-result-set ((expr %sql-expression) database &key full-set result-types)
Source

fdml.lisp.

Method: database-query-result-set :before (expr (database database) &key full-set result-types)
Method: database-query-result-set (query-expression database &key full-set result-types)
Method: database-query-result-set (query-expression (database database) &key full-set result-types)
Generic Function: database-read-large-object (object-id database)

Reads the large object content

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-reconnect (database)

Internal generic implementation of reconnect.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-reconnect (database)
Generic Function: database-release-to-conn-pool (database)

Chance for the database to cleanup before it is returned to the connection pool.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-release-to-conn-pool (database)
Source

pool.lisp.

Generic Function: database-run-prepared (prepared-stmt)

Execute a prepared statement.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-run-prepared ((stmt postgresql-stmt))
Source

generic-postgresql.lisp.

Method: database-run-prepared (pstmt)
Generic Function: database-sequence-last (name database)

Select the last value in sequence NAME in DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-sequence-last (sequence-name database)
Source

sequences.lisp.

Method: database-sequence-last (sequence-name (database generic-postgresql-database))
Source

generic-postgresql.lisp.

Generic Function: database-sequence-next (name database)

Increment a sequence in DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-sequence-next (sequence-name database)
Source

sequences.lisp.

Method: database-sequence-next (sequence-name (database generic-postgresql-database))
Source

generic-postgresql.lisp.

Generic Function: database-set-sequence-position (name position database)

Set the position of the sequence called NAME in DATABASE.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-set-sequence-position (sequence-name position database)
Source

sequences.lisp.

Method: database-set-sequence-position (name (position integer) (database generic-postgresql-database))
Source

generic-postgresql.lisp.

Generic Reader: database-state (object)
Package

clsql-sys.

Methods
Reader Method: database-state ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

state.

Generic Function: database-store-next-row (result-set database list)

Returns t and stores the next row in the result set in list or returns nil when result-set is finished.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-store-next-row (result-set (database generic-odbc-database) list)
Source

generic-odbc.lisp.

Method: database-store-next-row :before (result-set (database database) list)
Method: database-store-next-row (result-set database list)
Method: database-store-next-row (result-set (database database) list)
Generic Reader: database-type (object)
Package

clsql-sys.

Methods
Reader Method: database-type ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

database-type.

Generic Function: database-type-library-loaded (database-type)

The internal generic implementation for checking if database type library loaded successfully.

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: database-type-load-foreign (database-type)

The internal generic implementation of reload-database-types.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-type-load-foreign :after (database-type)
Source

initialize.lisp.

Method: database-type-load-foreign (x)
Source

initialize.lisp.

Generic Function: database-underlying-type (database)

Returns the type of the underlying database. For ODBC, needs to query ODBC driver.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: database-underlying-type (database)
Generic Function: database-write-large-object (object-id data database)

Writes data to the large object

Package

clsql-sys.

Source

db-interface.lisp.

Generic Function: db-backend-has-create/destroy-db? (db-type)

T [default] if backend can destroy and create databases.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-backend-has-create/destroy-db? (db-type)
Generic Function: db-type-default-case (db-type)

:upper [default] if means identifiers mapped to UPPER case SQL like CommonSQL API. However, Postgresql maps identifiers to lower case, so PostgreSQL uses a value of :lower for this result.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-default-case ((db-type (eql :postgresql)))
Source

generic-postgresql.lisp.

Method: db-type-default-case (db-type)
Generic Function: db-type-has-auto-increment? (db-type)

NIL [default] if database-type supports auto-incrementing columns.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-auto-increment? ((db-underlying-type (eql :mssql)))
Source

generic-odbc.lisp.

Method: db-type-has-auto-increment? ((db-type (eql :postgresql)))
Source

generic-postgresql.lisp.

Method: db-type-has-auto-increment? (db-type)
Generic Function: db-type-has-bigint? (db-type)

T [default] if database-type supports bigint.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-bigint? (db-type)
Generic Function: db-type-has-boolean-where? (db-type)

T [default] if database-type supports boolean WHERE clause, such as ’WHERE MARRIED’.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-boolean-where? ((db-type (eql :mssql)))
Source

generic-odbc.lisp.

Method: db-type-has-boolean-where? (db-type)
Generic Function: db-type-has-except? (db-type)

T [default] if database-type supports EXCEPT.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-except? ((db-type (eql :mssql)))
Source

generic-odbc.lisp.

Method: db-type-has-except? (db-type)
Generic Function: db-type-has-fancy-math? (db-type)

NIL [default] if database-type does not have fancy math.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-fancy-math? ((db-type (eql :postgresql)))
Source

generic-postgresql.lisp.

Method: db-type-has-fancy-math? (db-type)
Generic Function: db-type-has-intersect? (db-type)

T [default] if database-type supports INTERSECT.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-intersect? ((db-type (eql :mssql)))
Source

generic-odbc.lisp.

Method: db-type-has-intersect? (db-type)
Generic Function: db-type-has-prepared-stmt? (db-type)

T if database backend supports prepared statements.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-prepared-stmt? ((db-type (eql :postgresql-socket)))
Source

generic-postgresql.lisp.

Method: db-type-has-prepared-stmt? ((db-type (eql :postgresql)))
Source

generic-postgresql.lisp.

Method: db-type-has-prepared-stmt? (db-type)
Generic Function: db-type-has-subqueries? (db-type)

T [default] if database-type supports views.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-subqueries? (db-type)
Generic Function: db-type-has-union? (db-type)

T [default] if database-type supports boolean UNION.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-union? (db-type)
Generic Function: db-type-has-views? (db-type)

T [default] if database-type supports views.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-has-views? (db-type)
Generic Function: db-type-transaction-capable? (db database)

T [default] if database can supports transactions.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-transaction-capable? (db database)
Generic Function: db-type-use-column-on-drop-index? (db-type)

NIL [default] if database-type does not use column name on DROP INDEX.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-use-column-on-drop-index? (db-type)
Generic Function: db-type-use-fully-qualified-column-on-drop-index? (db-type)

NIL [default] if database-type does not require fully qualified column name on DROP INDEX.

Package

clsql-sys.

Source

db-interface.lisp.

Methods
Method: db-type-use-fully-qualified-column-on-drop-index? ((db-type (eql :mssql)))
Source

generic-odbc.lisp.

Method: db-type-use-fully-qualified-column-on-drop-index? (db-type)
Generic Function: delete-instance-records (object &key database)

Deletes the records represented by OBJECT in the appropriate table of the database associated with OBJECT. If OBJECT is not yet associated with a database, an error is signalled.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: delete-instance-records ((instance standard-db-object) &key database)

Removes the records associated with a given instance (as determined by key-qualifier-for-instance)

TODO: Doesnt handle normalized classes at all afaict

Source

oodml.lisp.

Generic Function: execute-command (expression &key database)

Executes the SQL command EXPRESSION, which may be an SQL expression or a string representing any SQL statement apart from a query, on the supplied DATABASE which defaults to *DEFAULT-DATABASE*.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: execute-command ((expr %sql-expression) &key database)
Source

fdml.lisp.

Method: execute-command ((sql-expression string) &key database)
Source

fdml.lisp.

Generic Reader: expression (object)
Generic Writer: (setf expression) (object)
Package

clsql-sys.

Methods
Reader Method: expression ((command-object command-object))
Writer Method: (setf expression) ((command-object command-object))

query that refers to parameters using "$1", "$2", "$n". These match positions in the parameters list.

Source

command-object.lisp.

Target Slot

expression.

Generic Function: filter-select-list (view-class select-list database)

Gives fine grained control over sql to be executed and mapped to slots called with a dummy instance (so that class precedence can be used)

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: filter-select-list ((c standard-db-object) (sl select-list) database)
Source

oodml.lisp.

Generic Reader: has-been-prepared (object)
Generic Writer: (setf has-been-prepared) (object)
Package

clsql-sys.

Methods
Reader Method: has-been-prepared ((command-object command-object))
Writer Method: (setf has-been-prepared) ((command-object command-object))

Have we already prepared this command object?

Source

command-object.lisp.

Target Slot

has-been-prepared.

Generic Function: instance-refreshed (object)

Provides a hook which is called within an object oriented call to SELECT with a non-nil value of REFRESH when the View Class instance OBJECT has been updated from the database. A method specialised on STANDARD-DB-OBJECT is provided which has no effects. Methods specialised on particular View Classes can be used to specify any operations that need to be made on View Classes instances which have been updated in calls to SELECT.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: instance-refreshed ((instance standard-db-object))
Source

oodml.lisp.

Generic Reader: join-slots (object)
Package

clsql-sys.

Methods
Reader Method: join-slots ((select-list select-list))

automatically generated reader method

Source

oodml.lisp.

Target Slot

join-slots.

Generic Writer: (setf join-slots) (object)
Package

clsql-sys.

Methods
Writer Method: (setf join-slots) ((select-list select-list))

automatically generated writer method

Source

oodml.lisp.

Target Slot

join-slots.

Generic Reader: joins (object)
Package

clsql-sys.

Methods
Reader Method: joins ((select-list select-list))

automatically generated reader method

Source

oodml.lisp.

Target Slot

joins.

Generic Writer: (setf joins) (object)
Package

clsql-sys.

Methods
Writer Method: (setf joins) ((select-list select-list))

automatically generated writer method

Source

oodml.lisp.

Target Slot

joins.

Generic Function: midnight (self)
Package

clsql-sys.

Source

time.lisp.

Methods
Method: midnight ((self wall-time))

truncate hours, minutes and seconds

Generic Reader: parameters (object)
Package

clsql-sys.

Methods
Reader Method: parameters ((command-object command-object))

list of parameters

Source

command-object.lisp.

Target Slot

parameters.

Generic Writer: (setf parameters) (object)
Package

clsql-sys.

Methods
Writer Method: (setf parameters) ((o command-object))

This causes the semantics to match cl-sql instead of cl-postgresql

Source

command-object.lisp.

Target Slot

parameters.

Generic Function: prepare-sql-parameter (sql-parameter)

This method is responsible for formatting parameters
as the database expects them (eg: :false is nil, nil is :null, dates are iso8601 strings)

Package

clsql-sys.

Source

command-object.lisp.

Methods
Method: prepare-sql-parameter (sql-parameter)
Generic Reader: prepared-name (object)
Generic Writer: (setf prepared-name) (object)
Package

clsql-sys.

Methods
Reader Method: prepared-name ((command-object command-object))
Writer Method: (setf prepared-name) ((command-object command-object))

If we want this to be a prepared statement, give it a name to identify it to this session

Source

command-object.lisp.

Target Slot

prepared-name.

Generic Function: query (query-expression &key database result-types flatp field-names)

Executes the SQL query expression QUERY-EXPRESSION, which may be an SQL expression or a string, on the supplied DATABASE which defaults to *DEFAULT-DATABASE*. RESULT-TYPES is a list of symbols which specifies the lisp type for each field returned by QUERY-EXPRESSION. If RESULT-TYPES is nil all results are returned as strings whereas the default value of :auto means that the lisp types are automatically computed for each field. FIELD-NAMES is t by default which means that the second value returned is a list of strings representing the columns selected by QUERY-EXPRESSION. If FIELD-NAMES is nil, the list of column names is not returned as a second value. FLATP has a default value of nil which means that the results are returned as a list of lists. If FLATP is t and only one result is returned for each record selected by QUERY-EXPRESSION, the results are returned as elements of a list.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: query ((expr sql-object-query) &key database result-types flatp field-names)
Source

fdml.lisp.

Method: query ((expr %sql-expression) &key database result-types flatp field-names)
Source

fdml.lisp.

Method: query ((query-expression string) &key database result-types flatp field-names)
Source

fdml.lisp.

Generic Function: read-sql-value (val type database db-type)
Package

clsql-sys.

Source

generics.lisp.

Methods
Method: read-sql-value (val type database db-type)

read a sql value, from :around read-eval is disabled read numbers in base 10

Source

oodml.lisp.

Method: read-sql-value :around (val type database db-type)
Source

oodml.lisp.

Generic Reader: record-caches (object)
Package

clsql-sys.

Methods
Reader Method: record-caches ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

record-caches.

Generic Writer: (setf record-caches) (object)
Package

clsql-sys.

Methods
Writer Method: (setf record-caches) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

record-caches.

Generic Reader: result-recording-stream (object)
Package

clsql-sys.

Methods
Reader Method: result-recording-stream ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

result-recording-stream.

Generic Writer: (setf result-recording-stream) (object)
Package

clsql-sys.

Methods
Writer Method: (setf result-recording-stream) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

result-recording-stream.

Generic Reader: select-list (object)
Package

clsql-sys.

Methods
Reader Method: select-list ((select-list select-list))

automatically generated reader method

Source

oodml.lisp.

Target Slot

select-list.

Generic Writer: (setf select-list) (object)
Package

clsql-sys.

Methods
Writer Method: (setf select-list) ((select-list select-list))

automatically generated writer method

Source

oodml.lisp.

Target Slot

select-list.

Generic Reader: slot-list (object)
Package

clsql-sys.

Methods
Reader Method: slot-list ((select-list select-list))

automatically generated reader method

Source

oodml.lisp.

Target Slot

slot-list.

Generic Writer: (setf slot-list) (object)
Package

clsql-sys.

Methods
Writer Method: (setf slot-list) ((select-list select-list))

automatically generated writer method

Source

oodml.lisp.

Target Slot

slot-list.

Generic Reader: sql-error-connection-spec (condition)
Package

clsql-sys.

Methods
Reader Method: sql-error-connection-spec ((condition sql-connection-error))
Source

conditions.lisp.

Target Slot

connection-spec.

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

clsql-sys.

Methods
Reader Method: sql-error-database ((condition sql-database-error))
Source

conditions.lisp.

Target Slot

database.

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

clsql-sys.

Methods
Reader Method: sql-error-database-message ((condition sql-database-error))
Source

conditions.lisp.

Target Slot

database-message.

Generic Reader: sql-error-database-type (condition)
Package

clsql-sys.

Methods
Reader Method: sql-error-database-type ((condition sql-connection-error))
Source

conditions.lisp.

Target Slot

database-type.

Generic Reader: sql-error-error-id (condition)
Package

clsql-sys.

Methods
Reader Method: sql-error-error-id ((condition sql-database-error))
Source

conditions.lisp.

Target Slot

error-id.

Generic Reader: sql-error-expression (condition)
Package

clsql-sys.

Methods
Reader Method: sql-error-expression ((condition sql-database-data-error))
Source

conditions.lisp.

Target Slot

expression.

Generic Reader: sql-error-secondary-error-id (condition)
Package

clsql-sys.

Methods
Reader Method: sql-error-secondary-error-id ((condition sql-database-error))
Source

conditions.lisp.

Target Slot

secondary-error-id.

Generic Reader: sql-user-error-message (condition)
Package

clsql-sys.

Methods
Reader Method: sql-user-error-message ((condition sql-user-error))
Source

conditions.lisp.

Target Slot

message.

Generic Reader: sql-warning-database (condition)
Package

clsql-sys.

Methods
Reader Method: sql-warning-database ((condition sql-database-warning))
Source

conditions.lisp.

Target Slot

database.

Generic Reader: transaction (object)
Package

clsql-sys.

Methods
Reader Method: transaction ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

transaction.

Generic Writer: (setf transaction) (object)
Package

clsql-sys.

Methods
Writer Method: (setf transaction) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

transaction.

Generic Reader: transaction-level (object)
Package

clsql-sys.

Methods
Reader Method: transaction-level ((database database))

automatically generated reader method

Source

base-classes.lisp.

Target Slot

transaction-level.

Generic Writer: (setf transaction-level) (object)
Package

clsql-sys.

Methods
Writer Method: (setf transaction-level) ((database database))

automatically generated writer method

Source

base-classes.lisp.

Target Slot

transaction-level.

Generic Function: update-instance-from-records (object &key database)

Updates the slot values of the View Class instance OBJECT using the attribute values of the appropriate table of DATABASE which defaults to the database associated with OBJECT or, if OBJECT is not associated with a database, *DEFAULT-DATABASE*. Join slots are updated but instances of the class on which the join is made are not updated.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: update-instance-from-records ((instance standard-db-object) &key database)

Updates a database object with the current values stored in the database

TODO: Should this update immediate join slots similar to build-objects? Can we just call build-objects?, update-objects-joins?

Source

oodml.lisp.

Generic Function: update-record-from-slot (object slot &key database)

Updates the value stored in the column represented by the slot, specified by the CLOS slot name SLOT, of View Class instance OBJECT. DATABASE defaults to *DEFAULT-DATABASE* and specifies the database in which the update is made only if OBJECT is not associated with a database. In this case, a record is created in DATABASE and the attribute represented by SLOT is initialised from the value of the supplied slots with other attributes having default values. Furthermore, OBJECT becomes associated with DATABASE.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: update-record-from-slot ((obj standard-db-object) slot &key database)

just call update-records-from-slots which now handles this.

This function is only here to maintain backwards compatibility in the public api

Source

oodml.lisp.

Generic Function: update-record-from-slots (object slots &key database)

Updates the values stored in the columns represented by the slots, specified by the CLOS slot names SLOTS, of View Class instance OBJECT. DATABASE defaults to *DEFAULT-DATABASE* and specifies the database in which the update is made only if OBJECT is not associated with a database. In this case, a record is created in the appropriate table of DATABASE and the attributes represented by SLOTS are initialised from the values of the supplied slots with other attributes having default
values. Furthermore, OBJECT becomes associated with DATABASE.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: update-record-from-slots ((obj standard-db-object) slots &key database)

For a given list of slots, update all records associated with those slots and classes.

Generally this will update the single record associated with this object, but for normalized classes might update as many records as there are inheritances

Source

oodml.lisp.

Generic Function: update-records-from-instance (object &key database)

Using an instance of a View Class, OBJECT, update the table that stores its instance data. DATABASE defaults to *DEFAULT-DATABASE* and specifies the database in which the update is made only if OBJECT is not associated with a database. In this case, a record is created in the appropriate table of DATABASE using values from the slot values of OBJECT, and OBJECT becomes associated with DATABASE.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: update-records-from-instance ((obj standard-db-object) &key database)

Updates the records in the database associated with this object if view-database slot on the object is nil then the object is assumed to be new and is inserted

Source

oodml.lisp.

Generic Function: update-slot-from-record (object slot &key database)

Updates the slot value, specified by the CLOS slot name SLOT, of the View Class instance OBJECT using the attribute values of the appropriate table of DATABASE which defaults to the database associated with OBJECT or, if OBJECT is not associated with a database, *DEFAULT-DATABASE*. Join slots are updated but instances of the class on which the join is made are not updated.

Package

clsql-sys.

Source

generics.lisp.

Methods
Method: update-slot-from-record ((instance standard-db-object) slot &key database)

Pulls the value of a given slot form the database and stores that in the appropriate slot on instance

Source

oodml.lisp.

Generic Function: view-table (object)
Package

clsql-sys.

Methods
Method: view-table ((o select-list))
Source

oodml.lisp.

Method: view-table ((o class-and-slots))

get the view-table of the view-class of o

Source

oodml.lisp.

Reader Method: view-table ((standard-db-class standard-db-class))

automatically generated reader method

Source

metaclasses.lisp.

Target Slot

view-table.

Generic Writer: (setf view-table) (object)
Package

clsql-sys.

Methods
Writer Method: (setf view-table) ((standard-db-class standard-db-class))

automatically generated writer method

Source

metaclasses.lisp.

Target Slot

view-table.


6.1.5 Standalone methods

Method: compute-effective-slot-definition ((class standard-db-class) slot-name direct-slots)
Package

sb-mop.

Source

metaclasses.lisp.

Method: compute-slots ((class standard-db-class))

Need to sort order of class slots so they are the same across implementations.

Package

sb-mop.

Source

metaclasses.lisp.

Method: direct-slot-definition-class ((class standard-db-class) &rest initargs)
Package

sb-mop.

Source

metaclasses.lisp.

Method: effective-slot-definition-class ((class standard-db-class) &rest initargs)
Package

sb-mop.

Source

metaclasses.lisp.

Method: finalize-inheritance :after ((class standard-db-class))
Package

sb-mop.

Source

metaclasses.lisp.

Method: initialize-instance ((object standard-db-object) &rest all-keys &key &allow-other-keys)
Source

ooddl.lisp.

Method: initialize-instance :after ((o command-object) &key &allow-other-keys)
Source

command-object.lisp.

Method: initialize-instance :after ((db generic-odbc-database) &rest all-keys)
Source

generic-odbc.lisp.

Method: initialize-instance :around ((class standard-db-class) &rest all-keys &key direct-superclasses base-table qualifier normalizedp &allow-other-keys)
Source

metaclasses.lisp.

Method: initialize-instance :after ((obj view-class-direct-slot-definition) &key &allow-other-keys)
Source

metaclasses.lisp.

Method: initialize-instance :around ((obj view-class-direct-slot-definition) &rest initargs &key db-constraints db-kind type &allow-other-keys)
Source

metaclasses.lisp.

Method: make-load-form ((sql sql-ident-table) &optional environment)
Source

expressions.lisp.

Method: make-load-form ((self sql-relational-exp) &optional environment)
Source

expressions.lisp.

Method: make-load-form ((sql sql-ident-attribute) &optional environment)
Source

expressions.lisp.

Method: make-load-form ((sql sql) &optional environment)
Source

expressions.lisp.

Method: make-load-form ((sql sql-ident) &optional environment)
Source

expressions.lisp.

Method: print-object ((object date) stream)
Source

time.lisp.

Method: print-object ((object wall-time) stream)
Source

time.lisp.

Method: print-object ((object duration) stream)
Source

time.lisp.

Method: print-object ((ident sql) stream)
Source

expressions.lisp.

Method: print-object ((object database) stream)
Source

base-classes.lisp.

Method: print-object ((self %sql-expression) stream)
Source

expressions.lisp.

Method: reinitialize-instance :around ((class standard-db-class) &rest all-keys &key base-table normalizedp direct-superclasses qualifier &allow-other-keys)
Source

metaclasses.lisp.

Method: slot-unbound (class (obj generic-postgresql-database) (slot (eql clsql-sys::has-table-pg_roles)))
Source

generic-postgresql.lisp.

Method: (setf slot-value-using-class) ((class standard-db-class) instance slot-def)

Handle auto syncing values to the database if *db-auto-sync* is t

Package

sb-mop.

Source

ooddl.lisp.

Method: slot-value-using-class ((class standard-db-class) instance slot-def)

When a slot is unbound but should contain a join object or a value from a normalized view-class, then retrieve and set those slots, so the value can be returned

Package

sb-mop.

Source

ooddl.lisp.

Method: validate-superclass ((class standard-db-class) (superclass standard-class))
Package

sb-mop.

Source

metaclasses.lisp.


6.1.6 Conditions

Condition: decimal-parse-error

Function ‘parse-decimal-number‘ signals this condition when it couldn’t parse a decimal number from string.

Package

decimals.

Source

decimals.lisp.

Direct superclasses

parse-error.

Condition: sql-condition
Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

condition.

Direct subclasses
Condition: sql-connection-error

Used to signal an error in connecting to a database.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-database-error.

Direct subclasses
Direct methods
Direct slots
Slot: database-type
Initform

(quote nil)

Initargs

:database-type

Readers

sql-error-database-type.

Writers

This slot is read-only.

Slot: connection-spec
Initform

(quote nil)

Initargs

:connection-spec

Readers

sql-error-connection-spec.

Writers

This slot is read-only.

Condition: sql-database-data-error

Used to signal an error with the SQL data passed to a database.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-database-error.

Direct methods

sql-error-expression.

Direct slots
Slot: expression
Initargs

:expression, nil

Readers

sql-error-expression.

Writers

This slot is read-only.

Condition: sql-database-error

Used to signal an error in a CLSQL database interface.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-error.

Direct subclasses
Direct methods
Direct slots
Slot: error-id
Initform

(quote nil)

Initargs

:error-id

Readers

sql-error-error-id.

Writers

This slot is read-only.

Slot: secondary-error-id
Initform

(quote nil)

Initargs

:secondary-error-id

Readers

sql-error-secondary-error-id.

Writers

This slot is read-only.

Slot: database-message
Initform

(quote nil)

Initargs

:message

Readers

sql-error-database-message.

Writers

This slot is read-only.

Slot: database
Initform

(quote nil)

Initargs

:database

Readers

sql-error-database.

Writers

This slot is read-only.

Condition: sql-database-warning
Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-warning.

Direct methods

sql-warning-database.

Direct slots
Slot: database
Initargs

:database

Readers

sql-warning-database.

Writers

This slot is read-only.

Condition: sql-error
Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses
Direct subclasses
Condition: sql-fatal-error

Used to signal an error when the database connection is no longer usable.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-connection-error.

Condition: sql-temporary-error

Used to signal an error when the database
cannot currently process a valid interaction because, for example, it is still executing another command possibly issued by another user.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-database-error.

Condition: sql-timeout-error

Used to signal an error when the database times out while processing some operation.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-connection-error.

Condition: sql-user-error

Used to signal lisp errors inside CLSQL.

Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses

sql-error.

Direct subclasses
Direct methods

sql-user-error-message.

Direct slots
Slot: message
Initform

(quote "unspecified error")

Initargs

:message

Readers

sql-user-error-message.

Writers

This slot is read-only.

Condition: sql-warning
Package

clsql-sys.

Source

conditions.lisp.

Direct superclasses
Direct subclasses

sql-database-warning.

Direct methods

sql-warning-message.

Direct slots
Slot: message
Initform

(quote nil)

Initargs

:message

Readers

sql-warning-message.

Writers

This slot is read-only.


6.1.7 Structures

Structure: date
Package

clsql-sys.

Source

time.lisp.

Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: mjd
Type

fixnum

Initform

0

Readers

date-mjd.

Writers

(setf date-mjd).

Structure: duration
Package

clsql-sys.

Source

time.lisp.

Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: year
Type

fixnum

Initform

0

Readers

duration-year.

Writers

(setf duration-year).

Slot: month
Type

fixnum

Initform

0

Readers

duration-month.

Writers

(setf duration-month).

Slot: day
Type

fixnum

Initform

0

Readers

duration-day.

Writers

(setf duration-day).

Slot: hour
Type

fixnum

Initform

0

Readers

duration-hour.

Writers

(setf duration-hour).

Slot: second
Package

common-lisp.

Type

fixnum

Initform

0

Readers

duration-second.

Writers

(setf duration-second).

Slot: minute
Type

fixnum

Initform

0

Readers

duration-minute.

Writers

(setf duration-minute).

Slot: usec
Type

fixnum

Initform

0

Readers

duration-usec.

Writers

(setf duration-usec).

Structure: wall-time
Package

clsql-sys.

Source

time.lisp.

Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: mjd
Type

fixnum

Initform

0

Readers

time-mjd.

Writers

(setf time-mjd).

Slot: second
Package

common-lisp.

Type

fixnum

Initform

0

Readers

time-second.

Writers

(setf time-second).

Slot: usec
Type

fixnum

Initform

0

Readers

time-usec.

Writers

(setf time-usec).


6.1.8 Classes

Class: command-object
Package

clsql-sys.

Source

command-object.lisp.

Direct methods
Direct slots
Slot: expression

query that refers to parameters using "$1", "$2", "$n". These match positions in the parameters list.

Initargs

:expression

Readers

expression.

Writers

(setf expression).

Slot: parameters

list of parameters

Initargs

:parameters

Readers

parameters.

Writers

(setf parameters).

Slot: prepared-name

If we want this to be a prepared statement, give it a name to identify it to this session

Initform

""

Initargs

:prepared-name

Readers

prepared-name.

Writers

(setf prepared-name).

Slot: has-been-prepared

Have we already prepared this command object?

Initargs

:has-been-prepared

Readers

has-been-prepared.

Writers

(setf has-been-prepared).

Class: conn-pool
Package

clsql-sys.

Source

pool.lisp.

Direct methods
Direct slots
Slot: connection-spec
Initargs

:connection-spec

Readers

connection-spec.

Writers

(setf connection-spec).

Slot: database-type
Initargs

:pool-database-type

Readers

pool-database-type.

Writers

(setf pool-database-type).

Slot: free-connections
Readers

free-connections.

Writers

(setf free-connections).

Slot: all-connections
Readers

all-connections.

Writers

(setf all-connections).

Slot: lock
Initform

(clsql-sys:make-process-lock "connection pool")

Readers

conn-pool-lock.

Writers

(setf conn-pool-lock).

Class: database

This class is the supertype of all databases handled by CLSQL.

Package

clsql-sys.

Source

base-classes.lisp.

Direct subclasses
Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

database-name.

Writers

This slot is read-only.

Slot: connection-spec

Required to use connection pool.

Initargs

:connection-spec

Readers

connection-spec.

Writers

This slot is read-only.

Slot: database-type
Initform

:unknown

Initargs

:database-type

Readers

database-type.

Writers

This slot is read-only.

Slot: encoding

External format character encoding.

Initargs

:encoding

Slot: state
Initform

:closed

Readers

database-state.

Writers

This slot is read-only.

Slot: autocommit
Initform

t

Readers

database-autocommit.

Writers

(setf database-autocommit).

Slot: command-recording-stream
Readers

command-recording-stream.

Writers

(setf command-recording-stream).

Slot: result-recording-stream
Readers

result-recording-stream.

Writers

(setf result-recording-stream).

Slot: record-caches
Readers

record-caches.

Writers

(setf record-caches).

Slot: view-classes
Readers

database-view-classes.

Writers

(setf database-view-classes).

Slot: transaction-level
Initform

0

Readers

transaction-level.

Writers

(setf transaction-level).

Slot: transaction
Readers

transaction.

Writers

(setf transaction).

Slot: conn-pool
Initargs

:conn-pool

Readers

conn-pool.

Writers

(setf conn-pool).

Slot: attribute-cache

Internal cache of table attributes. It is keyed by table-name. Values
are a list of ACTION specified for table and any cached value of list-attributes-types.

Initform

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

Readers

attribute-cache.

Writers

(setf attribute-cache).

Class: generic-odbc-database

Encapsulate same behavior across odbc and aodbc backends.

Package

clsql-sys.

Source

generic-odbc.lisp.

Direct superclasses

database.

Direct methods
Direct slots
Slot: dbi-package
Initargs

:dbi-package

Readers

dbi-package.

Writers

This slot is read-only.

Slot: odbc-conn
Initargs

:odbc-conn

Readers

odbc-conn.

Writers

(setf odbc-conn).

Slot: disconnect-fn
Readers

disconnect-fn.

Writers

This slot is read-only.

Slot: sql-fn
Readers

sql-fn.

Writers

This slot is read-only.

Slot: close-query-fn
Readers

close-query-fn.

Writers

This slot is read-only.

Slot: fetch-row
Readers

fetch-row-fn.

Writers

This slot is read-only.

Slot: list-all-database-tables-fn
Readers

list-all-database-tables-fn.

Writers

This slot is read-only.

Slot: list-all-table-columns-fn
Readers

list-all-table-columns-fn.

Writers

This slot is read-only.

Slot: odbc-db-type
Initargs

:odbc-db-type

Readers

database-odbc-db-type.

Writers

(setf database-odbc-db-type).

Class: generic-postgresql-database

Encapsulate same behavior across postgresql and postgresql-socket backends.

Package

clsql-sys.

Source

generic-postgresql.lisp.

Direct superclasses

database.

Direct methods
Direct slots
Slot: has-table-pg_roles
Type

boolean

Readers

has-table-pg_roles.

Writers

This slot is read-only.

Class: select-list

Collects the classes, slots and their respective sql representations
so that update-instance-from-recors, find-all, build-objects can share this info and calculate it once. Joins are select-lists for each immediate join-slot but only if make-select-list is called with do-joins-p

Package

clsql-sys.

Source

oodml.lisp.

Direct methods
Direct slots
Slot: view-class
Initargs

:view-class

Readers

view-class.

Writers

(setf view-class).

Slot: select-list
Initargs

:select-list

Readers

select-list.

Writers

(setf select-list).

Slot: slot-list
Initargs

:slot-list

Readers

slot-list.

Writers

(setf slot-list).

Slot: joins
Initargs

:joins

Readers

joins.

Writers

(setf joins).

Slot: join-slots
Initargs

:join-slots

Readers

join-slots.

Writers

(setf join-slots).

Class: sql

A literal SQL expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct methods
Direct slots
Slot: text
Initform

""

Initargs

:string

Class: sql-assignment-exp

An SQL Assignment expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-relational-exp.

Direct methods

output-sql.

Class: sql-between-exp

An SQL between expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-function-exp.

Direct methods

output-sql.

Class: sql-function-exp

An SQL function expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct subclasses

sql-between-exp.

Direct methods
Direct slots
Slot: name
Initargs

:name

Slot: args
Initargs

:args

Class: sql-ident

An SQL identifer.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct subclasses
Direct methods
Direct slots
Slot: name
Initform

clsql-sys::+null-string+

Initargs

:name

Class: sql-ident-attribute

An SQL Attribute identifier.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-ident.

Direct methods
Direct slots
Slot: qualifier
Initform

clsql-sys::+null-string+

Initargs

:qualifier

Slot: type
Package

common-lisp.

Initform

clsql-sys::+null-string+

Initargs

:type

Class: sql-ident-table

An SQL table identifier.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-ident.

Direct methods
Direct slots
Slot: alias
Initargs

:table-alias

Class: sql-object-query
Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct methods
Direct slots
Slot: objects
Initargs

:objects

Slot: flatp
Initargs

:flatp

Slot: exp
Package

common-lisp.

Initargs

:exp

Slot: refresh
Initargs

:refresh

Class: sql-query

An SQL SELECT query.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct methods
Direct slots
Slot: selections
Initargs

:selections

Slot: all
Initargs

:all

Slot: flatp
Initargs

:flatp

Slot: set-operation
Initargs

:set-operation

Slot: distinct
Initargs

:distinct

Slot: from
Initargs

:from

Slot: where
Initargs

:where

Slot: group-by
Initargs

:group-by

Slot: having
Initargs

:having

Slot: limit
Initargs

:limit

Slot: offset
Initargs

:offset

Slot: order-by
Initargs

:order-by

Slot: inner-join
Initargs

:inner-join

Slot: on
Initargs

:on

Class: sql-query-modifier-exp

An SQL query modifier expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct methods

output-sql.

Direct slots
Slot: modifier
Initargs

:modifier

Slot: components
Initargs

:components

Class: sql-relational-exp

An SQL relational expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct subclasses
Direct methods
Direct slots
Slot: operator
Initargs

:operator

Slot: sub-expressions
Initargs

:sub-expressions

Class: sql-set-exp

An SQL set expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct methods
Direct slots
Slot: operator
Initargs

:operator

Slot: sub-expressions
Initargs

:sub-expressions

Class: sql-typecast-exp

An SQL typecast expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-value-exp.

Direct methods
Class: sql-upcase-like

An SQL ’like’ that upcases its arguments.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

sql-relational-exp.

Direct methods

output-sql.

Class: sql-value-exp

An SQL value expression.

Package

clsql-sys.

Source

expressions.lisp.

Direct superclasses

%sql-expression.

Direct subclasses

sql-typecast-exp.

Direct methods
Direct slots
Slot: modifier
Initargs

:modifier

Slot: components
Initargs

:components

Class: standard-db-object

Superclass for all CLSQL View Classes.

Package

clsql-sys.

Source

ooddl.lisp.

Direct methods
Direct slots
Slot: view-database
Initargs

:view-database

Readers

view-database.

Writers

This slot is read-only.

Class: transaction
Package

clsql-sys.

Source

transaction.lisp.

Direct methods
Direct slots
Slot: commit-hooks
Readers

commit-hooks.

Writers

(setf commit-hooks).

Slot: rollback-hooks
Readers

rollback-hooks.

Writers

(setf rollback-hooks).

Slot: previous-autocommit
Initargs

:previous-autocommit

Readers

previous-autocommit.

Writers

This slot is read-only.

Slot: status

nil or :committed

Readers

transaction-status.

Writers

(setf transaction-status).


6.1.9 Types

Type: bigint ()

An integer larger than a 32-bit integer, this width may vary by SQL implementation.

Package

clsql-sys.

Source

oodml.lisp.

Type: generalized-boolean ()

A type which outputs a SQL boolean value, though any lisp type can be stored in the slot.

Package

clsql-sys.

Source

oodml.lisp.

Type: mediumint ()

An integer smaller than a 32-bit integer, but may be larger than a smallint. This width may vary by SQL implementation.

Package

clsql-sys.

Source

oodml.lisp.

Type: smallint ()

An integer smaller than a 32-bit integer. this width may vary by SQL implementation.

Package

clsql-sys.

Source

oodml.lisp.

Type: tinyint ()

An 8-bit integer, this width may vary by SQL implementation.

Package

clsql-sys.

Source

oodml.lisp.

Type: universal-time ()

A positive integer as returned by GET-UNIVERSAL-TIME.

Package

clsql-sys.

Source

oodml.lisp.

Type: varchar (&optional size)

A variable length string for the SQL varchar type.

Package

clsql-sys.

Source

oodml.lisp.


6.2 Internals


6.2.1 Special variables

Special Variable: *connected-databases*

List of active database objects.

Package

clsql-sys.

Source

database.lisp.

Special Variable: *day-keywords*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *day-names*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *db-deserializing*
Package

clsql-sys.

Source

ooddl.lisp.

Special Variable: *db-info-lambda-list*
Package

clsql-sys.

Source

metaclasses.lisp.

Special Variable: *db-initializing*
Package

clsql-sys.

Source

ooddl.lisp.

Special Variable: *db-pool*
Package

clsql-sys.

Source

pool.lisp.

Special Variable: *db-pool-lock*
Package

clsql-sys.

Source

pool.lisp.

Special Variable: *default-encoding*
Package

clsql-sys.

Source

database.lisp.

Special Variable: *in-subselect*
Package

clsql-sys.

Source

expressions.lisp.

Special Variable: *iso-8601-duration-delimiters*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *month-keywords*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *month-names*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *next-prepared-id-num*
Package

clsql-sys.

Source

generic-postgresql.lisp.

Special Variable: *original-readtable*
Package

clsql-sys.

Source

syntax.lisp.

Special Variable: *output-hash*

For caching generated SQL strings, set to NIL to disable.

Package

clsql-sys.

Source

expressions.lisp.

Special Variable: *restore-sql-reader-syntax*
Package

clsql-sys.

Source

syntax.lisp.

Special Variable: *roman-digits*
Package

clsql-sys.

Source

time.lisp.

Special Variable: *select-arguments*
Package

clsql-sys.

Source

expressions.lisp.

Special Variable: *sql-macro-close-char*
Package

clsql-sys.

Source

syntax.lisp.

Special Variable: *sql-macro-open-char*
Package

clsql-sys.

Source

syntax.lisp.

Special Variable: *sql-op-table*
Package

clsql-sys.

Source

operations.lisp.

Special Variable: *sql-stream*

stream which accumulates SQL output

Package

clsql-sys.

Source

expressions.lisp.

Special Variable: +auto-increment-names+
Package

clsql-sys.

Source

expressions.lisp.

Special Variable: +empty-string+
Package

clsql-sys.

Source

expressions.lisp.

Special Variable: +extra-class-options+
Package

clsql-sys.

Source

metaclasses.lisp.

Special Variable: +extra-slot-options+
Package

clsql-sys.

Source

metaclasses.lisp.

Special Variable: +no-slot-value+
Package

clsql-sys.

Source

oodml.lisp.

Special Variable: +null-string+
Package

clsql-sys.

Source

expressions.lisp.

Special Variable: +whitespace-chars+

List of whitespace characters for this lisp implementation.

Package

clsql-sys.

Source

utils.lisp.


6.2.2 Macros

Macro: defaulting (&rest place-value-plist)

for places and values (as an &rest plist) if place-n is null set it to value-n

Package

clsql-sys.

Source

utils.lisp.

Macro: defsql (function definition-keys &body body)
Package

clsql-sys.

Source

operations.lisp.

Macro: for-each-row (((&rest fields) &key from order-by where distinct limit) &body body)
Package

clsql-sys.

Source

fdml.lisp.

Macro: make-weak-hash-table (&rest args)

Creates a weak hash table for use in a cache.

Package

clsql-sys.

Source

utils.lisp.

Macro: pop-n (place &optional n)

pops n items off of a list in place and returns their values in a new list

if n > the length of the list in place, then we return the full list, setting the place to nil

Package

clsql-sys.

Source

utils.lisp.

Macro: process-class-option (metaclass slot-name &optional required)
Package

clsql-sys.

Source

kmr-mop.lisp.

Macro: process-slot-option (metaclass slot-name)
Package

clsql-sys.

Source

kmr-mop.lisp.

Macro: wrap-time-for-date (time-func &key result-func)
Package

clsql-sys.

Source

time.lisp.


6.2.3 Ordinary functions

Function: %clsql-subclauses (clauses)

a helper for dealing with lists of sql clauses

Package

clsql-sys.

Source

expressions.lisp.

Function: %command-output (control-string &rest args)

Interpolate ARGS into CONTROL-STRING as if by FORMAT, and synchronously execute the result using a Bourne-compatible shell, returns (VALUES string-output error-output exit-status)

Package

clsql-sys.

Source

utils.lisp.

Function: %convert-db-info-to-hash (slot-def)
Package

clsql-sys.

Source

metaclasses.lisp.

Function: %database-list-* (database type owner)

Internal function used by database-list-tables and database-list-views

Package

clsql-sys.

Source

generic-odbc.lisp.

Function: %disable-sql-reader-syntax ()
Package

clsql-sys.

Source

syntax.lisp.

Function: %enable-sql-reader-syntax ()
Package

clsql-sys.

Source

syntax.lisp.

Function: %get-int (v)
Package

clsql-sys.

Source

utils.lisp.

Function: %make-database-identifier (inp &optional database)

We want to quote an identifier if it came to us as a string or if it has special characters in it.

Package

clsql-sys.

Source

expressions.lisp.

Function: %make-date (&key mjd)
Package

clsql-sys.

Source

time.lisp.

Function: %make-duration (&key year month day hour second minute usec)
Package

clsql-sys.

Source

time.lisp.

Function: %make-wall-time (&key mjd second usec)
Package

clsql-sys.

Source

time.lisp.

Function: %object-joins-from-list (object slot joins force-p)

Given a list of objects that we are trying to join to, pull the correct ones for this object

Package

clsql-sys.

Source

oodml.lisp.

Function: %pool-force-disconnect (database)

Force disconnection of a connection from the pool.

Package

clsql-sys.

Source

pool.lisp.

Function: %print-date (date stream depth)
Package

clsql-sys.

Source

time.lisp.

Function: %print-duration (duration stream depth)
Package

clsql-sys.

Source

time.lisp.

Function: %print-wall-time (time stream depth)
Package

clsql-sys.

Source

time.lisp.

Function: %seq-name-key ()
Package

clsql-sys.

Source

sequences.lisp.

Function: %sequence-name-to-table (sequence-name database)
Package

clsql-sys.

Source

sequences.lisp.

Function: %svuc-slot-name (slot)
Package

clsql-sys.

Source

kmr-mop.lisp.

Function: %svuc-slot-object (slot class)
Package

clsql-sys.

Source

kmr-mop.lisp.

Function: %table-name-to-sequence-name (table-name)
Package

clsql-sys.

Source

sequences.lisp.

Function: %tables-for-query (classes from where inner-joins)

Given lists of classes froms wheres and inner-join compile a list of tables that should appear in the FROM section of the query.

This includes any immediate join classes from each of the classes

Package

clsql-sys.

Source

oodml.lisp.

Function: %time< (x y)
Package

clsql-sys.

Source

time.lisp.

Function: %time<= (x y)
Package

clsql-sys.

Source

time.lisp.

Function: %time= (x y)
Package

clsql-sys.

Source

time.lisp.

Function: %time> (x y)
Package

clsql-sys.

Source

time.lisp.

Function: %time>= (x y)
Package

clsql-sys.

Source

time.lisp.

Function: %uninstall-class (self &key database owner)
Package

clsql-sys.

Source

ooddl.lisp.

Function: %update-objects-joins-slot-defs (class slot-names)

Get the slot definitions for the joins slots specified as slot-names if slot-names is :immediate, :deferred or (or :all t) return all of that type of slot definitions

Package

clsql-sys.

Source

oodml.lisp.

Function: %write-operator (operator database)
Package

clsql-sys.

Source

expressions.lisp.

Function: acquire-from-pool (connection-spec database-type &optional pool encoding)

Try to find a working database connection in the pool or create a new one if needed. This performs 1 query against the DB to ensure it’s still valid. When possible (postgres, mssql) that query will be a reset command to put the connection back into its default state.

Package

clsql-sys.

Source

pool.lisp.

Function: all-home-keys-have-values-p (object slot-def)

Do all of the home-keys have values ?

Package

clsql-sys.

Source

oodml.lisp.

Function: all-immediate-join-classes-for (classes)

returns a list of all join-classes needed for a list of classes

Package

clsql-sys.

Source

oodml.lisp.

Function: base-db-class (classname)
Package

clsql-sys.

Source

metaclasses.lisp.

Function: binding-to-param (binding)
Package

clsql-sys.

Source

generic-postgresql.lisp.

Function: build-objects (select-lists row database &optional existing-instances)

Used by find-all to build objects.

THIS NEEDS TO MATCH THE ORDER OF FULL-SELECT-LIST

TODO: this caching scheme seems bad for a number of reasons
* order is not guaranteed so references being held by one object
might change to represent a different database row (seems HIGHLY suspect)
* also join objects are overwritten rather than refreshed

TODO: the way we handle immediate joins seems only valid if it is a single object. I suspect that making a :set :immediate join column would result in an invalid number of objects returned from the database, because there would be multiple rows per object, but we would return an object per row

Package

clsql-sys.

Source

oodml.lisp.

Function: check-slot-type (slotdef val)
Package

clsql-sys.

Source

oodml.lisp.

Function: clear-conn-pool (pool)

Be careful this function will disconnect connections without regard to whether another thread is actively using them.

Package

clsql-sys.

Source

pool.lisp.

Function: clsql-and (&rest clauses)

Correctly creates a sql ’and’ expression for the clauses ignores any nil clauses
returns a single child expression if there is only one returns an ’and’ expression if there are many returns nil if there are no children

Package

clsql-sys.

Source

expressions.lisp.

Function: clsql-ands (clauses)

Correctly creates a sql ’and’ expression for the clauses ignores any nil clauses
returns a single child expression if there is only one returns an ’and’ expression if there are many returns nil if there are no children

Package

clsql-sys.

Source

expressions.lisp.

Function: clsql-or (&rest clauses)

Correctly creates a sql ’or’ expression for the clauses ignores any nil clauses
returns a single child expression if there is only one returns an ’or’ expression if there are many returns nil if there are no children

Package

clsql-sys.

Source

expressions.lisp.

Function: clsql-ors (clauses)

Correctly creates a sql ’or’ expression for the clauses ignores any nil clauses
returns a single child expression if there is only one returns an ’or’ expression if there are many returns nil if there are no children

Package

clsql-sys.

Source

expressions.lisp.

Function: clsql-type->postgresql-type (type)
Package

clsql-sys.

Source

generic-postgresql.lisp.

Function: combine-database-identifiers (ids &optional database)

Create a new database identifier by combining parts in a reasonable way

Package

clsql-sys.

Source

expressions.lisp.

Function: compute-column-name (arg)
Package

clsql-sys.

Source

metaclasses.lisp.

Function: compute-lisp-type-from-specified-type (specified-type db-constraints)

Computes the Lisp type for a user-specified type.

Package

clsql-sys.

Source

metaclasses.lisp.

Function: compute-records-cache-key (targets qualifiers)
Package

clsql-sys.

Source

oodml.lisp.

Function: copy-date (instance)
Package

clsql-sys.

Source

time.lisp.

Function: copy-duration (instance)
Package

clsql-sys.

Source

time.lisp.

Function: copy-interval (instance)
Package

clsql-sys.

Source

time.lisp.

Function: copy-odbc-result-set (instance)
Package

clsql-sys.

Source

generic-odbc.lisp.

Function: copy-time (time)
Package

clsql-sys.

Source

time.lisp.

Function: copy-wall-time (instance)
Package

clsql-sys.

Source

time.lisp.

Function: database-identifier-equal (i1 i2 &optional database)
Package

clsql-sys.

Source

expressions.lisp.

Function: database-list-objects-of-type (database type owner)
Package

clsql-sys.

Source

generic-postgresql.lisp.

Function: date->time (date)

Returns a walltime for the given date

Package

clsql-sys.

Source

time.lisp.

Function: date/= (number &rest more-numbers)
Package

clsql-sys.

Source

time.lisp.

Function: day-name (day-index)
Package

clsql-sys.

Source

time.lisp.

Function: day-of-year (year month day &key careful)

the day number within the year of the date DATE. For example, 1987 1 1 returns 1

Package

clsql-sys.

Source

time.lisp.

Function: days-in-month (month year &key careful)

the number of days in MONTH of YEAR, observing Gregorian leap year rules

Package

clsql-sys.

Source

time.lisp.

Function: db-ancestors (classname)
Package

clsql-sys.

Source

metaclasses.lisp.

Function: db-value-from-slot (slotdef val database)
Package

clsql-sys.

Source

oodml.lisp.

Function: decimal-round-split (number &key round-magnitude rounder positive-sign negative-sign zero-sign)
Package

decimals.

Source

decimals.lisp.

Function: delete-at-index (idx list)
Package

clsql-sys.

Source

time.lisp.

Function: delimited-string-to-list (string &optional separator skip-terminal)

Split a string with delimiter, from KMRCL.

Package

clsql-sys.

Source

utils.lisp.

Function: delist-if-single (x)

if this is a single item in a list return it

Package

clsql-sys.

Source

utils.lisp.

Function: delistify (list)

Some MOPs, like openmcl 0.14.2, cons attribute values in a list.

Package

clsql-sys.

Source

metaclasses.lisp.

Function: delistify-dsd (list)

Some MOPs, like openmcl 0.14.2, cons attribute values in a list.

Package

clsql-sys.

Source

expressions.lisp.

Function: dequote (it)
Package

clsql-sys.

Source

utils.lisp.

Function: describe-db-layout (class)
Package

clsql-sys.

Source

metaclasses.lisp.

Function: direct-normalized-slot-p (class slot-name)

Is this a normalized class and if so is the slot one of our direct slots?

Package

clsql-sys.

Source

metaclasses.lisp.

Function: divide-into-groups (string &key separator from-end group-digits)
Package

decimals.

Source

decimals.lisp.

Function: duration- (duration &rest durations)

Subtract each DURATION from TIME, returning a new duration value.

Package

clsql-sys.

Source

time.lisp.

Function: duration-p (object)
Package

clsql-sys.

Source

time.lisp.

Reader: duration-usec (instance)
Writer: (setf duration-usec) (instance)
Package

clsql-sys.

Source

time.lisp.

Target Slot

usec.

Function: easy-slot-value (obj slot)

like slot-value except it accepts slot-names or defs and returns nil when the slot is unbound

Package

clsql-sys.

Source

utils.lisp.

Function: (setf easy-slot-value) (obj slot)

like slot-value except it accepts slot-names or defs

Package

clsql-sys.

Source

utils.lisp.

Function: error-converting-value (val type &optional database)
Package

clsql-sys.

Source

conditions.lisp.

Function: escaped-database-identifier (name &optional database find-class-p)
Package

clsql-sys.

Source

expressions.lisp.

Function: fault-join-slot (class object slot-def)