}
}
-/* Converts all the temporary transformations, if any, to
- permanent transformations. Further transformations will be
- permanent.
+/* Converts all the temporary transformations, if any, to permanent
+ transformations. Further transformations will be permanent.
+
+ The FILTER command is implemented as a temporary transformation, so a
+ procedure that uses this function should usually use proc_open_filtering()
+ with FILTER false, instead of plain proc_open().
+
Returns true if anything changed, false otherwise. */
bool
proc_make_temporary_transformations_permanent (struct dataset *ds)
if (active_file == NULL)
{
proc_discard_output (ds);
- file->reader = active_file = proc_open (ds);
+ file->reader = active_file = proc_open_filtering (ds, false);
}
else
file->reader = casereader_clone (active_file);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2010, 2011, 2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
goto error;
}
- ok = casereader_destroy (proc_open (ds));
+ ok = casereader_destroy (proc_open_filtering (ds, false));
ok = proc_commit (ds) && ok;
if (!ok)
goto error;
dsc->vars[i].moments = moments_create (dsc->max_moment);
/* Data pass. */
- grouper = casegrouper_create_splits (proc_open (ds), dict);
+ grouper = casegrouper_create_splits (proc_open_filtering (ds, z_cnt == 0),
+ dict);
while (casegrouper_get_next_group (grouper, &group))
calc_descriptives (dsc, group, ds);
ok = casegrouper_destroy (grouper);
flip->encoding = dict_get_encoding (new_dict);
dict_clear (new_dict);
- input = proc_open (ds);
+ input = proc_open_filtering (ds, false);
while ((c = casereader_read (input)) != NULL)
{
flip->n_cases++;
int k;
struct regression regression;
const struct dictionary *dict = dataset_dict (ds);
+ bool save;
memset (®ression, 0, sizeof (struct regression));
regression.models = xcalloc (regression.n_dep_vars, sizeof *regression.models);
- if (regression.pred || regression.resid)
+ save = regression.pred || regression.resid;
+ if (save)
{
if (proc_make_temporary_transformations_permanent (ds))
msg (SW, _("REGRESSION with SAVE ignores TEMPORARY. "
struct casereader *group;
bool ok;
- grouper = casegrouper_create_splits (proc_open (ds), dict);
+ grouper = casegrouper_create_splits (proc_open_filtering (ds, !save),
+ dict);
while (casegrouper_get_next_group (grouper, &group))
run_regression (®ression, group);
ok = casegrouper_destroy (grouper);
ok = proc_commit (ds) && ok;
}
- if (regression.pred || regression.resid )
+ if (save)
{
subcommand_save (®ression);
}
tests/language/data-io/save-translate.at \
tests/language/data-io/update.at \
tests/language/dictionary/attributes.at \
+ tests/language/dictionary/delete-variables.at \
tests/language/dictionary/formats.at \
tests/language/dictionary/missing-values.at \
tests/language/dictionary/mrsets.at \
--- /dev/null
+AT_BANNER([DELETE VARIABLES])
+
+dnl Checks for regressions against a crash reported in bug #38843.
+AT_SETUP([DELETE VARIABLES with FILTER])
+AT_DATA([delete-variables.sps], [dnl
+DATA LIST LIST /a b.
+BEGIN DATA.
+1 3
+4 6
+7 9
+END DATA.
+
+FILTER BY b.
+DELETE VARIABLES a.
+LIST.
+])
+AT_CHECK([pspp -O format=csv delete-variables.sps], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+a,F8.0
+b,F8.0
+
+Table: Data List
+b
+3.00
+6.00
+9.00
+])
+AT_CLEANUP