Fix compiling of fwd_eof_ok_query

Also added several debugging information
pull/4253/head
René Cannaò 3 years ago
parent 482c808449
commit 83759f0df1

@ -67,7 +67,7 @@ fwd_eof_query: fwd_eof_query.cpp $(TESTS_DEPS)
# NOTE: Compilation with 'libmysql' instead of 'libmariadb' client to confirm packet sequence id isn't check by 'libmariadb'
fwd_eof_ok_query: fwd_eof_query.cpp $(TAP_LIBDIR)/libtap.a
$(CXX) -DDEBUG fwd_eof_query.cpp $(OPT) -std=c++11 -I$(JSON_IDIR) -I$(TAP_LIBDIR) -I$(INCLUDEDIRS) -L$(TAP_LIBDIR) -L$(TAP_DEPS_LIBS) -L/usr/lib/x86_64-linux-gnu/ -lmysqlclient -ltap -ldl -o fwd_eof_ok_query -DGITVERSION=\"$(GIT_VERSION)\"
$(CXX) -DDEBUG fwd_eof_query.cpp $(OPT) -std=c++11 -I$(JSON_IDIR) -I$(TAP_LIBDIR) -I /usr/include/mysql/ -I$(IDIR) -L$(TAP_LIBDIR) -L$(TAP_DEPS_LIBS) -L/usr/lib/x86_64-linux-gnu/ -lmysqlclient -ltap -ldl -o fwd_eof_ok_query -DGITVERSION=\"$(GIT_VERSION)\"
deprecate_eof_cache-t: deprecate_eof_cache-t.cpp $(TESTS_DEPS)
$(CXX) -DDEBUG deprecate_eof_cache-t.cpp $(OPT) -std=c++11 -I$(JSON_IDIR) -I$(TAP_LIBDIR) -I$(INCLUDEDIRS) -L$(TAP_LIBDIR) -L$(TAP_DEPS_LIBS) -L$(MARIADB_TEST_DEP)/libmariadb -L$(SSL_LDIR) -L$(PROXYLDIR) -ltap $(MYLIBS) -lproxysql -ldl -o deprecate_eof_cache-t -DGITVERSION=\"$(GIT_VERSION)\"

@ -54,6 +54,14 @@ std::vector<std::string> queries {
int main(int argc, char** argv) {
CommandLine cl;
uint32_t c_operations = 50;
to_opts_t opts { 10000*1000, 100*1000, 500*1000, 2000*1000 };
unsigned int p = 1; // create table
p += c_operations; // inserts
p += c_operations*12; // 12 tests each time
plan(p);
if (cl.getEnv()) {
diag("Failed to get the required environmental variables.");
return -1;
@ -90,7 +98,6 @@ int main(int argc, char** argv) {
return exit_status();
}
uint32_t c_operations = 50;
vector<pair<string, string>> stored_pairs {};
// INSERT the required data for exercising the cache
@ -142,12 +149,14 @@ int main(int argc, char** argv) {
std::string select_query {};
string_format(t_select_query, select_query, id);
to_opts_t opts { 10000*1000, 100*1000, 500*1000, 2000*1000 };
std::string binary = "";
// Query *without* support for EOF deprecation
binary = "fwd_eof_query";
diag("Calling %s%s with query: %s", cl.workdir, binary.c_str(), select_query.c_str());
auto eof_query = [&] (std::string& query_res, std::string& eof_query_err) -> int {
int exec_res = wexecvp(
std::string(cl.workdir) + "fwd_eof_query",
std::string(cl.workdir) + binary,
{ select_query.c_str() },
opts,
query_res,
@ -158,9 +167,11 @@ int main(int argc, char** argv) {
};
// Query *with* support for EOF deprecation
binary = "fwd_eof_ok_query";
diag("Calling %s%s with query: %s", cl.workdir, binary.c_str(), select_query.c_str());
auto ok_query = [&] (std::string& query_res, std::string& ok_query_err) -> int {
int exec_res = wexecvp(
std::string(cl.workdir) + "fwd_eof_ok_query",
std::string(cl.workdir) + binary,
{ select_query.c_str() },
opts,
query_res,

@ -112,14 +112,14 @@ int main(int argc, char** argv) {
*/
if (!mysql_real_connect(proxy, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) {
std::string err_msg { "MySQL Error:" + std::string { mysql_error(proxy) }+ "" };
std::string err_msg { "MySQL Error:" + std::string { mysql_error(proxy) } + " at line " + std::to_string(__LINE__) };
std::cerr << "{ \"Code\": \"Err\", \"Result\": \"" << err_msg << "\" }";
return -1;
}
int query_res = mysql_query(proxy, query.c_str());
if (query_res != 0) {
std::string err_msg { "MySQL Error:" + std::string { mysql_error(proxy) }+ "" };
std::string err_msg { "MySQL Error:" + std::string { mysql_error(proxy) } + " at line " + std::to_string(__LINE__) };
std::cerr << "{ \"Code\": \"Err\", \"Result\": \"" << err_msg << "\" }";
return -1;
}
@ -132,7 +132,9 @@ int main(int argc, char** argv) {
MySQL_result_to_JSON(select_res, j_res);
std::cout << "{ \"Code\": \"OK\", \"Result\": " << j_res.dump()
<< ", \"Status\": " << proxy->server_status
<< ", \"Warnings\": " << mysql_warning_count(proxy) << " }";
<< ", \"Warnings\": " << mysql_warning_count(proxy)
<< ", \"Line\": " << __LINE__
<< " }";
} else {
std::string err_msg {
"MySQL Error: " + std::string { mysql_error(proxy) }+ ""

Loading…
Cancel
Save