diff --git a/include/multirec.cpp b/include/multirec.cpp index 5c85cd622..4bb22aa97 100755 --- a/include/multirec.cpp +++ b/include/multirec.cpp @@ -119,6 +119,30 @@ int TMultiple_rectype::write_rewrite(TBaseisamfile & f, bool re) const return err; } +// @mfunc confronta due record multipli +int TMultiple_rectype::compare(const TSortable& s) const +{ + int res = TRectype::compare(s); + TMultiple_rectype & m = (TMultiple_rectype &) s; + for (int i = 0 ; res == 0 && i < _files.items(); i++) + { + const int logicnum = _logicnums.get_int(i); + TRecord_array & r = body(logicnum); + TRecord_array & r1 = m.body(logicnum); + res = r.rows() - r1.rows(); + if (res == 0 && r.rows() > 0 && r1.rows() > 0) + { + for (int j = r.first_row(), k = r1.first_row(); res == 0 && j >= 0 && k >= 0; j = r.succ_row(j), k = r1.succ_row(k)) + { + res = j - k; + if (res == 0) + res = r[j] != r1[j]; + } + } + } + return res; +} + void TMultiple_rectype::remove_body(int logicnum) { const int index = log2ind(logicnum); diff --git a/include/multirec.h b/include/multirec.h index 68d384f11..c998bfc28 100755 --- a/include/multirec.h +++ b/include/multirec.h @@ -9,7 +9,6 @@ #include #endif -class TMultiple_rectype; //************************************** // classe per il controllo dei record composti da una testata e N file di righe // è implementato come un TRectype che contiene anche un TRecord_array diff --git a/include/relapp.cpp b/include/relapp.cpp index 09d3888e2..c0667adbc 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -861,16 +861,25 @@ void TRelation_application::main_loop() _recins = -1; // Provoca l'autopremimento per il messaggio di LINK - if (_lnflag) + if (_lnflag) { - if (load_transaction()) - { - _autodelete = _curr_transaction == TRANSACTION_DELETE; - if (_curr_transaction == TRANSACTION_INSERT ) - _mask->send_key(K_CTRL+'N', 0); - } - if (_curr_transaction !=TRANSACTION_RUN) + if (_trans_counter < _ntransactions) + { + // la transazione è sul .ini : la carica + if (load_transaction()) + { + // la transazione necessita di autopremimento + _autodelete = _curr_transaction == TRANSACTION_DELETE; + if (_curr_transaction == TRANSACTION_INSERT ) + _mask->send_key(K_CTRL+'N', 0); + else + _mask->send_key(K_AUTO_ENTER, 0); + } + } + else // la transazione non è sul .ini + { _mask->send_key(K_AUTO_ENTER, 0); + } } query_mode();