Skip to content

Allow "special values" passed as n in dbFetch() #296

@nbenn

Description

@nbenn

As per DBI specification a backend may allow for "special values" to be passed as n in dbFetch():

n maximum number of records to retrieve per fetch. Use n = -1 or n = Inf to retrieve all pending records. Some implementations may recognize other special values.

Such a "special value" might for example be NA. Yet, there are tests that disallow this:

fetch_n_bad = function(con) {
#' If the `n` argument is not an atomic whole number
#' greater or equal to -1 or Inf, an error is raised,
query <- trivial_query()
res <- local_result(dbSendQuery(con, query))
expect_error(dbFetch(res, -2))
expect_error(dbFetch(res, 1.5))
expect_error(dbFetch(res, integer()))
expect_error(dbFetch(res, 1:3))
expect_error(dbFetch(res, NA_integer_))
},

Generally, such tests should probably be removed. If the specification is narrowed down a bit (to scalar values for examples), some tests may remain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions