Patch level : 4.0 582

Files correlati     :  ve7.exe
Ricompilazione Demo : [ ]
Commento            :

Nella ricezione da galileo si devono esportare nel file di testo solo i record modificati


git-svn-id: svn://10.65.10.50/trunk@14711 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2007-01-03 15:49:20 +00:00
parent 6b06055dfe
commit eebf2d65ba
4 changed files with 47 additions and 13 deletions

View File

@ -2857,7 +2857,9 @@ int TSystemisamfile::dump(
char rs, // @parm Carattere separatore di record (default '\\n')
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (defualt TRUE)
bool withdeleted,// @parm Indica se scaricare anche i record cancellati (dafault FALSE)
const char * filter) // @parm Indica l'espressione filtro
const char * filter, // @parm Indica l'espressione filtro
SELECTIONFUNCTION select_func, // @parm funzione filtro
TObject * filter_obj) // @parm oggetto di filtro
// @xref <mf TSystemisamfile::load>
@ -2919,13 +2921,14 @@ int TSystemisamfile::dump(
{
TToken_string filter_str(filter);
TString16 fname;
bool skip = FALSE;
bool skip = false;
while (!skip && !(fname=filter_str.get()).empty())
{
const char* fval = filter_str.get();
const TString& cmp = get(fname);
skip = cmp != fval;
}
skip |= (select_func != NULL) && (select_func(curr(), filter_obj) == false);
if (skip)
continue;
}
@ -3029,14 +3032,15 @@ int TSystemisamfile::dump(
int TSystemisamfile::dump(
const char* to, // @parm Nome del file verso quale esportare
TToken_string & field_list, // @parm Lista dei campi
TAssoc_array * keys, // @parm lista delle chiavi primarie da esportare
int nkey, // @parm Numero della chiave di ordinamento con cui scaricare i dati (defualt 1)
char fs, // @parm Carattere seperatore di campo (defualt <pipe>)
char fd, // @parm Carattere delimitatore di campo (default '\\0')
char rs, // @parm Carattere separatore di record (default '\\n')
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (defualt TRUE)
bool withdeleted,// @parm Indica se scaricare anche i record cancellati (dafault FALSE)
const char * filter) // @parm Indica l'espressione filtro
const char * filter, // @parm Indica l'espressione filtro
SELECTIONFUNCTION select_func, // @parm funzione filtro
TObject * filter_obj) // @parm oggetto di filtro
// @xref <mf TSystemisamfile::load>
@ -3112,7 +3116,7 @@ int TSystemisamfile::dump(
skip = cmp != fval;
}
}
skip |= (keys != NULL) && (keys->objptr(curr().build_key(1)) == NULL);
skip |= (select_func != NULL) && (select_func(curr(), filter_obj) == false);
if (skip)
continue;
s = "";

View File

@ -562,6 +562,7 @@ public:
virtual ~TIsamfile();
};
typedef bool (*SELECTIONFUNCTION)(const TRectype & r, TObject * obj);
// @doc EXTERNAL
// @class TSystemisamfile | Classe per la definizione delle funzione per la creazione di un file
@ -615,8 +616,8 @@ public:
int overwrite(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = true) ;
// @cmember Esporta VERSO un file ascii.
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = true, bool withdeleted = false, const char * filter = NULL);
int dump(const char* to, TToken_string & field_list, TAssoc_array * keys = NULL, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = true, bool withdeleted = false, const char * filter = NULL);
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = true, bool withdeleted = false, const char * filter = NULL, SELECTIONFUNCTION select_func = NULL, TObject * filter_obj = NULL);
int dump(const char* to, TToken_string & field_list, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = true, bool withdeleted = false, const char * filter = NULL, SELECTIONFUNCTION select_func = NULL, TObject * filter_obj = NULL);
virtual word class_id() const { return CLASS_SYSTEMISAMFILE; }
virtual bool is_kind_of(word id) const { return id == class_id() || TIsamfile::is_kind_of(id); }

View File

@ -135,6 +135,7 @@ public:
virtual bool dump();
void set_data_limite(const TDate& data) { _data = data; }
void set_path(const TString& path) { _path = path; }
const TAssoc_array & keys() const { return _keys;}
TGalileo_clifo();
~TGalileo_clifo();
};
@ -144,7 +145,8 @@ class TGalileo_articoli : public TGalileo_transfer
TDate _data;
TString _path;
TAssoc_array _keys;
TAssoc_array _keys_articoli;
TAssoc_array _keys_umart;
protected:
int cancella_articolo(TLocalisamfile& clifo) const;
@ -153,6 +155,8 @@ protected:
public:
virtual bool trasferisci();
virtual bool dump();
const TAssoc_array & keys_articoli() const { return _keys_articoli;}
const TAssoc_array & keys_umart() const { return _keys_umart;}
void set_data_limite(const TDate& data) { _data = data; }
void set_path(const TString& path) { _path = path; }
TGalileo_articoli();

View File

@ -15,6 +15,13 @@
// TGalileo_clifo
///////////////////////////////////////////////////////////
bool select_clifo(const TRectype & rec, TObject * myself)
{
TGalileo_clifo * c = (TGalileo_clifo *) myself;
const TString key(rec.build_key());
return c->keys().objptr(key) != NULL;
}
int TGalileo_clifo::cancella_clifo(TLocalisamfile& clifo) const
{
return NOERR;
@ -78,7 +85,7 @@ bool TGalileo_clifo::dump()
TFilename path = _path;
path << "clifo.txt";
TSystemisamfile clifo(LF_CLIFO);
return (clifo.dump(path, lista_dump, &_keys) == NOERR);
return (clifo.dump(path, lista_dump, 1, '|', '\0', '\10', true, false, NULL, select_clifo, this) == NOERR);
}
bool TGalileo_clifo::trasferisci()
@ -208,6 +215,20 @@ TGalileo_clifo::~TGalileo_clifo()
// TGalileo_articoli
///////////////////////////////////////////////////////////
bool select_umart(const TRectype & rec, TObject * myself)
{
TGalileo_articoli * c = (TGalileo_articoli *) myself;
const TString key(rec.build_key());
return c->keys_umart().objptr(key) != NULL;
}
bool select_articoli(const TRectype & rec, TObject * myself)
{
TGalileo_articoli * c = (TGalileo_articoli *) myself;
const TString key(rec.build_key());
return c->keys_articoli().objptr(key) != NULL;
}
int TGalileo_articoli::cancella_articolo(TLocalisamfile& anamag) const
{
return NOERR;
@ -232,12 +253,12 @@ bool TGalileo_articoli::dump()
path << "umart.txt";
TSystemisamfile anamag(LF_ANAMAG);
TSystemisamfile umart(LF_UMART);
int err = umart.dump(path);
int err = umart.dump(path, NULL, 1, '|', '\0', '\10', true, false, NULL, select_umart, this) == NOERR;
if (err == NOERR)
{
path = _path;
path << "anamag.txt";
err = anamag.dump(path, lista_dump, &_keys);
err = anamag.dump(path, lista_dump, 1, '|', '\0', '\10', true, false, NULL, select_articoli, this) == NOERR;
}
return (err == NOERR);
}
@ -274,9 +295,9 @@ bool TGalileo_articoli::trasferisci()
rec_anamag.zero();
rec_anamag.put(ANAMAG_CODART, codart);
const TString16 key(rec_anamag.build_key(1));
const TString80 key(rec_anamag.build_key(1));
_keys.add(key, key);
_keys_articoli.add(key, key);
bool good = anamag.read() == NOERR;
@ -292,6 +313,10 @@ bool TGalileo_articoli::trasferisci()
rec_umart.zero();
rec_umart.put(UMART_CODART, codart);
rec_umart.put(UMART_NRIGA, 1);
const TString80 key_umart(rec_umart.build_key(1));
_keys_umart.add(key_umart, key_umart);
bool good = umart.read() == NOERR;
if (!good)
{