From 228ccd07579fedad59984229ab79052909c8133d Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 16 Sep 2012 12:14:01 +0200 Subject: [PATCH] Comparing tables fields (only by name). --- .anjuta_sym_db.db | Bin 36864 -> 36864 bytes src/main.c | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.anjuta_sym_db.db b/.anjuta_sym_db.db index a563dbd9affdb16c7eb542b859f2d79ab90710d2..1d8ea91f98dd3f04d466427d44c7e15a68741b89 100644 GIT binary patch delta 757 zcmZ`$O-vJE5dCJR3td@Y3)J#gT5woB4@z*Yfc zEJgAi>Jg%e7Y@{oF~md@0|!hrCd3#odXN|s;zd1p!!3}QK=@Ac-plvq%}jOyvkUmJ z1xoX+7ob$SI#3HTe_ZPW#r#m~l`4Dsy3h7?pL^B{jRD$VE*xR_8Nbs}9HB3`OhtT4 zPpO|?(q$6x6+Xd7I8E2_CjG?UG)W$OSISA~#|&#`mVt-;e~p4)L*DNxnCdctL8 z1eh3)sD>6yXoi|Lk}0jH$?OlT`p8ZX%*x0VIqPL&{{55ig=nO~PI*SJX`M=xr@ypF z8}!X|*bH(ukpIB&vblI8EJ-d_1Xg6r>=Rb-nv7>Y7c`5R81#xe+dEU?7u^Rxk4@-d zBbL)_6p)CA1s{YKW4jl TyfDP83jw}T_ywzcX>Rx*GD747 delta 585 zcmZWkOK4M35WO>#XH4^IKAN=o_-Si3(Fiuh2D@r2>Pi&sPT`r)tEMJVlc>Q(O|%9o zN$TTPvP}>XBn#uCNN`aQTgbv6UAWRs5&YmrL)w%f^A>!QgOk@SzvFL->k0F+zA7Kai2$Vw0*gK=){b9@BCB zhBJ5<-{2*h6i1(Nfu_hsE_~K3$Y{bGb2DM!(ncNp!qD!kXiA3TDYhg_T_%7-aWxV1 z^&$Q+OAdik;iTHr-zmAo9E&K?RMfrECiMuERwtA-#$~5vCbQr5SGUu*<~bgYB-FlM ztF%?f&SaH|)r?HJ@rY&x!H zc6I9`p{D`yb4@qKrpX~9SNq@MwbQXpMyfMfpf)w>JJo5KR%k`H87`Cke}P^<8n+booUFW#6!e8dkH(+1(NMH_Wht_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; -- 2.49.0