From: Andrea Zagli Date: Wed, 8 Feb 2017 15:15:28 +0000 (+0100) Subject: Aggiunta la funzione Titolo::get_by_id. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=05d01aed13f48dab4f8e6897508a3740dcfc0718;p=solipa%2Forganigramma Aggiunta la funzione Titolo::get_by_id. --- diff --git a/src/titolo.c b/src/titolo.c index 084fd16..16a65d0 100644 --- a/src/titolo.c +++ b/src/titolo.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2016 Andrea Zagli + * Copyright (C) 2010-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_titolo_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 titoli 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_titolo_carica (OrganigrammaTitolo *titolo) diff --git a/src/titolo.h b/src/titolo.h index 99f5aed..f233808 100644 --- a/src/titolo.h +++ b/src/titolo.h @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-2012 Andrea Zagli +/* + * Copyright (C) 2010-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 @@ OrganigrammaTitolo *organigramma_titolo_new (OrganigrammaCommons *commons, gint GtkWidget *organigramma_titolo_get_widget (OrganigrammaTitolo *titolo); +GHashTable *organigramma_titolo_get_by_id (OrganigrammaCommons *commons, gint id); + G_END_DECLS