|
|
|
|
@ -52,11 +52,20 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
int32_t server_status = backend["conn"]["mysql"]["server_status"];
|
|
|
|
|
ok(server_status & 0x01, "Connection status should reflect being in a transaction");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
int32_t server_status = backend["conn"]["mysql"]["server_status"];
|
|
|
|
|
ok(server_status & 0x01, "Connection status should reflect being in a transaction");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -107,11 +116,20 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
int32_t user_variable_status = backend["conn"]["status"]["user_variable"];
|
|
|
|
|
ok(user_variable_status == true, "Connection status should reflect that a 'user_variable' have been set.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
int32_t user_variable_status = backend["conn"]["status"]["user_variable"];
|
|
|
|
|
ok(user_variable_status == true, "Connection status should reflect that a 'user_variable' have been set.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -138,14 +156,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool prepared_stmt = backend["conn"]["status"]["prepared_statement"];
|
|
|
|
|
ok(prepared_stmt == true, "Connection status should reflect that a 'prepared statement' have been prepared.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool prepared_stmt = backend["conn"]["status"]["prepared_statement"];
|
|
|
|
|
ok(prepared_stmt == true, "Connection status should reflect that a 'prepared statement' have been prepared.");
|
|
|
|
|
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to the 'prepared statement'.");
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to the 'prepared statement'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -190,18 +217,36 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool lock_tables = backend["conn"]["status"]["lock_tables"];
|
|
|
|
|
ok(lock_tables == true, "Connection status should reflect that 'LOCK TABLE' have been executed.");
|
|
|
|
|
if (vj_status[0].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool lock_tables = backend["conn"]["status"]["lock_tables"];
|
|
|
|
|
ok(lock_tables == true, "Connection status should reflect that 'LOCK TABLE' have been executed.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool unlock_tables = backend["conn"]["status"]["lock_tables"];
|
|
|
|
|
ok(unlock_tables == false, "Connection status should reflect that 'UNLOCK TABLE' have been executed.");
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vj_status[1].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool unlock_tables = backend["conn"]["status"]["lock_tables"];
|
|
|
|
|
ok(unlock_tables == false, "Connection status should reflect that 'UNLOCK TABLE' have been executed.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -238,14 +283,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool temp_table = backend["conn"]["status"]["temporary_table"];
|
|
|
|
|
ok(temp_table == true, "Connection status should reflect that a 'CREATE TEMPORARY TABLE' have been executed.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool temp_table = backend["conn"]["status"]["temporary_table"];
|
|
|
|
|
ok(temp_table == true, "Connection status should reflect that a 'CREATE TEMPORARY TABLE' have been executed.");
|
|
|
|
|
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to 'CREATE TEMPORARY TABLE'.");
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to 'CREATE TEMPORARY TABLE'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -278,14 +332,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool lock_tables = backend["conn"]["status"]["get_lock"];
|
|
|
|
|
ok(lock_tables == true, "Connection status should reflect that a 'GET_LOCK' have been executed.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool lock_tables = backend["conn"]["status"]["get_lock"];
|
|
|
|
|
ok(lock_tables == true, "Connection status should reflect that a 'GET_LOCK' have been executed.");
|
|
|
|
|
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to 'GET_LOCK'.");
|
|
|
|
|
bool multiplex_disabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(multiplex_disabled == true, "Connection status should reflect that 'MultiplexDisabled' is enabled due to 'GET_LOCK'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -315,14 +378,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool user_variable = backend["conn"]["status"]["user_variable"];
|
|
|
|
|
ok(user_variable == true, "Connection status should have 'status.user_variable' set due to 'SET @variable'.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool user_variable = backend["conn"]["status"]["user_variable"];
|
|
|
|
|
ok(user_variable == true, "Connection status should have 'status.user_variable' set due to 'SET @variable'.");
|
|
|
|
|
|
|
|
|
|
bool no_multiplex = backend["conn"]["status"]["no_multiplex"];
|
|
|
|
|
ok(no_multiplex == true, "Connection status should have 'no_multiplex' set due to 'SET @variable'.");
|
|
|
|
|
bool no_multiplex = backend["conn"]["status"]["no_multiplex"];
|
|
|
|
|
ok(no_multiplex == true, "Connection status should have 'no_multiplex' set due to 'SET @variable'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -353,14 +425,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == false, "Connection status should have 'MultiplexDisabled' set to false even with 'START TRANSACTION'.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == false, "Connection status should have 'MultiplexDisabled' set to false even with 'START TRANSACTION'.");
|
|
|
|
|
|
|
|
|
|
bool no_multiplex = backend["conn"]["status"]["no_multiplex"];
|
|
|
|
|
ok(no_multiplex == false, "Connection status should have 'no_multiplex' set to false even with 'START TRANSACTION'.");
|
|
|
|
|
bool no_multiplex = backend["conn"]["status"]["no_multiplex"];
|
|
|
|
|
ok(no_multiplex == false, "Connection status should have 'no_multiplex' set to false even with 'START TRANSACTION'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -404,17 +485,35 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'LOCK TABLES'.");
|
|
|
|
|
if (vj_status[0].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'LOCK TABLES'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
ok(backend.contains("conn") == false, "Connection should be returned to the connection pool due to 'UNLOCK TABLES'.");
|
|
|
|
|
if (vj_status[1].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
ok(backend.contains("conn") == false, "Connection should be returned to the connection pool due to 'UNLOCK TABLES'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -446,16 +545,20 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool sql_log_bin0 = backend["conn"]["status"]["sql_log_bin0"];
|
|
|
|
|
ok(sql_log_bin0 == true, "Connection status should have 'status.sql_log_bin0' set to 'true' 'DUE TO 'SET SQL_LOG_BIN'.");
|
|
|
|
|
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SET SQL_LOG_BIN'.");
|
|
|
|
|
} else {
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SET SQL_LOG_BIN'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -495,14 +598,23 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool found_rows = backend["conn"]["status"]["found_rows"];
|
|
|
|
|
ok(found_rows == true, "Connection status should have 'status.found_rows' set to 'true' 'DUE TO 'SQL_CALC_FOUND_ROWS'.");
|
|
|
|
|
if (j_status.contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : j_status["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool found_rows = backend["conn"]["status"]["found_rows"];
|
|
|
|
|
ok(found_rows == true, "Connection status should have 'status.found_rows' set to 'true' 'DUE TO 'SQL_CALC_FOUND_ROWS'.");
|
|
|
|
|
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SQL_CALC_FOUND_ROWS'.");
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SQL_CALC_FOUND_ROWS'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
@ -521,7 +633,8 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
"SET AUTOCOMMIT=0",
|
|
|
|
|
"SAVEPOINT test_session_variables_savepoint",
|
|
|
|
|
"PROXYSQL INTERNAL SESSION",
|
|
|
|
|
"COMMIT"
|
|
|
|
|
"COMMIT",
|
|
|
|
|
"PROXYSQL INTERNAL SESSION"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::vector<json> vj_status;
|
|
|
|
|
@ -537,23 +650,38 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
mysql_free_result(tr_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
bool found_rows = backend["conn"]["status"]["has_savepoint"];
|
|
|
|
|
ok(found_rows == true, "Connection status should have 'status.has_savepoint' set to 'true' 'DUE TO 'SAVEPOINT'.");
|
|
|
|
|
if (vj_status[0].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[0]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
bool found_rows = backend["conn"]["status"]["has_savepoint"];
|
|
|
|
|
ok(found_rows == true, "Connection status should have 'status.has_savepoint' set to 'true' 'DUE TO 'SAVEPOINT'.");
|
|
|
|
|
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SAVEPOINT'.");
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == true, "Connection status should have 'MultiplexDisabled' set to 'true' 'DUE TO 'SAVEPOINT'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr && backend.contains("conn") && backend["conn"].contains("status")) {
|
|
|
|
|
ok(backend.contains("conn") == false, "Connection should be returned to the connection pool due to 'COMMIT'.");
|
|
|
|
|
|
|
|
|
|
bool MultiplexDisabled = backend["conn"]["MultiplexDisabled"];
|
|
|
|
|
ok(MultiplexDisabled == false, "Connection status should have 'MultiplexDisabled' set to 'false' 'DUE TO 'COMMIT'.");
|
|
|
|
|
if (vj_status[1].contains("backends")) {
|
|
|
|
|
bool found_backend = false;
|
|
|
|
|
for (const auto& backend : vj_status[1]["backends"]) {
|
|
|
|
|
if (backend != nullptr) {
|
|
|
|
|
found_backend = true;
|
|
|
|
|
ok(backend.contains("conn") == false, "Connection should be returned to the connection pool due to 'COMMIT'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found_backend == false) {
|
|
|
|
|
ok(false, "'backends' doens't contains 'conn' objects with the relevant session information");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ok(false, "No backends detected for the current connection.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(proxysql_mysql);
|
|
|
|
|
|