Skip to content

Commit

Permalink
Merge pull request #488 from r-dbi/f-dbitest
Browse files Browse the repository at this point in the history
chore: Update to DBItest 1.8.0
  • Loading branch information
aviator-app[bot] authored Dec 27, 2023
2 parents bf51a4a + b4112cd commit 3a4c2ae
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 15 deletions.
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ Depends:
Imports:
bit64,
blob (>= 1.2.0),
DBI (>= 1.1.0),
DBI (>= 1.2.0),
memoise,
methods,
pkgconfig,
rlang
Suggests:
callr,
DBItest (>= 1.7.3),
DBItest (>= 1.8.0),
gert,
gh,
hms,
Expand All @@ -58,6 +58,9 @@ LinkingTo:
cpp11 (>= 0.4.0)
VignetteBuilder:
knitr
Remotes:
r-dbi/DBI,
r-dbi/DBItest
Config/autostyle/scope: line_breaks
Config/autostyle/strict: false
Config/testthat/edition: 3
Expand Down
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,31 @@ exportClasses(SQLiteDriver)
exportClasses(SQLiteResult)
exportMethods(SQLKeywords)
exportMethods(dbAppendTable)
exportMethods(dbAppendTableArrow)
exportMethods(dbBegin)
exportMethods(dbBind)
exportMethods(dbBindArrow)
exportMethods(dbCanConnect)
exportMethods(dbClearResult)
exportMethods(dbColumnInfo)
exportMethods(dbCommit)
exportMethods(dbConnect)
exportMethods(dbCreateTable)
exportMethods(dbCreateTableArrow)
exportMethods(dbDataType)
exportMethods(dbDisconnect)
exportMethods(dbDriver)
exportMethods(dbExecute)
exportMethods(dbExistsTable)
exportMethods(dbFetch)
exportMethods(dbFetchArrow)
exportMethods(dbFetchArrowChunk)
exportMethods(dbGetConnectArgs)
exportMethods(dbGetException)
exportMethods(dbGetInfo)
exportMethods(dbGetPreparedQuery)
exportMethods(dbGetQuery)
exportMethods(dbGetQueryArrow)
exportMethods(dbGetRowCount)
exportMethods(dbGetRowsAffected)
exportMethods(dbGetStatement)
Expand All @@ -57,15 +64,18 @@ exportMethods(dbQuoteIdentifier)
exportMethods(dbQuoteLiteral)
exportMethods(dbQuoteString)
exportMethods(dbReadTable)
exportMethods(dbReadTableArrow)
exportMethods(dbRemoveTable)
exportMethods(dbRollback)
exportMethods(dbSendPreparedQuery)
exportMethods(dbSendQuery)
exportMethods(dbSendQueryArrow)
exportMethods(dbSendStatement)
exportMethods(dbUnloadDriver)
exportMethods(dbUnquoteIdentifier)
exportMethods(dbWithTransaction)
exportMethods(dbWriteTable)
exportMethods(dbWriteTableArrow)
exportMethods(fetch)
exportMethods(isSQLKeyword)
exportMethods(make.db.names)
Expand All @@ -74,6 +84,7 @@ exportMethods(sqlData)
import(DBI)
import(methods)
import(rlang)
importFrom(DBI,Id)
importFrom(bit64,integer64)
importFrom(bit64,is.integer64)
importFrom(blob,blob)
Expand Down
4 changes: 4 additions & 0 deletions R/SQLite.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ check_vfs <- function(vfs) {
#
# This function checks for known protocols, or for a colon at the beginning.
is_url_or_special_filename <- function(x) grepl("^(?:file|http|ftp|https|):", x)


#' @import rlang
NULL
6 changes: 5 additions & 1 deletion R/dbFetch_SQLiteResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ dbFetch_SQLiteResult <- function(res, n = -1, ...,
row.names = pkgconfig::get_config("RSQLite::row.names.query", FALSE)) {
row.names <- compatRowNames(row.names)
if (length(n) != 1) stopc("`n` must be scalar")
if (n < -1) stopc("`n` must be nonnegative or -1")
if (is.na(n)) {
n <- 256L
} else if (n < -1) {
stopc("`n` must be nonnegative or -1")
}
if (is.infinite(n)) n <- -1
if (trunc(n) != n) stopc("`n` must be a whole number")
ret <- result_fetch(res@ptr, n = n)
Expand Down
2 changes: 1 addition & 1 deletion R/db_bind.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ db_bind <- function(res, params, ..., allow_named_superset) {
}

if (any(empty) || any(numbers)) {
if (!is.null(names(params))) {
if (!is.null(names(params)) || any(names(params) != "")) {
stopc("Cannot use named parameters for anonymous/numbered placeholders")
}
} else {
Expand Down
41 changes: 32 additions & 9 deletions R/export.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Created with:
# methods::getGenerics(asNamespace("DBI")) %>%
# grep("^db[A-Z]", ., value = TRUE) %>%
# setdiff(c("dbCallProc", "dbListConnections", "dbSetDataMappings", "dbGetException")) %>%
# paste0("#' @exportMethod ", ., "\nNULL\n", collapse = "\n") %>%
# cat(file = "R/export.R")
# Generated by helper-reexport.R, do not edit by hand

#' @exportMethod dbAppendTable
NULL

#' @exportMethod dbAppendTableArrow
NULL

#' @exportMethod dbBegin
NULL

#' @exportMethod dbBind
NULL

#' @exportMethod dbBindArrow
NULL

#' @exportMethod dbCanConnect
NULL

Expand All @@ -31,6 +33,9 @@ NULL
#' @exportMethod dbCreateTable
NULL

#' @exportMethod dbCreateTableArrow
NULL

#' @exportMethod dbDataType
NULL

Expand All @@ -49,12 +54,24 @@ NULL
#' @exportMethod dbFetch
NULL

#' @exportMethod dbFetchArrow
NULL

#' @exportMethod dbFetchArrowChunk
NULL

#' @exportMethod dbGetConnectArgs
NULL

#' @exportMethod dbGetInfo
NULL

#' @exportMethod dbGetQuery
NULL

#' @exportMethod dbGetQueryArrow
NULL

#' @exportMethod dbGetRowCount
NULL

Expand Down Expand Up @@ -91,15 +108,15 @@ NULL
#' @exportMethod dbQuoteLiteral
NULL

#' @exportMethod dbQuoteLiteral
NULL

#' @exportMethod dbQuoteString
NULL

#' @exportMethod dbReadTable
NULL

#' @exportMethod dbReadTableArrow
NULL

#' @exportMethod dbRemoveTable
NULL

Expand All @@ -109,6 +126,9 @@ NULL
#' @exportMethod dbSendQuery
NULL

#' @exportMethod dbSendQueryArrow
NULL

#' @exportMethod dbSendStatement
NULL

Expand All @@ -124,5 +144,8 @@ NULL
#' @exportMethod dbWriteTable
NULL

#' @exportMethod dbWriteTableArrow
NULL

#' @export
DBI::Id
2 changes: 1 addition & 1 deletion tests/testthat/helper-DBItest.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tryCatch(skip = function(e) message(conditionMessage(e)), {
RSQLite::SQLite(),
list(dbname = tempfile("DBItest", fileext = ".sqlite")),
tweaks = DBItest::tweaks(
dbitest_version = "1.7.2",
dbitest_version = "1.8.0",
constructor_relax_args = TRUE,
placeholder_pattern = c("?", "$1", "$name", ":name"),
date_cast = function(x) paste0("'", x, "'"),
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/helper-reexport.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if (Sys.getenv("NOT_CRAN") != "" && Sys.getenv("CI") == "" && interactive()) {
# Created with:
methods::getGenerics(asNamespace("DBI")) %>%
grep("^db[A-Z]", ., value = TRUE) %>%
setdiff(c("dbCallProc", "dbListConnections", "dbSetDataMappings", "dbGetException")) %>%
paste0("#' @exportMethod ", ., "\nNULL\n", collapse = "\n") %>%
paste0(
"# Generated by helper-reexport.R, do not edit by hand\n\n",
.,
"\n#' @export\nDBI::Id\n"
) %>%
cat(file = "../../R/export.R")
}
6 changes: 5 additions & 1 deletion tests/testthat/test-DBItest.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
skip_on_cran()
skip_if_not_installed("DBItest")

DBItest::test_all()
DBItest::test_all(
skip = c(
if (getRversion() < "4.0") "stream_bind_too_many"
)
)

0 comments on commit 3a4c2ae

Please sign in to comment.