PoetaKodu / simple-mysql

A simple MySQL C++ wrapper of mysql C library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple MySQL

A simple C++ wrapper for C MySQL connector.

Installation

Uses pacc package manager.

pacc install PoetaKodu/simple-mysql --save

Usage

#include <SimpleMySQL/Everything.hpp>
#include <iostream>

namespace sql = simple_mysql;

int main()
{
	sql::Connection conn;
	conn.connect("localhost", "root", "mypassword", "dbname");

	auto result = conn.query("SELECT `id`, `first_name`, `last_name`, `grade` FROM `students`");

	std::cout << "Loaded " << result.rowCount() << " students.\n";
	while(auto row = result.nextRow())
	{
		std::cout << '[', row[0] << "]: " << row[1] << ' ' << row[2] << ", grade: " << row[3] << '\n';
	}
}

About

A simple MySQL C++ wrapper of mysql C library.


Languages

Language:C++ 100.0%