Skip to content

Commit

Permalink
use utf8mb4 (and set in one place only), closes #7, closes #8
Browse files Browse the repository at this point in the history
- The connection now uses the "utf8mb4" charset by default (#7).
  • Loading branch information
krlmlr committed Sep 13, 2017
1 parent aa56ab3 commit a16ce45
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ notifications:
on_failure: change

before_script:
- travis_retry mysql -e "CREATE DATABASE IF NOT EXISTS test; ALTER DATABASE test CHARACTER SET 'utf8'; FLUSH PRIVILEGES;" -uroot
- travis_retry mysql -e "CREATE DATABASE IF NOT EXISTS test; ALTER DATABASE test CHARACTER SET 'utf8mb4'; FLUSH PRIVILEGES;" -uroot
- travis_retry mysql -e "CREATE USER '"${USER}"'@'localhost'; FLUSH PRIVILEGES;" -uroot || true
- travis_retry mysql -e "GRANT ALL PRIVILEGES ON test.* TO '"${USER}"'@'localhost'; FLUSH PRIVILEGES;" -uroot

Expand Down
1 change: 0 additions & 1 deletion R/connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ setMethod("dbConnect", "MariaDBDriver",
)

dbExecute(con, "SET time_zone = '+00:00'")
dbExecute(con, "SET CHARACTER SET 'utf8'")
con
}
)
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install:
[System.IO.File]::WriteAllText($iniPath, $newText)
Restart-Service MySQL57
- cmd: |
"%PROGRAMFILES%\MySql\MySQL Server 5.7\bin\mysql" --user=%MYSQL_USER% -e "CREATE DATABASE IF NOT EXISTS test; ALTER DATABASE test CHARACTER SET 'utf8'; FLUSH PRIVILEGES;"
"%PROGRAMFILES%\MySql\MySQL Server 5.7\bin\mysql" --user=%MYSQL_USER% -e "CREATE DATABASE IF NOT EXISTS test; ALTER DATABASE test CHARACTER SET 'utf8mb4'; FLUSH PRIVILEGES;"
"%PROGRAMFILES%\MySql\MySQL Server 5.7\bin\mysql" --user=%MYSQL_USER% -e "CREATE USER IF NOT EXISTS 'appveyor'@'localhost' IDENTIFIED BY '%MYSQL_PWD%'; FLUSH PRIVILEGES;"
"%PROGRAMFILES%\MySql\MySQL Server 5.7\bin\mysql" --user=%MYSQL_USER% -e "GRANT ALL PRIVILEGES ON test.* TO 'appveyor'@'localhost'; FLUSH PRIVILEGES;"
Expand Down
2 changes: 1 addition & 1 deletion src/MariaConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void MariaConnection::connect(const Nullable<std::string>& host, const Nullable<
// Enable LOCAL INFILE for fast data ingest
mysql_options(this->pConn_, MYSQL_OPT_LOCAL_INFILE, 0);
// Default to UTF-8
mysql_options(this->pConn_, MYSQL_SET_CHARSET_NAME, "UTF8");
mysql_options(this->pConn_, MYSQL_SET_CHARSET_NAME, "utf8mb4");
if (!groups.isNull())
mysql_options(this->pConn_, MYSQL_READ_DEFAULT_GROUP,
as<std::string>(groups).c_str());
Expand Down

0 comments on commit a16ce45

Please sign in to comment.