Riportate modifiche dalla R9702:
1.113.2.7 ed 1.113.2.8, relative alla conversione dei tracciati record nel caso di variazione della lunghezza del campo. git-svn-id: svn://10.65.10.50/trunk@5416 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
053c2b9a8f
commit
7fa73a982c
@ -2105,7 +2105,7 @@ int TSystemisamfile::update(
|
|||||||
i0->fhnd=DB_open((const char*)tmpfname,0, TRUE);
|
i0->fhnd=DB_open((const char*)tmpfname,0, TRUE);
|
||||||
if (i0->fhnd < 0 ) err=get_error(i0->fhnd);
|
if (i0->fhnd < 0 ) err=get_error(i0->fhnd);
|
||||||
TFilename fname(filename());
|
TFilename fname(filename());
|
||||||
TString s(80);
|
TString s(80), fld_name, fld_val;
|
||||||
s.format("Aggiornamento archivio %s", (const char*) fname);
|
s.format("Aggiornamento archivio %s", (const char*) fname);
|
||||||
TProgind p(nitems ? nitems : 1, s, TRUE, TRUE, 70);
|
TProgind p(nitems ? nitems : 1, s, TRUE, TRUE, 70);
|
||||||
int nflds = curr().items();
|
int nflds = curr().items();
|
||||||
@ -2122,8 +2122,29 @@ int TSystemisamfile::update(
|
|||||||
nrec.zero();
|
nrec.zero();
|
||||||
ni++;
|
ni++;
|
||||||
for (j = 0; j < nflds; j++)
|
for (j = 0; j < nflds; j++)
|
||||||
if (nrec.exist((const TString&) fld[j]))
|
{
|
||||||
nrec.put((const TString&) fld[j], get((const TString&) fld[j]));
|
fld_name = (TString&) fld[j];
|
||||||
|
if (nrec.exist((fld_name)))
|
||||||
|
{
|
||||||
|
fld_val = get(fld_name);
|
||||||
|
// Se il campo e' di tipo stringa ed e' stato accorciato, tronca il contenuto,
|
||||||
|
// per evitare segnalazioni inutili in conversione. Nel caso di campo numerico
|
||||||
|
// viene "zappato"
|
||||||
|
// Questo trattamento non viene effettuato per i campi data
|
||||||
|
// perchè la get() restituisce una data formattata e quindi
|
||||||
|
// di lunghezza maggiore, ciò provoca una "zappatura" indiscriminata
|
||||||
|
// di tutti i campi data (fa pure rima) L.A.
|
||||||
|
TFieldtypes fld_type = nrec.type(fld_name);
|
||||||
|
if (fld_type != _datefld)
|
||||||
|
{
|
||||||
|
const int l1 = nrec.length(fld_name);
|
||||||
|
const int l2 = fld_val.len();
|
||||||
|
if ( l1 < l2)
|
||||||
|
fld_val.cut(fld_type == _alfafld ? l1 : 0);
|
||||||
|
}
|
||||||
|
nrec.put(fld_name, fld_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (lcf)
|
if (lcf)
|
||||||
makelc((TRectype &)nrec);
|
makelc((TRectype &)nrec);
|
||||||
browse_null(nrec.string(),DB_reclen(i0->fhnd));
|
browse_null(nrec.string(),DB_reclen(i0->fhnd));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user