[libgda] data-select: removed "auto-update" property



commit d4dd61f8f05bb0f8301b5c95160644ab7fca19b7
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Fri Feb 15 17:10:02 2019 -0600

    data-select: removed "auto-update" property
    
    This a feature better supported by GdaDataModelSelect

 libgda/gda-data-select.c                 | 40 --------------------------------
 libgda/sqlite/gda-sqlite-recordset.c     |  3 +--
 tools/browser/data-manager/data-source.c |  1 -
 3 files changed, 1 insertion(+), 43 deletions(-)
---
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index d49df2ce5..2c0122f52 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -77,7 +77,6 @@ typedef struct {
 
        GdaStatement           *sel_stmt;
        GdaSet                 *ext_params;
-       gboolean                reset_with_ext_params_change;
        GdaDataModelAccessFlags usage_flags;
 
        /* attributes specific to data model modifications */
@@ -158,7 +157,6 @@ enum
        PROP_UPD_QUERY,
        PROP_DEL_QUERY,
        PROP_SEL_STMT,
-       PROP_RESET_WITH_EXT_PARAM,
        PROP_EXEC_DELAY
 };
 
@@ -203,7 +201,6 @@ static GdaStatement *compute_single_insert_stmt (GdaDataSelect *model, BVector *
 static GdaStatement *compute_single_select_stmt (GdaDataSelect *model, GError **error);
 static gint *compute_insert_select_params_mapping (GdaSet *sel_params, GdaSet *ins_values, GdaSqlExpr 
*row_cond);
 
-static void ext_params_holder_changed_cb (GdaSet *paramlist, GdaHolder *param, GdaDataSelect *model);
 static gboolean check_data_model_for_updates (GdaDataSelect *imodel,
                               gint col,
                               const GValue *value,
@@ -334,12 +331,6 @@ gda_data_select_class_init (GdaDataSelectClass *klass)
                                                              "SELECT statement which was executed to yield 
to the data model",
                                                              GDA_TYPE_STATEMENT, G_PARAM_READABLE));
 
-       g_object_class_install_property (object_class, PROP_RESET_WITH_EXT_PARAM,
-                                        g_param_spec_boolean ("auto-reset", "Automatically reset itself",
-                                                              "Automatically re-run the SELECT statement if 
any parameter "
-                                                              "has changed since it was first executed", 
FALSE,
-                                                              G_PARAM_READABLE | G_PARAM_WRITABLE));
-
        /**
         * GdaDataSelect:execution-delay:
         *
@@ -404,7 +395,6 @@ gda_data_select_init (GdaDataSelect *model)
 
        priv->sh->sel_stmt = NULL;
        priv->sh->ext_params = NULL;
-       priv->sh->reset_with_ext_params_change = FALSE;
 
        priv->sh->iter_row = G_MININT;
        priv->ext_params_changed_sig_id = 0;
@@ -434,20 +424,6 @@ gda_data_select_init (GdaDataSelect *model)
        priv->sh->current_prow_row = -1;
 }
 
-static void
-ext_params_holder_changed_cb (G_GNUC_UNUSED GdaSet *paramlist, G_GNUC_UNUSED GdaHolder *param,
-                             GdaDataSelect *model)
-{
-       GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (model);
-       if (priv->sh->reset_with_ext_params_change) {
-               GError *error = NULL;
-               if (! gda_data_select_rerun (model, &error)) {
-                       g_warning (_("Could not re-run SELECT statement: %s"),
-                                  error && error->message ? error->message : _("No detail"));
-                       g_clear_error (&error);
-               }
-       }
-}
 
 static void
 free_private_shared_data (GdaDataSelect *model)
@@ -768,9 +744,6 @@ gda_data_select_set_property (GObject *object,
                        set = g_value_get_object (value);
                        if (set) {
                                priv->sh->ext_params = g_object_ref (set);
-                               priv->ext_params_changed_sig_id =
-                                       g_signal_connect (priv->sh->ext_params, "holder-changed",
-                                                         G_CALLBACK (ext_params_holder_changed_cb), 
GDA_DATA_SELECT (object));
                                priv->sh->modif_internals->exec_set = gda_set_copy (set);
                        }
                        break;
@@ -802,9 +775,6 @@ gda_data_select_set_property (GObject *object,
                        g_free (priv->sh->modif_internals->cols_mod[UPD_QUERY]);
                        priv->sh->modif_internals->cols_mod[UPD_QUERY] = NULL;
                        break;
-               case PROP_RESET_WITH_EXT_PARAM:
-                       priv->sh->reset_with_ext_params_change = g_value_get_boolean (value);
-                       break;
                case PROP_EXEC_DELAY:
                        priv->exec_time = g_value_get_double (value);
                        break;
@@ -858,9 +828,6 @@ gda_data_select_get_property (GObject *object,
                case PROP_SEL_STMT:
                        g_value_set_object (value, check_acceptable_statement (model, NULL));
                        break;
-               case PROP_RESET_WITH_EXT_PARAM:
-                       g_value_set_boolean (value, priv->sh->reset_with_ext_params_change);
-                       break;
                case PROP_EXEC_DELAY:
                        g_value_set_double (value, priv->exec_time);
                        break;
@@ -3764,7 +3731,6 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
        /* we need to keep some data from the old model */
        GdaDataSelectInternals *mi;
 
-       priv->sh->reset_with_ext_params_change = old_priv->sh->reset_with_ext_params_change;
        priv->sh->notify_changes = old_priv->sh->notify_changes;
        mi = old_priv->sh->modif_internals;
        old_priv->sh->modif_internals = priv->sh->modif_internals;
@@ -3774,12 +3740,6 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
        old_priv->sh->sel_stmt = priv->sh->sel_stmt;
        priv->sh->sel_stmt = (GdaStatement*) copy;
 
-       if (priv->sh->ext_params) {
-               priv->ext_params_changed_sig_id =
-                       g_signal_connect (priv->sh->ext_params, "holder-changed",
-                                         G_CALLBACK (ext_params_holder_changed_cb), model);
-       }
-
        /* keep the same GdaColumn pointers */
        GSList *l1, *l2;
        l1 = old_priv->sh->columns;
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index 00d447ea6..025640d08 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -311,8 +311,7 @@ _gda_sqlite_recordset_new (GdaConnection *cnc, GdaSqlitePStmt *ps, GdaSet *exec_
         model = g_object_new (GDA_TYPE_SQLITE_RECORDSET,
                              "connection", cnc,
                              "prepared-stmt", ps, "model-usage", rflags, 
-                             "exec-params", exec_params, 
-                             "auto-reset", force_empty, NULL);
+                             "exec-params", exec_params, NULL);
        gboolean is_virt;
        is_virt = GDA_IS_VCONNECTION_DATA_MODEL (cnc) ? TRUE : FALSE;
        if (is_virt) {
diff --git a/tools/browser/data-manager/data-source.c b/tools/browser/data-manager/data-source.c
index 272dff3a0..6ba9240f8 100644
--- a/tools/browser/data-manager/data-source.c
+++ b/tools/browser/data-manager/data-source.c
@@ -918,7 +918,6 @@ data_source_execute (DataSource *source, GError **error)
                                        if (source->priv->model)
                                                g_object_unref (source->priv->model);
                                        source->priv->model = GDA_DATA_MODEL (result);
-                                       g_object_set (source->priv->model, "auto-reset", FALSE, NULL);
                                }
                                gda_data_model_dump (source->priv->model, NULL);
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]