Commit 691c3c3a authored by Jonathan Mang's avatar Jonathan Mang 💡
Browse files

docs: updated manual files

parent 5108f62b
Pipeline #23536 passed with stages
in 41 minutes and 39 seconds
......@@ -46,3 +46,4 @@ Language: en-US
LazyData: true
SystemRequirements: libpq >= 9.0: libpq-dev (deb) or
postgresql-devel (rpm)
RoxygenNote: 7.1.1
......@@ -21,6 +21,7 @@
#'
#' @param db_con A DBI database connection.
#' @param sql_statement A character string containing a valid SQL statement.
#' Caution: Everything after the first ';' will be cut off.
#' @return Returns the result of the db-query.
#' @examples
#' \dontrun{
......@@ -39,17 +40,18 @@
# query_database
query_database <- function(db_con,
sql_statement) {
stopifnot(!is.null(sql_statement), !is.null(db_con))
# avoid sql-injection
# https://db.rstudio.com/best-practices/run-queries-safely/
sql <- DBI::sqlInterpolate(db_con, sql_statement)
# return data as data.table
## Remove tailing ";":
sql_statement <- gsub("\\;.*", "", sql_statement)
## Aavoid sql-injection:
## https://db.rstudio.com/best-practices/run-queries-safely/
sql <- DBI::sqlInterpolate(conn = db_con, sql = sql_statement)
# Return data as data.table
outdat <-
data.table::data.table(
RPostgres::dbGetQuery(db_con, sql),
stringsAsFactors = TRUE
)
data.table::data.table(RPostgres::dbGetQuery(db_con, sql),
stringsAsFactors = TRUE)
return(outdat)
}
......@@ -41,7 +41,11 @@ Default is 30 seconds.}
\item{logfile_dir}{(Optional, String, default: "tempdir()")
The absolute path to folder where the logfile will be stored.}
\item{lib_path}{A character string. The path to the ojdbc*.jar file.}
\item{lib_path}{A character string. The path to the ojdbc*.jar file.
If you run one of the R-containers from the UK-Erlangen DIZ, there
might be a lib for oracle here: `lib_path = "/opt/libs/ojdbc8.jar"`
Example-Dockerfile:
https://github.com/joundso/docker_images/blob/241814e13d99511143d90f6e2217c32ad0477256/image_rdsc_headless_j/Dockerfile#L376}
}
\value{
If successful, the result will be the established connection.
......
......@@ -9,7 +9,8 @@ query_database(db_con, sql_statement)
\arguments{
\item{db_con}{A DBI database connection.}
\item{sql_statement}{A character string containing a valid SQL statement.}
\item{sql_statement}{A character string containing a valid SQL statement.
Caution: Everything after the first ';' will be cut off.}
}
\value{
Returns the result of the db-query.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment