wrap_sql_query: combines strings and vectors in a sensible way for select queries
Description
This function is a variant of the sprintf function.
In the query, can be placed identifier tags which are a hash character followed by a number
e.g. #1
The number in the tag reflects the position of the arguments after the query
The resut of evaluating that argument will then be inserted in place of the tag.
If the result of evaluating the argument is a vector of length 1, it is inserted as is.
If it is a vector of length > 1, it is wrapped in parentheses and comma separated.
Usage
wrap_sql_query(query, ...)
Arguments
query
a character string with identifier tags (#[number]) for selecting the argument in ...
...
optional arguments selected by the identifier tags
Details
Note that this function is for help in constructing raw SQL queries and should not be used as an
input to the where argument in select_event calls.
This is because these calls use translate_sql_ to translate from R code to SQL