SQRL (version 0.6.2)

sqrlInterface: Creates Data Source Interfaces

Description

Creates, renames, and/or removes data source interface functions.

Communications with data sources (including SQL queries) are conducted through these interfaces.

Usage

sqrlInterface(...)

Arguments

The name of a defined data source, and the name to use for its interface.

Value

Returns the name of the source's interface function (visibly on get, invisibly on set).

Details

The source and interface names may be supplied as two character strings, (“source”, “interface”), or as a (source = “interface”), or (“source” = “interface”), pair.

The setting of an interface whose name would clash with that of any other object already on the R search path is prevented. An error will be thrown if a potential conflict is detected. Conversely, a successful call of this function guarantees both the existence of the new interface, and the uniqueness of its name.

If the interface name is specified as either NULL or “remove”, then any existing interface is deleted (and no new interface is created).

If only a single string is supplied, the name of that source's interface function is returned.

See Also

sqrlSource

Examples

Run this code
# NOT RUN {
# Define a new data source, named 'entropy'.
sqrlSource("entropy", uid = "ludwig", pwd = "<pwd>",
           driver = "{SQL Server Native Client 11.0}",
           server = "Clausius", database = "Gibbs")

# The source comes with an interface of the same name.
sqrlInterface("entropy")
entropy("sources")

# Change the name of the interface function.
sqrlInterface("entropy", "S")

# The name of the source remains unchanged.
sqrlInterface("entropy")
S("sources")

# }
# NOT RUN {
# Submit a query, via the interface.
S("select 1")

# Submit a script, via the interface.
S("My/SQL/file.sql")

# Submit a parameterised script, via the interface.
S("My/SQRL/file.sqrl", month = "April")
# }
# NOT RUN {
# Remove the source's interface function.
sqrlInterface("entropy", "remove")

# The source remains, but has no interface.
sqrlInterface("entropy")
sqrlSources()
# }

Run the code above in your browser using DataLab