GSList *relations; /* GdaExQueryEditorRelation */
/* for value choosing */
- guint editor_type; /* 1 - show; 2 - where; 3 - order */
+ guint editor_type;
GtkWidget *hbox;
GtkWidget *tbl;
return ret;
}
-const gchar
-*gdaex_query_editor_get_sql (GdaExQueryEditor *qe)
+GdaSqlBuilder
+*gdaex_query_editor_get_sql_as_gdasqlbuilder (GdaExQueryEditor *qe)
{
- const gchar *ret;
-
GdaExQueryEditorPrivate *priv;
GdaSqlBuilder *sqlbuilder;
GdaExQueryEditorTable *table;
GdaExQueryEditorField *field;
- GdaStatement *stmt;
- GError *error;
-
- ret = NULL;
-
g_return_val_if_fail (GDAEX_IS_QUERY_EDITOR (qe), NULL);
priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->lstore_order), &iter));
}
+ return sqlbuilder;
+}
+
+const gchar
+*gdaex_query_editor_get_sql (GdaExQueryEditor *qe)
+{
+ const gchar *ret;
+
+ GdaExQueryEditorPrivate *priv;
+
+ GdaSqlBuilder *sqlbuilder;
+ GdaStatement *stmt;
+ GError *error;
+
+ ret = NULL;
+
+ sqlbuilder = gdaex_query_editor_get_sql_as_gdasqlbuilder (qe);
+ if (sqlbuilder == NULL)
+ {
+ return ret;
+ }
+
+ priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
error = NULL;
stmt = gda_sql_builder_get_statement (sqlbuilder, &error);
if (stmt == NULL || error != NULL)
switch (priv->editor_type)
{
- case 1:
+ case GDAEX_QE_PAGE_SHOW:
gtk_tree_selection_unselect_all (priv->sel_show);
break;
- case 2:
+ case GDAEX_QE_PAGE_WHERE:
gtk_tree_selection_unselect_all (priv->sel_where);
break;
- case 3:
+ case GDAEX_QE_PAGE_ORDER:
gtk_tree_selection_unselect_all (priv->sel_order);
break;
}
switch (priv->editor_type)
{
- case 1:
+ case GDAEX_QE_PAGE_SHOW:
if (gtk_tree_selection_get_selected (priv->sel_show, NULL, &iter))
{
val1 = (gchar *)gtk_entry_get_text (GTK_ENTRY (priv->txt1));
}
break;
- case 2:
+ case GDAEX_QE_PAGE_WHERE:
if (gtk_tree_selection_get_selected (priv->sel_where, NULL, &iter))
{
GtkTreeModel *model;
}
break;
- case 3:
+ case GDAEX_QE_PAGE_ORDER:
if (gtk_tree_selection_get_selected (priv->sel_order, NULL, &iter))
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->opt_asc)))
if (gtk_tree_selection_get_selected (priv->sel_show, NULL, &iter))
{
- priv->editor_type = 1;
+ priv->editor_type = GDAEX_QE_PAGE_SHOW;
gtk_tree_selection_unselect_all (priv->sel_where);
gtk_tree_selection_unselect_all (priv->sel_order);
if (gtk_tree_selection_get_selected (priv->sel_where, NULL, &iter))
{
- priv->editor_type = 2;
+ priv->editor_type = GDAEX_QE_PAGE_WHERE;
gtk_tree_selection_unselect_all (priv->sel_show);
gtk_tree_selection_unselect_all (priv->sel_order);
if (gtk_tree_selection_get_selected (priv->sel_order, NULL, &iter))
{
- priv->editor_type = 3;
+ priv->editor_type = GDAEX_QE_PAGE_ORDER;
gtk_tree_selection_unselect_all (priv->sel_show);
gtk_tree_selection_unselect_all (priv->sel_where);