}
static gboolean
-comparing (GHashTable *ht_ref_db_tables, GHashTable *ht_db_tables)
+comparing_fields (Table *ref_table, Table *table)
{
+ gboolean ret;
+
GHashTableIter iter;
gpointer key, value;
- Table *table;
+ Field *field;
+ g_hash_table_iter_init (&iter, ref_table->ht_fields);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ field = (Field *)value;
+ if (!g_hash_table_lookup (table->ht_fields, field->name))
+ {
+ g_message ("Field «%s» missing on table «%s».", field->name, table->name);
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+
+static gboolean
+comparing (GHashTable *ht_ref_db_tables, GHashTable *ht_db_tables)
+{
gboolean ret;
+ GHashTableIter iter;
+ gpointer key, value;
+
+ Table *ref_table;
+ Table *table;
+
ret = TRUE;
g_hash_table_iter_init (&iter, ht_ref_db_tables);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- table = (Table *)value;
- if (!g_hash_table_lookup (ht_db_tables, table->name))
+ ref_table = (Table *)value;
+ table = g_hash_table_lookup (ht_db_tables, ref_table->name);
+ if (table == NULL)
{
- g_message ("Table «%s» missing.", table->name);
+ g_message ("Table «%s» missing.", ref_table->name);
ret = FALSE;
}
+ else
+ {
+ comparing_fields (ref_table, table);
+ }
}
return ret;