SQL — Construct an SQL string from supplied expressions.Function
Returns an SQL string generated from the expressions
args
. The expressions are translated into
SQL strings and then concatenated with a single space delimiting
each expression.
(sql nil) => "NULL" (sql 'foo) => "FOO" (sql "bar") => "'bar'" (sql 10) => "10" (sql '(nil foo "bar" 10)) => "(NULL,FOO,'bar',10)" (sql #(nil foo "bar" 10)) => "NULL,FOO,'bar',10" (sql [select [foo] [bar] :from [baz]] 'having [= [foo id] [bar id]] 'and [foo val] '< 5) => "SELECT FOO,BAR FROM BAZ HAVING (FOO.ID = BAR.ID) AND FOO.VAL < 5"
An error of type sql-user-error
is signalled if any element in args
is
not of the supported types (a symbol, string, number or symbolic
SQL expression) or a list or vector containing only these
supported types.