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

Test multi-row binding #96

Closed
3 of 11 tasks
krlmlr opened this issue Oct 1, 2016 · 8 comments
Closed
3 of 11 tasks

Test multi-row binding #96

krlmlr opened this issue Oct 1, 2016 · 8 comments
Assignees

Comments

@krlmlr
Copy link
Member

krlmlr commented Oct 1, 2016

Aims:

  • Good performance for multi-row binding if supported by the driver
  • Seamless fallback support possible if the driver doesn't support binding
  • No new methods, so that it works with DBI 0.5

Means:

  • dbBind() accepts multi-row input
  • Query via dbSendQuery()
    • Need to call dbFetch()
    • dbFetch() always returns a data frame
    • Optional group ID in first column
      • group.column argument: name, NULL or logical(1), default: NULL
    • How to fetch a single group, and then advance to the next?
      • all.groups argument: logical, default TRUE
    • How to return row counts for each parameter set?
      • all.groups argument to dbGetRowCount(): logical, default TRUE
  • Statement via dbSendStatement()
    • Executed immediately upon dbBind()
    • dbFetch() is a no-op, returns NULL (for the fallback)
    • Rows affected are accumulated
    • dbGetRowsAffected() returns single value
    • How to return rows affected for each parameter set?
      • all.groups argument to dbGetRowsAffected(): logical, default TRUE
  • Shortcuts via params argument to dbSendQuery() and dbSendStatement()
@gaborcsardi
Copy link

It would be amazing to make this work!

@krlmlr
Copy link
Member Author

krlmlr commented Oct 1, 2016

Thanks. Stay tuned, the overdue SQLite release will have most of that.

@krlmlr krlmlr self-assigned this Oct 4, 2016
krlmlr added a commit that referenced this issue Oct 6, 2016
- Test multi-row binding for queries and statements (#96).
krlmlr added a commit that referenced this issue Oct 6, 2016
- Test multi-row binding for queries and statements (#96).
- New `ellipsis` check that verifies that all implemented DBI methods contain `...` in their formals. This excludes `show()` and all methods defined in this or other packages.
- Align description of binding with code.
krlmlr added a commit that referenced this issue Dec 4, 2016
- Use markdown in documentation.
- Description of parametrized queries and statements (#88).
- New hidden `DBIspec-wip` page for work-in-progress documentation.
- Get rid of "Format" and "Usage" sections, and aliases, in the specs.

- Not testing for presence of `max.connections` element in `dbGetInfo(Driver)` (r-dbi/DBI#56).
- Test multi-row binding for queries and statements (#96).
- New `ellipsis` check that verifies that all implemented DBI methods contain `...` in their formals. This excludes `show()` and all methods defined in this or other packages.
- Refactored `bind_` tests to use the new `parameter_pattern` tweak (#95).
- Rough draft of transaction tests (#36).
- New `fetch_zero_rows` test, split from `fetch_premature_close`.
- The "compliance" test tests that the backend package exports exactly one subclass of each DBI virtual class.
- Document and enhance test for `dbDataType("DBIDriver", "ANY")` (#88).
- Minor corrections for "bind" tests.

- Isolate stress tests from main test suite (#92).
- Refactor test specification in smaller modules, isolated from actual test execution (#81). This breaks the documentation of the tests, which will be substituted by a DBI specification in prose.
- Align description of binding with code.
- Refactor tests for `dbBind()`, test is run by `BindTester` class, and behavior is specified by members and by instances of the new `BindTesterExtra` class.
- The `skip` argument to the `test_()` functions is again evaluated with `perl = TRUE` to support negative lookaheads (#33).
- Use `dbSendStatement()` and `dbExecute()` where appropriate.
- Avoid empty subsections in Rd documentation to satisfy `R CMD check` (#81).
@krlmlr
Copy link
Member Author

krlmlr commented Feb 25, 2017

The open issues seem a bit ambitious and perhaps unnecessary.

Multi-row binding for queries won't be supported at the moment until a real use case arises (#123).

Multi-row binding for statements is mostly used for inserting values into a table (at least for RSQLite). There seems to be no real need to retrieve the number of rows affected for each sub-statement.

@krlmlr krlmlr closed this as completed Feb 25, 2017
@ghost ghost removed the in progress label Feb 25, 2017
@gaborcsardi
Copy link

I agree it is difficult. My main use case was UPDATE, actually. E.g. bind on a PRIMARY KEY column, and update the rest of the columns.

@krlmlr
Copy link
Member Author

krlmlr commented Mar 1, 2017

Oh, this should work already.

@gaborcsardi
Copy link

Oh, really? That's great! Can you point me to an example if there is one?

@krlmlr
Copy link
Member Author

krlmlr commented Mar 1, 2017

?RSQLite::dbBind, but I'll also improve the DBI docs.

@gaborcsardi
Copy link

Cool, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants