Fixed references to private$getDBConn()
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
Package: AVSDevR.DBClient
|
Package: AVSDevR.DBClient
|
||||||
Title: AVSDev R Database Client
|
Title: AVSDev R Database Client
|
||||||
Version: 0.0.0.9000
|
Version: 0.0.0.9002
|
||||||
Authors@R:
|
Authors@R:
|
||||||
person("Craig", "Williams", , "craig@avsdev.uk", role = c("aut", "cre"))
|
person("Craig", "Williams", , "craig@avsdev.uk", role = c("aut", "cre"))
|
||||||
Description: AVSDevR.DBClient provides a collection of utility methods for
|
Description: AVSDevR.DBClient provides a collection of utility methods for
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
if (sum(keys %in% class(tbl$lazy_query$x)) == 0) {
|
if (sum(keys %in% class(tbl$lazy_query$x)) == 0) {
|
||||||
tbl$lazy_query$x <- dbplyr::as.sql(
|
tbl$lazy_query$x <- dbplyr::as.sql(
|
||||||
tbl$lazy_query$x, private$client$getConnection()
|
tbl$lazy_query$x, private$getDBConn()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
insertRows <- function(table_name, rows, key_name = NULL) {
|
insertRows <- function(table_name, rows, key_name = NULL) {
|
||||||
tbl <- self$table(table_name)
|
tbl <- self$table(table_name)
|
||||||
new_rows <- dbplyr::copy_inline(private$client$getConnection(), rows)
|
new_rows <- dbplyr::copy_inline(private$getDBConn(), rows)
|
||||||
|
|
||||||
if (getOption("db.simulate", FALSE)) {
|
if (getOption("db.simulate", FALSE)) {
|
||||||
return(printDebug("insertRows", table_name, key_name, tbl, rows, TRUE))
|
return(printDebug("insertRows", table_name, key_name, tbl, rows, TRUE))
|
||||||
@@ -45,7 +45,7 @@ insertRows <- function(table_name, rows, key_name = NULL) {
|
|||||||
|
|
||||||
appendRows <- function(table_name, rows, key_name = NULL) {
|
appendRows <- function(table_name, rows, key_name = NULL) {
|
||||||
tbl <- self$table(table_name)
|
tbl <- self$table(table_name)
|
||||||
new_rows <- dbplyr::copy_inline(private$client$getConnection(), rows)
|
new_rows <- dbplyr::copy_inline(private$getDBConn(), rows)
|
||||||
|
|
||||||
if (getOption("db.simulate", FALSE)) {
|
if (getOption("db.simulate", FALSE)) {
|
||||||
return(printDebug("appendRows", table_name, key_name, tbl, rows, TRUE))
|
return(printDebug("appendRows", table_name, key_name, tbl, rows, TRUE))
|
||||||
@@ -69,12 +69,12 @@ appendRows <- function(table_name, rows, key_name = NULL) {
|
|||||||
|
|
||||||
upsertRows <- function(table_name, rows, key_name = NULL) {
|
upsertRows <- function(table_name, rows, key_name = NULL) {
|
||||||
tbl <- self$table(table_name)
|
tbl <- self$table(table_name)
|
||||||
new_rows <- dbplyr::copy_inline(private$client$getConnection(), rows)
|
new_rows <- dbplyr::copy_inline(private$getDBConn(), rows)
|
||||||
|
|
||||||
tbl <- private$fix_dbplyr(tbl)
|
tbl <- private$fix_dbplyr(tbl)
|
||||||
|
|
||||||
# NOTE: Temporary fix for issue: tidyverse/dbplyr#1279
|
# NOTE: Temporary fix for issue: tidyverse/dbplyr#1279
|
||||||
if ("MariaDBConnection" %in% class(private$client$getConnection())) {
|
if ("MariaDBConnection" %in% class(private$getDBConn())) {
|
||||||
keys <- dplyr::pull(rows, !!key_name)
|
keys <- dplyr::pull(rows, !!key_name)
|
||||||
tbl_keys <- dplyr::select(tbl, !!key_name)
|
tbl_keys <- dplyr::select(tbl, !!key_name)
|
||||||
filt_rows <- dplyr::filter(tbl_keys, !!as.symbol(key_name) %in% !!keys)
|
filt_rows <- dplyr::filter(tbl_keys, !!as.symbol(key_name) %in% !!keys)
|
||||||
@@ -103,7 +103,7 @@ upsertRows <- function(table_name, rows, key_name = NULL) {
|
|||||||
|
|
||||||
updateRows <- function(table_name, rows, key_name = NULL) {
|
updateRows <- function(table_name, rows, key_name = NULL) {
|
||||||
tbl <- self$table(table_name)
|
tbl <- self$table(table_name)
|
||||||
new_rows <- dbplyr::copy_inline(private$client$getConnection(), rows)
|
new_rows <- dbplyr::copy_inline(private$getDBConn(), rows)
|
||||||
|
|
||||||
if (getOption("db.simulate", FALSE)) {
|
if (getOption("db.simulate", FALSE)) {
|
||||||
return(printDebug("updateRows", table_name, key_name, tbl, rows, TRUE))
|
return(printDebug("updateRows", table_name, key_name, tbl, rows, TRUE))
|
||||||
@@ -127,7 +127,7 @@ updateRows <- function(table_name, rows, key_name = NULL) {
|
|||||||
|
|
||||||
deleteRows <- function(table_name, rows, key_name = NULL) {
|
deleteRows <- function(table_name, rows, key_name = NULL) {
|
||||||
tbl <- self$table(table_name)
|
tbl <- self$table(table_name)
|
||||||
old_rows <- dbplyr::copy_inline(private$client$getConnection(), rows)
|
old_rows <- dbplyr::copy_inline(private$getDBConn(), rows)
|
||||||
|
|
||||||
if (getOption("db.simulate", FALSE)) {
|
if (getOption("db.simulate", FALSE)) {
|
||||||
return(printDebug("deleteRows", table_name, key_name, tbl, rows, TRUE))
|
return(printDebug("deleteRows", table_name, key_name, tbl, rows, TRUE))
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ dbAction <- function(statement) {
|
|||||||
if (getOption("db.debug", FALSE)) {
|
if (getOption("db.debug", FALSE)) {
|
||||||
cat("dbQuery:", statement, "\n")
|
cat("dbQuery:", statement, "\n")
|
||||||
}
|
}
|
||||||
DBI::dbExecute(private$getConn(), statement)
|
DBI::dbExecute(private$getDBConn(), statement)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ dbQuery <- function(statement) {
|
|||||||
if (getOption("db.debug", FALSE)) {
|
if (getOption("db.debug", FALSE)) {
|
||||||
cat("dbQuery:", statement, "\n")
|
cat("dbQuery:", statement, "\n")
|
||||||
}
|
}
|
||||||
query <- DBI::dbSendQuery(private$getConn(), statement)
|
query <- DBI::dbSendQuery(private$getDBConn(), statement)
|
||||||
res <- DBI::dbFetch(query)
|
res <- DBI::dbFetch(query)
|
||||||
DBI::dbClearResult(query)
|
DBI::dbClearResult(query)
|
||||||
res
|
res
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ withSchema <- function(table_name) {
|
|||||||
config <- private$conn$getConfiguration()
|
config <- private$conn$getConfiguration()
|
||||||
if (exists("schema", config)) {
|
if (exists("schema", config)) {
|
||||||
return(DBI::dbQuoteIdentifier(
|
return(DBI::dbQuoteIdentifier(
|
||||||
private$getConn(), DBI::Id(schema = config$schema, table = table_name)
|
private$getDBConn(), DBI::Id(schema = config$schema, table = table_name)
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
return(DBI::dbQuoteIdentifier(
|
return(DBI::dbQuoteIdentifier(
|
||||||
private$getConn(), DBI::Id(table = table_name)
|
private$getDBConn(), DBI::Id(table = table_name)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ table <- function(table_name) {
|
|||||||
if (getOption("db.debug", FALSE)) {
|
if (getOption("db.debug", FALSE)) {
|
||||||
cat("dbTable:", table_name, "\n")
|
cat("dbTable:", table_name, "\n")
|
||||||
}
|
}
|
||||||
dplyr::tbl(private$getConn(), self$dplyrWithSchema(table_name))
|
dplyr::tbl(private$getDBConn(), self$dplyrWithSchema(table_name))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user