sql: Represent a character vector as a SQL statement

Description Usage Arguments Details See Also Examples

View source: R/sql.R

Description

Creates a string with class 'sql'

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sql(x)

is.sql(x)

## S3 method for class 'sql'
print(x, ...)

as.sql(x)

## S3 method for class 'character'
as.sql(x)

Arguments

x

character; string to convert to a SQL statement

...

additional arguments

Details

There is nothing magical here. An object of sql is just a string ... i.e. an one-element character vector. It is coerced to a string by 'collapsing' the vector with \n.

See Also

sql_read for reading SQL from a connection

Examples

1
2
3
4
5
6
7
8
  stmt = "SELECT * FROM table"

  sql(stmt)

  is.sql(stmt)        # FALSE
  is.sql( sql(stmt) ) # TRUE

  as.sql(stmt)

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