Skip to content

Handle string quoting and missing values in strings - #89

Merged
krlmlr merged 1 commit into
r-dbi:masterfrom
jimhester:escaping
Aug 7, 2017
Merged

krlmlr merged 1 commit into
r-dbi:masterfrom
jimhester:escaping

Conversation

@jimhester

Copy link
Copy Markdown
Contributor

I ran into this when trying to use dbWriteTable(copy = FALSE). While the column and row names were escaped, the data values were not and connection_escape_string did not handle missing values.

Behavior after this PR

con <- dbConnect(RPostgres::Postgres(), db = "test_db", host = "localhost", password = "password", port = "5432")
dbQuoteString(con, c("AS", NA))
#> <SQL> 'AS'
#> <SQL> NULL

Missing values in non-character atomic vectors are still an issue, they don't seem to be handled currently.

@krlmlr

krlmlr commented Dec 28, 2016

Copy link
Copy Markdown
Member

Thanks. I'm getting DBItest failures when applying this to current master, could you please double-check? Also, I was hoping that this would help with #50, but the relevant tests still fail (as you mentioned).

@krlmlr
krlmlr merged commit b7c73d9 into r-dbi:master Aug 7, 2017
@krlmlr

krlmlr commented Aug 7, 2017

Copy link
Copy Markdown
Member

Thanks!

krlmlr added a commit that referenced this pull request Aug 7, 2017
- Update Rcpp registration code.
- `dbConnect()` now accepts arbitrary connection parameters in the `...` argument (#83, @thrasibule).
- Handles NA values by converting them to NULL (#82, @thrasibule).
- Handle string quoting and missing values in strings (#89, @jimhester).
- `PKG_CFLAGS` and `PKG_LIBS` are now being set when using pg_config for `includedir` and `libdir` (#119, @Usman-R).
- Use `BYTEA` instead of `BLOB` for PostgreSQL 9.5 support.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants