Skip to content

Commit

Permalink
Merge pull request #148 from duckdb/f-dbitest
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Apr 29, 2024
2 parents 5013908 + 05c7171 commit b330abb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/dbFetch__duckdb_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dbFetch__duckdb_result <- function(res, n = -1, ...) {
if (length(n) != 1) {
stop("need exactly one value in n")
}
if (is.infinite(n)) {
if (is.infinite(n) || is.na(n)) {
n <- -1
}
if (n < -1) {
Expand Down
12 changes: 12 additions & 0 deletions R/dbQuoteLiteral__duckdb_connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ dbQuoteLiteral__duckdb_connection <- function(conn, x, ...) {
}

if (inherits(x, "POSIXt")) {
if (length(x) == 0) {
return(SQL(character()))
}

out <- dbQuoteString(
conn,
strftime(as.POSIXct(x), "%Y-%m-%d %H:%M:%S", tz = "UTC")
Expand All @@ -26,11 +30,19 @@ dbQuoteLiteral__duckdb_connection <- function(conn, x, ...) {
}

if (inherits(x, "Date")) {
if (length(x) == 0) {
return(SQL(character()))
}

out <- callNextMethod()
return(SQL(paste0(out, "::date")))
}

if (inherits(x, "difftime")) {
if (length(x) == 0) {
return(SQL(character()))
}

out <- callNextMethod()
return(SQL(paste0(out, "::time")))
}
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/helper-DBItest.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (rlang::is_installed("DBItest")) DBItest::make_context(
# dblog::dblog(drv),
list(debug = FALSE),
tweaks = DBItest::tweaks(
dbitest_version = "1.8.1",
omit_blob_tests = FALSE,
temporary_tables = FALSE,
placeholder_pattern = "?",
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-DBItest.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,10 @@ if (rlang::is_installed("DBItest")) DBItest::test_all(c(
"write_table_row_names_na_missing",
"append_roundtrip_factor",
"bind_factor",
"arrow_bind_factor",
"arrow_send_query_stale_warning", # wontfix
"arrow_send_query_only_one_result_set", # wontfix
"arrow_write_table_arrow_roundtrip_timestamp_extended", # precision
"arrow_append_table_arrow_roundtrip_timestamp_extended", # precision
NULL
))

0 comments on commit b330abb

Please sign in to comment.