Description Usage Arguments Details Functions Examples
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.
1 2 3 4 5 6 7 8 9 | SeeConn(db = NULL, what = NULL)
SeeOpenConns()
SeeClosedConns()
ConnStatus(db = NULL)
ListConnAttr()
|
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 |
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:
DatabaseName of database
StatusOpen/Closed
InitiatorThe first opener of the connection
OpenerWho opened a closed connection
CloserWho closed an open connection
RequestorWho requested a connection (e.g. tried to open an already
open connection)
TimeInitiatedWhen was the connection first opened (timestamp resets
when connection is closed)
TimeOpenedWhen did the connection's status change from Closed to Open
TimeClosedWhen did the connection's status change from Open to Closed
TimeRequestedWhen was the connection was last requested (timestamp)
DurSinceInitDuration since connection was initiated
DurSinceRequestDuration since a connection was last requested
DurationOpenDuration that connection has been open
DurationClosedDuration that connection has been closed
AccessCountNumber of times the connection has been requested/opened since init
SeeConn: A function to "see" a particular connection objects attributes.
SeeOpenConns: See attributes for all open connections
SeeClosedConns: See attributes for all closed connections
ConnStatus: Prints status of all connection in the pool
ListConnAttr: A function that provides a quick lookup of
all attribute names that an object will have
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.