From f75b47a8647948238aa09cb164f381bbca6e7c6e Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Tue, 22 Feb 2011 18:10:40 +0100 Subject: [PATCH] Implementation draft. --- data/libgdaex/gui/libgdaex.ui | 104 +++++++++++++++++++--------------- src/queryeditor.c | 10 ++++ src/queryeditor.h | 19 +++++++ 3 files changed, 87 insertions(+), 46 deletions(-) diff --git a/data/libgdaex/gui/libgdaex.ui b/data/libgdaex/gui/libgdaex.ui index bf25df8..2843836 100644 --- a/data/libgdaex/gui/libgdaex.ui +++ b/data/libgdaex/gui/libgdaex.ui @@ -2,10 +2,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 normal - False True @@ -275,13 +318,24 @@ + + + Not + + + + 2 + + + + Type - 3 + 4 @@ -292,7 +346,7 @@ - 4 + 5 @@ -303,7 +357,7 @@ - 5 + 6 @@ -591,46 +645,4 @@ button2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/queryeditor.c b/src/queryeditor.c index bb630cf..84d858b 100644 --- a/src/queryeditor.c +++ b/src/queryeditor.c @@ -38,12 +38,21 @@ static void gdaex_query_editor_build_ui (GdaExQueryEditor *qe); #define GDAEX_QUERY_EDITOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GDAEX_QUERY_EDITOR, GdaExQueryEditorPrivate)) +typedef struct + { + gchar *name; + gchar *name_visible; + GHashTable *fields; /* GdaExQueryEditorField */ + } GdaExQueryEditorTable; + typedef struct _GdaExQueryEditorPrivate GdaExQueryEditorPrivate; struct _GdaExQueryEditorPrivate { GdaEx *gdaex; GtkWidget *hbx_main; + + GHashTable *tables; /* GdaExQueryEditorTable */ }; G_DEFINE_TYPE (GdaExQueryEditor, gdaex_query_editor, G_TYPE_OBJECT) @@ -76,6 +85,7 @@ enum { COL_WHERE_NAME, COL_WHERE_VISIBLE_NAME, + COL_WHERE_CONDITION_NOT, COL_WHERE_CONDITION_TYPE, COL_WHERE_CONDITION_FROM, COL_WHERE_CONDITION_TO diff --git a/src/queryeditor.h b/src/queryeditor.h index 1030015..9b83334 100644 --- a/src/queryeditor.h +++ b/src/queryeditor.h @@ -57,6 +57,25 @@ GdaExQueryEditor *gdaex_query_editor_new (GdaEx *gdaex); GtkWidget *gdaex_query_editor_get_widget (GdaExQueryEditor *gdaex_query_editor); +typedef struct + { + gchar *name; + gchar *name_visible; + /* - tipo di campo (stringa, interno, double, date, datetime) */ + /* - sempre presente nelle query, quindi non sceglibile per la parte show */ + /* - sceglibile per la parte where */ + /* - condizioni where che è possibile applicare (es. i campi id_* non ha senso che abbiano un between, */ + /* ma ci deve essere la possibilità di fare ricerche anche sulle decodifiche) */ + } GdaExQueryEditorField; + +gboolean gdaex_query_editor_add_table (GdaExQueryEditor *qe, const gchar *table_name, const gchar *table_name_visibile); +gboolean gdaex_query_editor_table_add_field (GdaExQueryEditor *qe, const gchar *table_name, GdaExQueryEditorField field); +gboolean gdaex_query_editor_add_relation (GdaExQueryEditor *qe, + const gchar *table_name1, GdaExQueryEditorField field1, + const gchar *table_name2, GdaExQueryEditorField field2); + +const gchar *gdaex_query_editor_get_sql (GdaExQueryEditor *qe); + G_END_DECLS -- 2.49.0