From 4fe1a3e29e191ea7efa7018df04b1c7544dbe557 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Tue, 4 Dec 2012 08:58:25 +0100 Subject: [PATCH] Aggiunta la funzione Ufficio::get_by_id. --- src/ufficio.c | 20 ++++++++++++++++++++ src/ufficio.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/ufficio.c b/src/ufficio.c index eea9c82..a32bdb2 100644 --- a/src/ufficio.c +++ b/src/ufficio.c @@ -342,6 +342,26 @@ GtkWidget return priv->w; } +GHashTable +*organigramma_ufficio_get_by_id (OrganigrammaCommons *commons, gint id) +{ + GHashTable *ret; + + gchar *sql; + + g_return_val_if_fail (commons != NULL, NULL); + g_return_val_if_fail (id > 0, NULL); + + sql = g_strdup_printf ("SELECT * FROM uffici WHERE id = %d", + id); + + ret = gdaex_data_model_row_to_hashtable_from_sql (commons->gdaex, sql, 0); + + g_free (sql); + + return ret; +} + /* PRIVATE */ static void organigramma_ufficio_carica (OrganigrammaUfficio *ufficio) diff --git a/src/ufficio.h b/src/ufficio.h index b157c39..0ab5a8a 100644 --- a/src/ufficio.h +++ b/src/ufficio.h @@ -59,6 +59,8 @@ OrganigrammaUfficio *organigramma_ufficio_new (OrganigrammaCommons *commons, gin GtkWidget *organigramma_ufficio_get_widget (OrganigrammaUfficio *ufficio); +GHashTable *organigramma_ufficio_get_by_id (OrganigrammaCommons *commons, gint id); + G_END_DECLS -- 2.49.0