fix one of the bugs seth found in the input framework.

(bug in PutTable when the table contained only one element and that element should not be wrapped into a record)
This commit is contained in:
Bernhard Amann 2012-02-22 10:46:35 -08:00
parent 7e5f733826
commit 93fac7a4be
5 changed files with 388 additions and 7 deletions

View file

@ -1083,12 +1083,11 @@ int Manager::PutTable(const ReaderFrontend* reader, int id, const Value* const *
Val* idxval = ValueToIndexVal(filter->num_idx_fields, filter->itype, vals);
Val* valval;
int position = filter->num_idx_fields;
if ( filter->num_val_fields == 0 ) {
valval = 0;
} else if ( filter->num_val_fields == 1 && !filter->want_record ) {
valval = ValueToVal(vals[filter->num_idx_fields], filter->rtype->FieldType(filter->num_idx_fields));
} else if ( filter->num_val_fields == 1 && filter->want_record == 0 ) {
valval = ValueToVal(vals[position], filter->rtype->FieldType(0));
} else {
valval = ValueToRecordVal(vals, filter->rtype, &position);
}
@ -1130,6 +1129,7 @@ int Manager::PutTable(const ReaderFrontend* reader, int id, const Value* const *
if ( filter->num_val_fields > 0 )
vl.append(valval);
Val* v = filter->pred->Call(&vl);
bool result = v->AsBool();
Unref(v);