xlReadScript: xlReadScript

Description Usage Arguments Details Examples

View source: R/xlReadScript.R

Description

Read standalone script into R as a single character string.

Usage

1
xlReadScript(script, cmt_sym = "--", ...)

Arguments

script

A connections object or a character string, exactly the same input expected by readLines function.

cmt_sym

The character sequence that signifies comment strings, default '--' for SQL.

...

passed to readLines.

Details

The funtion calls readLines to read in the script text file, strips out comments blocks, inline comments, and merge all lines into one single string. As it stands, it works best for a fairly simple SQL script. I will be albe to expand the functionality once I'm exposed to more complex script. This function is suitable for reading script that does not use line-by-line execution, but rather entirely relies on keywords, e.g. SQL.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# postgres
tbl(db, sql(xlReadScript('~/Script/script1.sql')))

# MS SQL Server
sqlQuery(conn, xlReadScript('~/Script/script2.sql'))

## End(Not run)

xinye1/xltools documentation built on Dec. 2, 2020, 7:23 p.m.