Corretti i filler

Corretto l'uso della lunghezza del campo
Corretto bug di autosave


git-svn-id: svn://10.65.10.50/trunk@5364 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
sauro 1997-10-14 08:26:26 +00:00
parent 327cac43fb
commit 25a5d5d8bc

View File

@ -279,14 +279,19 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section)
}
if (lavoro == "FIL")
{
if (!obj.blank())
{
bool condition = tc.filler() != obj[1];
if (condition)
tc.set_filler(obj[0]);
}
continue;
}
if (!obj.blank())
{
bool condition = tc.filler() != obj[1];
if (condition)
{
if (obj.len() > 1)
tc.set_filler(obj[1]);
else
tc.set_filler(obj[0]);
}
}
continue;
}
if (lavoro == "PIC")
{
if (tc.picture().blank() && (!obj.blank()))
@ -428,7 +433,9 @@ int TFile_text::write(TRecord_text& rec)
const TString& type = rec.type();
TTracciato_record& tr = *t_rec(type);
TArray& a_tc = tr.tracciati_campo();
int items = rec.items();
int items = rec.items();
if (_typepos>=0)
rec.add(type,_typepos);
if (_fixedlen) // campi a lunghezza fissa
{
for (int i = 0; i < items; i++)
@ -467,7 +474,8 @@ int TFile_text::write(TRecord_text& rec)
return 0;
}
//Carica tutti i dati nel tracciato record (valido anche per header e footer) nel record_text
// Carica tutti i dati del tracciato record (anche header o footer)
// nel record_text
void TFile_text::autoload(TRecord_text& rec, int mainfile)
{
TTracciato_record* tr = t_rec(mainfile);
@ -520,8 +528,9 @@ int TFile_text::autosave(int mainfile, const TRecord_text& rec)
const TString& type = rec.type();//prendo il tracciato record del tipo del record_text
TTracciato_record* tr = t_rec(type);
if (tr)
if (tr->relation()->lfile().num()==mainfile)
return _autosave(*(tr->relation()),rec, *tr);
if (tr->relation())
if (tr->relation()->lfile().num()==mainfile)
return _autosave(*(tr->relation()),rec, *tr);
return NOERR; // l'assenza del tracciato non significa un errore
}
@ -691,7 +700,7 @@ TString& TFile_text::format_field(const TTracciato_campo& tc, TString& campo)
{
const TRectype record(tc.field().file());
int length = record.length(tc.name());
int length = tc.field().len(record);
if (!fpicture(tc).blank())
{ TString tmp;
tmp.picture(fpicture(tc), campo);