Description Usage Arguments Value Author(s) Examples
Parse raw SQL from a file. The main purpose of this function is to get rid of comments which R does not handle very well within the DBI or RODBC packages (or their wrappers (e.g. dplyr)).
1 |
filename |
A connection object or a character string. |
silent |
logical. Warn if a text file is missing a final EOL or if there are embedded nulls. Defaults to TRUE. |
A character vector of length the number of lines read.
Joe Mienko, mienkoja@uw.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 | fname <- tempfile("sql",fileext=".sql")
cat("--query 6
select a6.column1, --trailing comments
a6.column2, ---test triple -
count(a6.column3) as counts, --/* funny comment */
a6.column3 - a6.column4 ---test single -
/*count the number of occurences in table 1;
test another comment style
*/
from data.table a6 /* --1st weirdo comment */
/* --2nd weirdo comment */
group by a6.column1\n", file=fname)
read_sql(fname)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.