Some changes

This commit is contained in:
WolverinDEV 2019-09-03 12:34:57 +02:00
parent a086dcc214
commit 2052317e6c
2 changed files with 18 additions and 2 deletions

View File

@ -4,11 +4,12 @@
#include "mysql_connection.h" #include "mysql_connection.h"
#include "src/log/LogUtils.h" #include "src/log/LogUtils.h"
#include <pipes/misc/http.h> #include <pipes/misc/http.h>
#include <mysql/mysql.h>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <mysql/mysql.h>
using namespace std; using namespace std;
using namespace sql; using namespace sql;
using namespace sql::mysql; using namespace sql::mysql;

View File

@ -143,8 +143,23 @@ int main() {
}); });
#endif #endif
#if true #if false
//{":hello", "world"}, {":yyyy", "xxx"}, {":numeric", 2} //{":hello", "world"}, {":yyyy", "xxx"}, {":numeric", 2}
sql::command((SqlManager*) nullptr, std::string("SELECT *"), {":hello", "world"}, {":numeric", 2}); sql::command((SqlManager*) nullptr, std::string("SELECT *"), {":hello", "world"}, {":numeric", 2});
#endif #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;
} }