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

Dynamically list methods in generic documentation #26

Open
hadley opened this issue Feb 14, 2017 · 4 comments
Open

Dynamically list methods in generic documentation #26

hadley opened this issue Feb 14, 2017 · 4 comments

Comments

@hadley
Copy link
Member

hadley commented Feb 14, 2017

This will require a \Sexpr{} tag that calls an internal function that generates Rd

Sketch of needed code:

library(DBI)
library(RSQLite)
library(RMySQL)
library(RPostgreSQL)

methods <- methods::findMethods("dbConnect")

# Extracted from roxygen2::object_topic.s4method
s4_topic <- function(x) {
  sig <- paste0(x@defined, collapse = ",")
  paste0(x@generic, ",", sig, "-method")
}

sapply(methods@.Data, s4_topic)
@krlmlr
Copy link
Member

krlmlr commented Jan 25, 2018

The \Sexpr{} seem to be rendered at install time, tested with \Sexpr{runif(1)}. Unless I'm missing something, a fully dynamic inline list cannot be implemented reliably.

Instead, I suggest to add an alias of the form dbConnect-impl to the documentation of each method in all DBI backends, and link to that. This seems close to the intent of this issue. Please advise.

@hadley
Copy link
Member Author

hadley commented Jan 25, 2018

@krlmlr
Copy link
Member

krlmlr commented Jan 26, 2018

Thanks, works. Thinking about using @template and @templateVar to reduce redundancy, will these tags stay around?

@hadley
Copy link
Member Author

hadley commented Jan 26, 2018

They will, but @evalRd in dev roxygen is a little nicer (dev roxygen CRAN submission is blocked by callr which is blocked by processx)

krlmlr referenced this issue in r-dbi/DBI Jan 27, 2018
- The `SQL()` function gains a `names` argument which can be used to assign names to SQL strings.
- `dbListResults()` is deprecated by documentation (#58).
- `dbGetException()` is soft-deprecated by documentation (#51).
- Help pages for generics now contain a dynamic list of methods implemented by DBI backends (#162).
- `sqlInterpolate()` now supports both named and positional variables (#216, @hannesmuehleisen).
- Specialized methods for `dbQuoteString()` and `dbQuoteIdentifier()` are available again, for compatibility with clients that use `getMethod()` to access them (#218).
krlmlr referenced this issue in r-dbi/DBI Mar 9, 2018
…ps the names from the output if the `names` argument is unset. - The `dbReadTable()`, `dbWriteTable()`, `dbExistsTable()`, `dbRemoveTable()`, and `dbListFields()` generics now specialize over the first two arguments to support implementations with the `Id` S4 class as type for the second argument. Some packages may need to update their documentation to satisfy R CMD check again. New generics ------------ - Schema support: Export `Id()`, new generics `dbListObjects()` and `dbUnquoteIdentifier()`, methods for `Id` that call `dbQuoteIdentifier()` and then forward (#220). - New `dbQuoteLiteral()` generic. The default implementation uses switchpatch to avoid dispatch ambiguities, and forwards to `dbQuoteString()` for character vectors. Backends may override methods that also dispatch on the second argument, but in this case also an override for the `"SQL"` class is necessary (#172). Default implementations ----------------------- - Default implementations of `dbQuoteIdentifier()` and `dbQuoteLiteral()` preserve names, default implementation of `dbQuoteString()` strips names (#173). - Specialized methods for `dbQuoteString()` and `dbQuoteIdentifier()` are available again, for compatibility with clients that use `getMethod()` to access them (#218). - Add default implementation of `dbListFields()`. - The default implementation of `dbReadTable()` now has `row.names = FALSE` as default and also supports `row.names = NULL` (#186). API changes ----------- - The `SQL()` function gains an optional `names` argument which can be used to assign names to SQL strings. Deprecated generics ------------------- - `dbListConnections()` is soft-deprecated by documentation. - `dbListResults()` is deprecated by documentation (#58). - `dbGetException()` is soft-deprecated by documentation (#51). - The deprecated `print.list.pairs()` has been removed. Bug fixes --------- - Fix `dbDataType()` for `AsIs` object (#198, @yutannihilation). - Fix `dbQuoteString()` and `dbQuoteIdentifier()` to ignore invalid UTF-8 strings (r-dbi/DBItest#156). Documentation ------------- - Help pages for generics now contain a dynamic list of methods implemented by DBI backends (#162). - `sqlInterpolate()` now supports both named and positional variables (#216, @hannesmuehleisen). - Point to db.rstudio.com (@wibeasley, #209). - Reflect new 'r-dbi' organization in `DESCRIPTION` (@wibeasley, #207). Internal -------- - Using switchpatch on the second argument for default implementations of `dbQuoteString()` and `dbQuoteIdentifier()`.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2020
@r-dbi r-dbi unlocked this conversation Nov 1, 2021
@krlmlr krlmlr transferred this issue from r-dbi/DBI Nov 1, 2021
@krlmlr krlmlr reopened this Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants