check_odbc_channel: Check if an object is an open ODBC-channel

View source: R/check_odbc_channel.R

check_odbc_channelR Documentation

Check if an object is an open ODBC-channel

Description

Check if an object is an open ODBC-channel.

Usage

check_odbc_channel(x, dbservice = NULL, dbinterface = "odbc")

assert_odbc_channel(
  x,
  dbservice = NULL,
  dbinterface = "odbc",
  .var.name = checkmate::vname(x),
  comment = NULL,
  add = NULL
)

Arguments

x

[any]
Object to check.

dbservice

[character(1)]
The database the channel should be connect to.

dbinterface

[character(1)]
The R-package that is used for interface towards the data base. Defaults to NULL.

.var.name

[character(1)]
Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.

comment

[character(1)]
Extra information to be appended to the standard error message in assertions.

add

[AssertCollection]
Collection to store assertions. See AssertCollection.

Details

The check uses RODBC:::odbcValidChannel to check if the argument is an open ODBC-channel. Be aware that this function is an internal RODBC-function and may change within that package without warning.

Value

Depending on the function prefix:
If the check is successful, the function assert_odbc_channel return x invisibly, whereas check_odbc_channel return TRUE.
If the check is not successful, assert_odbc_channel throws an error message and check_odbc_channel returns a string with the error message.

Author(s)

Petter Hopp Petter.Hopp@vetinst.no

Examples

## Not run: 
# login to PJS
journal_rapp <- login("PJS")

# error check:
check_odbc_channel(x = "journal_rapp", dbservice = "PJS")

## End(Not run)


NorwegianVeterinaryInstitute/NVIcheckmate documentation built on Dec. 14, 2024, 10:43 p.m.