RMariaDB v1.0.6

0

Monthly downloads

0th

Percentile

Database Interface and 'MariaDB' Driver

Implements a 'DBI'-compliant interface to 'MariaDB' (<https://mariadb.org/>) and 'MySQL' (<https://www.mysql.com/>) databases.

Readme

RMariaDB

Build Status AppVeyor Build Status Coverage Status CRAN_Status_Badge CRAN RStudio mirror downloads

RMariaDB is a database interface and MariaDB driver for R. This version is aimed at full compliance with the DBI specification, as a replacement for the old RMySQL package.

Hello World

library(DBI)
# Connect to my-db as defined in ~/.my.cnf
con <- dbConnect(RMariaDB::MariaDB(), group = "my-db")

dbListTables(con)
dbWriteTable(con, "mtcars", mtcars)
dbListTables(con)

dbListFields(con, "mtcars")
dbReadTable(con, "mtcars")

# You can fetch all results:
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)

# Or a chunk at a time
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
while(!dbHasCompleted(res)){
  chunk <- dbFetch(res, n = 5)
  print(nrow(chunk))
}
# Clear the result
dbClearResult(res)

# Disconnect from the database
dbDisconnect(con)

Installation

Binary packages for OS X or Windows can be installed directly from CRAN:

install.packages("RMariaDB")

The development version from github:

# install.packages("devtools")
devtools::install_github("r-dbi/DBI")
devtools::install_github("r-dbi/RMariaDB")

Installation from source on Linux or OS X currently requires Oracle's libmysqlclient or the more modern MariaDB Connector/C. The latter works best in version 2.3.4/3.0.3 or later, with older versions character and blob columns do not work reliably.

MySQL client library

On recent Debian or Ubuntu install libmysqlclient-dev.

sudo apt-get install -y libmysqlclient-dev

On Fedora, CentOS or RHEL we need mysql-devel:

sudo yum install mysql-devel

Follow instructions to enable the MySQL yum repository if the above command attempts to install MariaDB files.

On OS X use mysql-connector-c from Homebrew:

brew install mysql-connector-c

Connector/C

On recent Debian or Ubuntu install libmariadb-client-lgpl-dev. In Ubuntu 14.04 this was called libmariadbclient-dev.

sudo apt-get install -y libmariadb-client-lgpl-dev

On Fedora, CentOS or RHEL we need mariadb-devel:

sudo yum install mariadb-devel
`

On OS X use mariadb-connector-c from Homebrew:

brew install mariadb-connector-c

MariaDB configuration file

Instead of specifying a username and password in calls to dbConnect(), it's better to set up a MariaDB configuration file that names the databases that you connect to most commonly. This file should live in ~/.my.cnf and look like:

[database_name]
option1=value1
option2=value2

If you want to run the examples, you'll need to set the proper options in the [rs-dbi] group of any MariaDB option file, such as /etc/my.cnf or the .my.cnf file in your home directory. For a default single user install of MariaDB, the following code should work:

[rs-dbi]
database=test
user=root
password=

Acknowledgements

Many thanks to Christoph M. Friedrich, John Heuer, Kurt Hornik, Torsten Hothorn, Saikat Debroy, Matthew Kelly, Brian D. Ripley, Mikhail Kondrin, Jake Luciani, Jens Nieschulze, Deepayan Sarkar, Louis Springer, Duncan Temple Lang, Luis Torgo, Arend P. van der Veen, Felix Weninger, J. T. Lindgren, Crespin Miller, and Michal Okonlewski, Seth Falcon and Paul Gilbert for comments, suggestions, bug reports, and patches to the original RMySQL package, and to all contributors (of code and discussions) to this package.

Functions in RMariaDB

Name Description
RMariaDB-package RMariaDB: Database Interface and 'MariaDB' Driver
dbConnect,MariaDBDriver-method Connect/disconnect to a MariaDB DBMS
dbDataType,MariaDBConnection-method Determine the SQL Data Type of an S object
mariadb-tables Read and write MariaDB tables.
MariaDBConnection-class Class MariaDBConnection.
MariaDBResult-class Class MariaDBResult
MariaDBDriver-class Class MariaDBDriver with constructor MariaDB.
Client-flags Client flags
mariadb-quoting Quote MariaDB strings and identifiers.
result-meta Database interface meta-data.
reexports Objects exported from other packages
transactions DBMS Transaction Management
dbFetch,MariaDBResult-method Execute a SQL statement on a database connection.
mariadbHasDefault Check if default database is available.
mariadbClientLibraryVersions MariaDB Check for Compiled Versus Loaded Client Library Versions
No Results!

Last month downloads

Details

License GPL-2
URL https://github.com/r-dbi/RMariaDB, https://downloads.mariadb.org/connector-c/
BugReports https://github.com/r-dbi/RMariaDB/issues
LinkingTo BH, plogr, Rcpp
Encoding UTF-8
NeedsCompilation yes
RoxygenNote 6.0.1.9000
SystemRequirements libmariadb-client-lgpl-dev or libmysqlclient-dev (deb), mariadb-connector-c-devel or mariadb-devel (rpm), mariadb-connector-c or mysql-connector-c (brew)
Collate 'MariaDBConnection.R' 'MariaDBDriver.R' 'MariaDBResult.R' 'RMariaDB.R' 'RcppExports.R' 'coerce.R' 'connect.R' 'default.R' 'export.R' 'names.R' 'query.R' 'quote.R' 'rownames.R' 'table.R' 'transaction.R' 'utils.R' 'zzz.R'
Packaged 2018-05-06 17:03:59 UTC; kirill
Repository CRAN
Date/Publication 2018-05-06 20:21:29 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/RMariaDB)](http://www.rdocumentation.org/packages/RMariaDB)