{
error = NULL;
new_id = g_value_get_int (gda_data_model_get_value_at (dm, 0, 0, &error));
+
+ /* updating status */
+ sql = g_strdup_printf ("UPDATE %stables"
+ " SET status = ''"
+ " WHERE id = %d",
+ priv->commons->prefix,
+ new_id);
+ error = NULL;
+ stmt = gda_sql_parser_parse_string (priv->commons->gdaparser, sql, NULL, &error);
+ if (stmt == NULL || error != NULL)
+ {
+ gtk_widget_hide_all (dialog);
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Unable to get tables list.\n%s",
+ error != NULL && error->message != NULL ? error->message : "No details.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ break;
+ }
+
+ g_free (sql);
+
+ error = NULL;
+ if (gda_connection_statement_execute_non_select (priv->commons->gdacon, stmt, NULL, NULL, &error) != 1
+ || error != NULL)
+ {
+ gtk_widget_hide_all (dialog);
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Unable to get tables list.\n%s",
+ error != NULL && error->message != NULL ? error->message : "No details.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ break;
+ }
}
g_object_unref (stmt);
g_object_unref (dm);
if (g_strcmp0 (ids_fields_saved, "") != 0)
{
ids_fields_saved[strlen (ids_fields_saved) - 1] = '\0';
- sql = g_strdup_printf ("DELETE FROM %sfields AS f"
+ sql = g_strdup_printf ("UPDATE %sfields AS f"
+ " SET status = 'D'"
" WHERE f.id NOT IN (%s)"
" AND EXISTS (SELECT id FROM %stables AS t"
" WHERE f.id_tables = t.id"
if (g_strcmp0 (ids_tables_saved, "") != 0)
{
ids_tables_saved[strlen (ids_tables_saved) - 1] = '\0';
- sql = g_strdup_printf ("DELETE FROM %stables WHERE id NOT IN (%s)"
+ sql = g_strdup_printf ("UPDATE %stables "
+ " SET status = 'D'"
+ " WHERE id NOT IN (%s)"
" AND id_datasources = %d",
priv->commons->prefix,
ids_tables_saved,