Patch level : 2.2

Files correlati     : ca0
Ricompilazione Demo : [ ]
Commento            :

Corretta numerazione automatica standard dei TMultiple_rectype


git-svn-id: svn://10.65.10.50/trunk@12972 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-04-21 11:08:06 +00:00
parent 19236f1843
commit d4f9142d40
3 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,5 @@
#include <stdlib.h>
#include <multirec.h>
#include <relation.h>
@ -7,15 +9,17 @@ bool TMultiple_rectype::key_complete() const
const KeyDes& kd = recd.Ky[0];
const int nf = kd.FieldSeq[kd.NkFields - 1] % MaxFields; //posizione ultimo campo chiave principale
const RecFieldDes& rf = recd.Fd[nf];
const int type = rf.TypeF;
if (type == _intfld || type == _longfld ||
type == _intzerofld || type == _longzerofld)
{
const long num = get_long(rf.Name);
return num > 0;
}
return true;
const TString& val = get(rf.Name);
bool ok = !val.blank();
if (ok)
{
const int type = rf.TypeF; // Controllo meglio i campi numerici
if (type == _intfld || type == _longfld || type == _intzerofld || type == _longzerofld)
ok = atol(val) > 0;
}
return ok;
}
//assegna il prossimo numero all'ultimo campo della chiave principale della testata
@ -25,7 +29,11 @@ bool TMultiple_rectype::renum()
const KeyDes& kd = recd.Ky[0];
const int nf = kd.FieldSeq[kd.NkFields - 1] % MaxFields; //posizione ultimo campo chiave principale
const RecFieldDes& rf = recd.Fd[nf];
const int type = rf.TypeF; // Controllo che il campo sia numerico
if (type != _intfld && type != _longfld && type != _intzerofld && type != _longzerofld)
return false;
TRectype::zero(rf.Name); //azzera il contenuto del campo chiave numerico
long next_num = 1;
@ -51,7 +59,7 @@ bool TMultiple_rectype::renum()
put(rf.Name, next_num);
return false;
return true;
}
void TMultiple_rectype::set_body_key(TRectype & rowrec)

View File

@ -2324,7 +2324,7 @@ const char* TFieldref::read(const TRelation& r) const
void TFieldref::write(const char* val, TRelation& r) const
{
TRectype &rec = _id.empty() ? r.curr() : r.lfile(_id).curr();
TRectype& rec = _id.empty() ? r.curr() : r.lfile(_id).curr();
write(val, rec);
}

View File

@ -66,10 +66,10 @@ TString& TTable_application::get_mask_name(TString& t) const
t = tab.module();
t << "tb" << m;
t.upper();
t.lower();
TFilename n(t); n.ext("msk");
if (!n.exist())
if (!n.custom_path())
t.overwrite("ba");
return t;
}