Giter Site home page Giter Site logo

volka / sqlpp11-connector-mysql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rbock/sqlpp11-connector-mysql

0.0 2.0 0.0 211 KB

A C++ wrapper for mysql meant to be used in combination with sqlpp11.

License: BSD 2-Clause "Simplified" License

CMake 5.04% C++ 91.68% C 1.24% Python 2.04%

sqlpp11-connector-mysql's Introduction

sqlpp11-connector-mysql

A C++ wrapper for mysql meant to be used in combination with sqlpp11 (https://github.com/rbock/sqlpp11).

Status:

Branch / Compiler clang-3.4, gcc-4.9, Xcode-7 MSVC 2015
master Build Status Build status
develop Build Status Build status

Remark regarding MSVC builds on appveyor: As of now, I can neither to link against the provided mysql-connector-c library nor build it from scratch. I am currently compiling the mariadb client and link against that one. Build is fine, tests fail. Help is appreciated.

License Hint:

The code is distributed under BSD License, but if you build the library, then the binary will be linked dynamically to mysqlclient, which is published under GPL or commercial license as of this writing. The resulting binary might therefore fall under GPL. To avoid this, an option to link against the equivalent MariaDB connector (under LGPL) is provided: see the build instructions below.

Sample Code:

See for instance test/SampleTest.cpp

#include "TabSample.h"
#include <sqlpp11/sqlpp11.h>
#include <sqlpp11/mysql/mysql.h>

namespace mysql = sqlpp::mysql;
int main()
{
	auto config = std::make_shared<mysql::connection_config>();
 	config->user = "root";
 	config->database = "sqlpp_mysql";
	config->debug = true;
	mysql::connection db(config);

	TabSample tab;
	for(const auto& row : db.run(sqlpp::select(all_of(tab)).from(tab).unconditionally()))
	{
		std::cerr << "row.alpha: " << row.alpha << ", row.beta: " << row.beta << ", row.gamma: " << row.gamma <<  std::endl;
	};
  return 0;
}

Requirements:

Compiler: sqlpp11-connector-mysql makes use of C++11 and requires a recent compiler and STL. The following compilers are known to compile the test programs:

  • clang-3.4 on Ubuntu-12.4 (requires thread_local)
  • g++-4.8 on Ubuntu-12.4
  • MSVC 2015 Update 2 on appveyor

C++ SQL Layer: sqlpp11-connector-mysql is meant to be used with sqlpp11 (https://github.com/rbock/sqlpp11).

mysqlclient: libmysqlclient version 5.5 and up (or the respective mariadb version)

Build instructions:

Download and unpack the latest release or clone the repository. Inside the directory run the following commands:

mkdir build
cd build
cmake ..
make
make install

In order to customize the build process, you can add the following options to the cmake command above:

  • CMAKE_INSTALL_PREFIX: path to the install folder
  • DATE_INCLUDE_DIR: path to the folder containing date.h
  • SQLPP11_INCLUDE_DIR: path to the folder containing sqlpp11.h
  • USE_MARIADB: force the use of the MariaDB connector instead of the GPL'd MySQL connector

For example:

cmake -DCMAKE_INSTALL_PREFIX=/opt/sqlpp11_mariadb -DUSE_MARIADB=1 ..

sqlpp11-connector-mysql's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.