multirec.* Aggiunto confronto tra TMultiple_rectype

realpp.cpp   Corretta gestione transazione INSERT


git-svn-id: svn://10.65.10.50/trunk@6742 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-06-11 13:03:53 +00:00
parent 1e106d3046
commit 31b2527133
3 changed files with 41 additions and 9 deletions

View File

@ -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);

View File

@ -9,7 +9,6 @@
#include <varrec.h>
#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

View File

@ -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();