Description Usage Arguments Details See Also Examples
View source: R/sql_strip_comments.R
Strip comments from a SQL STATEMENT
1 | sql_strip_comments(sql, block = TRUE, inline = TRUE, ...)
|
sql |
connection or character; |
block |
logical; strip block ( |
inline |
logical; strip inline |
... |
additional arguments passed to |
sql_strip_comments
removes SQL standard comments from a SQL
statement. Both inline (--
) and block (/* ... */
) style
comments can be striped independently with the inline
and
block
arguments, the default is to strip both style of comments.
block
comments are given priority and will remove any nested
comments.
A single space preceding a comment is also stripped.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # BLOCK COMMENTS
sql <- "SELECT name /* User Name */ FROM table"
sql_strip_comments( sql )
sql <- "SELECT name /* User \n Name */ FROM table"
sql_strip_comments( sql )
sql <- "SELECT\n first_name, /* User First Name */\n last_name /* User Last Name */\n FROM table"
sql_strip_comments( sql )
# INLINE COMMENTS
sql <- "SELECT -- comment \n A -- col A \n from \n table"
sql_strip_comments( sql )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.