Skip to content
Extraits de code Groupes Projets
Vérifiée Valider aa871886 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

DB: Check the null terminator of table descriptions before the "main" function

This is done because there is only LKT_TABLE_FIELDS_MAX fields supported
per table description with the current upgrade system.
parent d23892d0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!169Solves #90 - Database automatic upgrade
Pipeline #2417 réussi
......@@ -46,6 +46,25 @@ UNUSED static struct sql_table_description *sql_tables_list[] = {
&sql_table_stickers_plt, NULL,
};
CONSTRUCTOR_FUNCTION
___verify_table_descriptions(void)
{
for (size_t i = 0; sql_tables_list[i]; ++i) {
struct sql_table_description *table = sql_tables_list[i];
size_t j = LKT_TABLE_FIELDS_MAX - 1;
while (j) {
if (table->fields[j] == NULL)
break;
--j;
}
if (j <= 0) {
LOG_FATAL("The description for the table '%s' has to many fields, "
"the maximum supported is %lu",
table->name, LKT_TABLE_FIELDS_MAX);
}
}
}
PRIVATE_FUNCTION bool
___compute_upgrade_sql_query(struct sql_table_description *table, char *buffer,
size_t buffer_length)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter