Name

SQL-EXPRESSION — Constructs an SQL expression from supplied keyword arguments.Function

Syntax

      sql-expression &key string table alias attribute type => result

Arguments and Values

string

A string.

table

A symbol representing a database table identifier.

alias

A table alias.

attribute

A symbol representing an attribute identifier.

type

A type specifier.

result

A object of type sql-expression.

Description

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;

  • string.

Examples

(sql-expression :table 'foo :attribute 'bar)
=> #<CLSQL-SYS:SQL-IDENT-ATTRIBUTE FOO.BAR>

(sql-expression :attribute 'baz)
=> #<CLSQL-SYS:SQL-IDENT-ATTRIBUTE BAZ>
      

Side Effects

None.

Affected by

None.

Exceptional Situations

An error of type sql-user-error is signalled if an unsupported combination of keyword arguments is specified.

See Also

sql
sql-operation
sql-operator

Notes

None.