Patch level : 10.0
Files correlati : *.exe Ricompilazione Demo : [ ] Commento : Potenziata gestione tabelle di modulo in modo da poter utilizzate in moduli diversi da quello di stretta appartenenza git-svn-id: svn://10.65.10.50/trunk@17234 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
888c0fb3fc
commit
474c581215
@ -603,8 +603,7 @@ const TObject& TFile_cache::query(const char* code)
|
|||||||
{
|
{
|
||||||
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
|
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
|
||||||
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave
|
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave
|
||||||
const int fi = f.tab() ? 1 : (f.num() == LF_TABMOD ? 2 : 0);
|
for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||||
for (int i = fi; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
|
||||||
{
|
{
|
||||||
const int nf = kd.FieldSeq[i] % MaxFields;
|
const int nf = kd.FieldSeq[i] % MaxFields;
|
||||||
const RecFieldDes& rf = recd->Fd[nf];
|
const RecFieldDes& rf = recd->Fd[nf];
|
||||||
@ -796,19 +795,26 @@ TRecord_cache& TDB_cache::rec_cache(int file)
|
|||||||
int TDB_cache::build_table_key(const char* table, const char* key, TToken_string& k) const
|
int TDB_cache::build_table_key(const char* table, const char* key, TToken_string& k) const
|
||||||
{
|
{
|
||||||
int file = LF_TAB;
|
int file = LF_TAB;
|
||||||
|
k.cut(0);
|
||||||
if (!isalnum(*table)) // gestisco i casi come %IVA e &AUT
|
if (!isalnum(*table)) // gestisco i casi come %IVA e &AUT
|
||||||
{
|
{
|
||||||
switch (*table)
|
switch (*table)
|
||||||
{
|
{
|
||||||
case '%': file = LF_TABCOM; break;
|
case '%': file = LF_TABCOM; break;
|
||||||
case '^': file = LF_TABGEN; break;
|
case '^': file = LF_TABGEN; break;
|
||||||
case '&': file = LF_TABMOD; break;
|
case '&': file = LF_TABMOD;
|
||||||
|
{
|
||||||
|
const TModule_table mt(table);
|
||||||
|
k = mt.module();
|
||||||
|
k.add(mt.customer());
|
||||||
|
}
|
||||||
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
default : file = LF_TAB; break;
|
default : file = LF_TAB; break;
|
||||||
}
|
}
|
||||||
table++; // Skippa il primo carattere speciale
|
table++; // Skippa il primo carattere speciale
|
||||||
}
|
}
|
||||||
k = table;
|
k.add(table);
|
||||||
k.add(key);
|
k.add(key);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
@ -6,27 +6,41 @@ TModule_table::TModule_table(const char* tabname, const char* module, long custo
|
|||||||
: TLocalisamfile(LF_TABMOD), _tabname(tabname),
|
: TLocalisamfile(LF_TABMOD), _tabname(tabname),
|
||||||
_module(module), _customer(customer)
|
_module(module), _customer(customer)
|
||||||
{
|
{
|
||||||
TFilename app = main_app().argv(0); app.ext("");
|
if (!isalnum(_tabname[0])) // Toglie eventuali prefissi inutili d'ora in poi
|
||||||
const TFixed_string appname(app.name());
|
|
||||||
|
|
||||||
if (_module.blank())
|
|
||||||
_module = appname.left(2);
|
|
||||||
_module.upper();
|
|
||||||
|
|
||||||
if (!isalpha(_tabname[0])) // Toglie eventuali prefissi inutili d'ora in poi
|
|
||||||
_tabname.ltrim(1);
|
_tabname.ltrim(1);
|
||||||
_tabname.upper();
|
_tabname.upper();
|
||||||
|
|
||||||
if (_customer <= 0L && real::is_natural(appname.mid(3)))
|
if (_tabname.len() >= 5)
|
||||||
_customer = atol(app.mid(2));
|
{
|
||||||
|
_module = _tabname.left(2);
|
||||||
|
_tabname.ltrim(2);
|
||||||
|
if (_tabname.len() > 3)
|
||||||
|
{
|
||||||
|
_customer = atol(_tabname);
|
||||||
|
_tabname = _tabname.right(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_module.blank() || _customer <= 0L)
|
||||||
|
{
|
||||||
|
TFilename app = main_app().argv(0); app.ext("");
|
||||||
|
const TFixed_string appname(app.name());
|
||||||
|
|
||||||
|
if (_module.blank())
|
||||||
|
_module = appname.left(2);
|
||||||
|
|
||||||
|
if (_customer <= 0L && real::is_natural(appname.mid(3)))
|
||||||
|
_customer = atol(app.mid(2));
|
||||||
|
}
|
||||||
|
_module.upper();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TModule_table::zero_rec(TRectype& rec, char c)
|
void TModule_table::zero_rec(TRectype& rec, char c)
|
||||||
{
|
{
|
||||||
rec.zero(c);
|
rec.zero(c);
|
||||||
rec.put("COD", _tabname);
|
|
||||||
rec.put("MOD", _module);
|
rec.put("MOD", _module);
|
||||||
rec.put("CUST", _customer);
|
rec.put("CUST", _customer);
|
||||||
|
rec.put("COD", _tabname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @cmember Vuota tutto il record
|
// @cmember Vuota tutto il record
|
||||||
|
Loading…
x
Reference in New Issue
Block a user