Skip to content

Commit

Permalink
Free result
Browse files Browse the repository at this point in the history
  • Loading branch information
justing-bq committed Apr 25, 2023
1 parent 451d65c commit 5766960
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions driver/failover_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,17 @@ bool FAILOVER_HANDLER::is_writer_cluster(const char* host) {
}

bool FAILOVER_HANDLER::is_read_only() {
bool read_only = false;
if (dbc->connection_proxy->query(MYSQL_READONLY_QUERY) == 0) {
auto result = dbc->connection_proxy->store_result();
MYSQL_ROW row;
if (row = dbc->connection_proxy->fetch_row(result)) {
return (strcmp(row[0], "1") == 0);
read_only = (strcmp(row[0], "1") == 0);
}
dbc->connection_proxy->free_result(result);
}

return false;
return read_only;
}

std::string FAILOVER_HANDLER::host_to_IP(std::string host) {
Expand Down

0 comments on commit 5766960

Please sign in to comment.