tests/testthat/test-sql-df.R

test_that("NAs turn in NULLs", {
  df <- data.frame(
    x = c(1, NA),
    y = c("a", NA),
    stringsAsFactors = FALSE
  )
  sql_df <- sqlData(ANSI(), df)

  expect_equal(sql_df$x, SQL(c("1", "NULL")))
  expect_equal(sql_df$y, SQL(c("'a'", "NULL")))
})

Try the DBI package in your browser

Any scripts or data that you put into this service are public.

DBI documentation built on June 22, 2024, 9:41 a.m.