Function SQL-OPERATION — Constructs an SQL expression from a supplied operator and arguments.
Function
sql-operation operation &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 operation and its arguments args. If operation 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')>
None.
None.
An error of type sql-user-error is signalled if operation is not a symbol representing a supported SQL operator.
sql |
sql-expression |
sql-operator |
None.