tests/testthat/test-dbQuoteString.R

context("dbQuoteString")

test_that("quoting works", {
  if (!mysqlHasDefault()) skip("Test database not available")

  con <- dbConnect(MySQL(), dbname = "test")
  on.exit(dbDisconnect(con))

  expect_equal(dbQuoteString(con, "\\'"), SQL("'\\\\\\''"))
  expect_equal(dbQuoteString(con, "'"), SQL("'\\''"))
})

Try the RMySQL package in your browser

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

RMySQL documentation built on Sept. 26, 2023, 5:11 p.m.