nbenn opened a new issue, #1365:
URL: https://github.com/apache/arrow-adbc/issues/1365

   DBI requires me to return a zero-row `data.frame` when binding zero-length 
parameters in a parametrized query. For something like
   
   ```r
   library(DBI)
   con <- dbConnect(adbi::adbi("adbcsqlite"), uri = ":memory:")
   dbWriteTable(con, "swiss", datasets::swiss)
   res <- dbSendQuery(con, "SELECT * from swiss WHERE Agriculture < ?")
   dbBind(res, list(integer()))
   dbFetch(res)
   ```
   
   I'd need to return something like
   
   ```r
   swiss[0, ]
   #> [1] Fertility        Agriculture      Examination      Education
   #> [5] Catholic         Infant.Mortality
   #> <0 rows> (or 0-length row.names)
   ```
   
   but instead I currently have an error `Error parsing schema->format: 
Expected a null-terminated string but found NULL`.
   
   One way for me to do this is by catching the zero-length parameter binding 
and constructing the zero-length `data.frame` from the result schema. To do 
this, I'd need to access the result schema without binding/executing.
   
   We have the exported function `adbc_statement_execute_schema()` available. 
Does that possibly do what I need it to? Unfortunately, I get
   
   ```r
   library(adbcdrivermanager)
   
   db <- adbc_database_init(adbcsqlite::adbcsqlite(), uri = ":memory:")
   con <- adbc_connection_init(db)
   
   write_adbc(datasets::swiss, con, "swiss", temporary = TRUE)
   
   stmt <- adbc_statement_init(con)
   adbc_statement_set_sql_query(stmt, "SELECT * from swiss WHERE Agriculture < 
?")
   adbc_statement_prepare(stmt)
   
   adbc_statement_execute_schema(stmt)
   #> Error in adbc_statement_execute_schema(stmt) : NOT_IMPLEMENTED
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to