diff --git a/src/MariaTypes.cpp b/src/MariaTypes.cpp index 4f560edb..bb396d58 100644 --- a/src/MariaTypes.cpp +++ b/src/MariaTypes.cpp @@ -5,6 +5,7 @@ bool all_raw(SEXP x); MariaFieldType variable_type_from_field_type(enum_field_types type, bool binary, bool length1) { + switch (type) { case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: @@ -53,7 +54,8 @@ MariaFieldType variable_type_from_field_type(enum_field_types type, bool binary, case MYSQL_TYPE_NULL: return MY_INT32; default: - cpp11::stop("Unimplemented MAX_NO_FIELD_TYPES: %d", type); + cpp11::warning("unrecognized field type %i imported as character", type); + return MY_STR; } } diff --git a/tests/testthat/test-dbWriteTable.R b/tests/testthat/test-dbWriteTable.R index 2528c5c0..f3b6a5cf 100644 --- a/tests/testthat/test-dbWriteTable.R +++ b/tests/testthat/test-dbWriteTable.R @@ -85,10 +85,11 @@ test_that("writing and reading JSON (#127)", { x <- data.frame(col1 = "[1,2,3]", stringsAsFactors = FALSE) dbWriteTable(con, "t1", x, field.types = c(col1 = "json"), overwrite = TRUE, temporary = TRUE) - dbReadTable(con, "t1") - expect_equal( - gsub(" ", "", dbReadTable(con, "t1")$col1), - x$col1 - ) + suppressWarnings(d <- dbReadTable(con, "t1")) + + # MySQL 8 returns "[1, 2, 3]", while MariaDB returns "[1,2,3]" + d$col1 <- gsub('\\s', '', d$col1) + + expect_equal(d, x) })