From c9462738266914cc87ac82a95d193a77ad10061c Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 24 May 2017 15:38:43 +0200 Subject: [PATCH] Aggiunta la funzione Comuni::get_dm_order. --- src/comuni.c | 13 ++++++++++--- src/comuni.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/comuni.c b/src/comuni.c index 7047994..8d8b870 100644 --- a/src/comuni.c +++ b/src/comuni.c @@ -278,7 +278,7 @@ GtkWidget } GdaDataModel -*territorio_comuni_get_dm (TerritorioCommons *commons, gboolean con_provincia, const gchar *where) +*territorio_comuni_get_dm_order (TerritorioCommons *commons, gboolean con_provincia, const gchar *where, const gchar *order) { GdaDataModel *dm; @@ -351,11 +351,12 @@ GdaDataModel NULL); g_value_unset (gval); - sql = g_strdup_printf ("SELECT %s FROM %s WHERE %s%s", + sql = g_strdup_printf ("SELECT %s FROM %s WHERE %s%s%s", gdaex_sql_builder_get_sql_select (sqlb, NULL, NULL), gdaex_sql_builder_get_sql_from (sqlb, NULL, NULL), gdaex_sql_builder_get_sql_where (sqlb, NULL, NULL), - where != NULL ? where : ""); + where != NULL ? where : "", + order != NULL ? g_strdup_printf (" ORDER BY %s", order) : ""); dm = gdaex_query (commons->gdaex, sql); g_free (sql); @@ -363,6 +364,12 @@ GdaDataModel return dm; } +GdaDataModel +*territorio_comuni_get_dm (TerritorioCommons *commons, gboolean con_provincia, const gchar *where) +{ + territorio_comuni_get_dm_order (commons, con_provincia, where, NULL); +} + /* PRIVATE */ static void territorio_comuni_carica (TerritorioComuni *territorio_comuni) diff --git a/src/comuni.h b/src/comuni.h index 204f438..1e66925 100644 --- a/src/comuni.h +++ b/src/comuni.h @@ -60,6 +60,7 @@ TerritorioComuni *territorio_comuni_new (TerritorioCommons *commons, gboolean se GtkWidget *territorio_comuni_get_widget (TerritorioComuni *territorio_comuni); GdaDataModel *territorio_comuni_get_dm (TerritorioCommons *commons, gboolean con_provincia, const gchar *where); +GdaDataModel *territorio_comuni_get_dm_order (TerritorioCommons *commons, gboolean con_provincia, const gchar *where, const gchar *order); G_END_DECLS -- 2.49.0