Next Prev Up Top Contents Index

sql-operation

Function
Summary

Generates an SQL statement from an operator and arguments.

Package

sql

Signature

sql-operation op &rest args => sql-result

Arguments

op

An operator.

args

A set of arguments for op.

Values

sql-result

An SQL expression.

Description

The function sql-operation takes an operator and its arguments, and returns an SQL statement. It is shorthand for (apply (sql-operator op) args) .

Example

The following code, uses sql-operation to produce an SQL expression.

(sql-operation 'select
  (sql-expression :table 'foo :attribute 'bar)
  (sql-expression :attribute 'baz)
  :from (list
           (sql-expression :table 'foo)
           (sql-expression :table 'quux))
  :where
     (sql-operation 'or
       (sql-operation '>
         (sql-expression :attribute 'baz)
         3)
       (sql-operation 'like
         (sql-expression :table 'foo :attribute 'bar)
         "SU%")))

The following SQL expression is produced.

#<SQL-QUERY: "(SELECT FOO.BAR,BAZ FROM FOO,QUUX
      WHERE ((BAZ > 3) OR (FOO.BAR LIKE 'SU%')))">
See also

sql
sql-expression
sql-operator


LispWorks Reference Manual (Windows version) - 14 Dec 2001

Next Prev Up Top Contents Index