From 3ebed1c72dfb90910b27e14be5aeae23c85f1ba0 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 8 Feb 2017 15:02:14 +0100 Subject: [PATCH] Aggiunta la funzione Ruolo::get_by_id. --- src/ruolo.c | 22 +++++++++++++++++++++- src/ruolo.h | 6 ++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ruolo.c b/src/ruolo.c index e9a3310..50caad2 100644 --- a/src/ruolo.c +++ b/src/ruolo.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2016 Andrea Zagli + * Copyright (C) 2013-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -202,6 +202,26 @@ GtkWidget return priv->w; } +GHashTable +*organigramma_ruolo_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 ruoli 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_ruolo_carica (OrganigrammaRuolo *ruolo) diff --git a/src/ruolo.h b/src/ruolo.h index c8f9b2e..0d199a9 100644 --- a/src/ruolo.h +++ b/src/ruolo.h @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2013 Andrea Zagli +/* + * Copyright (C) 2013-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -59,6 +59,8 @@ OrganigrammaRuolo *organigramma_ruolo_new (OrganigrammaCommons *commons, gint id GtkWidget *organigramma_ruolo_get_widget (OrganigrammaRuolo *ruolo); +GHashTable *organigramma_ruolo_get_by_id (OrganigrammaCommons *commons, gint id); + G_END_DECLS -- 2.49.0