From b331ff53aca9a239b50f400cbc52539972419a51 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Tue, 4 Dec 2012 09:11:12 +0100 Subject: [PATCH] Aggiunta la funzione Persona::get_by_id. --- src/persona.c | 20 ++++++++++++++++++++ src/persona.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/persona.c b/src/persona.c index 1cb904f..e5af88c 100644 --- a/src/persona.c +++ b/src/persona.c @@ -431,6 +431,26 @@ GtkWidget return priv->w; } +GHashTable +*organigramma_persona_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 persone 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_persona_carica (OrganigrammaPersona *persona) diff --git a/src/persona.h b/src/persona.h index 0869514..095f4dd 100644 --- a/src/persona.h +++ b/src/persona.h @@ -59,6 +59,8 @@ OrganigrammaPersona *organigramma_persona_new (OrganigrammaCommons *commons, gin GtkWidget *organigramma_persona_get_widget (OrganigrammaPersona *persona); +GHashTable *organigramma_persona_get_by_id (OrganigrammaCommons *commons, gint id); + G_END_DECLS -- 2.49.0