R: Test round tripping a simple table

test_roundtrip {odbc} | R Documentation

## Test round tripping a simple table

### Description

This tests all the supported data types, including missing values. It first writes them to the database, then reads them back and verifies the data is identical to the original.

### Usage

    test_roundtrip(
      con = DBItest:::connect(DBItest:::get_default_context()),
      columns = "",
      invert = TRUE,
      force_sorted = FALSE
    )

### Arguments

`con` | An established DBI connection.
`columns` | Table columns to exclude (default) or include, dependent on the value of `invert`. One of `datetime`, `date`, `binary`, `integer`, `double`, `character`, `logical`.
`invert` | If `TRUE`, change the definition of columns to be exclusive, rather than inclusive.
`force_sorted` | If `TRUE`, a sorted `id` column is added to the sent data, and the received data is sorted by this column before doing the comparison. This is necessary for some databases that do not preserve row order.

### Details

This function is not exported and should only be used during tests and as a sanity check when writing new `odbcDataType()` methods.

### Examples

    ## Not run:
    test_roundtrip(con)

    # exclude a few columns
    test_roundtrip(con, c("integer", "double"))

    # Only test a specific column
    test_roundtrip(con, "integer", invert = FALSE)

    ## End(Not run)

[Package odbc version 1.3.2 Index]