sqrlInterface: Creates Data Source Interfaces

Description Usage Arguments Details Value Note See Also Examples

View source: R/SQRL.R

Description

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

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

Usage

1

Arguments

...

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

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 “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.

Value

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

Note

Interfaces are stored in a publicly accessible environment, SQRL:Face. This is attached to the R search path when the package is loaded.

See Also

SQRL, sqrlSources, sqrlUsage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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")

## End(Not run)

# Remove the source's interface function.
sqrlInterface("entropy", "remove")

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

SQRL documentation built on Oct. 12, 2018, 9:05 a.m.