Learn R Programming

SQRL (version 0.3.0)

SQRL-package: SQRL

Description

Wrapper of convenience about RODBC. Supports parameterised multi-statement SQL scripts with embedded R. Generates like-named user-interfaces for Open Database Connectivity (ODBC) data sources. Implicitly manages connection handles and communication parameters. Provides visual indication of open channels and queries in progress. Detects lost connections and attempts recovery.

Arguments

Details

On load, the package will look for data source names (DSNs) via RODBC, and attempt to create a like-named interface function for each (additional data sources can be defined at any time). These interfaces dispense with the need for explicit connection parameters on every query. They support multi-statement SQL scripts, with or without embedded R expressions.

See Also

sqrlInterface, sqrlUsage, RODBC

Examples

Run this code
# NOT RUN {
require(SQRL)

# Show (pre)defined data sources.
sqrlSources()

# Define a new data source.
sqrlSource("mysource",
            driver = "MYSQL ODBC 5.3 ANSI Driver",
            server = "localhost",
            user = "<uid>",
            password = "<pwd>")

# Obtain help on usage (in text format).
mysource("help", "text")

# }
# NOT RUN {
# Submit a query to the new source.
mysource("select 1")

# Submit a parameterised query from file.
mysource("transactions.sqrl", customerid = 111111)
# }

Run the code above in your browser using DataLab