diff --git a/API b/API index 9894d0f7d..3bc1eed79 100644 --- a/API +++ b/API @@ -3,7 +3,7 @@ ## Exported functions ANSI() -SQL(x) +SQL(x, ..., names = NULL) SQLKeywords(dbObj, ...) dbBegin(conn, ...) dbBind(res, params, ...) diff --git a/DESCRIPTION b/DESCRIPTION index cb7f7c429..b7fe13712 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: DBI -Version: 0.7-13 -Date: 2017-11-27 +Version: 0.7-14 +Date: 2018-01-27 Title: R Database Interface Description: A database interface definition for communication between R and relational database management systems. All @@ -43,6 +43,7 @@ Collate: 'hidden.R' 'interpolate.R' 'quote.R' + 'rd.R' 'rownames.R' 'table-create.R' 'table-insert.R' diff --git a/NEWS.md b/NEWS.md index 64bf2208f..501015a23 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +## DBI 0.7-14 (2018-01-27) + +- 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). + + ## DBI 0.7-13 (2017-11-27) - The deprecated `print.list.pairs()` has been removed. diff --git a/R/DBConnection.R b/R/DBConnection.R index 04b2fc09e..892b3aa3c 100644 --- a/R/DBConnection.R +++ b/R/DBConnection.R @@ -34,7 +34,8 @@ setMethod("show", "DBIConnection", function(object) { # RPostgreSQL) tryCatch( show_connection(object), - error = function(e) NULL) + error = function(e) NULL + ) invisible(NULL) }) @@ -50,6 +51,9 @@ show_connection <- function(object) { #' This closes the connection, discards all pending work, and frees #' resources (e.g., memory, sockets). #' +#' @template methods +#' @templateVar method_name dbDisconnect +#' #' @inherit DBItest::spec_connection_disconnect return #' @inheritSection DBItest::spec_connection_disconnect Specification #' @@ -83,6 +87,10 @@ setGeneric("dbDisconnect", #' and transfer them piecemeal to R, others may transfer all the data to the #' client -- but not necessarily to the memory that R manages. See individual #' drivers' `dbSendQuery()` documentation for details. +#' +#' @template methods +#' @templateVar method_name dbSendQuery +#' #' @inherit DBItest::spec_result_send_query return #' @inheritSection DBItest::spec_result_send_query Specification #' @@ -120,6 +128,9 @@ setGeneric("dbSendQuery", #' forwards to [dbSendQuery()], to support backends that only #' implement the latter. #' +#' @template methods +#' @templateVar method_name dbSendStatement +#' #' @inherit DBItest::spec_result_send_statement return #' @inheritSection DBItest::spec_result_send_statement Specification #' @@ -168,6 +179,9 @@ setMethod( #' reasons. However, callers are strongly advised to use #' [dbExecute()] for data manipulation statements. #' +#' @template methods +#' @templateVar method_name dbGetQuery +#' #' @inherit DBItest::spec_result_get_query return #' @inheritSection DBItest::spec_result_get_query Specification #' @@ -213,6 +227,9 @@ setMethod("dbGetQuery", signature("DBIConnection", "character"), #' [dbSendStatement()], then [dbGetRowsAffected()], ensuring that #' the result is always free-d by [dbClearResult()]. #' +#' @template methods +#' @templateVar method_name dbExecute +#' #' @section Implementation notes: #' Subclasses should override this method only if they provide some sort of #' performance optimization. @@ -251,6 +268,9 @@ setMethod( #' Get DBMS exceptions #' +#' DEPRECATED. Backends should use R's condition system to signal errors and +#' warnings. +#' #' @inheritParams dbGetQuery #' @family DBIConnection generics #' @return a list with elements `errorNum` (an integer error number) and @@ -263,7 +283,9 @@ setGeneric("dbGetException", #' A list of all pending results #' -#' List of [DBIResult-class] objects currently active on the connection. +#' DEPRECATED. DBI currenty supports only one open result set per connection, +#' you need to keep track of the result sets you open if you need this +#' functionality. #' #' @inheritParams dbGetQuery #' @family DBIConnection generics @@ -296,10 +318,16 @@ setGeneric("dbListFields", #' @rdname hidden_aliases #' @export -setMethod("dbListFields", c("DBIConnection", "character"), +setMethod("dbListFields", signature("DBIConnection", "character"), function(conn, name, ...) { - rs <- dbSendQuery(conn, paste("SELECT * FROM ", - dbQuoteIdentifier(conn, name), "LIMIT 0")) + rs <- dbSendQuery( + conn, + paste( + "SELECT * FROM ", + dbQuoteIdentifier(conn, name), + "LIMIT 0" + ) + ) on.exit(dbClearResult(rs)) names(dbFetch(rs, n = 0, row.names = FALSE)) @@ -312,6 +340,9 @@ setMethod("dbListFields", c("DBIConnection", "character"), #' connection. #' This should, where possible, include temporary tables, and views. #' +#' @template methods +#' @templateVar method_name dbListTables +#' #' @inherit DBItest::spec_sql_list_tables return #' @inheritSection DBItest::spec_sql_list_tables Additional arguments #' @@ -337,6 +368,9 @@ setGeneric("dbListTables", #' a column to row names and converting the column names to valid #' R identifiers. #' +#' @template methods +#' @templateVar method_name dbReadTable +#' #' @inherit DBItest::spec_sql_read_table return #' @inheritSection DBItest::spec_sql_read_table Additional arguments #' @inheritSection DBItest::spec_sql_read_table Specification @@ -388,6 +422,9 @@ setMethod("dbReadTable", c("DBIConnection", "character"), #' Writes, overwrites or appends a data frame to a database table, optionally #' converting row names to a column and specifying SQL data types for fields. #' +#' @template methods +#' @templateVar method_name dbWriteTable +#' #' @inherit DBItest::spec_sql_write_table return #' @inheritSection DBItest::spec_sql_write_table Additional arguments #' @inheritSection DBItest::spec_sql_write_table Specification @@ -422,6 +459,9 @@ setGeneric("dbWriteTable", #' #' Returns if a table given by name exists in the database. #' +#' @template methods +#' @templateVar method_name dbExistsTable +#' #' @inherit DBItest::spec_sql_exists_table return #' @inheritSection DBItest::spec_sql_exists_table Additional arguments #' @inheritSection DBItest::spec_sql_exists_table Specification @@ -448,6 +488,9 @@ setGeneric("dbExistsTable", #' Remove a remote table (e.g., created by [dbWriteTable()]) #' from the database. #' +#' @template methods +#' @templateVar method_name dbRemoveTable +#' #' @inherit DBItest::spec_sql_remove_table return #' @inheritSection DBItest::spec_sql_remove_table Specification #' diff --git a/R/DBDriver.R b/R/DBDriver.R index 8ce2adfe3..526e54919 100644 --- a/R/DBDriver.R +++ b/R/DBDriver.R @@ -55,10 +55,11 @@ setClass("DBIDriver", contains = c("DBIObject", "VIRTUAL")) #' @export setGeneric("dbDriver", def = function(drvName, ...) standardGeneric("dbDriver"), - valueClass = "DBIDriver") + valueClass = "DBIDriver" +) #' @rdname hidden_aliases -setMethod("dbDriver", "character", +setMethod("dbDriver", signature("character"), definition = function(drvName, ...) { findDriver(drvName)(...) } @@ -72,7 +73,8 @@ setMethod("show", "DBIDriver", function(object) { # to protect drivers that fail to implement the required methods (e.g., # RPostgreSQL) show_driver(object), - error = function(e) NULL) + error = function(e) NULL + ) invisible(NULL) }) @@ -99,11 +101,13 @@ findDriver <- function(drvName) { } # Can't find it: - stop("Couldn't find driver ", drvName, ". Looked in:\n", + stop( + "Couldn't find driver ", drvName, ". Looked in:\n", "* global namespace\n", "* in package called ", drvName, "\n", "* in package called ", pkgName, - call. = FALSE) + call. = FALSE + ) } get2 <- function(x, env) { @@ -134,6 +138,9 @@ setGeneric("dbUnloadDriver", #' The authentication mechanism is left unspecified, so check the #' documentation of individual drivers for details. #' +#' @template methods +#' @templateVar method_name dbConnect +#' #' @inherit DBItest::spec_driver_connect return #' @inheritSection DBItest::spec_driver_connect Specification #' @@ -196,6 +203,9 @@ setGeneric("dbListConnections", #' Notice that many DBMS do not follow IEEE arithmetic, so there are potential #' problems with under/overflows and loss of precision. #' +#' @template methods +#' @templateVar method_name dbDataType +#' #' @inherit DBItest::spec_driver_data_type return #' @inheritSection DBItest::spec_driver_data_type Specification #' @inheritSection DBItest::spec_result_create_table_with_data_type Specification diff --git a/R/DBObject.R b/R/DBObject.R index a89dfb661..b430c09ea 100644 --- a/R/DBObject.R +++ b/R/DBObject.R @@ -74,7 +74,7 @@ setClass("DBIObject", "VIRTUAL") #' @return a named list #' @export setGeneric("dbGetInfo", - def = function(dbObj, ...) standardGeneric("dbGetInfo") + def = function(dbObj, ...) standardGeneric("dbGetInfo") ) #' Is this DBMS object still valid? @@ -82,6 +82,9 @@ setGeneric("dbGetInfo", #' This generic tests whether a database object is still valid (i.e. it hasn't #' been disconnected or cleared). #' +#' @template methods +#' @templateVar method_name dbIsValid +#' #' @inherit DBItest::spec_meta_is_valid return #' #' @inheritParams dbGetInfo @@ -105,7 +108,8 @@ setGeneric("dbGetInfo", #' dbIsValid(con) setGeneric("dbIsValid", def = function(dbObj, ...) standardGeneric("dbIsValid"), - valueClass = "logical") + valueClass = "logical" +) setGeneric("summary") setMethod("summary", "DBIObject", function(object, ...) { diff --git a/R/DBResult.R b/R/DBResult.R index 17e8d7600..1155b6bd5 100644 --- a/R/DBResult.R +++ b/R/DBResult.R @@ -29,13 +29,14 @@ setMethod("show", "DBIResult", function(object) { # RPostgreSQL) tryCatch( show_result(object), - error = function(e) NULL) + error = function(e) NULL + ) invisible(NULL) }) show_result <- function(object) { cat("<", is(object)[1], ">\n", sep = "") - if(!dbIsValid(object)){ + if (!dbIsValid(object)) { cat("EXPIRED\n") } else { cat(" SQL ", dbGetStatement(object), "\n", sep = "") @@ -56,6 +57,9 @@ show_result <- function(object) { #' implementation for `dbFetch()` calls `fetch()` so that it is compatible with #' existing code. Modern backends should implement for `dbFetch()` only. #' +#' @template methods +#' @templateVar method_name dbFetch +#' #' @inherit DBItest::spec_result_fetch return #' @inheritSection DBItest::spec_result_fetch Specification #' @inheritSection DBItest::spec_result_roundtrip Specification @@ -114,6 +118,9 @@ setGeneric("fetch", #' cases (e.g., very large result sets) this can be a critical step to avoid #' exhausting resources (memory, file descriptors, etc.) #' +#' @template methods +#' @templateVar method_name dbClearResult +#' #' @inherit DBItest::spec_result_clear_result return #' @inheritSection DBItest::spec_result_clear_result Specification #' @@ -167,6 +174,9 @@ setGeneric("dbColumnInfo", #' Returns the statement that was passed to [dbSendQuery()] #' or [dbSendStatement()]. #' +#' @template methods +#' @templateVar method_name dbGetStatement +#' #' @inherit DBItest::spec_meta_get_statement return #' #' @inheritParams dbClearResult @@ -193,6 +203,9 @@ setGeneric("dbGetStatement", #' A `SELECT` query is completed if all rows have been fetched. #' A data manipulation statement is always completed. #' +#' @template methods +#' @templateVar method_name dbHasCompleted +#' #' @inherit DBItest::spec_meta_has_completed return #' @inheritSection DBItest::spec_meta_has_completed Specification #' @@ -224,6 +237,9 @@ setGeneric("dbHasCompleted", #' This method returns the number of rows that were added, deleted, or updated #' by a data manipulation statement. #' +#' @template methods +#' @templateVar method_name dbGetRowsAffected +#' #' @inherit DBItest::spec_meta_get_rows_affected return #' #' @inheritParams dbClearResult @@ -250,6 +266,9 @@ setGeneric("dbGetRowsAffected", #' Returns the total number of rows actually fetched with calls to [dbFetch()] #' for this result set. #' +#' @template methods +#' @templateVar method_name dbGetRowCount +#' #' @inherit DBItest::spec_meta_get_row_count return #' #' @inheritParams dbClearResult @@ -327,6 +346,9 @@ setMethod("dbGetInfo", "DBIResult", function(dbObj, ...) { #' - `$1` (positional matching by index) in \pkg{RPostgres} and \pkg{RSQLite} #' - `:name` and `$name` (named matching) in \pkg{RSQLite} #' +#' @template methods +#' @templateVar method_name dbBind +#' #' @inherit DBItest::spec_meta_bind return #' @inheritSection DBItest::spec_meta_bind Specification #' diff --git a/R/deprecated.R b/R/deprecated.R index 24e5ff31c..216d6f349 100644 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -60,7 +60,7 @@ setGeneric("make.db.names", ) #' @rdname hidden_aliases -setMethod("make.db.names", signature(dbObj="DBIObject", snames="character"), +setMethod("make.db.names", signature(dbObj = "DBIObject", snames = "character"), definition = function(dbObj, snames, keywords, unique, allow.keywords, ...) { make.db.names.default(snames, keywords, unique, allow.keywords) }, @@ -75,25 +75,26 @@ setMethod("make.db.names", signature(dbObj="DBIObject", snames="character"), make.db.names.default <- function(snames, keywords = .SQL92Keywords, unique = TRUE, allow.keywords = TRUE) { makeUnique <- function(x, sep = "_") { - if(length(x)==0) return(x) + if (length(x) == 0) return(x) out <- x - lc <- make.names(tolower(x), unique=FALSE) + lc <- make.names(tolower(x), unique = FALSE) i <- duplicated(lc) lc <- make.names(lc, unique = TRUE) - out[i] <- paste(out[i], substring(lc[i], first=nchar(out[i])+1), sep=sep) + out[i] <- paste(out[i], substring(lc[i], first = nchar(out[i]) + 1), sep = sep) out } ## Note: SQL identifiers *can* be enclosed in double or single quotes ## when they are equal to reserverd keywords. fc <- substring(snames, 1, 1) lc <- substring(snames, nchar(snames)) - i <- match(fc, c("'", '"'), 0)>0 & match(lc, c("'", '"'), 0)>0 - snames[!i] <- make.names(snames[!i], unique=FALSE) - if(unique) + i <- match(fc, c("'", '"'), 0) > 0 & match(lc, c("'", '"'), 0) > 0 + snames[!i] <- make.names(snames[!i], unique = FALSE) + if (unique) { snames[!i] <- makeUnique(snames[!i]) - if(!allow.keywords){ + } + if (!allow.keywords) { kwi <- match(keywords, toupper(snames), nomatch = 0L) - snames[kwi] <- paste('"', snames[kwi], '"', sep='') + snames[kwi] <- paste('"', snames[kwi], '"', sep = "") } gsub("\\.", "_", snames) } @@ -108,7 +109,7 @@ setGeneric("isSQLKeyword", ) #' @rdname hidden_aliases -setMethod("isSQLKeyword", signature(dbObj="DBIObject", name="character"), +setMethod("isSQLKeyword", signature(dbObj = "DBIObject", name = "character"), definition = function(dbObj, name, keywords, case, ...) isSQLKeyword.default(name, keywords, case), valueClass = "logical" @@ -118,16 +119,19 @@ setMethod("isSQLKeyword", signature(dbObj="DBIObject", name="character"), #' @export isSQLKeyword.default <- function(name, keywords = .SQL92Keywords, case = c("lower", "upper", "any")[3]) { - n <- pmatch(case, c("lower", "upper", "any"), nomatch=0) - if(n==0) + n <- pmatch(case, c("lower", "upper", "any"), nomatch = 0) + if (n == 0) { stop('case must be one of "lower", "upper", or "any"') + } kw <- switch(c("lower", "upper", "any")[n], lower = tolower(keywords), upper = toupper(keywords), - any = toupper(keywords)) - if(n==3) + any = toupper(keywords) + ) + if (n == 3) { name <- toupper(name) - match(name, keywords, nomatch=0) > 0 + } + match(name, keywords, nomatch = 0) > 0 } ## SQL ANSI 92 (plus ISO's) keywords --- all 220 of them! @@ -152,7 +156,8 @@ setMethod("SQLKeywords", "missing", ) #' @export -.SQL92Keywords <- c("ABSOLUTE", "ADD", "ALL", "ALLOCATE", "ALTER", "AND", "ANY", +.SQL92Keywords <- c( + "ABSOLUTE", "ADD", "ALL", "ALLOCATE", "ALTER", "AND", "ANY", "ARE", "AS", "ASC", "ASSERTION", "AT", "AUTHORIZATION", "AVG", "BEGIN", "BETWEEN", "BIT", "BIT_LENGTH", "BY", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CHAR", "CHARACTER", "CHARACTER_LENGTH", "CHAR_LENGTH", diff --git a/R/interpolate.R b/R/interpolate.R index 66f69d3fb..44c0a976e 100644 --- a/R/interpolate.R +++ b/R/interpolate.R @@ -31,15 +31,31 @@ setGeneric("sqlInterpolate", setMethod("sqlInterpolate", "DBIConnection", function(conn, sql, ..., .dots = list()) { pos <- sqlParseVariables(conn, sql) - if (length(pos$start) == 0) + if (length(pos$start) == 0) { return(SQL(sql)) + } vars <- substring(sql, pos$start + 1, pos$end) + positional_vars <- pos$start == pos$end + if (all(positional_vars) != any(positional_vars)) { + stop("Can't mix positional (?) and named (?asdf) variables", call. = FALSE) + } + values <- c(list(...), .dots) - if (!setequal(vars, names(values))) { - stop("Supplied vars don't match vars to interpolate", call. = FALSE) + if (all(positional_vars)) { + if (length(vars) != length(values)) { + stop("Supplied values don't match positional vars to interpolate", call. = FALSE) + } + if (any(names(values) != "")) { + stop("Positional variables don't take named arguments") + } + } + else { + if (!setequal(vars, names(values))) { + stop("Supplied values don't match named vars to interpolate", call. = FALSE) + } + values <- values[vars] } - values <- values[vars] safe_values <- vapply(values, function(x) { if (is.character(x)) { @@ -95,7 +111,8 @@ setGeneric("sqlParseVariables", #' @rdname hidden_aliases #' @export setMethod("sqlParseVariables", "DBIConnection", function(conn, sql, ...) { - sqlParseVariablesImpl(sql, + sqlParseVariablesImpl( + sql, list( sqlQuoteSpec('"', '"'), sqlQuoteSpec("'", "'") @@ -110,13 +127,13 @@ setMethod("sqlParseVariables", "DBIConnection", function(conn, sql, ...) { #' @export #' @rdname sqlParseVariables sqlCommentSpec <- function(start, end, endRequired) { - list(start, end, endRequired) + list(start = start, end = end, endRequired = endRequired) } #' @export #' @rdname sqlParseVariables sqlQuoteSpec <- function(start, end, escape = "", doubleEscape = TRUE) { - list(start, end, escape, doubleEscape) + list(start = start, end = end, escape = escape, doubleEscape = doubleEscape) } #' @export @@ -127,7 +144,9 @@ sqlQuoteSpec <- function(start, end, escape = "", doubleEscape = TRUE) { #' @param comments A list of `CommentSpec` calls defining the commenting #' specification. sqlParseVariablesImpl <- function(sql, quotes, comments) { - sql_arr <- c(strsplit(as.character(sql), "", fixed = TRUE)[[1]], " ") + str_to_vec <- function(s) strsplit(s, "", fixed = TRUE)[[1L]] + + sql_arr <- c(str_to_vec(as.character(sql)), " ") # characters valid in variable names var_chars <- c(LETTERS, letters, 0:9, "_") @@ -142,45 +161,45 @@ sqlParseVariablesImpl <- function(sql, quotes, comments) { sql_variable_start <- 0L # prepare comments & quotes for quicker comparisions - for(c in seq_along(comments)) { - comments[[c]][[1]] <- strsplit(comments[[c]][[1]], "", fixed = TRUE)[[1]] - comments[[c]][[2]] <- strsplit(comments[[c]][[2]], "", fixed = TRUE)[[1]] + for (c in seq_along(comments)) { + comments[[c]][["start"]] <- str_to_vec(comments[[c]][["start"]]) + comments[[c]][["end"]] <- str_to_vec(comments[[c]][["end"]]) } - for(q in seq_along(quotes)) { - quotes[[q]][[5]] <- nchar(quotes[[q]][[3]]) > 0L + for (q in seq_along(quotes)) { + quotes[[q]][["hasEscape"]] <- nchar(quotes[[q]][["escape"]]) > 0L } - state <- 'default' - i <- 0 - while(i < length(sql_arr)) { - i <- i + 1 + state <- "default" + i <- 0L + while (i < length(sql_arr)) { + i <- i + 1L switch(state, default = { - # variable? + # variable if (sql_arr[[i]] == "?") { sql_variable_start <- i - state <- 'variable' + state <- "variable" next } - # starting quoted area? - for(q in seq_along(quotes)) { - if (identical(sql_arr[[i]], quotes[[q]][[1]])) { + # starting quoted area + for (q in seq_along(quotes)) { + if (identical(sql_arr[[i]], quotes[[q]][["start"]])) { quote_spec_offset <- q - state <- 'quote' + state <- "quote" break } } # we can abort here if the state has changed - if (state != 'default') next - # starting comment? - for(c in seq_along(comments)) { - comment_start_arr <- comments[[c]][[1]] + if (state != "default") next + # starting comment + for (c in seq_along(comments)) { + comment_start_arr <- comments[[c]][["start"]] comment_start_length <- length(comment_start_arr) - if (identical(sql_arr[i:(i + comment_start_length - 1)], comment_start_arr)) { + if (identical(sql_arr[i:(i + comment_start_length - 1L)], comment_start_arr)) { comment_spec_offset <- c i <- i + comment_start_length - state <- 'comment' + state <- "comment" break } } @@ -188,40 +207,36 @@ sqlParseVariablesImpl <- function(sql, quotes, comments) { variable = { if (!(sql_arr[[i]] %in% var_chars)) { - # make sure variable has at least one character after the '?' - if (i - sql_variable_start < 2) { - stop("Length 0 variable") - } # append current variable offsets to return vectors var_pos_start <- c(var_pos_start, sql_variable_start) - var_pos_end <- c(var_pos_end, i - 1) # we have already read too much, go back - i <- i - 1 - state <- 'default' + i <- i - 1L + var_pos_end <- c(var_pos_end, i) + state <- "default" } }, quote = { # if we see backslash-like escapes, ignore next character - if (quotes[[quote_spec_offset]][[5]] && identical(sql_arr[[i]], quotes[[quote_spec_offset]][[3]])) { - i <- i + 1 + if (quotes[[quote_spec_offset]][["hasEscape"]] && identical(sql_arr[[i]], quotes[[quote_spec_offset]][[3]])) { + i <- i + 1L next } - # end quoted area? - if (identical(sql_arr[[i]], quotes[[quote_spec_offset]][[2]])) { + # end quoted area + if (identical(sql_arr[[i]], quotes[[quote_spec_offset]][["end"]])) { quote_spec_offset <- 0L - state <- 'default' + state <- "default" } }, comment = { - # end commented area? - comment_end_arr <- comments[[comment_spec_offset]][[2]] + # end commented area + comment_end_arr <- comments[[comment_spec_offset]][["end"]] comment_end_length <- length(comment_end_arr) - if (identical(sql_arr[i:(i + comment_end_length - 1)], comment_end_arr)) { + if (identical(sql_arr[i:(i + comment_end_length - 1L)], comment_end_arr)) { i <- i + comment_end_length comment_spec_offset <- 0L - state <- 'default' + state <- "default" } } ) # @@ -230,8 +245,8 @@ sqlParseVariablesImpl <- function(sql, quotes, comments) { if (quote_spec_offset > 0L) { stop("Unterminated literal") } - if (comment_spec_offset > 0L && comments[[comment_spec_offset]][[3]]) { + if (comment_spec_offset > 0L && comments[[comment_spec_offset]][["endRequired"]]) { stop("Unterminated comment") } - list(start = as.integer(var_pos_start), end = as.integer(var_pos_end)) + list(start = var_pos_start, end = var_pos_end) } diff --git a/R/quote.R b/R/quote.R index e25b0b38e..5145a9638 100644 --- a/R/quote.R +++ b/R/quote.R @@ -25,6 +25,7 @@ NULL #' #' @param x A character vector to label as being escaped SQL. #' @param ... Other arguments passed on to methods. Not otherwise used. +#' @param names Names for the returned object, must have the same length as `x`. #' @return An object of class `SQL`. #' @export #' @examples @@ -40,7 +41,13 @@ NULL #' #' # This mechanism is used to prevent double escaping #' dbQuoteString(ANSI(), dbQuoteString(ANSI(), "SELECT")) -SQL <- function(x) new("SQL", x) +SQL <- function(x, ..., names = NULL) { + if (!is.null(names)) { + stopifnot(length(x) == length(names)) + } + names(x) <- names + new("SQL", x) +} #' @rdname SQL #' @export @@ -66,6 +73,9 @@ setMethod("show", "SQL", function(object) { #' @param x A character vector to quote as identifier. #' @param ... Other arguments passed on to methods. #' +#' @template methods +#' @templateVar method_name dbQuoteIdentifier +#' #' @inherit DBItest::spec_sql_quote_identifier return #' @inheritSection DBItest::spec_sql_quote_identifier Specification #' @@ -88,9 +98,7 @@ setGeneric("dbQuoteIdentifier", def = function(conn, x, ...) standardGeneric("dbQuoteIdentifier") ) -#' @rdname hidden_aliases -#' @export -setMethod("dbQuoteIdentifier", "DBIConnection", +quote_identifier <- function(conn, x, ...) { if (is(x, "SQL")) return(x) if (is(x, "Table")) { @@ -110,7 +118,20 @@ setMethod("dbQuoteIdentifier", "DBIConnection", SQL(paste('"', x, '"', sep = "")) } } -) + +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteIdentifier", c("DBIConnection"), quote_identifier) + +# Need to keep other method declarations around for now, because clients might +# use getMethod(), see e.g. https://github.com/r-dbi/odbc/pull/149 +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteIdentifier", c("DBIConnection", "character"), quote_identifier) + +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteIdentifier", c("DBIConnection", "SQL"), quote_identifier) #' Quote literal strings #' @@ -123,6 +144,9 @@ setMethod("dbQuoteIdentifier", "DBIConnection", #' @param x A character vector to quote as string. #' @param ... Other arguments passed on to methods. #' +#' @template methods +#' @templateVar method_name dbQuoteString +#' #' @inherit DBItest::spec_sql_quote_string return #' @inheritSection DBItest::spec_sql_quote_string Specification #' @@ -147,9 +171,7 @@ setGeneric("dbQuoteString", def = function(conn, x, ...) standardGeneric("dbQuoteString") ) -#' @rdname hidden_aliases -#' @export -setMethod("dbQuoteString", "DBIConnection", +quote_string <- function(conn, x, ...) { if (is(x, "SQL")) return(x) if (!is.character(x)) stop("x must be character or SQL", call. = FALSE) @@ -167,7 +189,20 @@ setMethod("dbQuoteString", "DBIConnection", SQL(str) } } -) + +# Need to keep other method declarations around for now, because clients might +# use getMethod(), see e.g. https://github.com/r-dbi/odbc/pull/149 +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteString", c("DBIConnection"), quote_string) + +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteString", c("DBIConnection", "character"), quote_string) + +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteString", c("DBIConnection", "SQL"), quote_string) #' Quote literal values #' @@ -179,6 +214,9 @@ setMethod("dbQuoteString", "DBIConnection", #' @inheritParams dbQuoteString #' @param x A vector to quote as string. #' +#' @template methods +#' @templateVar method_name dbQuoteLiteral +#' #' @inherit DBItest::spec_sql_quote_literal return #' @inheritSection DBItest::spec_sql_quote_literal Specification #' @@ -213,22 +251,35 @@ setGeneric("dbQuoteLiteral", #' @rdname hidden_aliases #' @export -setMethod("dbQuoteLiteral", "DBIConnection", +setMethod("dbQuoteLiteral", signature("DBIConnection"), function(conn, x, ...) { # Switchpatching to avoid ambiguous S4 dispatch, so that our method # is used only if no alternatives are available. if (is(x, "SQL")) return(x) + if (is.factor(x)) return(dbQuoteString(conn, as.character(x))) + if (is.character(x)) return(dbQuoteString(conn, x)) + if (inherits(x, "POSIXt")) { + return(dbQuoteString( + conn, + strftime(as.POSIXct(x), "%Y%m%d%H%M%S", tz = "UTC") + )) + } + + if (inherits(x, "Date")) return(dbQuoteString(conn, as.character(x, usetz = TRUE))) + if (is.list(x)) { blob_data <- vapply( x, function(x) { - if (is.null(x)) "NULL" - else if (is.raw(x)) paste0("X'", paste(format(x), collapse = ""), "'") - else { + if (is.null(x)) { + "NULL" + } else if (is.raw(x)) { + paste0("X'", paste(format(x), collapse = ""), "'") + } else { stop("Lists must contain raw vectors or NULL", call. = FALSE) } }, diff --git a/R/rd.R b/R/rd.R new file mode 100644 index 000000000..86473ed45 --- /dev/null +++ b/R/rd.R @@ -0,0 +1,30 @@ +methods_as_rd <- function(method) { + if (method == "transactions") { + method <- c("dbBegin", "dbCommit", "dbRollback") + } + + methods <- unlist(lapply(method, methods::findMethods), recursive = FALSE) + + # Extracted from roxygen2::object_topic.s4method + s4_topic <- function(x) { + sig <- paste0(x@defined, collapse = ",") + sig_text <- paste0('"', x@defined, '"', collapse = ", ") + package <- getNamespaceName(environment(x@.Data)) + paste0( + "\\code{\\link[=", x@generic, ",", sig, "-method]{", + package, "::", x@generic, + "(", sig_text, ")}}" + ) + } + + if (length(methods@.Data) == 0) return("") + + item_text <- vapply(methods@.Data, s4_topic, character(1)) + + paste0( + "\\subsection{Methods in other packages}{\n\n", + "\\itemize{\n", + paste0("\\item ", item_text, "\n", collapse = ""), + "}}\n" + ) +} diff --git a/R/table-create.R b/R/table-create.R index 3ade0f27d..2d2b053a6 100644 --- a/R/table-create.R +++ b/R/table-create.R @@ -37,7 +37,7 @@ setGeneric("sqlCreateTable", #' @rdname hidden_aliases #' @export -setMethod("sqlCreateTable", "DBIConnection", +setMethod("sqlCreateTable", signature("DBIConnection"), function(con, table, fields, row.names = NA, temporary = FALSE, ...) { table <- dbQuoteIdentifier(con, table) diff --git a/R/table-insert.R b/R/table-insert.R index 287965a32..283d12e98 100644 --- a/R/table-insert.R +++ b/R/table-insert.R @@ -22,7 +22,7 @@ setGeneric("sqlAppendTable", #' @rdname hidden_aliases #' @export -setMethod("sqlAppendTable", "DBIConnection", +setMethod("sqlAppendTable", signature("DBIConnection"), function(con, table, values, row.names = NA, ...) { stopifnot(is.data.frame(values)) diff --git a/R/table.R b/R/table.R index 17da0199c..a7a58cae7 100644 --- a/R/table.R +++ b/R/table.R @@ -17,3 +17,7 @@ Table <- function(...) { setMethod("show", "Table", function(object) { cat(" ", paste0(object@name, collapse = "."), "\n", sep = "") }) + +#' @rdname hidden_aliases +#' @export +setMethod("dbQuoteIdentifier", c("DBIConnection", "Table"), quote_identifier) diff --git a/R/transactions.R b/R/transactions.R index 11fe088ed..ab338a1ff 100644 --- a/R/transactions.R +++ b/R/transactions.R @@ -11,6 +11,9 @@ #' these methods should not be implemented for the specific #' [DBIConnection-class] subclass. #' +#' @template methods +#' @templateVar method_name transactions +#' #' @inherit DBItest::spec_transaction_begin_commit_rollback return #' @inheritSection DBItest::spec_transaction_begin_commit_rollback Specification #' @@ -84,7 +87,10 @@ setGeneric("dbRollback", #' #' DBI implements `dbWithTransaction()`, backends should need to override this #' generic only if they implement specialized handling. - +#' +#' @template methods +#' @templateVar method_name dbWithTransaction +#' #' @inherit DBItest::spec_transaction_with_transaction return #' @inheritSection DBItest::spec_transaction_with_transaction Specification #' @@ -144,10 +150,14 @@ setMethod("dbWithTransaction", "DBIConnection", function(conn, code) { rollback_because <- function(e) { call <- dbRollback(conn) if (identical(call, FALSE)) { - stop(paste("Failed to rollback transaction.", - "Tried to roll back because an error", - "occurred:", conditionMessage(e)), - call. = FALSE) + stop( + paste( + "Failed to rollback transaction.", + "Tried to roll back because an error", + "occurred:", conditionMessage(e) + ), + call. = FALSE + ) } if (inherits(e, "error")) { stop(e) @@ -169,7 +179,8 @@ setMethod("dbWithTransaction", "DBIConnection", function(conn, code) { res }, dbi_abort = rollback_because, - error = rollback_because) + error = rollback_because + ) }) #' @export @@ -178,6 +189,8 @@ dbBreak <- function() { signalCondition( structure( list(message = "Aborting DBI processing", call = NULL), - class = c("dbi_abort", "condition"))) + class = c("dbi_abort", "condition") + ) + ) stop("Invalid usage of dbBreak().", call. = FALSE) } diff --git a/_pkgdown.yml b/_pkgdown.yml index 7c4df1cb0..55c1c2a23 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,3 +1,3 @@ -templates: +template: params: bootswatch: flatly # https://bootswatch.com/flatly/ diff --git a/man-roxygen/methods.R b/man-roxygen/methods.R new file mode 100644 index 000000000..cce7eb36a --- /dev/null +++ b/man-roxygen/methods.R @@ -0,0 +1,6 @@ +#' @noMd +#' @name <%=method_name %> +#' @rdname <%=method_name %> +#' @description +#' \Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("<%=method_name %>")} +NULL diff --git a/man/DBI-package.Rd b/man/DBI-package.Rd index 04a654646..7b5bee36a 100644 --- a/man/DBI-package.Rd +++ b/man/DBI-package.Rd @@ -35,7 +35,9 @@ and \linkS4class{DBIResult}. The backend provides implementation for all methods of these base classes that are defined but not implemented by DBI. -All methods have an ellipsis \code{...} in their formals. +All methods defined in \pkg{DBI} are reexported (so that the package can +be used without having to attach \pkg{DBI}), +and have an ellipsis \code{...} in their formals for extensibility. } diff --git a/man/SQL.Rd b/man/SQL.Rd index 786ce669a..03c705c74 100644 --- a/man/SQL.Rd +++ b/man/SQL.Rd @@ -6,12 +6,14 @@ \alias{SQL-class} \title{SQL quoting} \usage{ -SQL(x) +SQL(x, ..., names = NULL) } \arguments{ \item{x}{A character vector to label as being escaped SQL.} \item{...}{Other arguments passed on to methods. Not otherwise used.} + +\item{names}{Names for the returned object, must have the same length as \code{x}.} } \value{ An object of class \code{SQL}. diff --git a/man/dbBind.Rd b/man/dbBind.Rd index ce34543cf..687f0eec5 100644 --- a/man/dbBind.Rd +++ b/man/dbBind.Rd @@ -46,6 +46,8 @@ statements that contain placeholders for values. The \code{dbBind()} function binds these placeholders to actual values, and is intended to be called on the result set before calling \code{\link[=dbFetch]{dbFetch()}} or \code{\link[=dbGetRowsAffected]{dbGetRowsAffected()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbBind")} } \details{ \pkg{DBI} supports parametrized (or prepared) queries and statements diff --git a/man/dbClearResult.Rd b/man/dbClearResult.Rd index 751c33fe4..0d34e7758 100644 --- a/man/dbClearResult.Rd +++ b/man/dbClearResult.Rd @@ -22,6 +22,8 @@ in both cases. Frees all resources (local and remote) associated with a result set. In some cases (e.g., very large result sets) this can be a critical step to avoid exhausting resources (memory, file descriptors, etc.) + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbClearResult")} } \section{Specification}{ diff --git a/man/dbConnect.Rd b/man/dbConnect.Rd index b46a3a31c..4866530ae 100644 --- a/man/dbConnect.Rd +++ b/man/dbConnect.Rd @@ -26,6 +26,8 @@ may invoke this function repeatedly assigning its output to different objects. The authentication mechanism is left unspecified, so check the documentation of individual drivers for details. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbConnect")} } \section{Specification}{ diff --git a/man/dbDataType.Rd b/man/dbDataType.Rd index 97ca74969..797eae97d 100644 --- a/man/dbDataType.Rd +++ b/man/dbDataType.Rd @@ -31,6 +31,8 @@ R object according to the SQL 92 specification, which may serve as a starting point for driver implementations. DBI also provides an implementation for data.frame which will return a character vector giving the type for each column in the dataframe. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbDataType")} } \details{ The data types supported by databases are different than the data types in R, diff --git a/man/dbDisconnect.Rd b/man/dbDisconnect.Rd index 634aa2f51..1166b9ae4 100644 --- a/man/dbDisconnect.Rd +++ b/man/dbDisconnect.Rd @@ -18,6 +18,8 @@ dbDisconnect(conn, ...) \description{ This closes the connection, discards all pending work, and frees resources (e.g., memory, sockets). + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbDisconnect")} } \section{Specification}{ diff --git a/man/dbExecute.Rd b/man/dbExecute.Rd index 6cea9fd6c..9484baf8b 100644 --- a/man/dbExecute.Rd +++ b/man/dbExecute.Rd @@ -31,6 +31,8 @@ Executes a statement and returns the number of rows affected. (which should work with most backends) that calls \code{\link[=dbSendStatement]{dbSendStatement()}}, then \code{\link[=dbGetRowsAffected]{dbGetRowsAffected()}}, ensuring that the result is always free-d by \code{\link[=dbClearResult]{dbClearResult()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbExecute")} } \section{Implementation notes}{ diff --git a/man/dbExistsTable.Rd b/man/dbExistsTable.Rd index f67b7385d..bc719b660 100644 --- a/man/dbExistsTable.Rd +++ b/man/dbExistsTable.Rd @@ -27,6 +27,8 @@ or if this results in a non-scalar. } \description{ Returns if a table given by name exists in the database. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbExistsTable")} } \section{Additional arguments}{ diff --git a/man/dbFetch.Rd b/man/dbFetch.Rd index 95b181e9e..f9ef167be 100644 --- a/man/dbFetch.Rd +++ b/man/dbFetch.Rd @@ -38,6 +38,8 @@ can be fetched and return an empty data frame, with a warning. \description{ Fetch the next \code{n} elements (rows) from the result set and return them as a data.frame. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbFetch")} } \details{ \code{fetch()} is provided for compatibility with older DBI clients - for all diff --git a/man/dbGetException.Rd b/man/dbGetException.Rd index 032f169c9..c8534039d 100644 --- a/man/dbGetException.Rd +++ b/man/dbGetException.Rd @@ -18,7 +18,8 @@ a list with elements \code{errorNum} (an integer error number) and connection \code{conn}. } \description{ -Get DBMS exceptions +DEPRECATED. Backends should use R's condition system to signal errors and +warnings. } \seealso{ Other DBIConnection generics: \code{\link{DBIConnection-class}}, diff --git a/man/dbGetQuery.Rd b/man/dbGetQuery.Rd index 1d8807d89..6c0d0bcea 100644 --- a/man/dbGetQuery.Rd +++ b/man/dbGetQuery.Rd @@ -35,6 +35,8 @@ Returns the result of a query as a data frame. (which should work with most backends) that calls \code{\link[=dbSendQuery]{dbSendQuery()}}, then \code{\link[=dbFetch]{dbFetch()}}, ensuring that the result is always free-d by \code{\link[=dbClearResult]{dbClearResult()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbGetQuery")} } \details{ This method is for \code{SELECT} queries only. Some backends may diff --git a/man/dbGetRowCount.Rd b/man/dbGetRowCount.Rd index 1adc3e9fe..dc538d270 100644 --- a/man/dbGetRowCount.Rd +++ b/man/dbGetRowCount.Rd @@ -34,6 +34,8 @@ Attempting to get the row count for a result set cleared with \description{ Returns the total number of rows actually fetched with calls to \code{\link[=dbFetch]{dbFetch()}} for this result set. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbGetRowCount")} } \examples{ con <- dbConnect(RSQLite::SQLite(), ":memory:") diff --git a/man/dbGetRowsAffected.Rd b/man/dbGetRowsAffected.Rd index d9e7e2c8c..4acfcbf5b 100644 --- a/man/dbGetRowsAffected.Rd +++ b/man/dbGetRowsAffected.Rd @@ -26,6 +26,8 @@ Attempting to get the rows affected for a result set cleared with \description{ This method returns the number of rows that were added, deleted, or updated by a data manipulation statement. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbGetRowsAffected")} } \examples{ con <- dbConnect(RSQLite::SQLite(), ":memory:") diff --git a/man/dbGetStatement.Rd b/man/dbGetStatement.Rd index 735f85397..45a7f97fe 100644 --- a/man/dbGetStatement.Rd +++ b/man/dbGetStatement.Rd @@ -21,6 +21,8 @@ Attempting to query the statement for a result set cleared with \description{ Returns the statement that was passed to \code{\link[=dbSendQuery]{dbSendQuery()}} or \code{\link[=dbSendStatement]{dbSendStatement()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbGetStatement")} } \examples{ con <- dbConnect(RSQLite::SQLite(), ":memory:") diff --git a/man/dbHasCompleted.Rd b/man/dbHasCompleted.Rd index f540be0ca..4af9f5d37 100644 --- a/man/dbHasCompleted.Rd +++ b/man/dbHasCompleted.Rd @@ -25,6 +25,8 @@ Attempting to query completion status for a result set cleared with This method returns if the operation has completed. A \code{SELECT} query is completed if all rows have been fetched. A data manipulation statement is always completed. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbHasCompleted")} } \section{Specification}{ diff --git a/man/dbIsValid.Rd b/man/dbIsValid.Rd index 9ba2b883f..3fa4f4a21 100644 --- a/man/dbIsValid.Rd +++ b/man/dbIsValid.Rd @@ -34,6 +34,8 @@ connectivity problems, server failure, etc.), \code{dbIsValid()} should return \description{ This generic tests whether a database object is still valid (i.e. it hasn't been disconnected or cleared). + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbIsValid")} } \examples{ dbIsValid(RSQLite::SQLite()) diff --git a/man/dbListResults.Rd b/man/dbListResults.Rd index 9e7f72eb7..187f87ce3 100644 --- a/man/dbListResults.Rd +++ b/man/dbListResults.Rd @@ -17,7 +17,9 @@ a list. If no results are active, an empty list. If only a single result is active, a list with one element. } \description{ -List of \linkS4class{DBIResult} objects currently active on the connection. +DEPRECATED. DBI currenty supports only one open result set per connection, +you need to keep track of the result sets you open if you need this +functionality. } \seealso{ Other DBIConnection generics: \code{\link{DBIConnection-class}}, diff --git a/man/dbListTables.Rd b/man/dbListTables.Rd index 85b0b54a2..637c47252 100644 --- a/man/dbListTables.Rd +++ b/man/dbListTables.Rd @@ -32,6 +32,8 @@ or invalid connection. Returns the unquoted names of remote tables accessible through this connection. This should, where possible, include temporary tables, and views. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbListTables")} } \section{Additional arguments}{ diff --git a/man/dbQuoteIdentifier.Rd b/man/dbQuoteIdentifier.Rd index 6492983fa..ebc076546 100644 --- a/man/dbQuoteIdentifier.Rd +++ b/man/dbQuoteIdentifier.Rd @@ -32,6 +32,8 @@ to achieve this behavior, but this is not required.) Call this method to generate a string that is suitable for use in a query as a column name, to make sure that you generate valid SQL and avoid SQL injection. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbQuoteIdentifier")} } \section{Specification}{ diff --git a/man/dbQuoteLiteral.Rd b/man/dbQuoteLiteral.Rd index 154950135..b38eb0e43 100644 --- a/man/dbQuoteLiteral.Rd +++ b/man/dbQuoteLiteral.Rd @@ -18,6 +18,8 @@ an active connection to an DBMS.} Call these methods to generate a string that is suitable for use in a query as a literal value of the correct type, to make sure that you generate valid SQL and avoid SQL injection. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbQuoteLiteral")} } \examples{ # Quoting ensures that arbitrary input is safe for use in a query diff --git a/man/dbQuoteString.Rd b/man/dbQuoteString.Rd index 0cabc6790..d580a48d0 100644 --- a/man/dbQuoteString.Rd +++ b/man/dbQuoteString.Rd @@ -30,6 +30,8 @@ to achieve this behavior, but this is not required.) Call this method to generate a string that is suitable for use in a query as a string literal, to make sure that you generate valid SQL and avoid SQL injection. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbQuoteString")} } \section{Specification}{ diff --git a/man/dbReadTable.Rd b/man/dbReadTable.Rd index 3e8c4e13e..b2a73ed5d 100644 --- a/man/dbReadTable.Rd +++ b/man/dbReadTable.Rd @@ -58,6 +58,8 @@ also raise an error. Reads a database table to a data frame, optionally converting a column to row names and converting the column names to valid R identifiers. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbReadTable")} } \section{Additional arguments}{ diff --git a/man/dbRemoveTable.Rd b/man/dbRemoveTable.Rd index 99a0d8ab1..400064fc3 100644 --- a/man/dbRemoveTable.Rd +++ b/man/dbRemoveTable.Rd @@ -28,6 +28,8 @@ or if this results in a non-scalar. \description{ Remove a remote table (e.g., created by \code{\link[=dbWriteTable]{dbWriteTable()}}) from the database. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbRemoveTable")} } \section{Specification}{ diff --git a/man/dbSendQuery.Rd b/man/dbSendQuery.Rd index d0da764f6..137fb3575 100644 --- a/man/dbSendQuery.Rd +++ b/man/dbSendQuery.Rd @@ -32,6 +32,8 @@ records --- for that you need to use the \code{\link[=dbFetch]{dbFetch()}} metho then you must call \code{\link[=dbClearResult]{dbClearResult()}} when you finish fetching the records you need. For interactive use, you should almost always prefer \code{\link[=dbGetQuery]{dbGetQuery()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbSendQuery")} } \details{ This method is for \code{SELECT} queries only. Some backends may diff --git a/man/dbSendStatement.Rd b/man/dbSendStatement.Rd index 498d526d8..6110ef88e 100644 --- a/man/dbSendStatement.Rd +++ b/man/dbSendStatement.Rd @@ -34,6 +34,8 @@ the number of affected rows, call \code{\link[=dbGetRowsAffected]{dbGetRowsAffec returned result object. You must also call \code{\link[=dbClearResult]{dbClearResult()}} after that. For interactive use, you should almost always prefer \code{\link[=dbExecute]{dbExecute()}}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbSendStatement")} } \details{ \code{\link[=dbSendStatement]{dbSendStatement()}} comes with a default implementation that simply diff --git a/man/dbWithTransaction.Rd b/man/dbWithTransaction.Rd index a09622f18..e02fa890d 100644 --- a/man/dbWithTransaction.Rd +++ b/man/dbWithTransaction.Rd @@ -37,6 +37,8 @@ that you don't have to remember to do \code{dbBegin()} and \code{dbCommit()} or \code{dbRollback()} -- that is all taken care of. The special function \code{dbBreak()} allows an early exit with rollback, it can be called only inside \code{dbWithTransaction()}. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbWithTransaction")} } \details{ DBI implements \code{dbWithTransaction()}, backends should need to override this diff --git a/man/dbWriteTable.Rd b/man/dbWriteTable.Rd index a80796336..43ea97429 100644 --- a/man/dbWriteTable.Rd +++ b/man/dbWriteTable.Rd @@ -43,6 +43,8 @@ also raise an error. \description{ Writes, overwrites or appends a data frame to a database table, optionally converting row names to a column and specifying SQL data types for fields. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbWriteTable")} } \section{Additional arguments}{ diff --git a/man/hidden_aliases.Rd b/man/hidden_aliases.Rd index 1a1cdfed1..269fac33a 100644 --- a/man/hidden_aliases.Rd +++ b/man/hidden_aliases.Rd @@ -26,12 +26,17 @@ \alias{sqlInterpolate,DBIConnection-method} \alias{sqlParseVariables,DBIConnection-method} \alias{show,SQL-method} -\alias{dbQuoteIdentifier,DBIConnection-method} -\alias{dbQuoteString,DBIConnection-method} +\alias{dbQuoteIdentifier,DBIConnection,ANY-method} +\alias{dbQuoteIdentifier,DBIConnection,character-method} +\alias{dbQuoteIdentifier,DBIConnection,SQL-method} +\alias{dbQuoteString,DBIConnection,ANY-method} +\alias{dbQuoteString,DBIConnection,character-method} +\alias{dbQuoteString,DBIConnection,SQL-method} \alias{dbQuoteLiteral,DBIConnection-method} \alias{sqlCreateTable,DBIConnection-method} \alias{sqlAppendTable,DBIConnection-method} \alias{show,Table-method} +\alias{dbQuoteIdentifier,DBIConnection,Table-method} \alias{dbWithTransaction,DBIConnection-method} \title{Internal page for hidden aliases} \usage{ @@ -80,9 +85,17 @@ \S4method{show}{SQL}(object) -\S4method{dbQuoteIdentifier}{DBIConnection}(conn, x, ...) +\S4method{dbQuoteIdentifier}{DBIConnection,ANY}(conn, x, ...) -\S4method{dbQuoteString}{DBIConnection}(conn, x, ...) +\S4method{dbQuoteIdentifier}{DBIConnection,character}(conn, x, ...) + +\S4method{dbQuoteIdentifier}{DBIConnection,SQL}(conn, x, ...) + +\S4method{dbQuoteString}{DBIConnection,ANY}(conn, x, ...) + +\S4method{dbQuoteString}{DBIConnection,character}(conn, x, ...) + +\S4method{dbQuoteString}{DBIConnection,SQL}(conn, x, ...) \S4method{dbQuoteLiteral}{DBIConnection}(conn, x, ...) @@ -94,6 +107,8 @@ \S4method{show}{Table}(object) +\S4method{dbQuoteIdentifier}{DBIConnection,Table}(conn, x, ...) + \S4method{dbWithTransaction}{DBIConnection}(conn, code) } \arguments{ diff --git a/man/transactions.Rd b/man/transactions.Rd index cca8e5c4c..29fe1bf9c 100644 --- a/man/transactions.Rd +++ b/man/transactions.Rd @@ -39,6 +39,8 @@ or undone with \code{dbRollback()}. In any case, the DBMS guarantees that either all or none of the statements have a permanent effect. This helps ensuring consistency of write operations to multiple tables. + +\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("transactions")} } \details{ Not all database engines implement transaction management, in which case diff --git a/revdep/.gitignore b/revdep/.gitignore new file mode 100644 index 000000000..1ec70f4fe --- /dev/null +++ b/revdep/.gitignore @@ -0,0 +1,3 @@ +* +!*.md +!.gitignore diff --git a/revdep/README.md b/revdep/README.md index 6ab2f5bc5..47c16c6fb 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -9,13 +9,13 @@ |language |(EN) | |collate |en_US.UTF-8 | |tz |Zulu | -|date |2017-11-23 | +|date |2017-11-27 | # Dependencies |package | old|new |Δ | |:-------|---:|:------|:--| -|DBI | 0.7|0.7-12 |* | +|DBI | 0.7|0.7-13 |* | # Revdeps @@ -32,12 +32,12 @@ ## Broken (2) -|package |version |error |warning |note | -|:-----------------------------------------------------|:-------|:------|:-------|:----| -|[huex10stprobeset.db](problems.md#huex10stprobesetdb) |8.6.0 |__+1__ | |4 | -|[pool](problems.md#pool) |0.1.3 | |__+1__ | | +|package |version |error |warning |note | +|:--------------------------------------------------|:-------|:------|:-------|:----| +|[AnnotationHubData](problems.md#annotationhubdata) |1.6.2 |__+1__ |2 |3 | +|[pool](problems.md#pool) |0.1.3 | |__+1__ | | -## All (516) +## All (517) |package |version |error |warning |note | |:-------------------------------------------------------------------------------------|:---------|:------|:-------|:----| @@ -52,8 +52,8 @@ |[AnnotationDbi](problems.md#annotationdbi) |1.38.2 | |2 |4 | |[AnnotationForge](problems.md#annotationforge) |1.18.2 |1 | |1 | |[AnnotationFuncs](problems.md#annotationfuncs) |1.26.0 | | |3 | -|[AnnotationHubData](problems.md#annotationhubdata) |1.6.2 |-1 |2 |3 | -|[archivist](problems.md#archivist) |2.1.2 | | |2 | +|[AnnotationHubData](problems.md#annotationhubdata) |1.6.2 |__+1__ |2 |3 | +|[archivist](problems.md#archivist) |2.2 | | |2 | |aroma.affymetrix |3.1.0 | | | | |[ath1121501.db](problems.md#ath1121501db) |3.2.3 | |1 |3 | |[BatchExperiments](problems.md#batchexperiments) |1.4.1 | | |2 | @@ -152,7 +152,7 @@ |[hguqiagenv3.db](problems.md#hguqiagenv3db) |3.2.3 | | |3 | |[Hs6UG171.db](problems.md#hs6ug171db) |3.2.3 | | |3 | |[HsAgilentDesign026652.db](problems.md#hsagilentdesign026652db) |3.2.3 | | |3 | -|[hta20probeset.db](problems.md#hta20probesetdb) |8.6.0 | | |4 | +|[hta20probeset.db](problems.md#hta20probesetdb) |8.6.0 |1 | |4 | |[hta20transcriptcluster.db](problems.md#hta20transcriptclusterdb) |8.6.0 | | |4 | |[hthgu133a.db](problems.md#hthgu133adb) |3.2.3 | | |3 | |[hthgu133b.db](problems.md#hthgu133bdb) |3.2.3 | | |3 | @@ -161,15 +161,15 @@ |[hu35ksubc.db](problems.md#hu35ksubcdb) |3.2.3 | | |3 | |[hu35ksubd.db](problems.md#hu35ksubddb) |3.2.3 | | |3 | |[hu6800.db](problems.md#hu6800db) |3.2.3 | | |3 | -|[huex10stprobeset.db](problems.md#huex10stprobesetdb) |8.6.0 |__+1__ | |4 | +|[huex10stprobeset.db](problems.md#huex10stprobesetdb) |8.6.0 | | |4 | |[huex10sttranscriptcluster.db](problems.md#huex10sttranscriptclusterdb) |8.6.0 | | |4 | -|[hugene10stprobeset.db](problems.md#hugene10stprobesetdb) |8.6.0 |1 | |4 | +|[hugene10stprobeset.db](problems.md#hugene10stprobesetdb) |8.6.0 | | |4 | |[hugene10sttranscriptcluster.db](problems.md#hugene10sttranscriptclusterdb) |8.6.0 | | |4 | -|[hugene11stprobeset.db](problems.md#hugene11stprobesetdb) |8.6.0 |1 | |4 | +|[hugene11stprobeset.db](problems.md#hugene11stprobesetdb) |8.6.0 | | |4 | |[hugene11sttranscriptcluster.db](problems.md#hugene11sttranscriptclusterdb) |8.6.0 | | |4 | |[hugene20stprobeset.db](problems.md#hugene20stprobesetdb) |8.6.0 | | |4 | |[hugene20sttranscriptcluster.db](problems.md#hugene20sttranscriptclusterdb) |8.6.0 | | |4 | -|[hugene21stprobeset.db](problems.md#hugene21stprobesetdb) |8.6.0 |1 | |4 | +|[hugene21stprobeset.db](problems.md#hugene21stprobesetdb) |8.6.0 | | |4 | |[hugene21sttranscriptcluster.db](problems.md#hugene21sttranscriptclusterdb) |8.6.0 | | |4 | |[HuO22.db](problems.md#huo22db) |3.2.3 | | |3 | |implyr |0.2.1 | | | | @@ -230,7 +230,7 @@ |[mouse4302.db](problems.md#mouse4302db) |3.2.3 | | |3 | |[mouse430a2.db](problems.md#mouse430a2db) |3.2.3 | | |3 | |[mpedbarray.db](problems.md#mpedbarraydb) |3.2.3 | | |3 | -|[mta10probeset.db](problems.md#mta10probesetdb) |8.6.0 | | |4 | +|[mta10probeset.db](problems.md#mta10probesetdb) |8.6.0 |1 | |4 | |[mta10transcriptcluster.db](problems.md#mta10transcriptclusterdb) |8.6.0 | | |4 | |[mu11ksuba.db](problems.md#mu11ksubadb) |3.2.3 | | |3 | |[mu11ksubb.db](problems.md#mu11ksubbdb) |3.2.3 | | |3 | @@ -401,11 +401,11 @@ |[pd.porgene.1.0.st](problems.md#pdporgene10st) |3.12.0 | |1 |4 | |[pd.porgene.1.1.st](problems.md#pdporgene11st) |3.12.0 | |1 |4 | |[pd.rabgene.1.0.st](problems.md#pdrabgene10st) |3.12.0 | |1 |4 | -|pd.rabgene.1.1.st |3.12.0 | | | | -|pd.rae230a |3.12.0 | | | | -|pd.rae230b |3.12.0 | | | | +|[pd.rabgene.1.1.st](problems.md#pdrabgene11st) |3.12.0 | |1 |4 | +|[pd.rae230a](problems.md#pdrae230a) |3.12.0 | |1 |4 | +|[pd.rae230b](problems.md#pdrae230b) |3.12.0 | |1 |4 | |[pd.raex.1.0.st.v1](problems.md#pdraex10stv1) |3.14.1 | |1 |4 | -|pd.ragene.1.0.st.v1 |3.14.1 | | | | +|[pd.ragene.1.0.st.v1](problems.md#pdragene10stv1) |3.14.1 | |1 |4 | |[pd.ragene.1.1.st.v1](problems.md#pdragene11stv1) |3.14.1 | |1 |4 | |[pd.ragene.2.0.st](problems.md#pdragene20st) |3.14.1 | |1 |4 | |[pd.ragene.2.1.st](problems.md#pdragene21st) |3.14.1 | |1 |4 | @@ -431,7 +431,7 @@ |[pd.soygene.1.1.st](problems.md#pdsoygene11st) |3.12.0 | |1 |4 | |[pd.sugar.cane](problems.md#pdsugarcane) |3.12.0 | |2 |4 | |[pd.tomato](problems.md#pdtomato) |3.12.0 | |2 |4 | -|[pd.u133.x3p](problems.md#pdu133x3p) |3.12.0 |1 | | | +|[pd.u133.x3p](problems.md#pdu133x3p) |3.12.0 | |1 |4 | |[pd.vitis.vinifera](problems.md#pdvitisvinifera) |3.12.0 | |1 |4 | |[pd.wheat](problems.md#pdwheat) |3.12.0 | |1 |4 | |[pd.x.laevis.2](problems.md#pdxlaevis2) |3.12.0 | |1 |4 | @@ -470,6 +470,7 @@ |[ragene21stprobeset.db](problems.md#ragene21stprobesetdb) |8.6.0 | | |4 | |[ragene21sttranscriptcluster.db](problems.md#ragene21sttranscriptclusterdb) |8.6.0 | | |4 | |[rat2302.db](problems.md#rat2302db) |3.2.3 | | |3 | +|[RClickhouse](problems.md#rclickhouse) |0.3.0 |1 | |1 | |RecordLinkage |0.4-10 | | | | |[redcapAPI](problems.md#redcapapi) |1.3 | | |1 | |refGenome |1.7.3 | | | | @@ -479,7 +480,7 @@ |[rgu34c.db](problems.md#rgu34cdb) |3.2.3 | | |3 | |[rguatlas4k.db](problems.md#rguatlas4kdb) |3.2.3 | | |3 | |[rgug4105a.db](problems.md#rgug4105adb) |3.2.3 | | |3 | -|[rgug4130a.db](problems.md#rgug4130adb) |3.2.3 | |-1 |3 | +|[rgug4130a.db](problems.md#rgug4130adb) |3.2.3 | | |3 | |[rgug4131a.db](problems.md#rgug4131adb) |3.2.3 | | |3 | |RImmPort |1.4.2 | | | | |[RJDBC](problems.md#rjdbc) |0.2-5 | |1 | | @@ -502,13 +503,13 @@ |RRedshiftSQL |0.1.2 | | | | |[RSQLite](problems.md#rsqlite) |2.0 |1 | |2 | |RSQLServer |0.3.0 | | | | -|[rta10probeset.db](problems.md#rta10probesetdb) |8.6.0 | | |4 | +|[rta10probeset.db](problems.md#rta10probesetdb) |8.6.0 |-1 | |4 | |[rta10transcriptcluster.db](problems.md#rta10transcriptclusterdb) |8.6.0 | | |4 | |rTRM |1.14.0 | | | | |[rtu34.db](problems.md#rtu34db) |3.2.3 | | |3 | |SEERaBomb |2017.2 | | | | |[sejmRP](problems.md#sejmrp) |1.3.4 | | |1 | -|[seplyr](problems.md#seplyr) |0.1.6 | |1 |1 | +|[seplyr](problems.md#seplyr) |0.5.0 | |1 |1 | |[seqplots](problems.md#seqplots) |1.14.1 | |1 |3 | |[sergeant](problems.md#sergeant) |0.5.2 |1 | | | |[sf](problems.md#sf) |0.5-5 | |1 |1 | diff --git a/revdep/cran.md b/revdep/cran.md index fa510eb37..58ebc1ded 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,6 +1,6 @@ ## revdepcheck results -We checked 516 reverse dependencies (121 from CRAN + 395 from BioConductor), comparing R CMD check results across CRAN and dev versions of this package. +We checked 517 reverse dependencies (122 from CRAN + 395 from BioConductor), comparing R CMD check results across CRAN and dev versions of this package. * We saw 1 new problems * We failed to check 3 packages diff --git a/revdep/problems.md b/revdep/problems.md index 5031dad74..77d1665a2 100644 --- a/revdep/problems.md +++ b/revdep/problems.md @@ -354,7 +354,7 @@ Version: 1.26.0 Version: 1.6.2 -## Newly fixed +## Newly broken * checking tests ... ``` @@ -441,7 +441,7 @@ Version: 1.6.2 # archivist -Version: 2.1.2 +Version: 2.2 ## In both @@ -1501,9 +1501,9 @@ Version: 0.7.4 * checking installed package size ... NOTE ``` - installed size is 32.9Mb + installed size is 33.0Mb sub-directories of 1Mb or more: - libs 31.0Mb + libs 31.1Mb ``` * checking data for non-ASCII characters ... NOTE @@ -3057,6 +3057,32 @@ Version: 8.6.0 ## In both +* checking examples ... ERROR + ``` + ... + + got <- xx[[1]] + + got[[1]][["GOID"]] + + got[[1]][["Ontology"]] + + got[[1]][["Evidence"]] + + } + [1] "IBA" + > # For the reverse map: + > # Convert to a list + > xx <- as.list(hta20probesetGO2PROBE) + > if(length(xx) > 0){ + + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers + + goids <- xx[2:3] + + # Gets the manufacturer ids for the first element of goids + + goids[[1]] + + # Evidence code for the mappings + + names(goids[[1]]) + + } + NULL + > # Convert hta20probesetGO2ALLPROBES to a list + > xx <- as.list(hta20probesetGO2ALLPROBES) + Killed + ``` + * checking installed package size ... NOTE ``` installed size is 302.3Mb @@ -3345,34 +3371,6 @@ Version: 3.2.3 Version: 8.6.0 -## Newly broken - -* checking examples ... ERROR - ``` - ... - + got <- xx[[1]] - + got[[1]][["GOID"]] - + got[[1]][["Ontology"]] - + got[[1]][["Evidence"]] - + } - [1] "IMP" - > # For the reverse map: - > # Convert to a list - > xx <- as.list(huex10stprobesetGO2PROBE) - > if(length(xx) > 0){ - + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers - + goids <- xx[2:3] - + # Gets the manufacturer ids for the first element of goids - + goids[[1]] - + # Evidence code for the mappings - + names(goids[[1]]) - + } - [1] "IEP" "IEP" "IEP" "IEP" "IEP" "IEP" "IEP" "IEP" "IEP" "IEP" - > # Convert huex10stprobesetGO2ALLPROBES to a list - > xx <- as.list(huex10stprobesetGO2ALLPROBES) - Killed - ``` - ## In both * checking installed package size ... NOTE @@ -3455,32 +3453,6 @@ Version: 8.6.0 ## In both -* checking examples ... ERROR - ``` - ... - + got <- xx[[1]] - + got[[1]][["GOID"]] - + got[[1]][["Ontology"]] - + got[[1]][["Evidence"]] - + } - [1] "IBA" - > # For the reverse map: - > # Convert to a list - > xx <- as.list(hugene10stprobesetGO2PROBE) - > if(length(xx) > 0){ - + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers - + goids <- xx[2:3] - + # Gets the manufacturer ids for the first element of goids - + goids[[1]] - + # Evidence code for the mappings - + names(goids[[1]]) - + } - [1] "IEP" "IEP" - > # Convert hugene10stprobesetGO2ALLPROBES to a list - > xx <- as.list(hugene10stprobesetGO2ALLPROBES) - Killed - ``` - * checking installed package size ... NOTE ``` installed size is 118.4Mb @@ -3561,32 +3533,6 @@ Version: 8.6.0 ## In both -* checking examples ... ERROR - ``` - ... - + got <- xx[[1]] - + got[[1]][["GOID"]] - + got[[1]][["Ontology"]] - + got[[1]][["Evidence"]] - + } - [1] "IBA" - > # For the reverse map: - > # Convert to a list - > xx <- as.list(hugene11stprobesetGO2PROBE) - > if(length(xx) > 0){ - + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers - + goids <- xx[2:3] - + # Gets the manufacturer ids for the first element of goids - + goids[[1]] - + # Evidence code for the mappings - + names(goids[[1]]) - + } - [1] "IEP" "IEP" - > # Convert hugene11stprobesetGO2ALLPROBES to a list - > xx <- as.list(hugene11stprobesetGO2ALLPROBES) - Killed - ``` - * checking installed package size ... NOTE ``` installed size is 118.4Mb @@ -3747,32 +3693,6 @@ Version: 8.6.0 ## In both -* checking examples ... ERROR - ``` - ... - + got <- xx[[1]] - + got[[1]][["GOID"]] - + got[[1]][["Ontology"]] - + got[[1]][["Evidence"]] - + } - [1] "IBA" - > # For the reverse map: - > # Convert to a list - > xx <- as.list(hugene21stprobesetGO2PROBE) - > if(length(xx) > 0){ - + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers - + goids <- xx[2:3] - + # Gets the manufacturer ids for the first element of goids - + goids[[1]] - + # Evidence code for the mappings - + names(goids[[1]]) - + } - [1] "IEP" "IEP" - > # Convert hugene21stprobesetGO2ALLPROBES to a list - > xx <- as.list(hugene21stprobesetGO2ALLPROBES) - Killed - ``` - * checking installed package size ... NOTE ``` installed size is 127.6Mb @@ -5611,6 +5531,32 @@ Version: 8.6.0 ## In both +* checking examples ... ERROR + ``` + ... + + got[[1]][["Ontology"]] + + got[[1]][["Evidence"]] + + } + [1] "IMP" + > # For the reverse map: + > # Convert to a list + > xx <- as.list(mta10probesetGO2PROBE) + > if(length(xx) > 0){ + + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers + + goids <- xx[2:3] + + # Gets the manufacturer ids for the first element of goids + + goids[[1]] + + # Evidence code for the mappings + + names(goids[[1]]) + + } + [1] "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" + [13] "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" + [25] "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" "IBA" + > # Convert mta10probesetGO2ALLPROBES to a list + > xx <- as.list(mta10probesetGO2ALLPROBES) + Killed + ``` + * checking installed package size ... NOTE ``` installed size is 146.2Mb @@ -6057,7 +6003,7 @@ Version: 1.1.3 * checking installed package size ... NOTE ``` - installed size is 6.0Mb + installed size is 6.1Mb sub-directories of 1Mb or more: libs 5.7Mb ``` @@ -10305,7 +10251,7 @@ Version: 3.12.2 * checking installed package size ... NOTE ``` - installed size is 770.8Mb + installed size is 770.9Mb sub-directories of 1Mb or more: data 42.8Mb extdata 727.9Mb @@ -12497,7 +12443,7 @@ Version: 3.12.0 * checking installed package size ... NOTE ``` - installed size is 52.1Mb + installed size is 52.0Mb sub-directories of 1Mb or more: data 4.3Mb extdata 47.6Mb @@ -12561,6 +12507,141 @@ Version: 3.12.0 for when this namespace is loaded but not attached. ``` +# pd.rabgene.1.1.st + +Version: 3.12.0 + +## In both + +* checking whether the namespace can be unloaded cleanly ... WARNING + ``` + ---- unloading + Warning message: + .onUnload failed in unloadNamespace() for 'pd.rabgene.1.1.st', details: + call: rsqlite_connection_valid(dbObj@ptr) + error: external pointer is not valid + ``` + +* checking package dependencies ... NOTE + ``` + Depends: includes the non-default packages: + ‘Biostrings’ ‘RSQLite’ ‘oligoClasses’ ‘oligo’ ‘DBI’ ‘IRanges’ + ‘S4Vectors’ + Adding so many packages to the search path is excessive and importing + selectively is preferable. + ``` + +* checking installed package size ... NOTE + ``` + installed size is 63.4Mb + sub-directories of 1Mb or more: + data 3.7Mb + extdata 59.6Mb + ``` + +* checking DESCRIPTION meta-information ... NOTE + ``` + Malformed Description field: should contain one or more complete sentences. + ``` + +* checking dependencies in R code ... NOTE + ``` + Packages in Depends field not imported from: + ‘IRanges’ ‘methods’ ‘oligo’ ‘oligoClasses’ + These packages need to be imported from (in the NAMESPACE file) + for when this namespace is loaded but not attached. + ``` + +# pd.rae230a + +Version: 3.12.0 + +## In both + +* checking whether the namespace can be unloaded cleanly ... WARNING + ``` + ---- unloading + Warning message: + .onUnload failed in unloadNamespace() for 'pd.rae230a', details: + call: rsqlite_connection_valid(dbObj@ptr) + error: external pointer is not valid + ``` + +* checking package dependencies ... NOTE + ``` + Depends: includes the non-default packages: + ‘Biostrings’ ‘RSQLite’ ‘oligoClasses’ ‘oligo’ ‘DBI’ ‘IRanges’ + ‘S4Vectors’ + Adding so many packages to the search path is excessive and importing + selectively is preferable. + ``` + +* checking installed package size ... NOTE + ``` + installed size is 12.1Mb + sub-directories of 1Mb or more: + data 1.2Mb + extdata 10.8Mb + ``` + +* checking DESCRIPTION meta-information ... NOTE + ``` + Malformed Description field: should contain one or more complete sentences. + ``` + +* checking dependencies in R code ... NOTE + ``` + Packages in Depends field not imported from: + ‘IRanges’ ‘methods’ ‘oligo’ ‘oligoClasses’ + These packages need to be imported from (in the NAMESPACE file) + for when this namespace is loaded but not attached. + ``` + +# pd.rae230b + +Version: 3.12.0 + +## In both + +* checking whether the namespace can be unloaded cleanly ... WARNING + ``` + ---- unloading + Warning message: + .onUnload failed in unloadNamespace() for 'pd.rae230b', details: + call: rsqlite_connection_valid(dbObj@ptr) + error: external pointer is not valid + ``` + +* checking package dependencies ... NOTE + ``` + Depends: includes the non-default packages: + ‘Biostrings’ ‘RSQLite’ ‘oligoClasses’ ‘oligo’ ‘DBI’ ‘IRanges’ + ‘S4Vectors’ + Adding so many packages to the search path is excessive and importing + selectively is preferable. + ``` + +* checking installed package size ... NOTE + ``` + installed size is 11.7Mb + sub-directories of 1Mb or more: + data 1.2Mb + extdata 10.4Mb + ``` + +* checking DESCRIPTION meta-information ... NOTE + ``` + Malformed Description field: should contain one or more complete sentences. + ``` + +* checking dependencies in R code ... NOTE + ``` + Packages in Depends field not imported from: + ‘IRanges’ ‘methods’ ‘oligo’ ‘oligoClasses’ + These packages need to be imported from (in the NAMESPACE file) + for when this namespace is loaded but not attached. + ``` + # pd.raex.1.0.st.v1 Version: 3.14.1 @@ -12606,6 +12687,51 @@ Version: 3.14.1 for when this namespace is loaded but not attached. ``` +# pd.ragene.1.0.st.v1 + +Version: 3.14.1 + +## In both + +* checking whether the namespace can be unloaded cleanly ... WARNING + ``` + ---- unloading + Warning message: + .onUnload failed in unloadNamespace() for 'pd.ragene.1.0.st.v1', details: + call: rsqlite_connection_valid(dbObj@ptr) + error: external pointer is not valid + ``` + +* checking package dependencies ... NOTE + ``` + Depends: includes the non-default packages: + ‘Biostrings’ ‘RSQLite’ ‘oligoClasses’ ‘oligo’ ‘DBI’ ‘IRanges’ + ‘S4Vectors’ + Adding so many packages to the search path is excessive and importing + selectively is preferable. + ``` + +* checking installed package size ... NOTE + ``` + installed size is 80.4Mb + sub-directories of 1Mb or more: + data 5.3Mb + extdata 75.0Mb + ``` + +* checking DESCRIPTION meta-information ... NOTE + ``` + Malformed Description field: should contain one or more complete sentences. + ``` + +* checking dependencies in R code ... NOTE + ``` + Packages in Depends field not imported from: + ‘IRanges’ ‘methods’ ‘oligo’ ‘oligoClasses’ + These packages need to be imported from (in the NAMESPACE file) + for when this namespace is loaded but not attached. + ``` + # pd.ragene.1.1.st.v1 Version: 3.14.1 @@ -13765,18 +13891,43 @@ Version: 3.12.0 ## In both -* checking package dependencies ... ERROR +* checking whether the namespace can be unloaded cleanly ... WARNING + ``` + ---- unloading + Warning message: + .onUnload failed in unloadNamespace() for 'pd.u133.x3p', details: + call: rsqlite_connection_valid(dbObj@ptr) + error: external pointer is not valid + ``` + +* checking package dependencies ... NOTE ``` - Package required but not available: ‘RSQLite’ - Depends: includes the non-default packages: ‘Biostrings’ ‘RSQLite’ ‘oligoClasses’ ‘oligo’ ‘DBI’ ‘IRanges’ ‘S4Vectors’ Adding so many packages to the search path is excessive and importing selectively is preferable. - - See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’ - manual. + ``` + +* checking installed package size ... NOTE + ``` + installed size is 46.4Mb + sub-directories of 1Mb or more: + data 3.8Mb + extdata 42.4Mb + ``` + +* checking DESCRIPTION meta-information ... NOTE + ``` + Malformed Description field: should contain one or more complete sentences. + ``` + +* checking dependencies in R code ... NOTE + ``` + Packages in Depends field not imported from: + ‘IRanges’ ‘methods’ ‘oligo’ ‘oligoClasses’ + These packages need to be imported from (in the NAMESPACE file) + for when this namespace is loaded but not attached. ``` # pd.vitis.vinifera @@ -14403,7 +14554,7 @@ Version: 1.14.0 > temp.db.file <- tempfile() > write(sim.bux.lines, file=temp.file) > test.bux.db <- parse.buxco(file.name=temp.file, db.name=temp.db.file, chunk.size=10000) - Processing /home/muelleki/tmp/RtmpM7WPrJ/file2080370a0ce5 in chunks of 10000 + Processing /home/muelleki/tmp/Rtmp2oiYlZ/file1c67b17284ced in chunks of 10000 Starting chunk 1 Reached breakpoint change Processing breakpoint 1 @@ -14431,7 +14582,7 @@ Version: 1.14.0 unit tests failed for package plethy In addition: Warning message: In .Internal(gc(verbose, reset)) : - closing unused connection 3 (/home/muelleki/tmp/Rtmpe6E1Rc/file29c91754c10f) + closing unused connection 3 (/home/muelleki/tmp/RtmpalOI5s/file1c7bb7be2fc24) Execution halted ``` @@ -15088,6 +15239,41 @@ Version: 3.2.3 See section ‘Good practice’ in '?.onAttach'. ``` +# RClickhouse + +Version: 0.3.0 + +## In both + +* checking tests ... + ``` + ERROR + Running the tests in ‘tests/testthat.R’ failed. + Last 13 lines of output: + 3. Error: correct conversion of logical values in dplyr (#15) (@test-regr-15.R#9) + fail to connect: Connection refused + 1: dbConnect(RClickhouse::clickhouse(), host = serveraddr) at testthat/test-regr-15.R:9 + 2: dbConnect(RClickhouse::clickhouse(), host = serveraddr) + 3: .local(drv, ...) + 4: connect(host, port, db, user, password, compression) + + testthat results ================================================================ + OK: 0 SKIPPED: 0 FAILED: 3 + 1. Error: reading & writing array columns (@test-array.R#9) + 2. Error: array columns with empty entries (@test-array.R#30) + 3. Error: correct conversion of logical values in dplyr (#15) (@test-regr-15.R#9) + + Error: testthat unit tests failed + Execution halted + ``` + +* checking installed package size ... NOTE + ``` + installed size is 9.7Mb + sub-directories of 1Mb or more: + libs 9.5Mb + ``` + # redcapAPI Version: 1.3 @@ -15287,15 +15473,6 @@ Version: 3.2.3 Version: 3.2.3 -## Newly fixed - -* checking replacement functions ... WARNING - ``` - Warning: system call failed: Cannot allocate memory - The argument of a replacement function which corresponds to the right - hand side must be named ‘value’. - ``` - ## In both * checking DESCRIPTION meta-information ... NOTE @@ -15667,7 +15844,7 @@ Version: 1.14.0 * checking re-building of vignette outputs ... NOTE ``` ... - 3: max(p.x-p.x.prev)=0.00005 + 3: max(p.x-p.x.prev)=0.00009 4: max(p.x-p.x.prev)=0.00000 Start roleswitch with 365 miRNA and 11016 mRNA @@ -15734,7 +15911,7 @@ Version: 0.3-0 ** preparing package for lazy loading R session is headless; GTK+ not initialized. -(R:39192): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() +(R:106687): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() Error: package or namespace load failed for ‘cairoDevice’: .onLoad failed in loadNamespace() for 'cairoDevice', details: call: fun(libname, pkgname) @@ -15754,7 +15931,7 @@ ERROR: lazy loading failed for package ‘RQDA’ ** preparing package for lazy loading R session is headless; GTK+ not initialized. -(R:39178): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() +(R:106680): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() Error: package or namespace load failed for ‘cairoDevice’: .onLoad failed in loadNamespace() for 'cairoDevice', details: call: fun(libname, pkgname) @@ -15809,6 +15986,34 @@ Version: 2.0 Version: 8.6.0 +## Newly fixed + +* checking examples ... ERROR + ``` + ... + + } + [1] "ISO" + > # For the reverse map: + > # Convert to a list + > xx <- as.list(rta10probesetGO2PROBE) + > if(length(xx) > 0){ + + # Gets the manufacturer ids for the top 2nd and 3nd GO identifiers + + goids <- xx[2:3] + + # Gets the manufacturer ids for the first element of goids + + goids[[1]] + + # Evidence code for the mappings + + names(goids[[1]]) + + } + [1] "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" + [13] "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "NAS" "NAS" "NAS" "ISO" "ISS" "ISO" + [25] "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" + [37] "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "ISO" "ISS" "NAS" "NAS" "NAS" + [49] "NAS" + > # Convert rta10probesetGO2ALLPROBES to a list + > xx <- as.list(rta10probesetGO2ALLPROBES) + Killed + ``` + ## In both * checking installed package size ... NOTE @@ -15930,7 +16135,7 @@ Version: 1.3.4 # seplyr -Version: 0.1.6 +Version: 0.5.0 ## In both @@ -16482,14 +16687,14 @@ Version: 2016.8-1 * checking running R code from vignettes ... ``` ... - INFO: Contacting web service with query: https://stats.oecd.org/restsdmx/sdmx.ashx/GetDataStructure/QNA - Nov 23, 2017 3:08:16 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery - SEVERE: HTTP error code 429 doesn't have a defined SDMX meaning. - Nov 23, 2017 3:08:16 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery - SEVERE: HTTP error code 429 doesn't have a defined SDMX meaning. + INFO: The sdmx call returned messages in the footer: + Message [code=400, severity=Error, url=null, text=[Error caused by the caller due to incorrect or semantically invalid arguments]] + Nov 27, 2017 8:40:27 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient getData + INFO: The sdmx call returned messages in the footer: + Message [code=400, severity=Error, url=null, text=[Error caused by the caller due to incorrect or semantically invalid arguments]] When sourcing ‘Guide.R’: - Error: QNA.CAN.B1_GE.CARSA.Q error: it.bancaditalia.oss.sdmx.exceptions.SdmxInvalidParameterException: HTTP error code 429 doesn't have a defined SDMX meaning. + Error: ei_nama_q.Q.MIO-EUR.NSA.CP.NA-P72.IT error: it.bancaditalia.oss.sdmx.exceptions.SdmxXmlContentException: The query: ei_nama_q.Q.MIO-EUR.NSA.CP.NA-P72.IT did not match any time series on the provider. Execution halted when running code in ‘GuideAppendix.Stex’ ... @@ -16509,18 +16714,18 @@ Version: 2016.8-1 ``` ... INFO: Contacting web service with query: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/dataflow/ESTAT/ei_nama_q/latest - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery INFO: Contacting web service with query: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/datastructure/ESTAT/DSD_ei_nama_q/1.0 - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery INFO: Contacting web service with query: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/datastructure/ESTAT/DSD_ei_nama_q/1.0 - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery INFO: Contacting web service with query: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/ESTAT,ei_nama_q,1.0/Q.MIO-EUR.NSA.CP.NA-P72.IT - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient runQuery INFO: Contacting web service with query: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/ESTAT,ei_nama_q,1.0/Q.MIO-EUR.NSA.CP.NA-P72.IT - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient getData + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient getData INFO: The sdmx call returned messages in the footer: Message [code=400, severity=Error, url=null, text=[Error caused by the caller due to incorrect or semantically invalid arguments]] - Nov 23, 2017 3:08:24 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient getData + Nov 27, 2017 8:40:40 PM it.bancaditalia.oss.sdmx.client.RestSdmxClient getData INFO: The sdmx call returned messages in the footer: Message [code=400, severity=Error, url=null, text=[Error caused by the caller due to incorrect or semantically invalid arguments]] @@ -16719,7 +16924,7 @@ Version: 2.1.3 Warning: no DISPLAY variable so Tk is not available R session is headless; GTK+ not initialized. -(R:49664): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() +(R:106806): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() Error : .onLoad failed in loadNamespace() for 'cairoDevice', details: call: fun(libname, pkgname) error: GDK display not found - please make sure X11 is running @@ -16738,7 +16943,7 @@ ERROR: lazy loading failed for package ‘vmsbase’ Warning: no DISPLAY variable so Tk is not available R session is headless; GTK+ not initialized. -(R:49651): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() +(R:106792): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() Error : .onLoad failed in loadNamespace() for 'cairoDevice', details: call: fun(libname, pkgname) error: GDK display not found - please make sure X11 is running diff --git a/tests/testthat/test-data-type.R b/tests/testthat/test-data-type.R index 72dabbba4..0da5d73a9 100644 --- a/tests/testthat/test-data-type.R +++ b/tests/testthat/test-data-type.R @@ -5,7 +5,6 @@ test_that("dbDataType works on a data frame", { types <- dbDataType(MockDriver(), df) expect_equal(types, c(x = "INT", y = "DOUBLE")) - }) test_that("dbDataType works on AsIs", { diff --git a/tests/testthat/test-interpolate.R b/tests/testthat/test-interpolate.R index 8f5e3b2e4..08fae8d81 100644 --- a/tests/testthat/test-interpolate.R +++ b/tests/testthat/test-interpolate.R @@ -24,15 +24,36 @@ test_that("parameter names matched", { test_that("parameters in strings are ignored", { expect_equal( - sqlInterpolate(ANSI(), "'?a'"), - SQL("'?a'") + sqlInterpolate(ANSI(), "'? ?fuu'"), + SQL("'? ?fuu'") + ) +}) + +test_that("named parameters check matches", { + expect_error( + sqlInterpolate(ANSI(), "?a ?b", a = 1, d = 2), + "Supplied values don't match named vars to interpolate" + ) +}) + +test_that("positional parameters work", { + expect_equal( + sqlInterpolate(ANSI(), "a ? c ? d ", 1, 2), + SQL("a 1 c 2 d ") + ) +}) + +test_that("positional parameters can't have names", { + expect_error( + sqlInterpolate(ANSI(), "? ?", a = 1, 2), + "Positional variables don't take named arguments" ) }) test_that("parameters in comments are ignored", { expect_equal( - sqlInterpolate(ANSI(), "-- ?a"), - SQL("-- ?a") + sqlInterpolate(ANSI(), "-- ? ?fuu"), + SQL("-- ? ?fuu") ) }) @@ -45,8 +66,8 @@ test_that("strings are quoted", { test_that("some more complex case works as well", { expect_equal( - sqlInterpolate(ANSI(), "asdf ?faa /*fdsa'zsc' */ qwer 'wer' \"bnmvbn\" -- Zc \n '234' ?fuu -- ?bar", faa = "abc", fuu=42L), - SQL("asdf 'abc' /*fdsa'zsc' */ qwer 'wer' \"bnmvbn\" -- Zc \n '234' 42 -- ?bar") + sqlInterpolate(ANSI(), "asdf ?faa /*fdsa'zsc' */ qwer 'wer' \"bnmvbn\" -- Zc \n '234' ?fuu -- ? ?bar", faa = "abc", fuu=42L), + SQL("asdf 'abc' /*fdsa'zsc' */ qwer 'wer' \"bnmvbn\" -- Zc \n '234' 42 -- ? ?bar") ) }) @@ -64,7 +85,7 @@ test_that("corner cases work", { ) expect_error( sqlInterpolate(ANSI(), "?"), - "Length 0 variable" + "Supplied values don't match positional vars to interpolate" ) expect_equal( sqlInterpolate(ANSI(), "?a", a = 1), diff --git a/tests/testthat/test-quote.R b/tests/testthat/test-quote.R index 9df954d89..ca8b75b8b 100644 --- a/tests/testthat/test-quote.R +++ b/tests/testthat/test-quote.R @@ -8,3 +8,8 @@ test_that("identifier", { expect_equal(dbQuoteIdentifier(ANSI(), SQL('"a"')), SQL('"a"')) expect_equal(dbQuoteIdentifier(ANSI(), SQL('"a b"')), SQL('"a b"')) }) + +test_that("SQL names", { + expect_null(names(SQL(letters))) + expect_equal(names(SQL(letters, names = LETTERS)), LETTERS) +}) diff --git a/tic.R b/tic.R index 47400b262..0712228ba 100644 --- a/tic.R +++ b/tic.R @@ -6,8 +6,8 @@ get_stage("deploy") %>% add_step(step_install_ssh_keys()) %>% add_step(step_test_ssh()) -if (ci()$get_branch() == "production" && Sys.getenv("BUILD_PKGDOWN") != "") { +if (ci()$get_branch() == "master" && Sys.getenv("BUILD_PKGDOWN") != "") { get_stage("deploy") %>% add_step(step_build_pkgdown()) %>% - add_step(step_push_deploy(path = "docs", branch = "gh-pages")) + add_step(step_push_deploy()) }