test_roundtrip: Test round tripping a simple table

Description Usage Arguments Details Examples

View source: R/DataTypes.R

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

1
2
3
4
5
6
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)

odbc documentation built on Dec. 11, 2021, 9:31 a.m.