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 (lavoro == "FIL")
{ {
if (!obj.blank()) if (!obj.blank())
{ {
bool condition = tc.filler() != obj[1]; bool condition = tc.filler() != obj[1];
if (condition) if (condition)
tc.set_filler(obj[0]); {
} if (obj.len() > 1)
continue; tc.set_filler(obj[1]);
} else
tc.set_filler(obj[0]);
}
}
continue;
}
if (lavoro == "PIC") if (lavoro == "PIC")
{ {
if (tc.picture().blank() && (!obj.blank())) if (tc.picture().blank() && (!obj.blank()))
@ -428,7 +433,9 @@ int TFile_text::write(TRecord_text& rec)
const TString& type = rec.type(); const TString& type = rec.type();
TTracciato_record& tr = *t_rec(type); TTracciato_record& tr = *t_rec(type);
TArray& a_tc = tr.tracciati_campo(); 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 if (_fixedlen) // campi a lunghezza fissa
{ {
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
@ -467,7 +474,8 @@ int TFile_text::write(TRecord_text& rec)
return 0; 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) void TFile_text::autoload(TRecord_text& rec, int mainfile)
{ {
TTracciato_record* tr = t_rec(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 const TString& type = rec.type();//prendo il tracciato record del tipo del record_text
TTracciato_record* tr = t_rec(type); TTracciato_record* tr = t_rec(type);
if (tr) if (tr)
if (tr->relation()->lfile().num()==mainfile) if (tr->relation())
return _autosave(*(tr->relation()),rec, *tr); if (tr->relation()->lfile().num()==mainfile)
return _autosave(*(tr->relation()),rec, *tr);
return NOERR; // l'assenza del tracciato non significa un errore 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()); const TRectype record(tc.field().file());
int length = record.length(tc.name()); int length = tc.field().len(record);
if (!fpicture(tc).blank()) if (!fpicture(tc).blank())
{ TString tmp; { TString tmp;
tmp.picture(fpicture(tc), campo); tmp.picture(fpicture(tc), campo);