Modifica 95/29
git-svn-id: svn://10.65.10.50/trunk@1822 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4c6fd5b667
commit
ecdce9d765
@ -251,14 +251,9 @@ HIDDEN int cisread(isfdptr isfd, TRectype & record, int mode)
|
||||
// Non usare mai _isnextn o _isprevn, usare il metodo skip!
|
||||
CHECK (rmode !=_isnextn && rmode !=_isprevn, "_isnextn and _isprevn not supported in cisread");
|
||||
|
||||
// BOOLEAN nolock = (lmode == _nolock);
|
||||
// BOOLEAN unlock = (lmode == _unlock);
|
||||
// BOOLEAN tlock = (lmode == INTTLOCK);
|
||||
char key[128];
|
||||
int err = NOERR ;
|
||||
|
||||
// if (nolock || unlock /* || tlock */) lmode = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (rmode>=_isequal && rmode<=_isgteq)
|
||||
@ -294,13 +289,13 @@ HIDDEN int cisread(isfdptr isfd, TRectype & record, int mode)
|
||||
if (err != NOERR) err=get_error(err);
|
||||
if (err == _islocked && lmode == _testandlock) break;
|
||||
}
|
||||
if (/* !tlock && */ err == _islocked)
|
||||
if (err == _islocked)
|
||||
{
|
||||
memcpy(record.string(),DB_getrecord(isfd->fhnd),DB_reclen(isfd->fhnd));
|
||||
CBuildKey(isfd->r, isfd->knum, record.string(), key, TRUE);
|
||||
message_box("Codice %s in uso da parte\ndi un altro utente.", key);
|
||||
}
|
||||
} while (/* !tlock && */ err ==_islocked);
|
||||
} while (err ==_islocked);
|
||||
|
||||
if (err == NOERR && lmode == _unlock)
|
||||
{
|
||||
@ -358,7 +353,7 @@ public:
|
||||
// FPUB
|
||||
|
||||
TExtrectype(const TTrec& r); // Costruisce il record a partire da r
|
||||
virtual ~TExtrectype();
|
||||
virtual ~TExtrectype() {}
|
||||
};
|
||||
|
||||
TExtrectype::TExtrectype(const TTrec& r) : TRectype(6)
|
||||
@ -367,19 +362,10 @@ TExtrectype::TExtrectype(const TTrec& r) : TRectype(6)
|
||||
delete _rec;
|
||||
_length = r.len();
|
||||
_rec = new char [ _length ];
|
||||
// _i = new isdef;
|
||||
// _i->r = r.rec();
|
||||
_rd = r.rec();
|
||||
zero();
|
||||
}
|
||||
|
||||
TExtrectype::~TExtrectype()
|
||||
|
||||
{
|
||||
// delete _rec;
|
||||
// delete _i;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TBaseisamfile
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -588,10 +574,20 @@ int TBaseisamfile::next(word lockop)
|
||||
|
||||
{
|
||||
NOT_OPEN();
|
||||
curr().setdirty();
|
||||
curr().setdirty();
|
||||
if (_recno != DB_recno(_isamfile->fhnd))
|
||||
{
|
||||
_lasterr = DB_go(_isamfile->fhnd, _recno);
|
||||
if (_lasterr != NOERR)
|
||||
{
|
||||
_lasterr = get_error(_lasterr);
|
||||
if (_lasterr != _islocked)
|
||||
fatal_box("Errore nella next %d : non posso riposizionarmi", _lasterr);
|
||||
}
|
||||
}
|
||||
_lasterr=cisread(_isamfile, curr(), _isnext + lockop);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
_recno = _isamfile->RecNo;
|
||||
_recno = _isamfile->RecNo;
|
||||
return _lasterr;
|
||||
}
|
||||
|
||||
@ -609,6 +605,16 @@ int TBaseisamfile::prev(word lockop)
|
||||
{
|
||||
NOT_OPEN();
|
||||
curr().setdirty();
|
||||
if (_recno != DB_recno(_isamfile->fhnd))
|
||||
{
|
||||
_lasterr = DB_go(_isamfile->fhnd, _recno);
|
||||
if (_lasterr != NOERR)
|
||||
{
|
||||
_lasterr = get_error(_lasterr);
|
||||
if (_lasterr != _islocked)
|
||||
fatal_box("Errore nella prev %d : non posso riposizionarmi", _lasterr);
|
||||
}
|
||||
}
|
||||
_lasterr=cisread(_isamfile, curr(), _isprev + lockop);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
_recno = _isamfile->RecNo;
|
||||
@ -651,25 +657,31 @@ int TBaseisamfile::reread(TRectype& rec, word lockop, TDate& atdate)
|
||||
int TBaseisamfile::skip(TRecnotype nrec, word lockop)
|
||||
|
||||
{
|
||||
int rmode = (lockop & READTYPES), lmode = (lockop & RECLOCKTYPES);
|
||||
// BOOLEAN nolock = (lmode == _nolock);
|
||||
// BOOLEAN unlock = (lmode == _unlock);
|
||||
// BOOLEAN tlock = (lmode == INTTLOCK);
|
||||
char key[128];
|
||||
|
||||
NOT_OPEN();
|
||||
if (!nrec) return NOERR;
|
||||
curr().setdirty();
|
||||
if (_recno != DB_recno(_isamfile->fhnd))
|
||||
{
|
||||
_lasterr = DB_go(_isamfile->fhnd, _recno);
|
||||
if (_lasterr != NOERR)
|
||||
{
|
||||
_lasterr = get_error(_lasterr);
|
||||
if (_lasterr != _islocked)
|
||||
fatal_box("Errore nella skip %d : non posso riposizionarmi", _lasterr);
|
||||
}
|
||||
}
|
||||
_lasterr=DB_skip(_isamfile->fhnd,nrec);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
do {
|
||||
if (/* !tlock && */ _lasterr == _islocked)
|
||||
if (_lasterr == _islocked)
|
||||
{
|
||||
CBuildKey(_isamfile->r, DB_tagget(_isamfile->fhnd), curr().string(), key,TRUE);
|
||||
message_box("Codice %s in uso da parte\ndi un altro utente.", key);
|
||||
}
|
||||
_lasterr=cisread(_isamfile,curr(),_iscurr + lockop);
|
||||
} while (/* !tlock && */ _lasterr ==_islocked);
|
||||
} while (_lasterr ==_islocked);
|
||||
_recno = _isamfile->RecNo = DB_recno(_isamfile->fhnd);
|
||||
return _lasterr;
|
||||
}
|
||||
@ -736,17 +748,11 @@ int TBaseisamfile::write(TDate& atdate)
|
||||
NOT_OPEN();
|
||||
int oldkey=getkey();
|
||||
browse_null(curr().string(),DB_reclen(_isamfile->fhnd));
|
||||
TRectype r(curr());
|
||||
|
||||
setkey(1);
|
||||
// if (cisread(_isamfile, r, _isequal + _nolock) != NOERR)
|
||||
// {
|
||||
memcpy(DB_getrecord(_isamfile->fhnd),curr().string(),DB_reclen(_isamfile->fhnd));
|
||||
_lasterr = DB_add(_isamfile->fhnd);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
// }
|
||||
// else
|
||||
// _lasterr=_isreinsert;
|
||||
setkey(oldkey);
|
||||
_recno = _isamfile->RecNo = DB_recno(_isamfile->fhnd);
|
||||
return _lasterr;
|
||||
@ -761,17 +767,11 @@ int TBaseisamfile::write(const TRectype& rec, TDate& atdate)
|
||||
NOT_OPEN();
|
||||
int oldkey=getkey();
|
||||
browse_null(rec.string(),DB_reclen(_isamfile->fhnd));
|
||||
TRectype r(rec);
|
||||
|
||||
setkey(1);
|
||||
// if (cisread(_isamfile, r, _isequal + _nolock) != NOERR)
|
||||
// {
|
||||
memcpy(DB_getrecord(_isamfile->fhnd),rec.string(),DB_reclen(_isamfile->fhnd));
|
||||
_lasterr = DB_add(_isamfile->fhnd);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
// }
|
||||
// else
|
||||
// _lasterr=_isreinsert;
|
||||
setkey(oldkey);
|
||||
_recno = _isamfile->RecNo = DB_recno(_isamfile->fhnd);
|
||||
return _lasterr;
|
||||
@ -970,10 +970,9 @@ int TBaseisamfile::_open(unsigned int mode)
|
||||
{
|
||||
TRecnotype n=DB_reccount(filehnd()->fhnd);
|
||||
TDir d;
|
||||
// d.get(num());
|
||||
d.get(num(),_nolock,_nordir,_sysdirop);
|
||||
if (d.is_com()) d.get(num(),_nolock,_comdir,_sysdirop);
|
||||
if ((filehnd()->d->EOD != n && n > 0) || (n >= d.eox()))
|
||||
if ((filehnd()->d->EOD != n && n > 0) || (n > d.eox()))
|
||||
{
|
||||
filehnd()->d->EOD = d.eod() = n;
|
||||
filehnd()->d->EOX = d.eox() = n;
|
||||
@ -1011,10 +1010,9 @@ int TBaseisamfile::_close()
|
||||
{
|
||||
TDir d;
|
||||
TRecnotype n=DB_reccount(filehnd()->fhnd);
|
||||
//d.get(num());
|
||||
d.get(num(),_nolock,_nordir,_sysdirop);
|
||||
if (d.is_com()) d.get(num(),_nolock,_comdir,_sysdirop);
|
||||
if ((filehnd()->d->EOD != n && n > 0) || (n >= d.eox()))
|
||||
if ((filehnd()->d->EOD != n && n > 0) || (n > d.eox()))
|
||||
{
|
||||
filehnd()->d->EOD = d.eod() = n;
|
||||
filehnd()->d->EOX = d.eox() = n;
|
||||
@ -1041,7 +1039,6 @@ int TBaseisamfile::_close()
|
||||
clearfilehnd();
|
||||
}
|
||||
}
|
||||
// _current->_i = NULL;
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
@ -1091,7 +1088,6 @@ int TLocalisamfile::close()
|
||||
{
|
||||
TRecnotype n = DB_reccount(filehnd()->fhnd);
|
||||
TDir d;
|
||||
//d.get(num());
|
||||
d.get(num(),_nolock,_nordir,_sysdirop);
|
||||
if (d.is_com()) d.get(num(),_nolock,_comdir,_sysdirop);
|
||||
if ((filehnd()->d->EOD!=n && n > 0) || (n > d.eox()))
|
||||
@ -1130,7 +1126,6 @@ int TLocalisamfile::open(unsigned int mode)
|
||||
err = _open();
|
||||
_was_open = TRUE;
|
||||
}
|
||||
// _current->_i = filehnd();
|
||||
|
||||
setstatus(err);
|
||||
return err;
|
||||
@ -1308,7 +1303,6 @@ int TIsamtempfile::open(const char* radix, bool create, TRecnotype eod, TRecnoty
|
||||
filehnd()->ln = -num();
|
||||
filehnd()->knum = 1;
|
||||
}
|
||||
|
||||
_recno = -1L;
|
||||
setstatus(err);
|
||||
return err;
|
||||
@ -1330,7 +1324,7 @@ int TIsamtempfile::close()
|
||||
|
||||
f.ext("dbf");
|
||||
::remove((const char*)f);
|
||||
if (c & 1) // FOXPRO format
|
||||
if (c & 1) // FOXPRO format
|
||||
f.ext("cdx");
|
||||
if (c & 4) // DBIV format
|
||||
f.ext("mdx");
|
||||
@ -1355,7 +1349,6 @@ int TIsamtempfile::close()
|
||||
relisfd(_isamfile);
|
||||
clearfilehnd();
|
||||
}
|
||||
// _current->_i = NULL;
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
@ -1535,7 +1528,6 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
TDir dir;
|
||||
|
||||
dir.get(num(), _unlock, _nordir, _sysdirop);
|
||||
const char p = *dir.name();
|
||||
const bool is_com = prefix().is_com();
|
||||
const bool toconvert = is_com ? dir.is_com() : dir.is_firm();
|
||||
|
||||
@ -2871,3 +2863,4 @@ TRecnotype TRecfield::ptr() const
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relation.cpp,v 1.63 1995-09-01 15:09:18 guy Exp $
|
||||
// $Id: relation.cpp,v 1.64 1995-09-14 13:12:18 alex Exp $
|
||||
// relation.cpp
|
||||
// fv 12/8/93
|
||||
// relation class for isam files
|
||||
@ -1232,7 +1232,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
|
||||
El_To_Sort * Element;
|
||||
|
||||
_order_expr.restart();
|
||||
while ((s=_order_expr.get()) && s.not_empty())
|
||||
while ((s=_order_expr.get()).not_empty())
|
||||
{
|
||||
check_expr(s); // Toglie l'eventuale operatore UPPER(), in modo che l'ultimo carattere
|
||||
// indichi eventualmente la direzione dell'ordinamento
|
||||
@ -1346,7 +1346,7 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
|
||||
|
||||
_order_expr.restart();
|
||||
strcpy(Element.f,"");
|
||||
while ((s=_order_expr.get()) && s.not_empty())
|
||||
while ((s=_order_expr.get()).not_empty())
|
||||
{
|
||||
bool is_up=is_upper(s);
|
||||
int p=s.find('[');// Qui estrae il nome del campo:
|
||||
@ -1404,7 +1404,7 @@ void TSorted_cursor::change_order(const char* order_expr)
|
||||
TString s;
|
||||
_order_expr = order_expr;
|
||||
_order_expr.restart();
|
||||
while ((s=_order_expr.get()) && s.not_empty() && (_is_valid_expr=check_expr(s))) ;
|
||||
while ((s=_order_expr.get()).not_empty() && (_is_valid_expr=check_expr(s))) ;
|
||||
if (_is_valid_expr)
|
||||
_is_changed_expr=TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user