Patch level : 10.0 148
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Aggiunta funzione call_filterfunction per riposizionarsi dopo la sua chiamata se necessario git-svn-id: svn://10.65.10.50/trunk@17493 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8232857172
commit
696eabe624
@ -1134,15 +1134,28 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
|
||||
return ap;
|
||||
}
|
||||
|
||||
bool TCursor::call_filterfunction(const TRelation * r, TRecnotype recno) const
|
||||
{
|
||||
bool ok = true;
|
||||
if (_filterfunction)
|
||||
{
|
||||
// memorizzo la chiave prima di eventuali spostamenti
|
||||
const char * s0 = DB_index_getkey(file().handle());
|
||||
ok = _filterfunction(_if);
|
||||
// ripristino la chiave dopo eventuali spostamenti
|
||||
const int handle = file().handle();
|
||||
if (recno != DB_index_recno(handle))
|
||||
DB_index_go(handle, s0, recno);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
bool TCursor::filtercursor(TRecnotype recno)
|
||||
{
|
||||
file().readat(recno);
|
||||
|
||||
|
||||
if (update_relation())
|
||||
{
|
||||
// memorizzo la chiave prima di eventuali spostamenti
|
||||
const TString s0(DB_index_getkey(file().handle()));
|
||||
// memorizzo la chiave prima di eventuali spostamenti
|
||||
const char * s0 = DB_index_getkey(file().handle());
|
||||
|
||||
_if->update(-filter_limit());
|
||||
|
||||
@ -1152,13 +1165,10 @@ bool TCursor::filtercursor(TRecnotype recno)
|
||||
DB_index_go(handle, s0, recno);
|
||||
}
|
||||
|
||||
bool ok = TRUE;
|
||||
|
||||
if (_filterfunction)
|
||||
ok = _filterfunction(_if);
|
||||
if (ok && _fexpr)
|
||||
bool ok = call_filterfunction(_if, recno);
|
||||
|
||||
if (ok && _fexpr)
|
||||
ok = __evalcondition(*_if, _fexpr, _frefs);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1249,19 +1259,20 @@ bool TCursor::ok() const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (update_relation())
|
||||
const TRecnotype old = file().recno();
|
||||
|
||||
if (update_relation())
|
||||
{
|
||||
const TRecnotype old = file().recno();
|
||||
_if->update();
|
||||
if (DB_recno(file().handle()) != old)
|
||||
file().readat(old);
|
||||
}
|
||||
|
||||
if ((_filterfunction ? _filterfunction(_if) : TRUE ) &&
|
||||
(_fexpr ? __evalcondition(*_if, _fexpr, _frefs) : TRUE))
|
||||
return TRUE;
|
||||
if (call_filterfunction(_if, old) &&
|
||||
(_fexpr ? __evalcondition(*_if, _fexpr, _frefs) : true))
|
||||
return true;
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TCursor::changed()
|
||||
@ -1603,8 +1614,8 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop)
|
||||
|
||||
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),
|
||||
_filterfunction_update(FALSE), _filter_limit(0), _filterfunction(NULL)
|
||||
: _if(r), _nkey(nkey), _fexpr(NULL), _frozen(false), _filter_update(false),
|
||||
_filterfunction_update(false), _filter_limit(0), _filterfunction(NULL)
|
||||
{
|
||||
file().setkey(_nkey);
|
||||
_pos = 0;
|
||||
|
@ -308,6 +308,9 @@ protected:
|
||||
|
||||
int filter_limit() const { return _filter_limit; }
|
||||
void set_filter_limit(int l) { _filter_limit = l; }
|
||||
|
||||
bool call_filterfunction(const TRelation * r, TRecnotype recno) const;
|
||||
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user