apache / apache/arrow-adbc

r/adbcdrivermanager: Quoting of literals

Open
#1,396 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

For the DBI integration of ADBC via adbcdrivermanager (adbi), I need the ability to quote both identifiers, as well as (arbitrary) literals. Currently I rely exclusively on the default quoting mechanism of DBI, which is problematic in cases where backends deviate from that standard.

In order for me to switch to the quoting infrastructure of adbcdrivermanager, quoting of literals might need to become more capable. Some examples with what I can do with DBI:

```r
DBI::dbQuoteLiteral(DBI::ANSI(), c(1:3, NA))
#> 1
#> 2
#> 3
#> NULL
DBI::dbQuoteLiteral(DBI::ANSI(), c(TRUE, FALSE, NA))
#> 1
#> 0
#> NULL
DBI::dbQuoteLiteral(DBI::ANSI(), list(as.raw(1:3), NULL))
#> X'010203'
#> NULL
DBI::dbQuoteLiteral(DBI::ANSI(), Sys.time())
#> '20231222091012'
DBI::dbQuoteLiteral(DBI::ANSI(), Sys.Date())
#> '2023-12-22'
DBI::dbQuoteLiteral(DBI::ANSI(), as.difftime(1, units = "mins"))
#> '00:01:00'
```

The default for string literals is mostly aligned with DBI apart from `NA` handling

```r
DBI::dbQuoteLiteral(DBI::ANSI(), c("a", NA))
#> 'a'
#> NULL
adbcdrivermanager::adbc_connection_quote_string(
structure(list(), class = "con"),
c("a", NA)
)
#> [1] "'a'" "'NA'"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.