sql_filter_factory: Create a DT funcFilter for SQL connections.

Description Usage Arguments Details Value Examples

View source: R/sql_filter_factory.R

Description

Given a DBI connection and a query function return a funcFilter function as required by DT::renderDT.

Usage

1
sql_filter_factory(con, query_fun, ...)

Arguments

con

DBI database connection for query_fun to use.

query_fun

function that takes con and params parameters and returns payload for a datatable. See query_sqlite for an example.

...

Additional arguments passed to query_fun.

Details

The main purpose of this function is to keep a reference to the database connection so as to prevent the need to set up a new connection every time data is accessed by the funcFilter.

It also allows for different implementations of query_fun so as not to be limited to just the current sqlite implementation.

Value

function conforming to a DT funcFilter interface.

Examples

1
2
3
4
5
6
## Not run: 
con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbWriteTable(con, "mtcars", mtcars)
myFuncFilter <- sql_filter_factory(con, query_sqlite, tbl = "mtcars")

## End(Not run)

grahamrp/dtdatasources documentation built on Dec. 8, 2019, 12:38 p.m.