SQL-OPERATION — Constructs an SQL expression from a supplied operator and arguments.
Function
sql-operation operator &rest args => result
sql-operation 'function func &rest args => result
A symbol denoting an SQL operator.
A string denoting an SQL function.
A set of arguments for the specified SQL operator or function.
A object of type sql-expression.
Returns an SQL expression constructed from the supplied SQL operator or function operator and its arguments args. If operator is passed the symbol 'function then the first value in args is taken to be a valid SQL function and the remaining values in args its arguments.
(sql-operation 'select (sql-expression :table 'foo :attribute 'bar) (sql-operation 'sum (sql-expression :table 'foo :attribute 'baz)) :from (sql-expression :table 'foo) :where (sql-operation '> (sql-expression :attribute 'bar) 12) :order-by (sql-operation 'sum (sql-expression :attribute 'baz))) => #<SQL-QUERY SELECT FOO.BAR,SUM(FOO.BAZ) FROM FOO WHERE (BAR > 12) ORDER BY SUM(BAZ)> (sql-operation 'function "strpos" "CLSQL" "SQL") => #<CLSQL-SYS:SQL-FUNCTION-EXP STRPOS('CLSQL','SQL')>
An error of type sql-user-error is signalled if operator is not a symbol representing a supported SQL operator.