From 6202d11fd3804d7f8272daa1698738a2491f4de3 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 30 Apr 2003 17:04:20 +0000 Subject: [PATCH] Patch level : 2.0 464 Files correlati : cb6.dll ba3 piu tutti gli altri Ricompilazione Demo : [ ] Commento : Corretto errore AO20007 In qualsiasi videata richiamata dal tasto Elimina, se non ho nessun record da scegliere e premo sul tasto Tutti, mi viene restituito un errore di Ba3.exe Corretto errore AO20017 Inserendo una nuova categoria se consulto i codici del Piano dei Conti, passo nella pagina descrizione e inserisco una stringa da ricercare dopo aver scritto la prima lettera si blocca tutto il programma senza che venga restituito nessun errore (tra l'altro succede solo su alcune lettere iniziali e non su tutte, il mio esempio inizia con la 'R'); inoltre se non scrivo nessuna stringa da cercare e ritorno sui codici del sottoconto, mi passa all'elenco dei codici del conto. Corretto errore AO20018 Inserendo una nuova categoria se consulto i codici del Piano dei Conti, passo nella pagina descrizione e inserisco una stringa da ricercare dopo aver scritto la prima lettera si blocca tutto il programma senza che venga restituito nessun errore (tra l'altro succede solo su alcune lettere iniziali e non su tutte, il mio esempio inizia con la 'R'); inoltre se non scrivo nessuna stringa da cercare e ritorno sui codici del sottoconto, mi passa all'elenco dei codici del conto. Corretto errore AO20019 CON LA TASTIERA Se premo sui tasti di salto all'ultimo o primo record e non ho nessun dato mi restituisce un errore del modulo Base: Impossibile leggere i dati - errore 201. git-svn-id: svn://10.65.10.50/trunk@11077 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cb/source/d4declar.h | 2 +- include/array.cpp | 3 ++- include/codeb.c | 13 +++++++++++++ include/codeb.h | 1 + include/relapp.cpp | 29 ++++++++--------------------- include/relapp.h | 4 ++-- include/relation.cpp | 26 +++++++++++++++++++++----- include/sheet.cpp | 29 ++++++++++++++++------------- 8 files changed, 64 insertions(+), 43 deletions(-) diff --git a/cb/source/d4declar.h b/cb/source/d4declar.h index f8064e3a2..73d6f2f7f 100755 --- a/cb/source/d4declar.h +++ b/cb/source/d4declar.h @@ -925,7 +925,7 @@ int mem4reset( void ) ; int tfile4exprKey( TAG4FILE *, unsigned char * * ) ; int tfile4freeAll( TAG4FILE * ) ; int tfile4freeSaved( TAG4FILE * ) ; - int tfile4go( TAG4FILE *, const unsigned char *, const long, const int ) ; + S4EXPORT int tfile4go( TAG4FILE *, const unsigned char *, const long, const int ) ; int tfile4goEof( TAG4FILE * ) ; int tfile4go2( TAG4FILE *, const unsigned char *, const long, const int ) ; int tfile4initSeekConv( TAG4FILE *, int ) ; /* Initialize 'stok' and 'dtok' */ diff --git a/include/array.cpp b/include/array.cpp index 4df034ea7..213985635 100755 --- a/include/array.cpp +++ b/include/array.cpp @@ -729,7 +729,8 @@ TBit_array& TBit_array::operator|= (const TBit_array& ba) // Certified 99% void TBit_array::set(long n) { - const word i = index(n); + CHECKD(n >= 0, "Can't set a negative bit ", n); + const word i = index(n); if (i >= _size) resize(i); _bit[i] |= mask(n); diff --git a/include/codeb.c b/include/codeb.c index 5c007c06f..6a1bf74ad 100755 --- a/include/codeb.c +++ b/include/codeb.c @@ -1137,6 +1137,19 @@ char* DB_index_getkey(int handle) return key; } +/*------------------------------------------------------------------------- + Si posiziona sulla chiave ed il record indicati + --------------------------------------------------------------------------*/ +int DB_index_go(int handle, const char* key, long recno) +{ + TAG4 *t; + + if(!handle_ok(handle)) return(-1); + if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1); + + return(tfile4go(t->tagFile, key, recno, FALSE)); +} + /*------------------------------------------------------------------------- Restituisce vero se l'indice e' alla fine --------------------------------------------------------------------------*/ diff --git a/include/codeb.h b/include/codeb.h index d2f7f236c..e6cc7b67e 100755 --- a/include/codeb.h +++ b/include/codeb.h @@ -57,6 +57,7 @@ extern "C" { long DB_index_recno(int handle); long DB_index_next(int handle); char* DB_index_getkey(int handle); + int DB_index_go(int handle, const char * key, long recno); char* DB_memoptr(const int handle, const char * fieldname ); int DB_memowrite(const int handle, const char * fieldname, const char * data ) ; int DB_index_eof(int handle); diff --git a/include/relapp.cpp b/include/relapp.cpp index 9f3644d88..51a2dd594 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -110,23 +110,17 @@ void TRelation_application::set_limits( file().setkey(1); if (what & 0x1) { - if (file().empty()) - _first = 1; - else - { - file().first(); - _first = file().recno(); - } + if (!file().empty() && file().first() == NOERR) + _first = file().recno(); + else + _first = -1; } if (what & 0x2) { - if (file().empty()) - _last = 1; - else - { - file().last(); - _last = file().recno(); - } + if (!file().empty() && file().last() == NOERR) + _last = file().recno(); + else + _last = -1; } } @@ -316,15 +310,8 @@ int TRelation_application::set_mode(int mode) const int m = ((TMaskmode)mode == NO_MODE) ? (int) MODE_QUERY : mode; _mask->set_mode(m); -// if (mode == _mode) -// { -// set_toolbar(FALSE); // Fast buttons update -// } -// else -// { set_toolbar(TRUE); // Full buttons update _mode = mode; -// } const char* t = ""; switch(mode) diff --git a/include/relapp.h b/include/relapp.h index 52b5a5e8f..e03f6db34 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -86,8 +86,6 @@ private: // @Setta i filtri di lettura void set_key_filter(); - // @cmember:(INTERNAL) Setta i limiti - void set_limits(byte what = 0x3); // @cmember:(INTERNAL) Posiziona l'applicazione in modo richiesta/inserimento (chiama ) void query_insert_mode() { query_mode(TRUE); } @@ -236,6 +234,8 @@ protected: // @access Public Member public: + // @cmember:(INTERNAL) Setta i limiti + void set_limits(byte what = 0x3); // @cmember Ritorna la maschera corrente TMask& curr_mask() const { return *_mask; } diff --git a/include/relation.cpp b/include/relation.cpp index a7059da22..8e73b5764 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -285,10 +285,10 @@ void TRelation::print_on(ostream& out) const void TRelation::restore_status() { - _status.restart(); - for (int i = 0; i < _files.items(); i++) +// _status.restart(); + for (int i = _files.last(); i >= 0 ; i--) { - const int err = _status.get_int(); + const int err = _status.get_int(i*3); const TRecnotype recno = _status.get_long(); const int key = _status.get_int(); @@ -297,6 +297,7 @@ void TRelation::restore_status() else file(i).curr().zero(); file(i).setstatus(err); } + _status.get(_files.items()*3 - 1); // mi riposiziono prima di tutti i first_match for (i = 0; i < _reldefs.items(); i++) { const bool first_match = _status.get_int() ? TRUE : FALSE; @@ -1092,8 +1093,17 @@ TRecnotype TCursor::buildcursor(TRecnotype rp) bool TCursor::filtercursor(TRecnotype recno) { file().readat(recno); - if (update_relation()) + if (update_relation()) + { + const int handle = file().handle(); + const char *s0 = DB_index_getkey(handle); + _if->update(-filter_limit()); + if (_nkey != DB_tagget(handle)) + DB_tagselect(handle, _nkey); + if (recno != DB_index_recno(handle)) + DB_index_go(handle, s0, recno); + } bool ok = TRUE; @@ -1362,7 +1372,7 @@ int TCursor::test(TIsamop op, TReclock lockop) const TLocalisamfile& curfile = file(); const TRectype& currec = curfile.curr(); curfile.setkey(_nkey); - + int err = NOERR; if (op == _isequal) { @@ -1400,6 +1410,12 @@ int TCursor::test(TIsamop op, TReclock lockop) const break; else { + if (((TCursor *)this)->items() == 0) + { + err = _isemptyfile; + break; + } + if (lockop != _nolock) curfile.reread(_unlock); diff --git a/include/sheet.cpp b/include/sheet.cpp index 48fda2d89..c925c0541 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -498,19 +498,22 @@ void TSheet_control::check( if (on) { const long tot = items()-1; - _checked.set(tot); // Forza le dimensioni del bit array - _checked.set(); // Setta tutti i bit + if (tot >= 0) + { + _checked.set(tot); // Forza le dimensioni del bit array + _checked.set(); // Setta tutti i bit - // Elimina i bit in eccesso alla fine dell'array - for (long i = _checked.items()-1; i > tot; i--) - _checked.reset(i); + // Elimina i bit in eccesso alla fine dell'array + for (long i = _checked.items()-1; i > tot; i--) + _checked.reset(i); - // Elimina i bit corrispondenti a righe disabilitate - if (_disabled.first_one() >= 0) - { - for (long i = tot; i >= 0; i--) - if (_disabled[i]) _checked.reset(i); - } + // Elimina i bit corrispondenti a righe disabilitate + if (_disabled.first_one() >= 0) + { + for (long i = tot; i >= 0; i--) + if (_disabled[i]) _checked.reset(i); + } + } } else _checked.reset(); @@ -1247,8 +1250,8 @@ bool TSheet::tutti_handler(TMask_field& f, KEY k) if (k == K_SPACE) { TSheet& s = (TSheet&)f.mask(); - if (s.check_enabled()) - s.check(-1, !s.one_checked()); + if (s.check_enabled()) + s.check(-1, !s.one_checked()); } return TRUE; }