Skip to content
A stand-alone Swift wrapper around the MariaDB client library, enabling access to MariaDB servers. http://www.perfect.org
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Perfect - MariaDB Connector 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 5.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

This project provides a Swift wrapper around the MariaDB client library, enabling access to MariaDB database servers.

This package builds with Swift Package Manager and is part of the Perfect project. It was written to be stand-alone and so does not require PerfectLib or any other components.

Ensure you have installed and activated the latest Swift tool chain.

OS X Build Notes

To install MariaDB connector:

 brew install mariadb-connector-c

You will have to deal with pkg-config file, such as: /usr/local/lib/pkgconfig/mariadb.pc, similar with below:

libdir=/usr/local/lib/mariadb
includedir=/usr/local/include/mariadb

Name: mariadb
Description: MariaDB Connector/C
Version: 5.5.1
Requires:
Libs: -L${libdir} -lmariadb  -ldl -lm -lpthread
Cflags: -I${includedir}
Libs_r: -L${libdir} -lmariadb -ldl -lm -lpthread

Then please also edit your ~/.bash_profile with the following line:

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"

once done, reload this profile as

source ~/.bash_profile

To test if pkg-config is working, try command:

$ pkg-config mariadb --cflags --libs

Linux Build Notes

Tests performed on Ubuntu 16.04. Prior to build this library, please ensure:

sudo apt-get install pkg-config libmariadb2 libmariadb-client-lgpl-dev  

Please also make sure the pkg-config file /usr/lib/pkgconfig/mariadb.pc specified for MariaDB should be MANUALLY added and corrected before building, possibly looks like this:

libdir=/usr/lib/x86_64-linux-gnu
includedir=/usr/include/mariadb

Name: mariadb
Description: MariaDB Connector/C
Version: 5.5.0
Requires:
Libs: -L${libdir} -lmariadb  -ldl -lm -lpthread
Cflags: -I${includedir}
Libs_r: -L${libdir} -lmariadb -ldl -lm -lpthread

To test if pkg-config is working, try command:

$ pkg-config mariadb --cflags --libs

Building

Add this project as a dependency in your Package.swift file.

.package(url:"https://github.com/PerfectlySoft/Perfect-MariaDB.git", from: "4.0.0")
...
dependencies: ["MariaDB"]),

Import required libraries:

import MariaDB
import PerfectCRUD

Perfect-MariaDB supports the Perfect-CRUD protocol. Please check Perfect-CRUD for more information.

Further Information

For more information on the Perfect project, please visit perfect.org.

You can’t perform that action at this time.