Skip to content

dbBind example fails #136

@imanuelcostigan

Description

@imanuelcostigan

Example from dbBind():

> con <- dbConnect(RSQLite::SQLite(), ":memory:")
> 
> dbWriteTable(con, "iris", iris)
[1] TRUE
> iris_result <- dbSendQuery(con, "SELECT * FROM iris WHERE [Petal.Width] > ?")
Error in sqliteSendQuery(conn, statement) : 
  incomplete data binding: expected 1 parameters, got 0

NB: This is marked as "Don't run".

I think this dovetails closely to a major concern I have with the dbBind() approach. That is, prepared statements without bound parameters cannot be executed and return a ResultSet in JDBC. They must have any parameters bound before rather than after execution - namely before, rather than after, any ResultSet object is available. DBI assumes the opposite from what I can tell. I am hacking my way around this, but it isn't pretty.

Session:

> session_info()
Session info -----------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.1 (2016-06-21)
 system   x86_64, darwin16.0.0        
 ui       RStudio (0.99.1283)         
 language (EN)                        
 collate  en_AU.UTF-8                 
 tz       Australia/Sydney            
 date     2016-08-14                  

Packages ---------------------------------------------------------------------------------------
 package    * version date       source        
 DBI        * 0.5     2016-08-11 CRAN (R 3.3.1)
 devtools   * 1.12.0  2016-06-24 CRAN (R 3.3.1)
 digest       0.6.10  2016-08-02 CRAN (R 3.3.1)
 memoise      1.0.0   2016-01-29 CRAN (R 3.3.0)
 rstudioapi   0.6     2016-06-27 CRAN (R 3.3.1)
 withr        1.0.2   2016-06-20 CRAN (R 3.3.0)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions