Common Lisp Package: CLSQL-SYS

This is the INTERNAL SQL-Interface package of CLSQL.

README:

FUNCTION

Public

ADD-SQL-STREAM (STREAM &KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

ADD-TRANSACTION-COMMIT-HOOK (COMMIT-HOOK &KEY (DATABASE *DEFAULT-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*.

ADD-TRANSACTION-ROLLBACK-HOOK (ROLLBACK-HOOK &KEY (DATABASE *DEFAULT-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*.

ATTRIBUTE-TYPE (ATTRIBUTE TABLE &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

BIND-PARAMETER (PREPARED-STMT POSITION VALUE)

Sets the value of a parameter is in prepared statement.

CACHE-TABLE-QUERIES (TABLE &KEY (ACTION NIL) (DATABASE *DEFAULT-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.

COMMIT (&KEY (DATABASE *DEFAULT-DATABASE*))

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

CONNECT (CONNECTION-SPEC &KEY (IF-EXISTS *CONNECT-IF-EXISTS*) (MAKE-DEFAULT T) (POOL NIL) (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*) (ENCODING NIL))

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.

CONNECTED-DATABASES

Returns the list of active database objects.

CREATE-DATABASE (CONNECTION-SPEC &KEY (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*))

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

CREATE-INDEX (NAME &KEY ON (UNIQUE NIL) ATTRIBUTES (DATABASE *DEFAULT-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.

CREATE-LARGE-OBJECT (&KEY (DATABASE *DEFAULT-DATABASE*))

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

CREATE-SEQUENCE (NAME &KEY (DATABASE *DEFAULT-DATABASE*))

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

CREATE-TABLE (NAME DESCRIPTION &KEY (DATABASE *DEFAULT-DATABASE*) (CONSTRAINTS NIL) (TRANSACTIONS T))

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.

CREATE-VIEW (NAME &KEY AS COLUMN-LIST (WITH-CHECK-OPTION NIL) (DATABASE *DEFAULT-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.

CREATE-VIEW-FROM-CLASS (VIEW-CLASS-NAME &KEY (DATABASE *DEFAULT-DATABASE*) (TRANSACTIONS T))

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

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.

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.

DATE-DIFFERENCE (DATE1 DATE2)

Returns a DURATION representing the difference between TIME1 and TIME2.

DATE-MJD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DB-TIMESTRING (TIME &KEY STREAM)

return the string to store the given time in the database

DECODE-DATE (DATE)

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

DECODE-TIME (TIME)

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

DELETE-LARGE-OBJECT (OBJECT-ID &KEY (DATABASE *DEFAULT-DATABASE*))

Deletes the large object in the database

DELETE-RECORDS (&KEY (FROM NIL) (WHERE NIL) (DATABASE *DEFAULT-DATABASE*))

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

DELETE-SQL-STREAM (STREAM &KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

DESTROY-DATABASE (CONNECTION-SPEC &KEY (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*))

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

DISCONNECT (&KEY (DATABASE *DEFAULT-DATABASE*) (ERROR NIL))

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.

DISCONNECT-POOLED (&OPTIONAL CLEAR)

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

DROP-INDEX (NAME &KEY (IF-DOES-NOT-EXIST ERROR) (ON NIL) (DATABASE *DEFAULT-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.

DROP-SEQUENCE (NAME &KEY (IF-DOES-NOT-EXIST ERROR) (DATABASE *DEFAULT-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.

DROP-TABLE (NAME &KEY (IF-DOES-NOT-EXIST ERROR) (DATABASE *DEFAULT-DATABASE*) (OWNER NIL))

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.

DROP-VIEW (NAME &KEY (IF-DOES-NOT-EXIST ERROR) (DATABASE *DEFAULT-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.

DROP-VIEW-FROM-CLASS (VIEW-CLASS-NAME &KEY (DATABASE *DEFAULT-DATABASE*) (OWNER NIL))

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

DURATION+ (TIME &REST DURATIONS)

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

DURATION-DAY (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DURATION-HOUR (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DURATION-MINUTE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DURATION-MONTH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DURATION-SECOND (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DURATION-YEAR (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ENSURE-KEYWORD (NAME)

Returns keyword for a name.

FIND-DATABASE (DATABASE &KEY (ERRORP T) (DB-TYPE NIL))

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.

FLOAT-TO-SQL-STRING (NUM)

Convert exponent character for SQL

FORMAT-DATE (STREAM DATE &KEY FORMAT (DATE-SEPARATOR -) (INTERNAL-SEPARATOR ))

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

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

FREE-PREPARED-SQL (PREPARED-STMT)

Delete the objects associated with a prepared statement.

GET-DATE

Returns a date for today

GET-TIME

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

GETENV (VAR)

Return the value of the environment variable.

IN-TRANSACTION-P (&KEY (DATABASE *DEFAULT-DATABASE*))

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

INDEX-EXISTS-P (NAME &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

INITIALIZE-DATABASE-TYPE (&KEY (DATABASE-TYPE *DEFAULT-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*.

INSERT-RECORDS (&KEY (INTO NIL) (ATTRIBUTES NIL) (VALUES NIL) (AV-PAIRS NIL) (QUERY NIL) (DATABASE *DEFAULT-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.

INTERVAL-CONTAINED (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INTERVAL-DATA (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

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.

INTERVAL-END (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INTERVAL-MATCH (LIST TIME)

Return the index of the first interval in list containing time

INTERVAL-RELATION (X Y)

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

INTERVAL-START (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INTERVAL-TYPE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

LIST-ATTRIBUTE-TYPES (TABLE &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

LIST-ATTRIBUTES (NAME &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

LIST-CLASSES (&KEY (TEST #'IDENTITY) (ROOT-CLASS (FIND-CLASS 'STANDARD-DB-OBJECT)) (DATABASE *DEFAULT-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.

LIST-DATABASES (CONNECTION-SPEC &KEY (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*))

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

LIST-INDEXES (&KEY (OWNER NIL) (DATABASE *DEFAULT-DATABASE*) (ON NIL))

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.

LIST-SEQUENCES (&KEY (OWNER NIL) (DATABASE *DEFAULT-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.

LIST-SQL-STREAMS (&KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

LIST-TABLES (&KEY (OWNER NIL) (DATABASE *DEFAULT-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.

LIST-VIEWS (&KEY (OWNER NIL) (DATABASE *DEFAULT-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.

MAP-QUERY (OUTPUT-TYPE-SPEC FUNCTION QUERY-EXPRESSION &KEY (DATABASE *DEFAULT-DATABASE*) (RESULT-TYPES AUTO))

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.

PARSE-DATE-TIME (STRING)

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

PARSE-DATESTRING (DATESTRING &KEY (START 0) 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).

PARSE-TIMESTRING (TIMESTRING &KEY (START 0) 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.

PREPARE-SQL (SQL-STMT TYPES &KEY (DATABASE *DEFAULT-DATABASE*) (RESULT-TYPES AUTO) 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)

PROBE-DATABASE (CONNECTION-SPEC &KEY (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*))

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

PUSH-LIBRARY-PATH (PATH)

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

READ-LARGE-OBJECT (OBJECT-ID &KEY (DATABASE *DEFAULT-DATABASE*))

Reads the large object content

RECONNECT (&KEY (DATABASE *DEFAULT-DATABASE*) (ERROR NIL) (FORCE T))

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.

RELOAD-DATABASE-TYPES

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

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)

ROLLBACK (&KEY (DATABASE *DEFAULT-DATABASE*))

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

RUN-PREPARED-SQL (PREPARED-STMT)

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

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.

SEQUENCE-EXISTS-P (NAME &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

SEQUENCE-LAST (NAME &KEY (DATABASE *DEFAULT-DATABASE*))

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

SEQUENCE-NEXT (NAME &KEY (DATABASE *DEFAULT-DATABASE*))

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

SET-AUTOCOMMIT (VALUE &KEY (DATABASE *DEFAULT-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.

SET-SEQUENCE-POSITION (NAME POSITION &KEY (DATABASE *DEFAULT-DATABASE*))

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

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.

SQL-ESCAPE (IDENTIFIER)

Change hyphens to underscores, ensure string

SQL-ESCAPE-QUOTES (S)

Escape quotes for SQL string writing

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.

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.

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.

SQL-RECORDING-P (&KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

SQL-STREAM (&KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

START-SQL-RECORDING (&KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

START-TRANSACTION (&KEY (DATABASE *DEFAULT-DATABASE*))

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

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.

STOP-SQL-RECORDING (&KEY (TYPE COMMANDS) (DATABASE *DEFAULT-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.

TABLE-EXISTS-P (NAME &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

TIME+ (TIME &REST DURATIONS)

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

TIME- (TIME &REST DURATIONS)

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

TIME-DIFFERENCE (TIME1 TIME2)

Returns a DURATION representing the difference between TIME1 and TIME2.

TIME-DOW (TIME)

Return the 0 indexed Day of the week starting with Sunday

TIME-MAX (NUMBER &REST MORE-NUMBERS)

Returns the greatest of its arguments.

TIME-MIN (NUMBER &REST MORE-NUMBERS)

Returns the least of its arguments.

TIME-MJD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TIME< (NUMBER &REST MORE-NUMBERS)

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

TIME<= (NUMBER &REST MORE-NUMBERS)

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

TIME= (NUMBER &REST MORE-NUMBERS)

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

TIME> (NUMBER &REST MORE-NUMBERS)

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

TIME>= (NUMBER &REST MORE-NUMBERS)

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

TRUNCATE-DATABASE (&KEY (DATABASE *DEFAULT-DATABASE*))

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

UPDATE-OBJECTS-JOINS (OBJECTS &KEY (SLOTS IMMEDIATE) (FORCE-P T) CLASS-NAME (MAX-LEN *DEFAULT-UPDATE-OBJECTS-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

UPDATE-RECORDS (TABLE &KEY (ATTRIBUTES NIL) (VALUES NIL) (AV-PAIRS NIL) (WHERE NIL) (DATABASE *DEFAULT-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.

UTIME->TIME (UTIME)

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

VIEW-EXISTS-P (NAME &KEY (OWNER NIL) (DATABASE *DEFAULT-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.

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.

WRITE-LARGE-OBJECT (OBJECT-ID DATA &KEY (DATABASE *DEFAULT-DATABASE*))

Writes data to the large object

Undocumented

COMMAND-OBJECT (EXPRESSION &OPTIONAL PARAMETERS (PREPARED-NAME ))

COMMAND-OUTPUT (CONTROL-STRING &REST ARGS)

CONVERT-TO-DB-DEFAULT-CASE (STR DATABASE)

CURRENT-DAY

CURRENT-MONTH

CURRENT-YEAR

DATE-COMPARE (DATE-A DATE-B)

DATE-DOW (DATE)

DATE-ELEMENT (DATE ELEMENT)

DATE-MAX (NUMBER &REST MORE-NUMBERS)

DATE-MIN (NUMBER &REST MORE-NUMBERS)

SETFDATE-MJD (NEW-VALUE INSTANCE)

DATE-P (OBJECT)

DATE-YMD (DATE)

DATE< (NUMBER &REST MORE-NUMBERS)

DATE<= (NUMBER &REST MORE-NUMBERS)

DATE= (NUMBER &REST MORE-NUMBERS)

DATE> (NUMBER &REST MORE-NUMBERS)

DATE>= (NUMBER &REST MORE-NUMBERS)

DB-DATESTRING (DATE)

SETFDURATION-DAY (NEW-VALUE INSTANCE)

SETFDURATION-HOUR (NEW-VALUE INSTANCE)

SETFDURATION-MINUTE (NEW-VALUE INSTANCE)

SETFDURATION-MONTH (NEW-VALUE INSTANCE)

DURATION-REDUCE (DURATION PRECISION &OPTIONAL ROUND)

SETFDURATION-SECOND (NEW-VALUE INSTANCE)

DURATION-TIMESTRING (DURATION)

SETFDURATION-YEAR (NEW-VALUE INSTANCE)

DURATION< (DURATION-A DURATION-B)

DURATION<= (DURATION-A DURATION-B)

DURATION= (DURATION-A DURATION-B)

DURATION> (X Y)

DURATION>= (X Y)

ENCODING (DB)

SETFENCODING (ENCODING DB)

EXTRACT-ROMAN (STRING &AUX PARSE)

FORMAT-DURATION (STREAM DURATION &KEY (PRECISION MINUTE))

GREGORIAN-TO-MJD (MONTH DAY YEAR)

INTERVAL-CLEAR (LIST TIME)

SETFINTERVAL-CONTAINED (NEW-VALUE INSTANCE)

SETFINTERVAL-DATA (NEW-VALUE INSTANCE)

SETFINTERVAL-END (NEW-VALUE INSTANCE)

INTERVAL-PUSH (INTERVAL-LIST INTERVAL &OPTIONAL CONTAINER-RULE)

SETFINTERVAL-START (NEW-VALUE INSTANCE)

SETFINTERVAL-TYPE (NEW-VALUE INSTANCE)

IS-DATABASE-OPEN (DATABASE)

ISO-TIMESTRING (TIME &KEY STREAM)

MAKE-DATE (&KEY (YEAR 0) (MONTH 1) (DAY 1) (HOUR 0) (MINUTE 0) (SECOND 0) (USEC 0) (OFFSET 0))

MAKE-DURATION (&KEY (YEAR 0) (MONTH 0) (DAY 0) (HOUR 0) (MINUTE 0) (SECOND 0) (USEC 0))

MAKE-INTERVAL (&KEY ((START DUM1208) NIL) ((END DUM1209) NIL) ((NAME DUM1210) NIL) ((CONTAINED DUM1211) NIL) ((TYPE DUM1212) NIL) ((DATA DUM1213) NIL))

MAKE-PROCESS-LOCK (NAME)

MAKE-TIME (&KEY (YEAR 0) (MONTH 1) (DAY 1) (HOUR 0) (MINUTE 0) (SECOND 0) (USEC 0) (OFFSET 0))

MERGED-TIME (DAY TIME-OF-DAY)

MJD-TO-GREGORIAN (MJD)

MONTH-NAME (MONTH-INDEX)

NUMBER-TO-SQL-STRING (NUM)

PARSE-YEARSTRING (STRING)

READ-INSTANCE-FROM-STREAM (STREAM)

ROLL (DATE &KEY (YEAR 0) (MONTH 0) (DAY 0) (SECOND 0) (HOUR 0) (MINUTE 0) (USEC 0) (DESTRUCTIVE NIL))

ROLL-TO (DATE SIZE POSITION)

SQL-* (&REST REST)

SQL-+ (&REST REST)

SQL-- (&REST REST)

SQL-/ (&REST REST)

SQL-< (&REST REST)

SQL-<= (&REST REST)

SQL-<> (&REST REST)

SQL-= (&REST REST)

SQL-== (&REST REST)

SQL-> (&REST REST)

SQL->= (&REST REST)

SQL-ALL (&REST REST)

SQL-AND (&REST REST)

SQL-ANY (&REST REST)

SQL-AVG (&REST REST)

SQL-BETWEEN (&REST REST)

SQL-COALESCE (&REST REST)

SQL-CONCAT (&REST REST)

SQL-CONCAT-OP (&REST REST)

SQL-COUNT (&REST REST)

SQL-DISTINCT (&REST REST)

SQL-EXCEPT (&REST REST)

SQL-EXISTS (&REST REST)

SQL-FUNCTION (&REST ARGS)

SQL-GROUP-BY (&REST REST)

SQL-HAVING (&REST REST)

SQL-IN (&REST REST)

SQL-INTERSECT (&REST REST)

SQL-IS (&REST REST)

SQL-LIKE (&REST REST)

SQL-LIMIT (&REST REST)

SQL-MAX (&REST REST)

SQL-MIN (&REST REST)

SQL-MINUS (&REST REST)

SQL-NOT (&REST REST)

SQL-NOT-NULL (&OPTIONAL NOT-NULL-THING)

SQL-NULL (&OPTIONAL NOT-NULL-THING)

SQL-NVL (&REST REST)

SQL-OR (&REST REST)

SQL-ORDER-BY (&REST REST)

SQL-QUERY (&REST ARGS)

SQL-SLOT-VALUE (CLASSNAME SLOT &OPTIONAL (VALUE +NO-SLOT-VALUE+) (DATABASE *DEFAULT-DATABASE*))

SQL-SOME (&REST REST)

SQL-SUBSTR (&REST REST)

SQL-SUBSTRING (&REST REST)

SQL-SUM (&REST REST)

SQL-THE (&REST REST)

SQL-UNION (&REST REST)

SQL-UPLIKE (&REST REST)

SQL-USERENV (&REST REST)

SQL-VIEW-CLASS (CLASSNAME &OPTIONAL (DATABASE *DEFAULT-DATABASE*))

SYMBOL-NAME-DEFAULT-CASE (STR)

TIME-COMPARE (TIME-A TIME-B)

TIME-ELEMENT (TIME ELEMENT)

SETFTIME-MJD (NEW-VALUE INSTANCE)

TIME-YMD (TIME)

WEEK-CONTAINING (TIME)

Private

%CLSQL-SUBCLAUSES (CLAUSES)

a helper for dealing with lists of sql clauses

%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)

%DATABASE-LIST-* (DATABASE TYPE OWNER)

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

%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.

%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

%POOL-FORCE-DISCONNECT (DATABASE)

Force disconnection of a connection from the pool.

%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

%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

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.

ALL-HOME-KEYS-HAVE-VALUES-P (OBJECT SLOT-DEF)

Do all of the home-keys have values ?

ALL-IMMEDIATE-JOIN-CLASSES-FOR (CLASSES)

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

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

CLEAR-CONN-POOL (POOL)

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

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

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

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

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

COMBINE-DATABASE-IDENTIFIERS (IDS &OPTIONAL (DATABASE *DEFAULT-DATABASE*) &AUX RES ALL-SYM? PKG)

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

COMPUTE-LISP-TYPE-FROM-SPECIFIED-TYPE (SPECIFIED-TYPE DB-CONSTRAINTS)

Computes the Lisp type for a user-specified type.

DATE->TIME (DATE)

Returns a walltime for the given date

DAY-OF-YEAR (YEAR MONTH DAY &KEY (CAREFUL T))

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

DAYS-IN-MONTH (MONTH YEAR &KEY (CAREFUL T))

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

DELIMITED-STRING-TO-LIST (STRING &OPTIONAL (SEPARATOR ) SKIP-TERMINAL)

Split a string with delimiter, from KMRCL.

DELIST-IF-SINGLE (X)

if this is a single item in a list return it

DELISTIFY (LIST)

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

DELISTIFY-DSD (LIST)

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

DIRECT-NORMALIZED-SLOT-P (CLASS SLOT-NAME)

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

DURATION- (DURATION &REST DURATIONS)

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

DURATION-USEC (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

EASY-SLOT-VALUE (OBJ SLOT)

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

SETFEASY-SLOT-VALUE (NEW OBJ SLOT)

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

FIELD-NAMES (FIELD-FORMS)

Return a list of field name strings from a fields form

FILTER-PLIST (PLIST &REST KEYS-TO-REMOVE)

Returns a copy of the given plist with indicated key-value pairs removed. keys are searched with #'MEMBER

FIND-ALL (VIEW-CLASSES &REST ARGS &KEY ALL SET-OPERATION DISTINCT FROM WHERE GROUP-BY HAVING ORDER-BY OFFSET LIMIT REFRESH FLATP RESULT-TYPES INNER-JOIN ON (DATABASE *DEFAULT-DATABASE*) INSTANCES PARAMETERS)

Called by SELECT to generate object query results when the View Classes VIEW-CLASSES are passed as arguments to SELECT. TODO: the caching scheme of passing in instances and overwriting their values 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) 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 objects returned from the database

FIND-NORMALIZED-KEY (OBJ)

Find the first / primary key of a normalized object

FIND-OR-CREATE-CONNECTION-POOL (CONNECTION-SPEC DATABASE-TYPE)

Find connection pool in hash table, creates a new connection pool if not found

FIND-SLOT-BY-NAME (CLASS SLOT-NAME &OPTIONAL DIRECT? RECURSE?)

Looks up a direct-slot-definition by name

FIND-SLOT-IF (CLASS PREDICATE &OPTIONAL DIRECT? RECURSE?)

Looks up a direct-slot-definition by name

FROM-NAMES (FROM)

Return a list of field name strings from a fields form

FULL-SELECT-LIST (SELECT-LISTS)

Returns a list of sql-ref of things to select for the given classes THIS NEEDS TO MATCH THE ORDER OF build-objects

GENERATE-ATTRIBUTE-REFERENCE (VCLASS SLOTDEF &OPTIONAL (DATABASE *DEFAULT-DATABASE*))

Turns key class and slot-def into a sql-expression representing the table and column it comes from used by things like make-select-list, update-slot-from-record

GET-JOIN-SLOTS (CLASS &OPTIONAL RETRIEVAL-METHOD)

Returns list of join slots for a class. if a retrieval method is specified only return slots of that type if the retrieval method is T, nil or :all return all join slots

GET-JOINED-OBJECTS (OBJECTS SLOTDEF &KEY FORCE-P (BATCH-SIZE *DEFAULT-UPDATE-OBJECTS-MAX-LEN*))

Given a list of objects and a join slot-def get the objects that need to be joined to the input objects we will query in batches as large as batch-size

INTERVAL-NAME (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

JOIN-QUALIFIER (CLASS OBJECT SLOT-DEF)

Builds the join where clause based on the keys of the join slot and values of the object

JOIN-SLOT-CLASS (SLOT-DEF)

Get the join class for a given join slot

JOIN-SLOT-CLASS-NAME (SLOT-DEF)

get the join class name for a given join slot

JOIN-SLOT-INFO-VALUE (SLOT-DEF KEY)

Get the join-slot db-info value associated with a key

JOIN-SLOT-P (SLOT-DEF)

takes a slot def and returns whether or not it is a join slot

JOIN-SLOT-QUALIFIER (CLASS JOIN-SLOT)

Creates a sql-expression expressing the join between the home-key on the table and its respective key on the joined-to-table

JOIN-SLOT-RETRIEVAL-METHOD (SLOT-DEF)

if this is a join slot return the retrieval param in the db-info

KEY-OR-BASE-SLOT-P (SLOT-DEF)

takes a slot def and returns whether or not it is a key

KEY-QUALIFIER-FOR-INSTANCE (OBJ &KEY (DATABASE *DEFAULT-DATABASE*) THIS-CLASS)

Generate a boolean sql-expression that identifies an object by its keys

KEY-SLOT-P (SLOT-DEF)

takes a slot def and returns whether or not it is a key

LEAP-YEAR? (YEAR)

t if YEAR is a leap yeap in the Gregorian calendar

MAKE-CLASS-AND-SLOTS (C &OPTIONAL S)

Create a new class-and-slots object

MAKE-SELECT-LIST (CLASS-AND-SLOTS &KEY (DO-JOINS-P NIL))

Make a select-list for the current class (or class-and-slots) object.

NORMALIZED-KEY-VALUE (OBJ)

Normalized classes share a single key for all their key slots

NOT-DIRECT-NORMALIZED-SLOT-P (CLASS SLOT-NAME)

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

ODBC-RESULT-SET-FULL-SET (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ODBC-RESULT-SET-QUERY (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ODBC-RESULT-SET-TYPES (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ORDERED-CLASS-DIRECT-SLOTS (CLASS)

Gets an ordered list of direct class slots

ORDINAL-DAY (DAY-KEYWORD)

Return the zero-based day number for the given DAY keyword.

ORDINAL-MONTH (MONTH-KEYWORD)

Return the zero-based month number for the given MONTH keyword.

OUTPUT-SQL-WHERE-CLAUSE (WHERE DATABASE)

ensure that we do not output a "where" sql keyword when we will not output a clause. Also sets *in-subselect* to use SQL parentheticals as needed.

PARSE-ISO-8601-DURATION (STRING)

return a wall-time from a duration string

PARSE-ISO-8601-TIME (STRING)

return the wall-time corresponding to the given ISO 8601 datestring

POSITION-CHAR (CHAR STRING START MAX)

From KMRCL.

QUERY-GET-SELECTIONS (SELECT-ARGS)

Return two values: the list of select-args up to the first keyword, uninclusive, and the args from that keyword to the end.

RELEASE-TO-POOL (DATABASE &OPTIONAL (POOL (CONN-POOL DATABASE)))

Release a database connection to the pool. The backend will have a chance to do cleanup.

REPLACE-ALL (STRING PART REPLACEMENT &KEY (TEST #'CHAR=) STREAM)

Returns a new string in which all the occurences of the part is replaced with replacement. [FROM http://cl-cookbook.sourceforge.net/strings.html#manip]

REPLACE-STRING (STRING1 SEARCH-STRING REPLACE-STRING &KEY (TEST #'STRING=))

Search within string1 for search-string, replace with replace-string, non-destructively.

SELECT-REFERENCE-EQUAL (R1 R2)

determines if two sql select references are equal using database identifier equal

SLOT-HAS-DEFAULT-P (SLOT)

returns nil if the slot does not have a default constraint

SLOTS-FOR-POSSIBLY-NORMALIZED-CLASS (CLASS)

Get the slots for this class, if normalized this is only the direct slots otherwiese its all the slots

SPECIAL-CASED-SYMBOL-P (SYM)

Should the symbols case be preserved, or should we convert to default casing

SPECIAL-CHAR-P (S)

Check if a string has any special characters

SQL-OUTPUT (SQL-EXPR &OPTIONAL (DATABASE *DEFAULT-DATABASE*))

Top-level call for generating SQL strings. Returns an SQL string appropriate for DATABASE which corresponds to the supplied lisp expression SQL-EXPR.

SUBSTITUTE-CHAR-STRING (PROCSTR MATCH-CHAR SUBST-STR)

Substitutes a string for a single matching character of a string

SUBSTITUTE-CHARS-STRINGS (STR REPL-ALIST)

Replace all instances of a chars with a string. repl-alist is an assoc list of characters and replacement strings.

SUBSTITUTE-STRING-FOR-CHAR (PROCSTR MATCH-CHAR SUBST-STR)

Substitutes a string for a single matching character of a string

TIME->DATE (TIME)

Returns a date for the given wall time (obvious loss in resolution)

TIME-SECOND (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TIME-USEC (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TIME/= (NUMBER &REST MORE-NUMBERS)

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

TO-SLOT-NAME (SLOT)

try to turn what we got representing the slot into a slot name

UPDATE-AUTO-INCREMENTS-KEYS (CLASS OBJ DATABASE)

handle pulling any autoincrement values into the object if normalized and we now that all the

VALID-GREGORIAN-DATE-P (DATE)

t if DATE (year month day) exists in the Gregorian calendar

VALID-MONTH-P (MONTH)

t if MONTH exists in the Gregorian calendar

Undocumented

%CONVERT-DB-INFO-TO-HASH (SLOT-DEF)

%DISABLE-SQL-READER-SYNTAX

%ENABLE-SQL-READER-SYNTAX

%GET-INT (V)

%MAKE-DATE (&KEY ((MJD DUM150) 0))

%MAKE-DURATION (&KEY ((YEAR DUM75) 0) ((MONTH DUM76) 0) ((DAY DUM77) 0) ((HOUR DUM78) 0) ((SECOND DUM79) 0) ((MINUTE DUM80) 0) ((USEC DUM81) 0))

%MAKE-WALL-TIME (&KEY ((MJD DUM8) 0) ((SECOND DUM9) 0) ((USEC DUM10) 0))

%PRINT-DATE (DATE STREAM DEPTH)

%PRINT-DURATION (DURATION STREAM DEPTH)

%PRINT-WALL-TIME (TIME STREAM DEPTH)

%SEQ-NAME-KEY

%SEQUENCE-NAME-TO-TABLE (SEQUENCE-NAME DATABASE)

%SVUC-SLOT-NAME (SLOT)

%SVUC-SLOT-OBJECT (SLOT CLASS)

%TABLE-NAME-TO-SEQUENCE-NAME (TABLE-NAME)

%TIME< (X Y)

%TIME<= (X Y)

%TIME= (X Y)

%TIME> (X Y)

%TIME>= (X Y)

%UNINSTALL-CLASS (SELF &KEY (DATABASE *DEFAULT-DATABASE*) (OWNER NIL))

%WRITE-OPERATOR (OPERATOR DATABASE)

BASE-DB-CLASS (CLASSNAME)

BINDING-TO-PARAM (BINDING)

CHECK-SLOT-TYPE (SLOTDEF VAL)

CLSQL-TYPE->POSTGRESQL-TYPE (TYPE)

COMPUTE-COLUMN-NAME (ARG)

COMPUTE-RECORDS-CACHE-KEY (TARGETS QUALIFIERS)

COPY-DATE (INSTANCE)

COPY-DURATION (INSTANCE)

COPY-INTERVAL (INSTANCE)

COPY-ODBC-RESULT-SET (INSTANCE)

COPY-TIME (TIME)

COPY-WALL-TIME (INSTANCE)

DATABASE-IDENTIFIER-EQUAL (I1 I2 &OPTIONAL (DATABASE *DEFAULT-DATABASE*))

DATABASE-LIST-OBJECTS-OF-TYPE (DATABASE TYPE OWNER)

DATE/= (NUMBER &REST MORE-NUMBERS)

DAY-NAME (DAY-INDEX)

DB-ANCESTORS (CLASSNAME)

DB-VALUE-FROM-SLOT (SLOTDEF VAL DATABASE)

DELETE-AT-INDEX (IDX LIST)

DEQUOTE (IT)

DESCRIBE-DB-LAYOUT (CLASS)

DURATION-P (OBJECT)

SETFDURATION-USEC (NEW-VALUE INSTANCE)

ESCAPED-DATABASE-IDENTIFIER (NAME &OPTIONAL DATABASE FIND-CLASS-P)

FAULT-JOIN-SLOT (CLASS OBJECT SLOT-DEF)

FAULT-JOIN-SLOT-RAW (CLASS OBJECT SLOT-DEF)

FAULT-JOIN-TARGET-SLOT (CLASS OBJECT SLOT-DEF)

FIND-STANDARD-DB-CLASS (NAME &AUX CLS)

GENERATE-SQL-REFERENCE (&REST ARGLIST)

GET-KEYWORDS (KEYS LIST)

HAS-TABLE (NAME DATABASE)

HORK-INTEGERS (INPUT)

IMMEDIATE-JOIN-SLOTS (CLASS)

INSERT-AT-INDEX (IDX LIST ELT)

SETFINTERVAL-NAME (NEW-VALUE INSTANCE)

INTERVAL-P (OBJECT)

ISO-8601-DELIMITER (ELT)

ISO-8601-DURATION-SUBSEQ (STRING END)

ISO-DATESTRING (DATE)

KEYSLOTS-FOR-CLASS (CLASS)

LEAP-DAYS-IN-DAYS (DAYS)

LISP->SQL-NAME (FIELD)

LISTIFY (X)

LOOP-RECORD-ITERATION-PATH (VARIABLE DATA-TYPE PREP-PHRASES)

MAKE-ATTRIBUTE-VALUE-PAIR (SLOT-DEF VALUE DATABASE)

MAKE-CONSTRAINTS-DESCRIPTION (CONSTRAINT-LIST)

MAKE-ODBC-RESULT-SET (&KEY ((QUERY DUM227) NIL) ((TYPES DUM228) NIL) ((FULL-SET DUM229) NIL))

MAKE-QUERY (&REST ARGS)

MAKE-SQL-INSERT (&KEY (INTO NIL) (ATTRS NIL) (VALS NIL) (AV-PAIRS NIL) (SUBQUERY NIL))

MAP-QUERY-FOR-EFFECT (FUNCTION QUERY-EXPRESSION DATABASE RESULT-TYPES)

MAP-QUERY-TO-LIST (FUNCTION QUERY-EXPRESSION DATABASE RESULT-TYPES)

MAP-QUERY-TO-SIMPLE (OUTPUT-TYPE-SPEC FUNCTION QUERY-EXPRESSION DATABASE RESULT-TYPES)

MARK-TRANSACTION-COMMITTED (DATABASE)

NEXT-PREPARED-ID

SETFODBC-RESULT-SET-FULL-SET (NEW-VALUE INSTANCE)

ODBC-RESULT-SET-P (OBJECT)

SETFODBC-RESULT-SET-QUERY (NEW-VALUE INSTANCE)

SETFODBC-RESULT-SET-TYPES (NEW-VALUE INSTANCE)

ORDER-BY-STRINGS (ORDER-BY)

ORDERED-CLASS-SLOTS (CLASS)

OWNER-CLAUSE (OWNER)

PARSE-DB-INFO (DB-INFO-LIST)

PARSE-INTEGER-INSENSITIVELY (STRING)

POSTGRESQL-DATABASE-LIST (CONNECTION-SPEC TYPE)

PREPARED-SQL-TO-POSTGRESQL-SQL (SQL)

PRETTY-TIME (HOUR MINUTE)

QUERY-ARG-P (SYM)

QUERY-STRING (FIELDS FROM WHERE DISTINCT ORDER-BY LIMIT)

READ-STREAM-TO-STRING (IN)

RECORD-SQL-COMMAND (EXPR DATABASE)

RECORD-SQL-RESULT (RES DATABASE)

RECORDS-CACHE-RESULTS (TARGETS QUALIFIERS DATABASE)

SETFRECORDS-CACHE-RESULTS (RESULTS TARGETS QUALIFIERS DATABASE)

REGISTER-METACLASS (CLASS SLOTS)

REMOVE-KEYWORD-ARG (ARGLIST AKEY)

REPLACE-AT-INDEX (IDX LIST ELT)

REPLACED-STRING-LENGTH (STR REPL-ALIST)

RESTRICT-INTERVALS (LIST START END &AUX NEWLIST)

SET-VIEW-TABLE-SLOT (CLASS BASE-TABLE)

SIGNAL-CLOSED-DATABASE-ERROR (DATABASE)

SIGNAL-DATABASE-TOO-STRANGE (MESSAGE)

SIGNAL-NO-DATABASE-ERROR (DATABASE)

SLOTDEF-FOR-SLOT-WITH-CLASS (SLOT CLASS)

SLOTDEFS-FOR-SLOTS-WITH-CLASS (SLOTS CLASS)

SORT-INTERVAL-LIST (LIST)

SQL-LOWER (&REST REST)

SQL-READER-OPEN (STREAM CHAR)

SQL-UPPER (&REST REST)

STRING-TO-LIST-CONNECTION-SPEC (STR)

SYNTAX-PARSE-ISO-8601 (STRING)

TABLE-NAME-FROM-ARG (ARG)

TIME-HMS (TIME)

TIME-MERIDIAN (HOURS)

SETFTIME-SECOND (NEW-VALUE INSTANCE)

SETFTIME-USEC (NEW-VALUE INSTANCE)

TO-ATTRIBUTES-AND-VALUES (AV-PAIRS)

TO-CLASS (IT)

TO-CLASS-NAME (O)

UNESCAPED-DATABASE-IDENTIFIER (NAME &OPTIONAL DATABASE FIND-CLASS-P)

UPDATE-FAULT-JOIN-NORMALIZED-SLOT (CLASS OBJECT SLOT-DEF)

WALL-TIME-P (OBJECT)

WHERE-STRINGS (WHERE)

MACRO

Public

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.

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.

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.

DO-QUERY (((&REST ARGS) QUERY-EXPRESSION &KEY (DATABASE '*DEFAULT-DATABASE*) (RESULT-TYPES AUTO)) &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.

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.

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

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.

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.

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.

TIME (FORM)

Execute FORM and print timing information on *TRACE-OUTPUT*. On some hardware platforms estimated processor cycle counts are included in this output; this number is slightly inflated, since it includes the pipeline involved in reading the cycle counter -- executing (TIME NIL) a few times will give you an idea of the overhead, and its variance. The cycle counters are also per processor, not per thread: if multiple threads are running on the same processor, the reported counts will include cycles taken up by all threads running on the processor where TIME was executed. Furthermore, if the operating system migrates the thread to another processor between reads of the cycle counter, the results will be completely bogus. Finally, the counter is cycle counter, incremented by the hardware even when the process is halted -- which is to say that cycles pass normally during operations like SLEEP.

WITH-DATABASE ((DB-VAR CONNECTION-SPEC &KEY MAKE-DEFAULT POOL (IF-EXISTS *CONNECT-IF-EXISTS*) (DATABASE-TYPE *DEFAULT-DATABASE-TYPE*) (ENCODING NIL)) &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.

WITH-DEFAULT-DATABASE ((DATABASE) &REST BODY)

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

WITH-TRANSACTION ((&KEY (DATABASE '*DEFAULT-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.

Undocumented

IN (OBJ &REST CHOICES)

LOOP (&ENVIRONMENT ENV &REST KEYWORDS-AND-FORMS)

WITH-PROCESS-LOCK ((LOCK DESC) &BODY BODY)

WITHOUT-INTERRUPTS (&BODY BODY)

Private

DEFAULTING (&REST PLACE-VALUE-PLIST)

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

MAKE-WEAK-HASH-TABLE (&REST ARGS)

Creates a weak hash table for use in a cache.

POP-N (PLACE &OPTIONAL (N 1))

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

Undocumented

DEFSQL (FUNCTION DEFINITION-KEYS &BODY BODY)

FOR-EACH-ROW (((&REST FIELDS) &KEY FROM ORDER-BY WHERE DISTINCT LIMIT) &BODY BODY)

PROCESS-CLASS-OPTION (METACLASS SLOT-NAME &OPTIONAL REQUIRED)

PROCESS-SLOT-OPTION (METACLASS SLOT-NAME)

WRAP-TIME-FOR-DATE (TIME-FUNC &KEY (RESULT-FUNC NIL))

GENERIC-FUNCTION

Public

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.

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.

DATABASE-BIND-PARAMETER (PREPARED-STMT POSITION VALUE)

Bind a parameter for a prepared statement.

DATABASE-CONNECT (CONNECTION-SPEC DATABASE-TYPE)

Internal generic implementation of connect.

DATABASE-CREATE (CONNECTION-SPEC TYPE)

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

DATABASE-CREATE-LARGE-OBJECT (DATABASE)

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

DATABASE-CREATE-SEQUENCE (NAME DATABASE)

Create a sequence in DATABASE.

DATABASE-DELETE-LARGE-OBJECT (OBJECT-ID DATABASE)

Deletes the large object in the database

DATABASE-DESTROY (CONNECTION-SPEC TYPE)

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

DATABASE-DISCONNECT (DATABASE)

Internal generic implementation of disconnect.

DATABASE-DROP-SEQUENCE (NAME DATABASE)

Drop a sequence from DATABASE.

DATABASE-DUMP-RESULT-SET (RESULT-SET DATABASE)

Dumps the received result-set.

DATABASE-EXECUTE-COMMAND (SQL-EXPRESSION DATABASE)

Internal generic implementation of execute-command.

DATABASE-FREE-PREPARED (PREPARED-STMT)

Free the resources of a prepared statement.

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.

DATABASE-INITIALIZE-DATABASE-TYPE (DATABASE-TYPE)

The internal generic implementation of initialize-database-type.

DATABASE-LIST (CONNECTION-SPEC TYPE)

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

DATABASE-LIST-ATTRIBUTES (TABLE DATABASE &KEY OWNER)

List all attributes in TABLE.

DATABASE-LIST-INDEXES (DATABASE &KEY OWNER)

List all indexes in the DATABASE.

DATABASE-LIST-SEQUENCES (DATABASE &KEY OWNER (OWNER NIL))

List all sequences in DATABASE.

DATABASE-LIST-TABLE-INDEXES (TABLE DATABASE &KEY OWNER)

List all indexes for a table in the DATABASE.

DATABASE-LIST-TABLES (DATABASE &KEY OWNER)

List all tables in the given database

DATABASE-LIST-TABLES-AND-SEQUENCES (DATABASE &KEY OWNER)

List all tables in the given database, may include seqeneces

DATABASE-LIST-VIEWS (DATABASE &KEY OWNER)

List all views in the DATABASE.

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.

DATABASE-PREPARE (STMT TYPES DATABASE RESULT-TYPES FIELD-NAMES)

Prepare a statement for later execution.

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.

DATABASE-QUERY (QUERY-EXPRESSION DATABASE RESULT-TYPES FIELD-NAMES)

Internal generic implementation of query.

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.

DATABASE-READ-LARGE-OBJECT (OBJECT-ID DATABASE)

Reads the large object content

DATABASE-RECONNECT (DATABASE)

Internal generic implementation of reconnect.

DATABASE-RELEASE-TO-CONN-POOL (DATABASE)

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

DATABASE-RUN-PREPARED (PREPARED-STMT)

Execute a prepared statement.

DATABASE-SEQUENCE-LAST (NAME DATABASE)

Select the last value in sequence NAME in DATABASE.

DATABASE-SEQUENCE-NEXT (NAME DATABASE)

Increment a sequence in DATABASE.

DATABASE-SET-SEQUENCE-POSITION (NAME POSITION DATABASE)

Set the position of the sequence called NAME in DATABASE.

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.

DATABASE-TYPE-LIBRARY-LOADED (DATABASE-TYPE)

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

DATABASE-TYPE-LOAD-FOREIGN (DATABASE-TYPE)

The internal generic implementation of reload-database-types.

DATABASE-UNDERLYING-TYPE (DATABASE)

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

DATABASE-WRITE-LARGE-OBJECT (OBJECT-ID DATA DATABASE)

Writes data to the large object

DB-BACKEND-HAS-CREATE/DESTROY-DB? (DB-TYPE)

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

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.

DB-TYPE-HAS-AUTO-INCREMENT? (DB-TYPE)

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

DB-TYPE-HAS-BIGINT? (DB-TYPE)

T [default] if database-type supports bigint.

DB-TYPE-HAS-BOOLEAN-WHERE? (DB-TYPE)

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

DB-TYPE-HAS-EXCEPT? (DB-TYPE)

T [default] if database-type supports EXCEPT.

DB-TYPE-HAS-FANCY-MATH? (DB-TYPE)

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

DB-TYPE-HAS-INTERSECT? (DB-TYPE)

T [default] if database-type supports INTERSECT.

DB-TYPE-HAS-PREPARED-STMT? (DB-TYPE)

T if database backend supports prepared statements.

DB-TYPE-HAS-SUBQUERIES? (DB-TYPE)

T [default] if database-type supports views.

DB-TYPE-HAS-UNION? (DB-TYPE)

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

DB-TYPE-HAS-VIEWS? (DB-TYPE)

T [default] if database-type supports views.

DB-TYPE-TRANSACTION-CAPABLE? (DB DATABASE)

T [default] if database can supports transactions.

DB-TYPE-USE-COLUMN-ON-DROP-INDEX? (DB-TYPE)

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

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.

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.

EXECUTE-COMMAND (EXPRESSION &KEY DATABASE (DATABASE *DEFAULT-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*.

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.

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)

QUERY (QUERY-EXPRESSION &KEY DATABASE RESULT-TYPES FLATP FIELD-NAMES (FIELD-NAMES T) (FLATP NIL) (RESULT-TYPES AUTO) (DATABASE *DEFAULT-DATABASE*))

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.

UPDATE-INSTANCE-FROM-RECORDS (OBJECT &KEY DATABASE (DATABASE *DEFAULT-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.

UPDATE-RECORD-FROM-SLOT (OBJECT SLOT &KEY DATABASE (DATABASE *DEFAULT-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.

UPDATE-RECORD-FROM-SLOTS (OBJECT SLOTS &KEY DATABASE (DATABASE *DEFAULT-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.

UPDATE-RECORDS-FROM-INSTANCE (OBJECT &KEY DATABASE (DATABASE *DEFAULT-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.

UPDATE-SLOT-FROM-RECORD (OBJECT SLOT &KEY DATABASE (DATABASE *DEFAULT-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.

Undocumented

BAD-COMPONENT (CONDITION)

DATABASE-LAST-AUTO-INCREMENT-ID (DATABASE TABLE COLUMN)

DATABASE-OUTPUT-SQL-AS-TYPE (TYPE VAL DATABASE DB-TYPE)

MIDNIGHT (SELF)

SETFPARAMETERS (NEW-VALUE OBJECT)

READ-SQL-VALUE (VAL TYPE DATABASE DB-TYPE)

SQL-ERROR-CONNECTION-SPEC (CONDITION)

SQL-ERROR-DATABASE (CONDITION)

SQL-ERROR-DATABASE-MESSAGE (CONDITION)

SQL-ERROR-DATABASE-TYPE (CONDITION)

SQL-ERROR-ERROR-ID (CONDITION)

SQL-ERROR-EXPRESSION (CONDITION)

SQL-ERROR-SECONDARY-ERROR-ID (CONDITION)

SQL-USER-ERROR-MESSAGE (CONDITION)

SQL-WARNING-DATABASE (CONDITION)

Private

AUTO-INCREMENT-SEQUENCE-NAME (CLASS SLOTDEF DATABASE)

The sequence name to create for this autoincremnt column on this class if returns nil, there is no associated sequence

CHOOSE-DATABASE-FOR-INSTANCE (OBJECT &OPTIONAL DATABASE)

Used by the oodml functions to select which database object to use. Chooses the database associated with the object primarily, falls back to the database provided as an argument or the *DEFAULT-DATABASE*.

DATABASE-ABORT-TRANSACTION (DATABASE)

Abort current transaction in DATABASE.

DATABASE-ADD-ATTRIBUTE (TABLE ATTRIBUTE DATABASE)

Add the attribute to the table.

DATABASE-ADD-AUTOINCREMENT-SEQUENCE (CLASS DATABASE)

If a database needs to add a sequence for its autoincrement to work, this is where it should go. Default is that it doesnt so just return nil

DATABASE-COMMIT-TRANSACTION (DATABASE)

Commit current transaction in DATABASE.

DATABASE-LAST-AUTOINCREMENT-ID (DATABASE TABLE COLUMN)

Many databases have the notion of an auto-increment id; i.e. a sequence implicitly on a table. This function should return that ID.

DATABASE-OUTPUT-SQL (EXPR DATABASE)

Returns an SQL string appropriate for DATABASE and corresponding to the lisp expression EXPR. DATABASE-OUTPUT-SQL is called by OUTPUT-SQL when no more specific method exists for EXPR.

DATABASE-REMOVE-AUTOINCREMENT-SEQUENCE (CLASS DATABASE)

If a database needs to add a sequence for its autoincrement to work, this is where it should go. Default is that it doesnt so just return nil

DATABASE-RENAME-ATTRIBUTE (TABLE OLDATT NEWNAME DATABASE)

Rename the attribute in the table to NEWNAME.

DATABASE-START-TRANSACTION (DATABASE)

Start a transaction in DATABASE.

DATABASE-TRUNCATE (DATABASE)

Remove all data from database.

OID (OBJECT)

Return the unique ID of a database object.

OUTPUT-SQL (EXPR DATABASE)

Writes an SQL string appropriate for DATABASE and corresponding to the lisp expression EXPR to *SQL-STREAM*. The function SQL-OUTPUT is a top-level call for generating SQL strings which initialises *SQL-STREAM*, calls OUTPUT-SQL and reads the generated SQL string from *SQL-STREAM*.

OUTPUT-SQL-HASH-KEY (EXPR DATABASE)

Returns a list (or other object suitable for use as the key of an EQUAL hash table) which uniquely identifies the arguments EXPR and DATABASE.

UPDATE-SLOT-WITH-NULL (INSTANCE SLOTDEF)

Called to update a slot when its column has a NULL value. If nulls are allowed for the column, the slot's value will be nil, otherwise its value will be set to the result of calling DATABASE-NULL-VALUE on the type of the slot.

Undocumented

%INSTALL-CLASS (CLASS DATABASE &KEY TRANSACTIONS (TRANSACTIONS T))

%TABLE-EXISTS-P (NAME DATABASE &KEY OWNER)

%UPDATE-INSTANCE-HELPER (CLASS-AND-SLOTS OBJ DATABASE)

ATTRIBUTE-REFERENCES (O)

ATTRIBUTE-VALUE-PAIRS (DEF O DATABASE)

AUTO-INCREMENT-COLUMN-P (SLOTDEF &OPTIONAL (DATABASE))

COLLECT-TABLE-REFS (SQL)

DATABASE-CONSTRAINT-STATEMENT (CONSTRAINTS DATABASE)

DATABASE-GENERATE-COLUMN-DEFINITION (CLASS SLOTDEF DATABASE)

DATABASE-IDENTIFIER (NAME &OPTIONAL DATABASE FIND-CLASS-P)

DATABASE-PKEY-CONSTRAINT (CLASS DATABASE)

GENERIC-FUNCTION-LAMBDA-LIST (GF)

GET-SLOT-VALUE-FROM-RECORD (INSTANCE SLOT &KEY (DATABASE *DEFAULT-DATABASE*))

GET-SLOT-VALUES-FROM-VIEW (OBJ SLOTDEFLIST VALUES)

KEY-VALUE-FROM-DB (SLOTDEF VALUE DATABASE)

PRIMARY-KEY-SLOT-VALUES (OBJ &KEY CLASS SLOTS)

SELECT-TABLE-SQL-EXPR (TABLE)

SQL-TABLE (O)

SQL-WARNING-MESSAGE (CONDITION)

TO-STRING (VAL &REST KEYS)

UPDATE-SLOT-DEFAULT-VALUES (OBJ CLASSES-AND-SLOTS)

UPDATE-SLOT-FROM-DB (INSTANCE SLOTDEF VAL)

UPDATE-SLOT-FROM-DB-VALUE (INSTANCE SLOTDEF VALUE)

VIEW-CLASSES-AND-SLOTS-BY-NAME (OBJ SLOTS-TO-MATCH)

VIEW-CLASSES-AND-STORABLE-SLOTS (CLASS)

VIEW-TABLE-EXP (O)

SLOT-ACCESSOR

Public

ATTRIBUTE-CACHE (OBJECT)

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.

SETFATTRIBUTE-CACHE (NEW-VALUE OBJECT)

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.

CONNECTION-SPEC (OBJECT)

Required to use connection pool.

EXPRESSION (OBJECT)

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

SETFEXPRESSION (NEW-VALUE OBJECT)

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

HAS-BEEN-PREPARED (OBJECT)

Have we already prepared this command object?

SETFHAS-BEEN-PREPARED (NEW-VALUE OBJECT)

Have we already prepared this command object?

PARAMETERS (OBJECT)

list of parameters

PREPARED-NAME (OBJECT)

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

SETFPREPARED-NAME (NEW-VALUE OBJECT)

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

VIEW-TABLE (OBJECT)

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

Undocumented

COMMAND-RECORDING-STREAM (OBJECT)

SETFCOMMAND-RECORDING-STREAM (NEW-VALUE OBJECT)

CONN-POOL (OBJECT)

SETFCONN-POOL (NEW-VALUE OBJECT)

SETFCONNECTION-SPEC (NEW-VALUE OBJECT)

DATABASE (OBJECT)

DATABASE-AUTOCOMMIT (OBJECT)

SETFDATABASE-AUTOCOMMIT (NEW-VALUE OBJECT)

DATABASE-NAME (OBJECT)

DATABASE-STATE (OBJECT)

DATABASE-TYPE (OBJECT)

RECORD-CACHES (OBJECT)

SETFRECORD-CACHES (NEW-VALUE OBJECT)

RESULT-RECORDING-STREAM (OBJECT)

SETFRESULT-RECORDING-STREAM (NEW-VALUE OBJECT)

TRANSACTION (OBJECT)

SETFTRANSACTION (NEW-VALUE OBJECT)

TRANSACTION-LEVEL (OBJECT)

SETFTRANSACTION-LEVEL (NEW-VALUE OBJECT)

SETFVIEW-TABLE (NEW-VALUE OBJECT)

Private

SPECIFIED-TYPE (OBJECT)

Internal slot storing the :type specified by user.

SETFSPECIFIED-TYPE (NEW-VALUE OBJECT)

Internal slot storing the :type specified by user.

TRANSACTION-STATUS (OBJECT)

nil or :committed

SETFTRANSACTION-STATUS (NEW-VALUE OBJECT)

nil or :committed

VIEW-CLASS-SLOT-AUTOINCREMENT-SEQUENCE (OBJECT)

A string naming the (possibly automatically generated) sequence for a slot with an :auto-increment constraint.

SETFVIEW-CLASS-SLOT-AUTOINCREMENT-SEQUENCE (NEW-VALUE OBJECT)

A string naming the (possibly automatically generated) sequence for a slot with an :auto-increment constraint.

VIEW-CLASS-SLOT-COLUMN (OBJECT)

The name of the SQL column this slot is stored in. Defaults to the slot name.

SETFVIEW-CLASS-SLOT-COLUMN (NEW-VALUE OBJECT)

The name of the SQL column this slot is stored in. Defaults to the slot name.

VIEW-CLASS-SLOT-DB-CONSTRAINTS (OBJECT)

A keyword symbol representing a single SQL column constraint or list of such symbols.

SETFVIEW-CLASS-SLOT-DB-CONSTRAINTS (NEW-VALUE OBJECT)

A keyword symbol representing a single SQL column constraint or list of such symbols.

VIEW-CLASS-SLOT-DB-INFO (OBJECT)

Description of the join.

SETFVIEW-CLASS-SLOT-DB-INFO (NEW-VALUE OBJECT)

Description of the join.

VIEW-CLASS-SLOT-DB-KIND (OBJECT)

The kind of DB mapping which is performed for this slot. :base indicates the slot maps to an ordinary column of the DB view. :key indicates that this slot corresponds to part of the unique keys for this view, :join indicates ... and :virtual indicates that this slot is an ordinary CLOS slot. Defaults to :base.

SETFVIEW-CLASS-SLOT-DB-KIND (NEW-VALUE OBJECT)

The kind of DB mapping which is performed for this slot. :base indicates the slot maps to an ordinary column of the DB view. :key indicates that this slot corresponds to part of the unique keys for this view, :join indicates ... and :virtual indicates that this slot is an ordinary CLOS slot. Defaults to :base.

VIEW-CLASS-SLOT-DB-READER (OBJECT)

If a string, then when reading values from the DB, the string will be used for a format string, with the only value being the value from the database. The resulting string will be used as the slot value. If a function then it will take one argument, the value from the database, and return the value that should be put into the slot.

SETFVIEW-CLASS-SLOT-DB-READER (NEW-VALUE OBJECT)

If a string, then when reading values from the DB, the string will be used for a format string, with the only value being the value from the database. The resulting string will be used as the slot value. If a function then it will take one argument, the value from the database, and return the value that should be put into the slot.

VIEW-CLASS-SLOT-DB-TYPE (OBJECT)

A string which will be used as the type specifier for this slots column definition in the database.

SETFVIEW-CLASS-SLOT-DB-TYPE (NEW-VALUE OBJECT)

A string which will be used as the type specifier for this slots column definition in the database.

VIEW-CLASS-SLOT-DB-WRITER (OBJECT)

If a string, then when reading values from the slot for the DB, the string will be used for a format string, with the only value being the value of the slot. The resulting string will be used as the column value in the DB. If a function then it will take one argument, the value of the slot, and return the value that should be put into the database.

SETFVIEW-CLASS-SLOT-DB-WRITER (NEW-VALUE OBJECT)

If a string, then when reading values from the slot for the DB, the string will be used for a format string, with the only value being the value of the slot. The resulting string will be used as the column value in the DB. If a function then it will take one argument, the value of the slot, and return the value that should be put into the database.

VIEW-CLASS-SLOT-VOID-VALUE (OBJECT)

Value to store if the SQL value is NULL. Default is NIL.

SETFVIEW-CLASS-SLOT-VOID-VALUE (NEW-VALUE OBJECT)

Value to store if the SQL value is NULL. Default is NIL.

Undocumented

ALL-CONNECTIONS (OBJECT)

SETFALL-CONNECTIONS (NEW-VALUE OBJECT)

ATTRIBUTE (OBJECT)

SETFATTRIBUTE (NEW-VALUE OBJECT)

BINDINGS (OBJECT)

CLOSE-QUERY-FN (OBJECT)

COMMIT-HOOKS (OBJECT)

SETFCOMMIT-HOOKS (NEW-VALUE OBJECT)

CONN-POOL-LOCK (OBJECT)

SETFCONN-POOL-LOCK (NEW-VALUE OBJECT)

DATABASE-VIEW-CLASSES (OBJECT)

SETFDATABASE-VIEW-CLASSES (NEW-VALUE OBJECT)

DB-VALUE (OBJECT)

SETFDB-VALUE (NEW-VALUE OBJECT)

DBI-PACKAGE (OBJECT)

DISCONNECT-FN (OBJECT)

ESCAPED (OBJECT)

SETFESCAPED (NEW-VALUE OBJECT)

FETCH-ROW-FN (OBJECT)

FREE-CONNECTIONS (OBJECT)

SETFFREE-CONNECTIONS (NEW-VALUE OBJECT)

HAS-TABLE-PG_ROLES (OBJECT)

ID (OBJECT)

JOIN-SLOTS (OBJECT)

SETFJOIN-SLOTS (NEW-VALUE OBJECT)

JOINS (OBJECT)

SETFJOINS (NEW-VALUE OBJECT)

KEY-SLOTS (OBJECT)

SETFKEY-SLOTS (NEW-VALUE OBJECT)

LIST-ALL-DATABASE-TABLES-FN (OBJECT)

LIST-ALL-TABLE-COLUMNS-FN (OBJECT)

NORMALIZEDP (OBJECT)

SETFNORMALIZEDP (NEW-VALUE OBJECT)

OBJECT-DEFINITION (OBJECT)

SETFOBJECT-DEFINITION (NEW-VALUE OBJECT)

ODBC-CONN (OBJECT)

SETFODBC-CONN (NEW-VALUE OBJECT)

POOL-DATABASE-TYPE (OBJECT)

SETFPOOL-DATABASE-TYPE (NEW-VALUE OBJECT)

PREVIOUS-AUTOCOMMIT (OBJECT)

RESULT-TYPES (OBJECT)

ROLLBACK-HOOKS (OBJECT)

SETFROLLBACK-HOOKS (NEW-VALUE OBJECT)

SELECT-LIST (OBJECT)

SETFSELECT-LIST (NEW-VALUE OBJECT)

SLOT-DEFS (OBJECT)

SETFSLOT-DEFS (NEW-VALUE OBJECT)

SLOT-LIST (OBJECT)

SETFSLOT-LIST (NEW-VALUE OBJECT)

SQL-FN (OBJECT)

STMT-FIELD-NAMES (OBJECT)

SETFSTMT-FIELD-NAMES (NEW-VALUE OBJECT)

UNESCAPED (OBJECT)

SETFUNESCAPED (NEW-VALUE OBJECT)

VIEW-CLASS (OBJECT)

SETFVIEW-CLASS (NEW-VALUE OBJECT)

VIEW-CLASS-QUALIFIER (OBJECT)

SETFVIEW-CLASS-QUALIFIER (NEW-VALUE OBJECT)

VIEW-DATABASE (OBJECT)

VARIABLE

Public

*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.

*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.

*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.

*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.

*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.

*DEFAULT-CACHING*

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

*DEFAULT-DATABASE*

Specifies the default database to be used.

*DEFAULT-DATABASE-TYPE*

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

*DEFAULT-STRING-LENGTH*

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

*DEFAULT-UPDATE-OBJECTS-MAX-LEN*

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

*FOREIGN-LIBRARY-SEARCH-PATHS*

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

*INITIALIZED-DATABASE-TYPES*

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

*LOADED-DATABASE-TYPES*

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

*OLD-SEQUENCE-NAMES*

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

Private

*CONNECTED-DATABASES*

List of active database objects.

*OUTPUT-HASH*

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

*SQL-STREAM*

stream which accumulates SQL output

+WHITESPACE-CHARS+

List of whitespace characters for this lisp implementation.

Undocumented

*CONSTRAINT-TYPES*

*DAY-KEYWORDS*

*DAY-NAMES*

*DB-DESERIALIZING*

*DB-INFO-LAMBDA-LIST*

*DB-INITIALIZING*

*DB-POOL*

*DB-POOL-LOCK*

*IN-SUBSELECT*

*ISO-8601-DURATION-DELIMITERS*

*MONTH-KEYWORDS*

*MONTH-NAMES*

*NEXT-PREPARED-ID-NUM*

*ORIGINAL-READTABLE*

*RESTORE-SQL-READER-SYNTAX*

*ROMAN-DIGITS*

*SELECT-ARGUMENTS*

*SQL-MACRO-CLOSE-CHAR*

*SQL-MACRO-OPEN-CHAR*

*SQL-OP-TABLE*

+EMPTY-STRING+

+EXTRA-CLASS-OPTIONS+

+EXTRA-SLOT-OPTIONS+

+NO-SLOT-VALUE+

+NULL-STRING+

CLASS

Public

DATABASE (OBJECT)

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

GENERIC-ODBC-DATABASE

Encapsulate same behavior across odbc and aodbc backends.

GENERIC-POSTGRESQL-DATABASE

Encapsulate same behavior across postgresql and postgresql-socket backends.

SQL (&REST ARGS)

A literal SQL expression.

SQL-ASSIGNMENT-EXP

An SQL Assignment expression.

SQL-BETWEEN-EXP

An SQL between expression.

SQL-FUNCTION-EXP

An SQL function expression.

SQL-IDENT

An SQL identifer.

SQL-IDENT-ATTRIBUTE

An SQL Attribute identifier.

SQL-IDENT-TABLE

An SQL table identifier.

SQL-QUERY (&REST ARGS)

An SQL SELECT query.

SQL-QUERY-MODIFIER-EXP

An SQL query modifier expression.

SQL-RELATIONAL-EXP

An SQL relational expression.

SQL-SET-EXP

An SQL set expression.

SQL-TYPECAST-EXP

An SQL typecast expression.

SQL-UPCASE-LIKE

An SQL 'like' that upcases its arguments.

SQL-VALUE-EXP

An SQL value expression.

STANDARD-DB-OBJECT

Superclass for all CLSQL View Classes.

Undocumented

COMMAND-OBJECT (EXPRESSION &OPTIONAL PARAMETERS (PREPARED-NAME ))

CONN-POOL (OBJECT)

DATE

DURATION

SQL-OBJECT-QUERY

TRANSACTION (OBJECT)

WALL-TIME

Private

%DATABASE-IDENTIFIER

A database identifier represents a string/symbol ready to be spliced into a sql string. It keeps references to both the escaped and unescaped versions so that unescaped versions can be compared to the results of list-tables/views/attributes etc. It also allows you to be sure that an identifier is escaped only once. (escaped-database-identifiers *any-reasonable-object*) should be called to produce a string that is safe to splice directly into sql strings. (unescaped-database-identifier *any-reasonable-object*) is generally what you pass to it with the exception that symbols have been clsql-sys:sql-escape which converts to a string and changes - to _ (so that unescaped can be compared to the results of eg: list-tables)

ATTRIBUTE-VALUE-PAIR

Represents an attribute-sql-expression and its value, used to pass to insert/update. Was previously a two list

CLASS-AND-SLOTS

A helper class to keep track of which slot-defs from a table need to be updated, a normalized class might have many of these because each of its parent classes might represent some other table and we need to match which slots came from which parent class/table

GENERIC-DATABASE

Encapsulate same behavior across backends.

SELECT-LIST (OBJECT)

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

SQL-CREATE-TABLE

An SQL CREATE TABLE statement.

SQL-CREATE-VIEW

An SQL CREATE VIEW statement.

SQL-DELETE

An SQL DELETE statement.

SQL-INSERT

An SQL INSERT statement.

SQL-UPDATE

An SQL UPDATE statement.

STANDARD-DB-CLASS

Metaclass for all CLSQL View Classes.

Undocumented

%SLOT-ORDER-TEST-CLASS

%SQL-EXPRESSION

INTERVAL

ODBC-RESULT-SET

POSTGRESQL-STMT

VIEW-CLASS-DIRECT-SLOT-DEFINITION

VIEW-CLASS-EFFECTIVE-SLOT-DEFINITION

VIEW-CLASS-SLOT-DEFINITION-MIXIN

CONDITION

Public

SQL-CONNECTION-ERROR

Used to signal an error in connecting to a database.

SQL-DATABASE-DATA-ERROR

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

SQL-DATABASE-ERROR

Used to signal an error in a CLSQL database interface.

SQL-FATAL-ERROR

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

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.

SQL-TIMEOUT-ERROR

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

SQL-USER-ERROR

Used to signal lisp errors inside CLSQL.

Undocumented

SQL-CONDITION

SQL-DATABASE-WARNING

SQL-ERROR

SQL-WARNING

Private

DATABASE-TOO-STRANGE

Used to signal cases where CLSQL is going to fail at mapping your database correctly

Undocumented

ISO-8601-SYNTAX-ERROR