-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from collinhundley/master
MariaDB Compatibility
- Loading branch information
Showing
2 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,40 @@ | ||
# Qutheory - CMySQL - (Not Tested) | ||
# CMySQL | ||
C module for MySQL | ||
|
||
## Install MySQL via Brew (OS X) | ||
follow link to download page http://dev.mysql.com/downloads/mysql/ | ||
## Building | ||
|
||
You may need to use the following command to build if you experience errors. | ||
**To build on macOS:** | ||
|
||
```sh | ||
swift build -Xswiftc -I -Xswiftc /usr/local/mysql/include/ -Xlinker -L -Xlinker /usr/local/mysql/lib/ | ||
swift build -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib | ||
``` | ||
|
||
## Install MySQL via APT-GET (Linux) | ||
- `-I` tells the compiler where to find the MySQL header file `mysql.h`. | ||
- `-L` tells the linker where to find MySQL library `libmysqlclient`. | ||
|
||
* Update your system (you may need ```sudo```): | ||
``` | ||
apt-get update | ||
apt-get upgrade | ||
``` | ||
**To build on Linux:** | ||
|
||
`swift build` should work normally. | ||
|
||
## MariaDB | ||
|
||
To use MariaDB instead of MySQL, you just need to change a couple of the compiler flags. | ||
|
||
* To install MySQL ... | ||
**macOS:** | ||
|
||
```sh | ||
swift build -Xlinker -L/usr/local/lib -Xswiftc -DMARIADB -Xswiftc -DNOJSON | ||
``` | ||
apt-get install mysql-server | ||
|
||
- `-DMARIADB` tells the compiler to link the MariaDB library instead of the MySQL library. | ||
- `-DNOJSON` tells the package to ignore the `JSON` type (not supported as of MariaDB 10.1.16). | ||
|
||
**Linux:** | ||
|
||
```sh | ||
swift build -Xswiftc -I/usr/include/mariadb -Xlinker -L/usr/lib/x86_64-linux-gnu -Xswiftc -DMARIADB -Xswiftc -DNOJSON | ||
``` | ||
|
||
- This simply changes the library/header paths and sets the same compatibility options shown above. | ||
- Note that on macOS the library is called `libmysqlclient`, while on Linux the library is called `libmariadb`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters