Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbBind example fails #136

Closed
imanuelcostigan opened this issue Aug 14, 2016 · 1 comment
Closed

dbBind example fails #136

imanuelcostigan opened this issue Aug 14, 2016 · 1 comment
Assignees
Labels

Comments

@imanuelcostigan
Copy link

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)
imanuelcostigan added a commit to imanuelcostigan/RSQLServer that referenced this issue Aug 14, 2016
@krlmlr
Copy link
Member

krlmlr commented Aug 14, 2016

Unfortunately, the example currently requires RSQLite > 1.0.0.

Your DBI driver could provide a separate DBIResult implementations for "unbound" queries/statements.

@krlmlr krlmlr self-assigned this Dec 1, 2016
@krlmlr krlmlr closed this as completed in e7ea81e Dec 1, 2016
@ghost ghost removed the in progress label Dec 1, 2016
krlmlr added a commit that referenced this issue Dec 2, 2016
- Remove `valueClass = "logical"` for those generics where the return value is meaningless, to allow backends to return invisibly (#135).
- New `dbQuoteIdentifier(DBIConnection, list)` to support quoting multi-component identifiers such as tables in a schema (#71). DBI backends should implement this method for schema support.
- Renamed arguments to `sqlInterpolate()` and `sqlParseVariables()`, the former gains a `.dots` argument (#140, #147).
until RSQLite 1.1 has been built for OS X
- Remove `max.connections` requirement from documentation (#56).
- Enable `dbBind()` example (#136).
- Use roxygen2 inheritance to copy DBI specification to this package.
- Avoid using braces in the definitions of generics if possible, so that standard generics can be detected (#146).
- Change `omegahat.org` URL to `omegahat.net`, the particular document still doesn't exist below the new domain.
- Use `tic` package for building documentation.
krlmlr added a commit that referenced this issue Mar 10, 2017
- Interface changes
    - Deprecated `dbDriver()` and `dbUnloadDriver()` by documentation (#21).
    - Renamed arguments to  `sqlInterpolate()` and `sqlParseVariables()` to be more consistent with the rest of the interface, and added `.dots` argument to `sqlParseVariables`. DBI drivers are now expected to implement `sqlParseVariables(conn, sql, ..., .dots)` and `sqlInterpolate(conn, sql, ...)` (#147).

- Interface enhancements
    - Removed `valueClass = "logical"` for those generics where the return value is meaningless, to allow backends to return invisibly (#135).
    - Avoiding using braces in the definitions of generics if possible, so that standard generics can be detected (#146).
    - Added default implementation for `dbReadTable()`.
    - All standard generics are required to have an ellipsis (with test), for future extensibility.    - Improved default implementation of `dbQuoteString()` and `dbQuoteIdentifier()` (#77).
    - Removed `tryCatch()` call in `dbGetQuery()` (#113).

- Documentation improvements
    - Finalized first draft of DBI specification, now in a vignette.
    - Most methods now draw documentation from `DBItest`, only those where the behavior is not finally decided don't do this yet yet.
    - Removed `max.connections` requirement from documentation (#56).
    - Improved `dbBind()` documentation and example (#136).
    - Change `omegahat.org` URL to `omegahat.net`, the particular document still doesn't exist below the new domain.

- Internal
    - Use roxygen2 inheritance to copy DBI specification to this package.
    - Use `tic` package for building documentation.
    - Use markdown in documentation.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants