All Projects → liancheng → Amy

liancheng / Amy

Licence: mit
A C++11 compliant header-only asynchronous MySQL client library based on Asio. Enables you to work with MySQL in both asynchronous and blocking ways.

Labels

Projects that are alternatives of or similar to Amy

Go Mysqlstack
MySQL protocol library implementing in Go (golang)
Stars: ✭ 145 (-4.61%)
Mutual labels:  mysql
Querybuilder
SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
Stars: ✭ 2,111 (+1288.82%)
Mutual labels:  mysql
Travianz Legacy
Join our Discord Server: https://discordapp.com/invite/9fbJKP9 | New repo: https://github.com/iopietro/Travianz
Stars: ✭ 150 (-1.32%)
Mutual labels:  mysql
Polluter
The easiest solution to seed database with Go
Stars: ✭ 146 (-3.95%)
Mutual labels:  mysql
Meetingfilm
基于微服务架构的在线电影购票平台
Stars: ✭ 149 (-1.97%)
Mutual labels:  mysql
Xupdateservice
Use Spring Boot easy build, Gradle build, and provide update service for XUpdate.(使用Spring Boot简易搭建,Gradle构建,为XUpdate提供更新服务)
Stars: ✭ 149 (-1.97%)
Mutual labels:  mysql
Boost Asio Study
Examples and toturials for C++ Boost Asio library.
Stars: ✭ 144 (-5.26%)
Mutual labels:  asio
Serendipity
A PHP blog software
Stars: ✭ 151 (-0.66%)
Mutual labels:  mysql
Algernon
🎩 Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support
Stars: ✭ 1,880 (+1136.84%)
Mutual labels:  mysql
Csgowinbig
Open-source Counter-Strike: Global Offensive jackpot betting website.
Stars: ✭ 149 (-1.97%)
Mutual labels:  mysql
Canal Elasticsearch
基于阿里巴的canal向elasticsearch中同步数据mysql数据的小工具
Stars: ✭ 147 (-3.29%)
Mutual labels:  mysql
Mysql Swift
A type safe MySQL client for Swift
Stars: ✭ 148 (-2.63%)
Mutual labels:  mysql
Carbon Forum
A high performance open-source forum software written in PHP. Discussions Tags based with Quora/StackOverflow style.
Stars: ✭ 1,814 (+1093.42%)
Mutual labels:  mysql
Lapidus
Stream your PostgreSQL, MySQL or MongoDB databases anywhere, fast.
Stars: ✭ 145 (-4.61%)
Mutual labels:  mysql
Grimoire
Database access layer for golang
Stars: ✭ 151 (-0.66%)
Mutual labels:  mysql
Dapper.fsharp
Lightweight F# extension for StackOverflow Dapper with support for MSSQL, MySQL and PostgreSQL
Stars: ✭ 145 (-4.61%)
Mutual labels:  mysql
Datamining And Social Sentiment Analysis Based On Weibo
基于微博的数据挖掘与社交舆情分析
Stars: ✭ 149 (-1.97%)
Mutual labels:  asio
Zhihuquestionsspider
😊😊😊 知乎问题爬虫
Stars: ✭ 152 (+0%)
Mutual labels:  mysql
Slimdump
A tool for creating configurable dumps of large MySQL-databases.
Stars: ✭ 151 (-0.66%)
Mutual labels:  mysql
Mysqlbackup.net
A tool to backup and restore MySQL database in C#/VB.NET/ASP.NET.
Stars: ✭ 150 (-1.32%)
Mutual labels:  mysql

Build Status

Overview

Amy is a C++11 compliant header-only Asynchronous MySQL client library based on Asio. It enables you to work with MySQL in both asynchronous and blocking ways. Amy had been tested using Clang++ 3.8 under Ubuntu 16.04, FreeBSD 11.0, and Mac OS X 10.10. It should also works under other similar UNIX-like systems with minimum efforts.

Getting Started

Dependencies

Using vanilla Asio

By default, Amy compiles against vanilla Asio. You may claim this explicitly by defining macro USE_BOOST_ASIO to 0.

Using Boost.Asio

Amy also allows you to compile against Boost.Asio by defineing USE_BOOST_ASIO to 1.

Using MariaDB Non-blocking API

The main difference of amy::mariadb_connector and amy::mysql_connector is that: amy::mysql_connector using an internal thread running mysql blocking API while amy::mariadb_connector using the original mariadb non-blocking API without internal thread.

Installing dependencies

You can probably obtain all the dependencies pretty easily using the package manager on your favorite operating system. For example:

  • Ubuntu 16.04:

    $ sudo apt-get install libboost-all-dev libmysqlclient-dev libasio-dev
    
  • FreeBSD 11.0:

    $ sudo pkg instal boost-all mysql-connector-c asio
    
  • Mac OS X 10.10+:

    $ brew install boost mysql-connector-c asio
    

Optionally, to build examples and tests, you may also want to install SCons:

$ sudo pip install scons

and LCov:

  • Ubuntu 16.04:

    $ sudo apt-get install lcov
    
  • FreeBSD 11.0:

    $ sudo pkg instal lcov
    
  • Mac OS X 10.10+:

    $ brew install lcov
    

Compile your program with Amy

Get Amy:

$ git clone https://github.com/liancheng/amy.git amy
$ cd amy
$ export AMY_HOME=$(pwd)

Add $AMY_HOME/include to your header search path and make sure to link your program against the following libraries:

  • libmysqlclient
  • pthread
  • libboost_system (only required when using Boost.Asio)

Most of the time, the following compiler options should be sufficient:

  • Building against vanilla Asio

    clang++ -DUSE_BOOST_ASIO=0  \
            -I$AMY_HOME/include \
            -L/usr/lib          \
            -L/usr/local/lib    \
            -lmysqlclient       \
            -lpthread           \
            ...
    
  • Building against Boost.Asio

    clang++ -DUSE_BOOST_ASIO=1  \
            -I$AMY_HOME/include \
            -L/usr/lib          \
            -L/usr/local/lib    \
            -lmysqlclient       \
            -lpthread           \
            -lboost_system      \
            ...
    

You may need an extra library path /usr/local/lib/mysql under FreeBSD since that's where the pkg package manager installs the MySQL client library:

Examples

Please check the following examples for a taste of Amy:

To build the examples, run:

$ cd $AMY_ROOT
$ scons USE_BOOST_ASIO=0 example # Using vanilla Asio
$ scons USE_BOOST_ASIO=1 example # Using Boost.Asio

Built executables can be found under $AMY_ROOT/build/example. Run each example with --help to find out how to use them.

Run the example programs with -h command line option to find out how to use them.

Tests

Note that an extra dependency, Boost.Test, is used to build and write test cases for Amy. Usually, it should have already been installed together with Boost.

Some (integration) test cases need to establish actual connections to an existing MySQL server. To make sure these tests succeed, you need to start a MySQL server listening on localhost:3306 and setup the following testing database and user account:

CREATE DATABASE test_amy;
CREATE USER 'amy'@'localhost' IDENTIFIED BY 'amy';
GRANT ALL PRIVILEGES ON test_amy.* TO 'amy'@'localhost';
FLUSH PRIVILEGES;

To test Amy, run:

$ cd $AMY_ROOT
$ scons USE_BOOST_ASIO=0 test # Using vanilla Asio
$ scons USE_BOOST_ASIO=1 test # Using Boost.Asio
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].