Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Implementato nuovo nnonche' fantastico costruttore dei TRecord_array. Provare per credere. Parola di Guido ... Angeli git-svn-id: svn://10.65.10.50/trunk@12689 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
08d0526d91
commit
4381888011
@ -23,5 +23,6 @@
|
|||||||
#define CAU_SOSPESO "SOSPESO"
|
#define CAU_SOSPESO "SOSPESO"
|
||||||
#define CAU_VALINTRA "VALINTRA"
|
#define CAU_VALINTRA "VALINTRA"
|
||||||
#define CAU_SOLOIVA "SOLOIVA"
|
#define CAU_SOLOIVA "SOLOIVA"
|
||||||
|
#define CAU_MOVIND "MOVIND"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define PCN_CMSNEEDED "CMSNEEDED"
|
#define PCN_CMSNEEDED "CMSNEEDED"
|
||||||
#define PCN_CODCMS "CODCMS"
|
#define PCN_CODCMS "CODCMS"
|
||||||
#define PCN_FASCMS "FASCMS"
|
#define PCN_FASCMS "FASCMS"
|
||||||
|
#define PCN_ANALITICA "ANALITICA"
|
||||||
|
|
||||||
#define PCN_ANALITICA "ANALITICA"
|
#define PCN_ANALITICA "ANALITICA"
|
||||||
|
|
||||||
|
@ -26,6 +26,34 @@ TRecord_array::TRecord_array(const TRecord_array& a)
|
|||||||
copy(a);
|
copy(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Questo si che e' il costruttore dei miei sogni
|
||||||
|
// Senza cavolate come numfield o necessita' di interi record come chiave!
|
||||||
|
TRecord_array::TRecord_array(const char* keytok, int logicnum, int first)
|
||||||
|
: _file(logicnum), _offset(first - 1)
|
||||||
|
{
|
||||||
|
const RecDes& rd = prefix().get_recdes(logicnum); // Tracciato record del file
|
||||||
|
const KeyDes& kd = rd.Ky[0]; // Tracciato della chiave primaria
|
||||||
|
const int nLast = kd.FieldSeq[kd.NkFields-1] % MaxFields; // Posizione dell'ultimo campo della chiave
|
||||||
|
_num = rd.Fd[nLast].Name; // Nome dell'ultimo campo della chiave
|
||||||
|
|
||||||
|
TRectype* keyrec = new TRectype(logicnum); // Record chiave (vuoto)
|
||||||
|
|
||||||
|
if (keytok && *keytok) // La stringa chiave non e' vuota
|
||||||
|
{
|
||||||
|
const TToken_string key(keytok);
|
||||||
|
TString80 val; // Un campo chiave non puo' mai superare i 50
|
||||||
|
for (int i = 0; i < kd.NkFields-1; i++) // Riempio "quasi" tutta la chiave primaria
|
||||||
|
{
|
||||||
|
const int nPos = kd.FieldSeq[i] % MaxFields; // Posizione del campo i della chiave
|
||||||
|
const char* field = rd.Fd[nPos].Name; // Nome del campo i della chiave
|
||||||
|
key.get(i, val); // Valore del campo i della chiave
|
||||||
|
keyrec->put(field, val); // Riempio il campo chiave corrispondente
|
||||||
|
}
|
||||||
|
}
|
||||||
|
read(keyrec); // Leggo o inizializzo l'array vuoto
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TRecord_array::~TRecord_array()
|
TRecord_array::~TRecord_array()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,8 @@ public:
|
|||||||
TRecord_array(int logicnum, const char* numfield, int first = 1);
|
TRecord_array(int logicnum, const char* numfield, int first = 1);
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TRecord_array(const TRecord_array& a);
|
TRecord_array(const TRecord_array& a);
|
||||||
|
// @cmember Costruttore moderno (c) by Guy
|
||||||
|
TRecord_array(const char* keytok, int logicnum, int first = 1);
|
||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
virtual ~TRecord_array();
|
virtual ~TRecord_array();
|
||||||
};
|
};
|
||||||
|
@ -1147,21 +1147,20 @@ int TRelation_application::write(const TMask& m)
|
|||||||
|
|
||||||
int TRelation_application::rewrite(const TMask& m)
|
int TRelation_application::rewrite(const TMask& m)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
|
|
||||||
TRelation& r = *get_relation();
|
TRelation& r = *get_relation();
|
||||||
m.autosave(r);
|
m.autosave(r);
|
||||||
// rewrite relation and all independent sheets
|
// rewrite relation and all independent sheets
|
||||||
r.rewrite();
|
r.rewrite();
|
||||||
err=r.status();
|
int err=r.status();
|
||||||
const int max = m.fields();
|
const int max = m.fields();
|
||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
if (m.fld(i).is_sheet()) {
|
if (m.fld(i).is_sheet())
|
||||||
TSheet_field& f = (TSheet_field& )m.fld(i);
|
{
|
||||||
|
TSheet_field& f = (TSheet_field&)m.fld(i);
|
||||||
if (f.record()&& !f.external_record())
|
if (f.record()&& !f.external_record())
|
||||||
err|=f.record()->write(TRUE);
|
err|=f.record()->write(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ int TRelation::write(bool force)
|
|||||||
int TRelation::rewrite(bool force)
|
int TRelation::rewrite(bool force)
|
||||||
{
|
{
|
||||||
_errors = file(0).rewrite(); // Riscrive testata
|
_errors = file(0).rewrite(); // Riscrive testata
|
||||||
if (force && _errors == _iskeynotfound) // Se non la trova ...
|
if (force && _errors == _iskeynotfound) // Se non la trova ...
|
||||||
_errors = file(0).write(); // ... forza la scrittura
|
_errors = file(0).write(); // ... forza la scrittura
|
||||||
|
|
||||||
for (int i = 0; i < _reldefs.items(); i++)
|
for (int i = 0; i < _reldefs.items(); i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user