sql_read: Read SQL statement from a connection or string

Description Usage Arguments Details Value Note See Also Examples

View source: R/sql_read.R

Description

Reads a SQL statement from a file or connection string.

Usage

1
2
3
sql_read(..., strip.comments = FALSE)

read.sql(..., strip.comments = FALSE)

Arguments

...

arguments passed to readLines

strip.comments

logical; Strip block and inline comments from sql. Default: FALSE

Details

For converting a character vector to a sql, see sql.

... is passed to readLines and can provide either a connection object or a character vector denoting a path to a local file.

The resulting text is coerced to a sql object using sql.

strip.comments strips comments from the SQL.

Value

an object of class sql, i.e. string (character) containing a SQL statement

Note

read.sql is an alias for sql_read. The latter aligns with the conventions of this package, i.e. exported functions are prefixed with sql_, while the former conforms to the conventions of base R where functions for reading data begin with read.. The developer is free to follow the convention of this package or base R.

See Also

For finer contol of stipping comments see: sql_strip_comments.

For rendering a mustache style SQL template see: sql_render

sql
readLines

Examples

1
2
3
4
5
  ## Not run: 
     sql_read( "path/to/file" )
     sql_read( connection )
  
## End(Not run)

decisionpatterns/sql.template documentation built on July 6, 2020, 8:41 a.m.