Giter Site home page Giter Site logo

matiasbatero / mariadbpp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from viaduck/mariadbpp

0.0 1.0 0.0 352 KB

C++ client library for MariaDB. Continuation of https://code.launchpad.net/mariadb++

License: Boost Software License 1.0

CMake 1.99% C++ 98.01%

mariadbpp's Introduction

mariadb++

C++ client library for MariaDB. Uses the C connector.

Features

  • Prepared statements
  • Transactions and savepoints
  • Concurrency allows connection sharing between threads
  • Data type support: blob, decimal, datetime, time, timespan, etc.
  • Exceptions

Setup

  1. Initialize Git submodules: git submodule update --init
  2. Install mariadbclient or mysqlclient libraries.
  3. Link against the mariadbclientpp CMake target in your project.

Building tests

Create database and user according to the information in test/CMakeLists.txt or adjust these values.

Usage example

// set up the account
account_ref acc = account::create(...);

// create connection
connection_ref con = connection::create(acc);

// insert, update, select on the connection
u64 id = con->insert("INSERT INTO table VALUES (1, 2, 3)");
u64 affected = con->execute("UPDATE table SET a=1");
result_set_ref result = con->query("SELECT * FROM table");

// create statement
statement_ref stmt = con->create_statement(...);

// insert, update, select on the statement
u64 id = stmt->insert();
u64 affected = stmt->execute();
result_set_ref result = stmt->query();

// reading from a result set
while (result->next()) {
    int a = result->get_unsigned32(0);
    int b = result->get_unsigned32("b");
}

// insert using prepared statement
statement_ref stmt = con->create_statement("INSERT INTO table (?, ?, ?)");
stmt->set_unsigned32(0, 13);
stmt->set_unsigned32(1, 37);
stmt->set_unsigned32(2, 42);
stmt->insert();

More usage examples can be found in the test/ directory.

License

This library is subject to the Boost Software License. See accompanying LICENSE file.

mariadbpp's People

Contributors

roussosalex avatar kleest avatar nwerensteijn avatar labidus avatar sponk avatar richardhozak avatar barbossa404 avatar fboranek avatar bu11etmagnet avatar dedmen avatar nunojpg avatar omeyer-dc avatar

Watchers

James Cloos 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.