PooledConnectionHandler | R Documentation |
Transparently works the same way as a standard connection handler but stores pooled connections.
Useful for long running applications that serve multiple concurrent requests.
Note that a side effect of using this is that each call to this increments the .GlobalEnv attribute RMMPooledHandlerCount
boolean TRUE if connection is valid executeSql
ResultModelManager::ConnectionHandler
-> PooledConnectionHandler
new()
PooledConnectionHandler$new( connectionDetails = NULL, snakeCaseToCamelCase = TRUE, loadConnection = TRUE, dbConnectArgs = NULL, forceJdbcConnection = TRUE )
connectionDetails
DatabaseConnector::connectionDetails class
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default)
loadConnection
Boolean option to load connection right away
dbConnectArgs
Optional arguments to call pool::dbPool overrides default usage of connectionDetails
forceJdbcConnection
Force JDBC connection (requires using DatabaseConnector ConnectionDetails) initialize pooled db connection
initConnection()
Overrides ConnectionHandler Call Used for getting a checked out connection from a given environment (if one exists)
PooledConnectionHandler$initConnection()
getCheckedOutConnectionPath()
PooledConnectionHandler$getCheckedOutConnectionPath()
.deferedFrame
defaults to the parent frame of the calling block. Get Connection
getConnection()
Returns a connection from the pool When the desired frame exits, the connection will be returned to the pool As a side effect, the connection is stored as an attribute within the calling frame (e.g. the same function) to prevent multiple connections being spawned, which limits performance.
If you call this somewhere you need to think about returning the object or you may create a connection that is never returned to the pool.
PooledConnectionHandler$getConnection(.deferedFrame = parent.frame(n = 2))
.deferedFrame
defaults to the parent frame of the calling block. get dbms
dbms()
Get the dbms type of the connection Close Connection
PooledConnectionHandler$dbms()
closeConnection()
Overrides ConnectionHandler Call - closes all active connections called with getConnection queryDb
PooledConnectionHandler$closeConnection()
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.
PooledConnectionHandler$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
PooledConnectionHandler$executeSql(sql, ...)
sql
sql query string
...
Additional query parameters query Function
queryFunction()
Overrides ConnectionHandler Call. Does not translate or render sql.
PooledConnectionHandler$queryFunction( sql, snakeCaseToCamelCase = self$snakeCaseToCamelCase, connection )
sql
sql query string
snakeCaseToCamelCase
(Optional) Boolean. return the results columns in camel case (default) query Function
connection
db connection assumes pooling is handled outside of call
executeFunction()
Overrides ConnectionHandler Call. Does not translate or render sql.
PooledConnectionHandler$executeFunction(sql, connection)
sql
sql query string
connection
DatabaseConnector connection. Assumes pooling is handled outside of call
clone()
The objects of this class are cloneable with this method.
PooledConnectionHandler$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.