Patch level : 12.0 no-patch
Files correlati : Commento : Aggiunta reset_sheet per svuotare uno sheet senza visualizzare Aggiunti costruttori e funzioni di copia per TRelationdef, TRelation e TCursor Aggiunta funzioine admin
This commit is contained in:
parent
568a79875b
commit
070afa432b
@ -333,7 +333,7 @@ const TString& TConfig::get(
|
||||
const char* key = get_varkey(var, index);
|
||||
const TString* val = (TString*)_data.objptr(key);
|
||||
|
||||
if (val == NULL) // Se non la trova inserisci il default
|
||||
if (val == nullptr) // Se non la trova inserisci il default
|
||||
{
|
||||
if (def && *def)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define DBL_DATA "DATA"
|
||||
#define DBL_ORA "ORA"
|
||||
#define DBL_CMDLINE "CMDLINE"
|
||||
#define DBL_YEAR "YEAR"
|
||||
#define DBL_ANNO "ANNO"
|
||||
#define DBL_RELEASE "RELEASE"
|
||||
#define DBL_TAG "TAG"
|
||||
#define DBL_PATCH "PATCH"
|
||||
|
@ -1,3 +1,3 @@
|
||||
182
|
||||
0
|
||||
$dblog|0|0|404|0|Log Transazioni|||
|
||||
$dblog|28|28|411|0|Log Transazioni|||
|
||||
|
@ -5,9 +5,9 @@ FILE|2|4|0|File
|
||||
KEY|1|200|0|Chiave 1
|
||||
RECNO|3|10|0|Numero di record
|
||||
DATA|5|8|0|Data
|
||||
ORA|7|1|0|Ora
|
||||
ORA|1|8|0|Ora
|
||||
CMDLINE|1|40|0|Command line
|
||||
YEAR|2|4|0|Anno
|
||||
ANNO|2|4|0|Anno
|
||||
RELEASE|2|3|0|Release
|
||||
TAG|2|4|0|Tag
|
||||
PATCH|1|4|0|Patch
|
||||
|
@ -3983,7 +3983,7 @@ bool TSheet_field::autoload(const TRelation& rel)
|
||||
CHECK(_linee_rec !=NULL, "Iu ev forgotten tu declare de Record array for de scit");
|
||||
// *******
|
||||
// trasferisce le linee dal record array allo sheet
|
||||
destroy(); // cancella lo sheet
|
||||
reset_sheet(); // cancella lo sheet
|
||||
const int last_line = _linee_rec->last_row();
|
||||
for (int i = 1; i <= last_line; i++)
|
||||
autoload_line(i,_linee_rec->row(i, true));
|
||||
|
@ -219,6 +219,8 @@ public:
|
||||
// piu' processi attivi
|
||||
void on_idle();
|
||||
|
||||
// @cmember Elimina una o tutte le righe
|
||||
void reset_sheet(bool update_sheet = false) { destroy(-1, update_sheet); }
|
||||
// @cmember Elimina una o tutte le righe
|
||||
void destroy(int r = -1, bool update_sheet = true);
|
||||
// @cmember Inserisce una riga
|
||||
|
@ -322,7 +322,7 @@ void TMultiple_rectype::synchronize_bodies()
|
||||
if (_autoload[i])
|
||||
load_rows_file(lognum(i));
|
||||
else
|
||||
if (_files.objptr(i) != NULL)
|
||||
if (_files.objptr(i) != nullptr)
|
||||
_changed.set(i);
|
||||
}
|
||||
}
|
||||
|
@ -100,12 +100,35 @@ public:
|
||||
|
||||
void print_on(TToken_string& out) const;
|
||||
|
||||
// Funzioni per costruttore di copia
|
||||
|
||||
virtual TRelationdef & copy(const TRelationdef & reldef);
|
||||
virtual TRelationdef* dup() const { return new TRelationdef(*this); }
|
||||
virtual TRelationdef& operator =(const TRelationdef & reldef) { return copy(reldef); }
|
||||
|
||||
TRelationdef(const TRelation* rel, int file, byte key,
|
||||
int linkto, const char* relexprs, int alias,
|
||||
bool allow_lock);
|
||||
// Costruttore di copia
|
||||
TRelationdef(const TRelationdef& reldef);
|
||||
|
||||
virtual ~TRelationdef() {}
|
||||
};
|
||||
|
||||
TRelationdef & TRelationdef::copy(const TRelationdef & reldef)
|
||||
{
|
||||
_rel = reldef._rel;
|
||||
_num = reldef._num;
|
||||
_numto = reldef._numto;
|
||||
_alias = reldef._alias;
|
||||
_key = reldef._key;
|
||||
_fields = reldef._fields;
|
||||
_exprs = reldef._exprs;
|
||||
_first_match = reldef._first_match;
|
||||
_allow_lock = reldef._allow_lock;
|
||||
_write_enable = reldef._write_enable;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
||||
int idx_to, const char* relexprs, int alias,
|
||||
@ -160,6 +183,11 @@ TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
||||
}
|
||||
}
|
||||
|
||||
TRelationdef::TRelationdef(const TRelationdef & reldef)
|
||||
{
|
||||
copy(reldef);
|
||||
}
|
||||
|
||||
|
||||
void TRelationdef::print_on(ostream& out) const
|
||||
{
|
||||
@ -275,6 +303,24 @@ const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to) const
|
||||
// TRelation
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TRelation & TRelation::copy(const TRelation & rel)
|
||||
{
|
||||
_errors = rel._errors;
|
||||
_status = rel._status;
|
||||
FOR_EACH_ARRAY_ITEM(rel._files, i, file)
|
||||
{
|
||||
TLocalisamfile * f = (TLocalisamfile *)file;
|
||||
int logic = f->num();
|
||||
|
||||
_files.add(new TLocalisamfile(logic));
|
||||
lfile(logic).curr() = f->curr();
|
||||
lfile(logic).setkey(f->getkey());
|
||||
lfile(logic).read();
|
||||
}
|
||||
_reldefs = rel._reldefs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRelation::TRelation(int logicnum)
|
||||
: _files(4), _reldefs(4), _errors(NOERR)
|
||||
{
|
||||
@ -297,6 +343,11 @@ TRelation::TRelation(TLocalisamfile* l)
|
||||
: _files(4), _reldefs(4), _errors(NOERR)
|
||||
{ _files.add(l); }
|
||||
|
||||
TRelation::TRelation(const TRelation & rel)
|
||||
{
|
||||
copy(rel);
|
||||
}
|
||||
|
||||
TRelation::~TRelation()
|
||||
{}
|
||||
|
||||
@ -1702,6 +1753,37 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop)
|
||||
return _pos;
|
||||
}
|
||||
|
||||
|
||||
TCursor & TCursor::copy(const TCursor & cursor)
|
||||
{
|
||||
safe_delete(_if);
|
||||
_if = new TRelation(*cursor._if);
|
||||
_nkey = cursor._nkey;
|
||||
file().setkey(_nkey);
|
||||
_fexpr = cursor._fexpr == nullptr ? nullptr : new TExpression(*cursor._fexpr);
|
||||
_filename = cursor._filename;
|
||||
_filter = cursor._filter;
|
||||
_keyfrom = cursor._keyfrom;
|
||||
_keyto = cursor._keyto;
|
||||
FOR_EACH_ARRAY_ITEM(cursor._frefs, i, obj)
|
||||
{
|
||||
TRecfield * fref = (TRecfield *)obj;
|
||||
|
||||
_frefs.add(new TRecfield(_if->curr(fref->record().num()), fref->name(), fref->from(), fref->to()));
|
||||
}
|
||||
_frozen = cursor._frozen;
|
||||
_filter_update = cursor._filter_update;
|
||||
_filterfunction_update = cursor._filterfunction_update;
|
||||
_filter_limit = cursor._filter_limit;
|
||||
_filterfunction = cursor._filterfunction;
|
||||
_pos = 0;
|
||||
_totrec = 0;
|
||||
_lastrec = 0;
|
||||
_lastkrec = 0;
|
||||
_pagefirstpos = 0L;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TCursor::TCursor(TRelation* r, const char* fil, int nkey,
|
||||
const TRectype *from, const TRectype* to, int tilde)
|
||||
: _if(r), _nkey(nkey), _fexpr(NULL), _frozen(false), _filter_update(false),
|
||||
@ -1721,6 +1803,12 @@ TCursor::TCursor(TRelation* r, const char* fil, int nkey,
|
||||
filter(fil, from, to, tilde);
|
||||
}
|
||||
|
||||
TCursor::TCursor(const TCursor & cursor) : _if(nullptr)
|
||||
{
|
||||
copy(cursor);
|
||||
_page = new TRecnotype[_cmaxelpage];
|
||||
memset(_page, 0, _cmaxelpage * sizeof(TRecnotype));
|
||||
}
|
||||
|
||||
TCursor::~TCursor()
|
||||
{
|
||||
|
@ -203,6 +203,12 @@ public: // TObject
|
||||
// @cmember Aggiorna i valori delle variabili udando maschera <m>
|
||||
// (ritorna lo stato)
|
||||
void mask2rel(const TMask & m);
|
||||
|
||||
// Funzioni per costruttore di copia
|
||||
|
||||
virtual TRelation & copy(const TRelation & rel);
|
||||
virtual TObject* dup() const { return new TRelation(*this); }
|
||||
virtual TRelation& operator =(const TRelation & rel) { return copy(rel); }
|
||||
|
||||
// @cmember Costruttore dal numero logico del file
|
||||
TRelation(int logicnum);
|
||||
@ -210,6 +216,8 @@ public: // TObject
|
||||
TRelation(const char* tabname);
|
||||
// @cmember Costruttore dal nome del file
|
||||
TRelation(TLocalisamfile* f);
|
||||
// @cmember Costruttore di copia
|
||||
TRelation(const TRelation & rel);
|
||||
|
||||
// @cmember Distruttore
|
||||
virtual ~TRelation();
|
||||
@ -459,9 +467,16 @@ public:
|
||||
|
||||
bool scan(CURSOR_SCAN_FUNC func, void* pJolly = NULL, const char* msg = "");
|
||||
|
||||
// Funzioni per costruttore di copia
|
||||
|
||||
virtual TCursor & copy(const TCursor & mov);
|
||||
virtual TObject* dup() const { return new TCursor(*this); }
|
||||
virtual TCursor& operator =(const TCursor & mov) { return copy(mov); }
|
||||
|
||||
// @cmember Costruttore
|
||||
TCursor(TRelation* f, const char* filter = "", int key = 1,
|
||||
const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0);
|
||||
TCursor(TRelation* f, const char* filter = "", int key = 1,
|
||||
const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0);
|
||||
TCursor(const TCursor & cursor);
|
||||
// @cmember Distruttore
|
||||
virtual ~TCursor();
|
||||
};
|
||||
|
@ -804,6 +804,7 @@ public:
|
||||
};
|
||||
|
||||
TString& user();
|
||||
inline const bool admin() { return user() == "ADMIN"; }
|
||||
TToken_string& get_tmp_string(int len = -1);
|
||||
|
||||
const TToken_string& empty_string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user