Swiftpack.co - PerfectlySoft/Perfect-MariaDB as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by PerfectlySoft.
PerfectlySoft/Perfect-MariaDB v2.0.2
A stand-alone Swift wrapper around the MariaDB client library, enabling access to MariaDB servers. http://www.perfect.org
⭐️ 9
🕓 3 years ago
linux macOS iOS
.package(url: "https://github.com/PerfectlySoft/Perfect-MariaDB.git", from: "v2.0.2")

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

Linux Build Notes

Tests performed on Ubuntu 18.04. Prior to building this library, please ensure you install the required MariaDB library:

sudo apt-get install pkg-config libmariadb-dev  

On older distros (like 16.04), you may need to install libmariadb-client-lgpl-dev instead of libmariadb-dev. On older versions, you will also need to create a pkg-config file. In such cases, create /usr/lib/pkgconfig/libmariadb.pc and make it look something like this:

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

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

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

pkg-config libmariadb --cflags --libs

Building

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

.package(url:"https://github.com/PerfectlySoft/Perfect-MariaDB.git", from: "3.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.

GitHub

link
Stars: 9
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Adding ping()
6 years ago

MySQL connection will go away when idle timeout. The ping() function can confirm the connectivity and also reconnect if need. https://dev.mysql.com/doc/refman/5.7/en/mysql-ping.html Thanks @JoeCharlier.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics