Patch level : 10.0
Files correlati : agalib, lv Ricompilazione Demo : [ ] Commento : Corretta gestione tabelle di modulo. Correzioni importanti: Le ricerche sulle tabelle di modulo sono filtrate correttamente La descrizione della tabella di modulo viene reperita correttamente git-svn-id: svn://10.65.10.50/trunk@17015 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2398a832f0
commit
0b2aaa4eb9
@ -510,11 +510,9 @@ public:
|
||||
void zero(const char * fieldname)
|
||||
{ curr().zero(fieldname);}
|
||||
// @cmember Vuota il contenuto del record corrente
|
||||
virtual void zero()
|
||||
{ curr().zero();}
|
||||
virtual void zero() { curr().zero();}
|
||||
// @cmember Vuota tutto il record corrente usando il carattere <p c>
|
||||
void zero(char c)
|
||||
{ curr().zero(c);}
|
||||
void zero(char c) { curr().zero(c);}
|
||||
// @cmember Riempie il campo <p fieldname> del record corrente di spazi
|
||||
void blank(const char * fieldname)
|
||||
{ curr().blank(fieldname); }
|
||||
|
@ -2202,7 +2202,7 @@ int TBrowse::do_input(
|
||||
return ne;
|
||||
|
||||
TRectype& cur = _cursor->curr();
|
||||
cur.zero();
|
||||
_cursor->file(0).zero(); // was cur.zero() che non va bene per le tabelle di modulo
|
||||
TRectype filtrec(cur);
|
||||
|
||||
_inp_id.restart();
|
||||
@ -3196,10 +3196,15 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
TDir d; d.get(logicnum);
|
||||
if (fexist(d.filename())) // Controlla l'esistenza del file
|
||||
{
|
||||
if (logicnum >= LF_TABGEN && logicnum <= LF_TAB)
|
||||
switch (logicnum)
|
||||
{
|
||||
case LF_TABGEN:
|
||||
case LF_TABCOM:
|
||||
case LF_TAB:
|
||||
case LF_TABMOD:
|
||||
r = new TRelation(tablename);
|
||||
else
|
||||
{
|
||||
break;
|
||||
default:
|
||||
r = new TRelation(logicnum);
|
||||
tablename.cut(0);
|
||||
}
|
||||
@ -3242,7 +3247,7 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
}
|
||||
scanner.push();
|
||||
|
||||
if (tablename.not_empty())
|
||||
if (tablename.full())
|
||||
{
|
||||
tablename.insert("MTB", 0);
|
||||
browse()->set_insert(tablename);
|
||||
|
@ -51,7 +51,7 @@ bool TTable_module_application::user_create()
|
||||
|
||||
TString4 tabname = argv(2);
|
||||
tabname.upper();
|
||||
if (tabname.len() == 3)
|
||||
if (tabname[0] != '&')
|
||||
tabname.insert("&"); // Forza la tabella di modulo
|
||||
_rel = new TRelation(tabname);
|
||||
_msk = user_create_mask();
|
||||
|
@ -1073,10 +1073,18 @@ void TCursor_parser::parse_join_param(TRelation* rel, const TString& j, int to)
|
||||
yesnofatal_box("JOIN senza espressioni INTO");
|
||||
|
||||
const int logicnum = table2logic(j);
|
||||
if (logicnum != LF_TAB && logicnum != LF_TABCOM)
|
||||
switch (logicnum)
|
||||
{
|
||||
case LF_TABGEN:
|
||||
case LF_TABCOM:
|
||||
case LF_TAB:
|
||||
case LF_TABMOD:
|
||||
rel->add(j, exp, key, to, alias); // join table
|
||||
break;
|
||||
default:
|
||||
rel->add(logicnum, exp, key, to, alias); // join file
|
||||
else
|
||||
rel->add(j, exp, key, to, alias); // join table
|
||||
break;
|
||||
}
|
||||
|
||||
TString16 tabname;
|
||||
if (alias > 0)
|
||||
@ -1110,9 +1118,7 @@ void TCursor_parser::parse_sortedjoin()
|
||||
const TString j = pop(); // File or table
|
||||
const TString& tok = pop();
|
||||
if (tok == "BY" )
|
||||
{
|
||||
parse_sortexpr(sortexp);
|
||||
}
|
||||
else
|
||||
push();
|
||||
|
||||
|
@ -320,7 +320,7 @@ void TRelation::restore_status()
|
||||
|
||||
file(i).setkey(key);
|
||||
if (recno >= 0l) file(i).readat(recno);
|
||||
else file(i).curr().zero();
|
||||
else file(i).zero();
|
||||
file(i).setstatus(err);
|
||||
}
|
||||
_status.get(_files.items()*3 - 1); // mi riposiziono prima di tutti i first_match
|
||||
@ -546,7 +546,11 @@ bool TRelation::add(int logicnum, const char* relexprs, int key,
|
||||
bool TRelation::add(const char* tabname, const char* relexprs, int key,
|
||||
int linkto, int alias, bool allow_lock)
|
||||
{
|
||||
TTable* t = new TTable(tabname);
|
||||
TLocalisamfile* t = NULL;
|
||||
if (*tabname == '&')
|
||||
t = new TModule_table(tabname);
|
||||
else
|
||||
t = new TTable(tabname);
|
||||
return add(t, relexprs, key, linkto, alias, allow_lock);
|
||||
}
|
||||
|
||||
@ -581,8 +585,8 @@ void TRelation::replacef(
|
||||
|
||||
{
|
||||
int index=0;
|
||||
if (lognum<0) index=alias2ind(lognum);
|
||||
if (lognum>0) index=log2ind(lognum);
|
||||
if (lognum < 0) index=alias2ind(lognum);
|
||||
if (lognum > 0) index=log2ind(lognum);
|
||||
replace(f,index,relexprs,key);
|
||||
}
|
||||
|
||||
@ -1289,7 +1293,7 @@ TRecnotype TCursor::update()
|
||||
TLocalisamfile& f = file();
|
||||
f.setkey(_nkey);
|
||||
if (f.curr().empty())
|
||||
f.curr().zero();
|
||||
f.zero(); // Usare sempre l'azzeratore esperto del file non direttamente f.curr().zero()
|
||||
f.read(_isgteq);
|
||||
|
||||
_totrec = buildcursor(f.recno());
|
||||
@ -1349,13 +1353,27 @@ void TCursor::filter(
|
||||
|
||||
{
|
||||
TString kf(_keyfrom), kto(_keyto);
|
||||
|
||||
const bool filterchanged = (fil != NULL) && (_filter != fil);
|
||||
|
||||
if (file().tab())
|
||||
switch (file().num())
|
||||
{
|
||||
const TTable& f = (const TTable&)file();
|
||||
kf = kto = f.name();
|
||||
case LF_TABGEN:
|
||||
case LF_TABCOM:
|
||||
case LF_TAB:
|
||||
{
|
||||
const TTable& f = (const TTable&)file();
|
||||
kf = kto = f.name();
|
||||
};
|
||||
break;
|
||||
case LF_TABMOD:
|
||||
{
|
||||
const TModule_table& t = (TModule_table&)file();
|
||||
kf.format("%2s%6ld%3s", (const char*)t.module(), t.customer(), (const char*)t.name());
|
||||
kto = kf;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (from != NULL)
|
||||
matildator(*from, _nkey, (tilde & 0x1) != 0, kf);
|
||||
@ -1587,7 +1605,7 @@ TCursor::TCursor(TRelation* r, const char* fil, int nkey,
|
||||
_totrec = 0;
|
||||
_lastrec = 0;
|
||||
_lastkrec = 0;
|
||||
_pagefirstpos = 0L,
|
||||
_pagefirstpos = 0L;
|
||||
|
||||
_page = new TRecnotype[_cmaxelpage];
|
||||
memset(_page, 0, _cmaxelpage * sizeof(TRecnotype));
|
||||
@ -1620,7 +1638,7 @@ TRecnotype TCursor::readrec()
|
||||
if (_pos >= items())
|
||||
{
|
||||
file().setstatus(_iseof);
|
||||
curr().zero();
|
||||
file().zero();
|
||||
return nrec;
|
||||
}
|
||||
file().setstatus(NOERR);
|
||||
|
@ -20,13 +20,8 @@ TModule_table::TModule_table(const char* tabname, const char* module, long custo
|
||||
if (_customer <= 0L && real::is_natural(appname.mid(3)))
|
||||
_customer = atol(app.mid(2));
|
||||
}
|
||||
// @cmember Vuota tutto il record usando il carattere <p c>
|
||||
void TModule_table::zero(char c)
|
||||
{
|
||||
zero(curr(), c);
|
||||
}
|
||||
|
||||
void TModule_table::zero(TRectype & rec, char c)
|
||||
void TModule_table::zero_rec(TRectype& rec, char c)
|
||||
{
|
||||
rec.zero(c);
|
||||
rec.put("COD", _tabname);
|
||||
@ -34,6 +29,18 @@ void TModule_table::zero(TRectype & rec, char c)
|
||||
rec.put("CUST", _customer);
|
||||
}
|
||||
|
||||
// @cmember Vuota tutto il record
|
||||
void TModule_table::zero()
|
||||
{
|
||||
zero_rec(curr(), '\0');
|
||||
}
|
||||
|
||||
// @cmember Vuota tutto il record usando il carattere <p c>
|
||||
void TModule_table::zero(char c)
|
||||
{
|
||||
zero_rec(curr(), c);
|
||||
}
|
||||
|
||||
bool TModule_table::in_table() const
|
||||
{
|
||||
const TRectype& rec = curr();
|
||||
@ -69,18 +76,18 @@ int TModule_table::_read(TRectype& rec, word op, word lockop)
|
||||
{
|
||||
case _isfirst:
|
||||
{
|
||||
zero(rec);
|
||||
zero_rec(rec, '\0');
|
||||
TBaseisamfile::_read(rec, _isgteq, lockop);
|
||||
|
||||
if (not_in_table())
|
||||
setstatus(_isemptyfile);
|
||||
if (bad())
|
||||
zero(rec);
|
||||
zero_rec(rec, '\0');
|
||||
}
|
||||
break;
|
||||
case _islast:
|
||||
{
|
||||
zero(rec);
|
||||
zero_rec(rec, '\0');
|
||||
put("CODTAB", "\xFF");
|
||||
TBaseisamfile::_read(rec, _isgteq);
|
||||
if (!eof())
|
||||
@ -92,7 +99,7 @@ int TModule_table::_read(TRectype& rec, word op, word lockop)
|
||||
if (not_in_table())
|
||||
setstatus(_isemptyfile);
|
||||
if (bad())
|
||||
zero(rec);
|
||||
zero_rec(rec, '\0');
|
||||
}
|
||||
break;
|
||||
case _isprev:
|
||||
@ -188,10 +195,10 @@ void TModule_table::load_module_description()
|
||||
c.format("%06ld", _customer);
|
||||
n << c;
|
||||
}
|
||||
n << _tabname;
|
||||
n << "tb" << _tabname;
|
||||
n.ext("msk");
|
||||
|
||||
if (n.exist())
|
||||
if (n.custom_path())
|
||||
{
|
||||
TScanner m(n);
|
||||
bool ok = true;
|
||||
|
@ -40,13 +40,13 @@ protected:
|
||||
bool in_table() const ;
|
||||
// @cmember Testa se il record fa non parte della tabella
|
||||
bool not_in_table() const { return !in_table(); }
|
||||
// @cmember Vuota tutto il record passato usando il carattere <p c>
|
||||
void zero_rec(TRectype& rec, char c);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Salta <p nrec> record dalla posizione corrente
|
||||
virtual int skip(TRecnotype nrec, word lockop = _nolock);
|
||||
// @cmember Controlla se si tratta di una tabella (ritorna sempre TRUE)
|
||||
virtual bool tab() const { return true; }
|
||||
// @cmember Ritorna il nome della tabella
|
||||
virtual const char* name() const { return _tabname;}
|
||||
// @cmember Ritorna il modulo al quale appartiene la tabella
|
||||
@ -60,11 +60,10 @@ public:
|
||||
virtual bool empty();
|
||||
// @cmember Ritorna la relapp che gestisce la tabella
|
||||
virtual bool get_relapp(TString& app) const;
|
||||
// @cmember Vuota tutto il record
|
||||
virtual void zero();
|
||||
// @cmember Vuota tutto il record usando il carattere <p c>
|
||||
virtual void zero(char c = '\0');
|
||||
// @cmember Vuota tutto il record passato usando il carattere <p c>
|
||||
void zero(TRectype & rec, char c = '\0');
|
||||
|
||||
|
||||
// @cmember Ritorna il numero logico della tabella <p tabname>
|
||||
static int name2log(const char* tabname) { return LF_TABGEN;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user