Next Previous Up Top Contents Index

16 The SQL Package

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 functionsql-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, usessql-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 - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker