From 2052317e6c6feba915bdb64d4c8187ff8479e585 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 3 Sep 2019 12:34:57 +0200 Subject: [PATCH] Some changes --- src/sql/mysql/MySQL.cpp | 3 ++- test/SQLTest.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/sql/mysql/MySQL.cpp b/src/sql/mysql/MySQL.cpp index d18d080..5cc8033 100644 --- a/src/sql/mysql/MySQL.cpp +++ b/src/sql/mysql/MySQL.cpp @@ -4,11 +4,12 @@ #include "mysql_connection.h" #include "src/log/LogUtils.h" #include -#include #include #include +#include + using namespace std; using namespace sql; using namespace sql::mysql; diff --git a/test/SQLTest.cpp b/test/SQLTest.cpp index 1b64bd5..c7d0f15 100644 --- a/test/SQLTest.cpp +++ b/test/SQLTest.cpp @@ -143,8 +143,23 @@ int main() { }); #endif -#if true +#if false //{":hello", "world"}, {":yyyy", "xxx"}, {":numeric", 2} sql::command((SqlManager*) nullptr, std::string("SELECT *"), {":hello", "world"}, {":numeric", 2}); #endif + + sql::mysql::MySQLManager manager; + + if(!manager.connect("mysql://localhost:3306/test?userName=root&password=markus&connections=1")) { + cerr << "failed to connect" << endl; + return 1; + } + + auto result = sql::command(&manager, "SELECT * FROM `level_miner`").query([](int length, std::string* values, std::string* names) { + cout << "-- entry" << endl; + for(int index = 0; index < length; index++) { + cout << " " << names[index] << " => " << values[index] << endl; + } + }); + cout << result.fmtStr() << endl; } \ No newline at end of file