Skip to content

RMariaDB 1.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 03 Dec 05:34
6e86962

Breaking changes

  • INT UNSIGNED columns are returned as numeric, exact over their full range,
    instead of as integer, which turned values above 2147483647 into negative values or NA (#639).
    Use as.integer() on the column where code relies on an integer and all values fit one.
    BIGINT UNSIGNED and the other integer types are returned as before.

    dbExecute(con, "CREATE TEMPORARY TABLE t (x INT UNSIGNED)")
    dbExecute(con, "INSERT INTO t VALUES (4294967295)")
    dbGetQuery(con, "SELECT x FROM t")$x
    #> [1] 4294967295
  • DATE, DATETIME and TIMESTAMP values with a zero year, month or day are returned as NA instead of as nonsensical dates (#598).

  • Writing time values that are infinite or out of range fails with an error that names the affected columns,
    instead of storing garbage (#623).
    Replace such values with NA before writing.

  • dbAppendTable(), dbBind(), dbWriteTable() and sqlData() fail on Inf and -Inf in numeric columns instead of writing NULL,
    also with load_data_local_infile = TRUE (#636).
    NaN and NA are still written as NULL.
    To keep the old behavior, replace infinite values with NA before writing:

    df$x[is.infinite(df$x)] <- NA
    dbWriteTable(con, "tbl", df)

Features

  • dbConnect() gains an ssl.mode argument that requires or relaxes TLS verification,
    modeled after the --ssl-mode option of the mysql command-line client (#650).
    It takes "disabled", "preferred", "required", "verify_ca" or "verify_identity".
    The default NULL keeps the behavior of the client library.
    ?dbConnect lists which client library supports which mode.
    The error for a certificate that fails verification points to ssl.ca and ssl.mode = "required",
    building on an earlier hint by @jeroen.

    con <- dbConnect(
      RMariaDB::MariaDB(),
      host = Sys.getenv("DB_HOST"),
      ssl.mode = "verify_identity",
      ssl.ca = "~/certs/server-ca.pem"
    )
  • dbGetQueryArrow(), dbReadTableArrow() and the other Arrow generics, as well as dbGetConnectArgs(), are reexported from DBI,
    so that DBI's default methods apply to RMariaDB's connections and results (#584).
    RMariaDB now requires DBI >= 1.2.3.

    con <- dbConnect(RMariaDB::MariaDB(), dbname = "test")
    stream <- dbGetQueryArrow(con, "SELECT 1 AS a, 'x' AS b")
    as.data.frame(stream)

Bug fixes

  • Bound times are rounded to the nearest microsecond (#610).

  • hms values of 256 hours or more are bound without wrapping around (#616).

  • Warnings are raised only after the C++ code is done with the result,
    so that a calling handler can no longer free the result or close the connection in use (#632).

  • The package compiles with the MySQL client library 26.x,
    detecting MariaDB Connector/C by its own macros instead of by version number (#628).

  • configure no longer adds a Homebrew OpenSSL path on macOS, which caused a warning on CRAN (@jeroen).

  • dbBegin(), dbCommit(), dbExecute(), dbExistsTable(), dbRollback() and dbSendQuery() on a disconnected connection
    fail with a clear error (#640).

  • dbBind() reads the result types after execution,
    so that placeholder columns such as SELECT ? AS x keep their values (#618).

  • dbBind() accepts parameters whose names are all empty (#607).

  • dbBind() leaves the result unbound after a failed rebind, instead of out of sync (#620).

  • dbCreateTable() gives character and factor columns without a non-NA value, such as those of zero-row data frames,
    the type TEXT instead of VARCHAR(1) (#588).

  • dbDisconnect() closes the connection before freeing its result,
    and the methods of a result whose connection is closed fail with a clear error instead of crashing (#624).

  • dbFetch() reports the server's message when a fetch fails with MariaDB Connector/C (#612).

  • dbFetch() stops with a clear error when R code it calls,
    such as an interrupt handler, closes its result or connection (#629).

  • dbHasCompleted() and dbGetRowCount() follow dbBind() of a query (#608).

Documentation

  • The README installs the development version with pak::pak() (#556),
    and replaces dead links to the client libraries (#561).

  • ?"Client-flags" explains CLIENT_IGNORE_SPACE for function names followed by a space (#649).

Chore

  • RMariaDB requires DBI 1.4.0 or later.