Add resultset helper function to mariadb_func.h

Added a function that converts resultsets into matrices of strings.
This commit is contained in:
Markus Mäkelä
2018-04-26 15:44:09 +03:00
parent 9ba9322b9b
commit 8b09ec56cf
2 changed files with 23 additions and 8 deletions

View File

@ -27,6 +27,7 @@
#include <vector>
typedef std::vector<std::string> Row;
typedef std::vector<Row> Result;
/**
* Opens connection to DB: wropper over mysql_real_connect
@ -215,7 +216,17 @@ int find_field(MYSQL* conn, const char* sql, const char* field_name, char* value
*
* @return The first row as a list of strings
*/
std::vector<std::string> get_row(MYSQL* conn, std::string sql);
Row get_row(MYSQL* conn, std::string sql);
/**
* Execute a query and return the result
*
* @param conn The connection to use
* @param sql The query to execute
*
* @return The result as a list of rows
*/
Result get_result(MYSQL* conn, std::string sql);
int get_int_version(std::string version);