Corrette la packfile() e la packindex() nel caso vengano chiamate dal
direttorio di una ditta per compattare un file residente nel direttorio comune. Modificati i costruttori di TRectype: tolto il controllo di '%' su filename; analogamente per la getisfd(). Modificate la build() e la update() nel caso venga passato un tracciato record vuoto. git-svn-id: svn://10.65.10.50/trunk@1622 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4db02131c2
commit
252c1f05f3
@ -139,7 +139,7 @@ HIDDEN void getisfd(isfdptr & isfd, int logicnum)
|
||||
isfd->d = new FileDes ;
|
||||
CGetFile(logicnum, isfd->d, _nolock, _nordir);
|
||||
const TFixed_string name(isfd->d->SysName);
|
||||
if (name.not_empty() && name[0] == '%')
|
||||
if (name.not_empty() && name[0] != '$')
|
||||
isfd->ft = _comdir;
|
||||
else
|
||||
isfd->ft = _nordir;
|
||||
@ -1369,12 +1369,15 @@ int TSystemisamfile::build(TRecnotype eox)
|
||||
|
||||
d.get(num());
|
||||
r.get(num());
|
||||
CHECK(r.len() != 0, "Can't create a file with empty field info");
|
||||
|
||||
TFilename f(d.name());
|
||||
|
||||
f = f.path(); if (!is_not_slash(f.right(1)[0])) f.rtrim(1);
|
||||
if (!fexist(f))
|
||||
make_dir(f);
|
||||
if (r.len() != 0)
|
||||
{
|
||||
err=DB_build(d.name(),r.rec());
|
||||
if (err == NOERR)
|
||||
{
|
||||
@ -1398,7 +1401,7 @@ int TSystemisamfile::build(TRecnotype eox)
|
||||
load(lf, '|', '\0', '\n', TRUE, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1520,6 +1523,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
|
||||
{
|
||||
CHECKS(filehnd() == NULL, "Can't update open file", (const char*)filename());
|
||||
CHECK(newrec.len() != 0, "Can't update to file with empty field info");
|
||||
|
||||
TDir dir;
|
||||
|
||||
@ -1532,6 +1536,8 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
TTrec oldrec;
|
||||
|
||||
oldrec.get(num());
|
||||
if (newrec.len() != 0)
|
||||
{
|
||||
const long lev = prefix().filelevel();
|
||||
const bool lcf = getlcf(lev);
|
||||
exec_convapp(lev, TRUE);
|
||||
@ -1636,6 +1642,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
newrec.put(num());
|
||||
if (toconvert && dir.eox() > 0L) packindex();
|
||||
exec_convapp(lev, FALSE);
|
||||
}
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
@ -1647,7 +1654,8 @@ int TSystemisamfile::packfile(bool vis)
|
||||
int err=NOERR;
|
||||
TDir d;
|
||||
|
||||
d.get(num());
|
||||
d.get(num(),_nolock, _nordir,_sysdirop);
|
||||
d.get(num(),_nolock, (d.is_com()) ? _comdir : _nordir);
|
||||
CHECKS(filehnd() == NULL, "Can't pack open file", (const char*)filename());
|
||||
err=DB_packfile(vis,d.name(),d.eod());
|
||||
if (err != NOERR) err = get_error(err);
|
||||
@ -1668,7 +1676,8 @@ int TSystemisamfile::packindex(bool vis)
|
||||
CHECKS(filehnd() == NULL, "Can't pack index of open file", (const char*)filename());
|
||||
|
||||
r.get(num());
|
||||
d.get(num());
|
||||
d.get(num(),_nolock, _nordir,_sysdirop);
|
||||
d.get(num(),_nolock, (d.is_com()) ? _comdir : _nordir);
|
||||
err=DB_packindex(vis,d.name(),r.rec(),&peod);
|
||||
if (err != NOERR) err = get_error(err);
|
||||
if (err != NOERR) error_box("Errore in compattamento indici.\nFile %d : %d", num(),err);
|
||||
@ -1676,7 +1685,7 @@ int TSystemisamfile::packindex(bool vis)
|
||||
if (peod >= 0 && peod != d.eod())
|
||||
{
|
||||
d.eod() = peod;
|
||||
d.put(num());
|
||||
d.put(num(),(d.is_com() ? _comdir : _nordir));
|
||||
}
|
||||
setstatus(err);
|
||||
return err;
|
||||
@ -1998,7 +2007,7 @@ TRectype::TRectype(int logicnum) : _cod(NULL)
|
||||
{
|
||||
TDir wdir;
|
||||
wdir.get(_logicnum, _nolock, _nordir, _sysdirop);
|
||||
if (wdir.name()[0] == '%')
|
||||
if (wdir.is_com())
|
||||
wdir.get(_logicnum, _nolock, _comdir, _sysdirop);
|
||||
_length = wdir.len();
|
||||
}
|
||||
@ -2017,7 +2026,7 @@ TRectype::TRectype(const TBaseisamfile* i): _cod(NULL)
|
||||
TDir wdir;
|
||||
|
||||
wdir.get(_logicnum, _nolock, _nordir, _sysdirop);
|
||||
if (wdir.name()[0] == '%')
|
||||
if (wdir.is_com())
|
||||
wdir.get(_logicnum, _nolock, _comdir, _sysdirop);
|
||||
_length = wdir.len();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user