Aggiunto meccanismo per le conversioni di dati piu' complesse
git-svn-id: svn://10.65.10.50/trunk@669 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
30ff853857
commit
024fe5f5f3
@ -15,6 +15,8 @@
|
||||
#include <extcdecl.h>
|
||||
#include <scanner.h>
|
||||
#include <utility.h>
|
||||
#include <applicat.h>
|
||||
#include <mailbox.h>
|
||||
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
#include <sys/types.h>
|
||||
@ -885,6 +887,40 @@ long TSystemisamfile::size(TRecnotype eox)
|
||||
}
|
||||
|
||||
#ifndef FOXPRO
|
||||
bool TSystemisamfile::exec_convapp(long flev, const bool before)
|
||||
|
||||
{
|
||||
const char * const v = before ? "BCNV" : "ACNV";
|
||||
|
||||
if (flev == 0) flev = 199401;
|
||||
else flev++;
|
||||
for (long l = flev; l <= stdlevel; l++)
|
||||
{
|
||||
TString16 paragraph(format("%06ld", l));
|
||||
TConfig conv(CONFIG_FCONV, paragraph);
|
||||
|
||||
if (!conv.new_paragraph() && conv.exist(v, num()))
|
||||
{
|
||||
int err = 0;
|
||||
TString80 s(conv.get(v, NULL, num())); s << " " << main_app().get_firm();
|
||||
TExternal_app app(s);
|
||||
|
||||
if (app.can_run())
|
||||
{
|
||||
app.run();
|
||||
err = app.error();
|
||||
TMailbox mail;
|
||||
TMessage* msg = mail.next(TRUE);
|
||||
if (err == 0 && msg != NULL)
|
||||
err = atoi(msg->body());
|
||||
}
|
||||
else err = 16;
|
||||
if (err)
|
||||
return error_box("Non posso eseguire il programma di %sconversione\ndel livello %ld/%ld\nErrore n.ro %d", before ? "pre" : "post", l / 100, l % 100, err);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TSystemisamfile::getlcf(long flev)
|
||||
|
||||
@ -897,9 +933,8 @@ bool TSystemisamfile::getlcf(long flev)
|
||||
{
|
||||
TString16 paragraph(format("%06ld", l));
|
||||
TConfig conv(CONFIG_FCONV, paragraph);
|
||||
|
||||
|
||||
if (!conv.new_paragraph())
|
||||
if (!conv.new_paragraph() && conv.exist("F", num()))
|
||||
{
|
||||
TToken_string exprline(conv.get("F", NULL, num()));
|
||||
|
||||
@ -952,9 +987,15 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
TTrec oldrec;
|
||||
|
||||
oldrec.get(num());
|
||||
const bool lcf = getlcf(prefhndl->filelevel());
|
||||
const long lev = prefhndl->filelevel();
|
||||
const bool lcf = getlcf(lev);
|
||||
exec_convapp(lev, TRUE);
|
||||
|
||||
if (!lcf && newrec == oldrec) return NOERR;
|
||||
if (!lcf && newrec == oldrec)
|
||||
{
|
||||
exec_convapp(lev, FALSE);
|
||||
return NOERR;
|
||||
}
|
||||
|
||||
const TRecnotype nitems = dir.eod();
|
||||
const unsigned int lenr = newrec.len();
|
||||
@ -1021,6 +1062,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
dir.put(num(), _nordir, _sysdirop);
|
||||
newrec.put(num());
|
||||
if (toconvert && dir.eox() > 0L) packindex();
|
||||
exec_convapp(lev, FALSE);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -348,6 +348,7 @@ class TSystemisamfile : public TIsamfile
|
||||
TArray _exps;
|
||||
|
||||
bool getlcf(long flev);
|
||||
bool exec_convapp(long flev, const bool before);
|
||||
void makelc(TRectype& rec);
|
||||
|
||||
public:
|
||||
|
@ -60,7 +60,7 @@ $(LIB)(files.o): files.cpp $(I16) $(I28) $(I5) $(I10) $(I31)
|
||||
|
||||
$(LIB)(form.o): form.cpp $(I24) $(I33) $(I51) $(I39) $(I40) $(I31) bagn003.h
|
||||
|
||||
$(LIB)(isam.o): isam.cpp $(I30) $(I28) $(I37) $(I48) $(I39) $(I56) $(I12) $(I5) $(I17) $(I31)
|
||||
$(LIB)(isam.o): isam.cpp $(I24) $(I30) $(I28) $(I37) $(I48) $(I39) $(I56) $(I12) $(I5) $(I17) $(I31) $(I47)
|
||||
|
||||
$(LIB)(mailbox.o): mailbox.cpp $(I24) $(I47) $(I31)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user