ENGINE-838: Well well well, turns out if you learned C in 1996, you might not know all the tricks from C99.

audit_branch
Krista 'DarthMama' Bennett 2020-10-26 12:26:53 +01:00
parent 3b3cd39357
commit e1ab12e744
1 changed files with 2 additions and 8 deletions

View File

@ -645,18 +645,12 @@ static int table_contains_column(PEP_SESSION session, const char* table_name,
PEP_STATUS repair_altered_tables(PEP_SESSION session) {
PEP_STATUS status = PEP_STATUS_OK;
char* table_names[_PEP_MAX_AFFECTED];
int i = 0;
char** index = table_names;
for (i = 0; i < _PEP_MAX_AFFECTED; i++, index++) {
*index = NULL;
}
char* table_names[_PEP_MAX_AFFECTED] = {0};
const char* sql_query = "select tbl_name from sqlite_master WHERE sql LIKE '%REFERENCES%' AND sql LIKE '%_old%';";
sqlite3_stmt *stmt;
sqlite3_prepare_v2(session->db, sql_query, -1, &stmt, NULL);
i = 0;
int i = 0;
int int_result = 0;
while ((int_result = sqlite3_step(stmt)) == SQLITE_ROW && i < _PEP_MAX_AFFECTED) {
table_names[i++] = strdup((const char*)(sqlite3_column_text(stmt, 0)));