You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some code where I'm building up complex conditions to insert into a parameterized query with glue_sql. In a previous glue version, if those conditions were NULL (in R) I would insert nothing into that part of the query using .null = DBI::SQL("") in glue_sql. However, in 1.8.0 it appears that the .null argument no longer has any impact on the output of glue_sql, and the .na argument doesn't seem to do anything either.
Is this the intended behavior of these arguments?
library(glue)
library(DBI)
library(RSQLite)
con<- dbConnect(RSQLite::SQLite(), "test.sqlite")
# In previous glue version these would be equivalent, now first returns empty query
glue_sql("select {cond}", .con=con, .null=DBI::SQL(""), cond=NULL)
#> <SQL>
glue_sql("select {cond}", .con=con, cond=DBI::SQL(""))
#> <SQL> select# And neither .null nor .na seem to have any effect on output
glue_sql("select {cond}", .con=con, .null="foo", .na="foo", cond=NA)
#> <SQL> select NULL
glue_sql("select {cond}", .con=con, .null="foo", .na="foo", cond=NULL)
#> <SQL>
All I can say off the top of my head is that there has been a sequence of recent-ish issues and PRs around what glue_sql() does for NULL or length-0 inputs.
I have some code where I'm building up complex conditions to insert into a parameterized query with glue_sql. In a previous glue version, if those conditions were NULL (in R) I would insert nothing into that part of the query using
.null = DBI::SQL("")
in glue_sql. However, in 1.8.0 it appears that the .null argument no longer has any impact on the output of glue_sql, and the .na argument doesn't seem to do anything either.Is this the intended behavior of these arguments?
Created on 2024-11-26 with reprex v2.1.1
Session info
The text was updated successfully, but these errors were encountered: