A library for MySQL that implements a simpler framework for MySQL Connector++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
marcelb 6129774980 Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
.vscode Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
lib Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
src Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
test Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
.gitignore Add protect if connection is not valid 9 months ago
LICENSE Separe sqlQA and mySQL lib, add namespace, commnets, license and readme file 9 months ago
README.md Implement typed execute, typed response, clear for unnecessary requests, delete incomplete SQL_QA type, etc. 1 month ago
dependency Add dependency 1 year ago

README.md

A library for MySQL that implements a simpler framework for MySQL Connector++

A small framework for basic MySQL database operations via MySQL/Connector++

Features

  • Object oriented
  • Active connection pool
  • Retries to connect
  • Native C++ containers: vector, tuple
  • Response object
  • Thread safe
  • Exceptions

Installation

First install dependency MySQL/Connector++

sudo apt install libmysqlcppconn-dev

Just download the latest release and unzip it into your project. You can turn it on with:

#include "mysql/lib/mysql.hpp"
using namespace marcelb;

Usage

/**
* Init
*/
MySQL mydb("tcp://192.168.2.10:3306", "user_nm", "passss", "my_db", 5);

/**
* Use                                 ------------------              
*/                                   |                  |    
                                 ------------------     |
try {                           |    |              |   |
    // execute                  |    |              |   |
    auto response = mydb.exec<int,string>("SELECT id,domain FROM records WHERE enabled = 0;");
    // response is MySQL_Res<int,string> type
    // check is execute
    cout << response.affected << " " << response.have_result << endl;
    cout << response.rows << " " << response.columns << endl;

    for (auto row : response) { // row is tuple<int,string> type
        cout << get<0>(row) << " " << get<1>(row) << endl;
    }

} catch (const string err) {
    cout << err << endl;
}

License

APACHE 2.0

Support & Feedback

For support and any feedback, contact the address: marcelb96@yahoo.com.

Contributing

Contributions are always welcome!

Feel free to fork and start working with or without a later pull request. Or contact for suggest and request an option.