Skip to content

Commit

Permalink
Removed several assert() from MySQL_Variables in non-debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Jan 25, 2024
1 parent 725027b commit b757c97
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/MySQL_Variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,30 @@ bool MySQL_Variables::client_set_value(MySQL_Session* session, int idx, const st
}

const char* MySQL_Variables::client_get_value(MySQL_Session* session, int idx) const {
#ifdef DEBUG
assert(session);
assert(session->client_myds);
assert(session->client_myds->myconn);
#endif // DEBUG
return session->client_myds->myconn->variables[idx].value;
}

uint32_t MySQL_Variables::client_get_hash(MySQL_Session* session, int idx) const {
#ifdef DEBUG
assert(session);
assert(session->client_myds);
assert(session->client_myds->myconn);
#endif // DEBUG
return session->client_myds->myconn->var_hash[idx];
}

void MySQL_Variables::server_set_value(MySQL_Session* session, int idx, const char* value) {
#ifdef DEBUG
assert(session);
assert(session->mybe);
assert(session->mybe->server_myds);
assert(session->mybe->server_myds->myconn);
#endif // DEBUG
if (!value) return; // FIXME: I am not sure about this implementation . If value == NULL , show the variable be reset?
session->mybe->server_myds->myconn->var_hash[idx] = SpookyHash::Hash32(value,strlen(value),10);

Expand All @@ -242,10 +248,12 @@ void MySQL_Variables::server_set_value(MySQL_Session* session, int idx, const ch
}

void MySQL_Variables::server_reset_value(MySQL_Session* session, int idx) {
#ifdef DEBUG
assert(session);
assert(session->mybe);
assert(session->mybe->server_myds);
assert(session->mybe->server_myds->myconn);
#endif // DEBUG

MySQL_Connection *backend_conn = session->mybe->server_myds->myconn;

Expand All @@ -261,18 +269,22 @@ void MySQL_Variables::server_reset_value(MySQL_Session* session, int idx) {
}

const char* MySQL_Variables::server_get_value(MySQL_Session* session, int idx) const {
#ifdef DEBUG
assert(session);
assert(session->mybe);
assert(session->mybe->server_myds);
assert(session->mybe->server_myds->myconn);
#endif // DEBUG
return session->mybe->server_myds->myconn->variables[idx].value;
}

uint32_t MySQL_Variables::server_get_hash(MySQL_Session* session, int idx) const {
#ifdef DEBUG
assert(session);
assert(session->mybe);
assert(session->mybe->server_myds);
assert(session->mybe->server_myds->myconn);
#endif // DEBUG
return session->mybe->server_myds->myconn->var_hash[idx];
}

Expand Down

0 comments on commit b757c97

Please sign in to comment.