ConnectionHandler | R Documentation |
Class for handling DatabaseConnector:connection objects with consistent R6 interfaces for pooled and non-pooled connections. Allows a connection to cleanly be opened and closed and stored within class/object variables
DatabaseConnector Connection instance close Connection
boolean TRUE if connection is valid queryDb
boolean TRUE if connection is valid executeSql
connectionDetails
DatabaseConnector connectionDetails object
con
DatabaseConnector connection object
isActive
Is connection active or not#'
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default)
new()
ConnectionHandler$new( connectionDetails, loadConnection = TRUE, snakeCaseToCamelCase = TRUE )
connectionDetails
DatabaseConnector::connectionDetails class
loadConnection
Boolean option to load connection right away
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default) get dbms
dbms()
Get the dbms type of the connection get table
ConnectionHandler$dbms()
tbl()
get a dplyr table object (i.e. lazy loaded)
ConnectionHandler$tbl(table, databaseSchema = NULL)
table
table name
databaseSchema
databaseSchema to which table belongs Render Translate Sql.
renderTranslateSql()
Masked call to SqlRender
ConnectionHandler$renderTranslateSql(sql, ...)
sql
Sql query string
...
Elipsis initConnection
initConnection()
Load connection Get Connection
ConnectionHandler$initConnection()
getConnection()
Returns connection for use with standard DatabaseConnector calls. Connects automatically if it isn't yet loaded
ConnectionHandler$getConnection()
closeConnection()
Closes connection (if active) close Connection
ConnectionHandler$closeConnection()
finalize()
Closes connection (if active) db Is Valid
ConnectionHandler$finalize()
dbIsValid()
Masks call to DBI::dbIsValid. Returns False if connection is NULL
ConnectionHandler$dbIsValid()
queryDb()
query database and return the resulting data.frame
If environment variable LIMIT_ROW_COUNT is set Returned rows are limited to this value (no default) Limit row count is intended for web applications that may cause a denial of service if they consume too many resources.
ConnectionHandler$queryDb( sql, snakeCaseToCamelCase = self$snakeCaseToCamelCase, overrideRowLimit = FALSE, ... )
sql
sql query string
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default)
overrideRowLimit
(Optional) Boolean. In some cases, where row limit is enforced on the system You may wish to ignore it.
...
Additional query parameters
executeSql()
execute set of database queries
ConnectionHandler$executeSql(sql, ...)
sql
sql query string
...
Additional query parameters query Function
queryFunction()
queryFunction that can be overriden with subclasses (e.g. use different base function or intercept query) Does not translate or render sql.
ConnectionHandler$queryFunction( sql, snakeCaseToCamelCase = self$snakeCaseToCamelCase, connection = self$getConnection() )
sql
sql query string
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default)
connection
(Optional) connection object execute Function
executeFunction()
exec query Function that can be overriden with subclasses (e.g. use different base function or intercept query) Does not translate or render sql.
ConnectionHandler$executeFunction(sql, connection = self$getConnection())
sql
sql query string
connection
connection object
clone()
The objects of this class are cloneable with this method.
ConnectionHandler$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.