ConnectionAttributes: Connection Attribute Information

Description Usage Arguments Details Functions Examples

Description

Resources to manage connections, to test the status of connections, as well as functions to get details (attributes) about a connection object that exists within the connection pool.

Usage

1
2
3
4
5
6
7
8
9

Arguments

db

A character value representing the name of a database whose connection's attributes need to be accessed

what

A character value representing the attribute name to access

Details

As a developer creating a custom query function, you may need the ability to know, for example, if a connection is open and how long it's been open. These are known as attributes and all existing connection objects have the following set of attributes:

Functions

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
## Not run: 
# Common developer helper functions #
db <- "a_database_name"
CheckDB(db)     # trys to find a matching database name, returns error if not
AccessInfo(db)  # access info for specified db
ValidDB()       # What DBs are configured in the package?
ConnString(db)  # Connection string for db?

# Opening/Closing Connections #
OpenDB(db)      # Returns 1 on success
CloseDB(db)     # Returns 1 on success
CloseDB(db)     # Warning if closing db that is already closed
CloseDB("blah") # Error if db doesn't exist

# Manage connections #
ConnExists(db)  # Returns TRUE for any open/closed connections
ConnPool()      # Returns all the connection (names) in the pool
ConnStatus()    # Returns a table showing status for all configured dbs

# Use should be rare to not at all #
GetConn(db)     # Retrieve connection object
Clean(db)       # Removes connection from pool (usually because of error)
Clean()         # Removes ALL connections from pool (usually because of error)

## End(Not run)

bfatemi/sqlsauce documentation built on May 12, 2019, 7:27 p.m.