Files
AVSDevR.DBClient/R/DBClient-dbQuery.R

18 lines
511 B
R

#' @name DBClient$dbQuery
#' @title DBClient$dbQuery
#' @description
#' Runs a query (statement) on a database and returns the results
#' @param statement <character> Query to run on the database
#' @returns <complex> A lazy data table with the results from the query
NULL
dbQuery <- function(statement) {
if (getOption("db.debug", FALSE)) {
cat("dbQuery:", statement, "\n")
}
query <- DBI::dbSendQuery(private$getDBConn(), statement)
res <- DBI::dbFetch(query)
DBI::dbClearResult(query)
res
}