Patch level : 12.0 302
Files correlati : ef0 ef1 Commento : Correttro in comportamento delle cache per le tabelle di modulo git-svn-id: svn://10.65.10.50/branches/R_10_00@23374 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7cf822d272
commit
aaa11a99bc
@ -689,8 +689,6 @@ const TObject& TFile_cache::query(const char* code)
|
||||
TLocalisamfile& f = file();
|
||||
TRectype& curr = f.curr();
|
||||
const int logicnum = f.num();
|
||||
const bool is_tab = (logicnum >= LF_TABGEN && logicnum <= LF_TAB) || (logicnum == LF_TABMOD);
|
||||
|
||||
if (_code.full())
|
||||
{
|
||||
const RecDes& recd = curr.rec_des(); // Descrizione del record della testata
|
||||
@ -702,11 +700,7 @@ const TObject& TFile_cache::query(const char* code)
|
||||
const char* val = _code.get();
|
||||
|
||||
if (val && *val)
|
||||
{
|
||||
if (is_tab && strcmp(rf.Name, "COD") == 0)
|
||||
curr.settab(val);
|
||||
curr.put(rf.Name, val);
|
||||
}
|
||||
else
|
||||
curr.zero(rf.Name);
|
||||
}
|
||||
@ -902,6 +896,19 @@ TRecord_cache& TDB_cache::rec_cache(int file)
|
||||
return *rc;
|
||||
}
|
||||
|
||||
TRecord_cache& TDB_cache::rec_cache(const char * table)
|
||||
{
|
||||
TRecord_cache* rc = (TRecord_cache*)_table_array.objptr(table);
|
||||
if (rc == NULL)
|
||||
{
|
||||
rc = new TRecord_cache(table);
|
||||
rc->set_items_limit(256); // per ora 256 k
|
||||
rc->test_file_changes();
|
||||
_table_array.add(table, rc);
|
||||
}
|
||||
return *rc;
|
||||
}
|
||||
|
||||
int TDB_cache::build_table_key(const char* table, const char* key, TToken_string& k) const
|
||||
{
|
||||
CHECK(table && *table, "Invalid Table code");
|
||||
@ -936,7 +943,7 @@ const TRectype& TDB_cache::get(const char* table, const char* key)
|
||||
{
|
||||
TToken_string tabkey;
|
||||
const int file = build_table_key(table, key, tabkey);
|
||||
return get(file, tabkey);
|
||||
return rec_cache(table).get(tabkey);
|
||||
}
|
||||
|
||||
const TRectype& TDB_cache::get(const TRectype& curr)
|
||||
@ -996,7 +1003,7 @@ bool TDB_cache::discard(const char *table, const char* key)
|
||||
{
|
||||
TToken_string tabkey;
|
||||
const int file = build_table_key(table, key, tabkey);
|
||||
return rec_cache(file).discard(tabkey);
|
||||
return rec_cache(table).discard(tabkey);
|
||||
}
|
||||
|
||||
bool TDB_cache::discard(const TRectype& curr)
|
||||
@ -1027,6 +1034,10 @@ TDB_cache& cache()
|
||||
TRecord_cache& rec_cache(int file)
|
||||
{ return cache().rec_cache(file); }
|
||||
|
||||
TRecord_cache& rec_cache(const char * table)
|
||||
{ return cache().rec_cache(table); }
|
||||
|
||||
|
||||
// Utente corrente (elemento 0) e suoi gruppi di appartenenza (dall'elemento 1 in poi)
|
||||
const TString_array& user_and_groups()
|
||||
{
|
||||
|
@ -244,11 +244,14 @@ public:
|
||||
|
||||
class TDB_cache : public TArray
|
||||
{
|
||||
TAssoc_array _table_array;
|
||||
|
||||
protected:
|
||||
int build_table_key(const char* table, const char* key, TToken_string& k) const;
|
||||
|
||||
public:
|
||||
TRecord_cache& rec_cache(int file);
|
||||
TRecord_cache& rec_cache(const char * table);
|
||||
|
||||
bool discard(int file, const char* key);
|
||||
bool discard(const char *table, const char* key);
|
||||
@ -260,10 +263,11 @@ public:
|
||||
const TRectype& get(int file, long key) { return rec_cache(file).get(key); }
|
||||
const TRectype& get(const char* table, const char* key_tok);
|
||||
const TRectype& get(const TRectype& key);
|
||||
const TRectype& get_rec(int file, char c, long n);
|
||||
|
||||
// Smarter get: no token string key needed
|
||||
const TRectype& get_rec(int file, const char* key1, const char* key2=NULL, const char* key3=NULL, const char* key4=NULL);
|
||||
|
||||
|
||||
// clifo&anagr get: no token string key needed
|
||||
const TRectype& get_rec(int file, char c, long n);
|
||||
|
||||
@ -285,6 +289,7 @@ public:
|
||||
|
||||
TDB_cache& cache();
|
||||
TRecord_cache& rec_cache(int file);
|
||||
TRecord_cache& rec_cache(const char * table);
|
||||
const TString_array& user_and_groups();
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user