Skip to content

Commit

Permalink
add r-dbi user-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
elefeint authored and krlmlr committed Dec 26, 2024
1 parent 677d1c9 commit ea8af42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static bool CastRstringToVarchar(Vector &source, Vector &result, idx_t count, Ca
if (readonly) {
config.options.access_mode = AccessMode::READ_ONLY;
}
config.options.duckdb_api = "r-dbi";

auto confignames = configsexp.names();

Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,12 @@ test_that("config only applies to the first driver object for a path", {
gc()
})

test_that("user agent is set to r", {
skip_if_not(TEST_RE2)

drv <- duckdb()
con <- dbConnect(drv)
expect_match(dbGetQuery(con, "PRAGMA user_agent")[1, "user_agent"], "duckdb/.*(.*) r-dbi")

gc()
})

0 comments on commit ea8af42

Please sign in to comment.