Move query result helper class to maxsql

Added some asserts to ensure the class is used correctly.
This commit is contained in:
Esa Korhonen
2019-01-09 17:50:20 +02:00
parent 07cbda7771
commit b4d91d4b9a
8 changed files with 230 additions and 190 deletions

View File

@ -15,6 +15,7 @@
#include <maxscale/ccdefs.hh>
#include <stdlib.h>
#include <stdint.h>
#include <maxsql/mariadb.hh>
#include <maxscale/protocol/mysql.hh>
#include <maxscale/server.hh>
@ -123,4 +124,21 @@ mxs_mysql_name_kind_t mxs_mysql_name_to_pcre(char* pcre,
*/
void mxs_mysql_update_server_version(SERVER* dest, MYSQL* source);
namespace maxscale
{
/**
* Execute a query which returns data. The results are returned as a unique pointer to a QueryResult
* object. The column names of the results are assumed unique.
*
* @param conn Server connection
* @param query The query
* @param errmsg_out Where to store an error message if query fails. Can be null.
* @return Pointer to query results, or an empty pointer on failure
*/
std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query,
std::string* errmsg_out = NULL);
}
MXS_END_DECLS