NextPrevUpTopContentsIndex

18.5.2 Programmatic interface

In some cases it is necessary to build SQL-expressions dynamically under program control.

The function sql-operation returns the SQL expression for an operator applied to its arguments. It also supports building SQL expressions which contain arbitrary SQL functions.

The function sql-expression makes an SQL expression from the given keywords. This is equivalent to the first and third uses of the [] syntax as discussed in The "[...]" Syntax.

sql-operator returns the Lisp symbol for an SQL operator.

The function sql makes SQL out of the arguments supplied. Each argument to sql is turned into SQL and then the args are concatenated with a single space between each pair. A Lisp string maps to the same characters enclosed between single quotes (this corresponds to an SQL string constant). nil maps to "NULL" , that is, an SQL null value. Symbols and numbers map to strings. A list maps to a parenthesised, comma-separated expression. A vector maps to a comma-separated expression, which allows the easy generation of SQL lists that require no parentheses such as table lists in select statements.

The rules for the conversion via sql are fully specified in the LispWorks Reference Manual .

18.5.2.1 Examples


LispWorks User Guide - 7 Jul 2004

NextPrevUpTopContentsIndex