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

Value

boolean TRUE if connection is valid executeSql

Super class

ResultModelManager::ConnectionHandler -> PooledConnectionHandler

Methods

Inherited methods


Method new()

Usage

PooledConnectionHandler$new(
  connectionDetails = NULL,
  snakeCaseToCamelCase = TRUE,
  loadConnection = TRUE,
  dbConnectArgs = NULL,
  forceJdbcConnection = TRUE
)

Arguments

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


Method initConnection()

Overrides ConnectionHandler Call Used for getting a checked out connection from a given environment (if one exists)

Usage

PooledConnectionHandler$initConnection()


Method getCheckedOutConnectionPath()

Usage

PooledConnectionHandler$getCheckedOutConnectionPath()

Arguments

.deferedFrame

defaults to the parent frame of the calling block. Get Connection


Method 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.

Usage

PooledConnectionHandler$getConnection(.deferedFrame = parent.frame(n = 2))

Arguments

.deferedFrame

defaults to the parent frame of the calling block. get dbms


Method dbms()

Get the dbms type of the connection Close Connection

Usage

PooledConnectionHandler$dbms()


Method closeConnection()

Overrides ConnectionHandler Call - closes all active connections called with getConnection queryDb

Usage

PooledConnectionHandler$closeConnection()


Method 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.

Usage

PooledConnectionHandler$queryDb(
  sql,
  snakeCaseToCamelCase = self$snakeCaseToCamelCase,
  overrideRowLimit = FALSE,
  ...
)

Arguments

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


Method executeSql()

execute set of database queries

Usage

PooledConnectionHandler$executeSql(sql, ...)

Arguments

sql

sql query string

...

Additional query parameters query Function


Method queryFunction()

Overrides ConnectionHandler Call. Does not translate or render sql.

Usage

PooledConnectionHandler$queryFunction(
  sql,
  snakeCaseToCamelCase = self$snakeCaseToCamelCase,
  connection
)

Arguments

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


Method executeFunction()

Overrides ConnectionHandler Call. Does not translate or render sql.

Usage

PooledConnectionHandler$executeFunction(sql, connection)

Arguments

sql

sql query string

connection

DatabaseConnector connection. Assumes pooling is handled outside of call


Method clone()

The objects of this class are cloneable with this method.

Usage

PooledConnectionHandler$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.