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)
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))
closeConnection()
Overrides ConnectionHandler Call - closes all active connections called with getConnection queryDb
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.
queryFunction()
Overrides ConnectionHandler Call. Does not translate or render sql.