Config Rimossa la creazione dei .bak
Isam Aggiunti check sui record vuoti in scrittura Maskfld Tolti i simboli | da tutti i campi editabili Msksheet Corretto errore alla fine delle ricerche con F9 negli sheet Relapp Spostato l'azzeramento della relazione nella init_insert_mode Relation Aggiunti check per debug git-svn-id: svn://10.65.10.50/trunk@1575 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3ec89dfa54
commit
4938651fb0
@ -115,13 +115,12 @@ void TConfig::_write_file()
|
|||||||
|
|
||||||
out.close(); in.close();
|
out.close(); in.close();
|
||||||
|
|
||||||
if (_file[0] > 'B' || _file[1] != ':') // Non creare il .bak su dischetto
|
while (access(_file, 02) != 0)
|
||||||
{
|
message_box("Il file %s e' gia' in uso", (const char*)_file);
|
||||||
while (access(_file, 02) != 0)
|
/*
|
||||||
message_box("Il file %s e' gia' in uso", (const char*)_file);
|
TFilename bak(_file); bak.ext("bak");
|
||||||
TFilename bak(_file); bak.ext("bak");
|
rename(_file, bak);
|
||||||
rename(_file, bak);
|
*/
|
||||||
}
|
|
||||||
fcopy(temp, _file); // Copia dalla tempdir al nuovo .ini
|
fcopy(temp, _file); // Copia dalla tempdir al nuovo .ini
|
||||||
remove(temp); // Cancella file temporaneo
|
remove(temp); // Cancella file temporaneo
|
||||||
}
|
}
|
||||||
|
@ -722,8 +722,9 @@ int TBaseisamfile::readat(TRectype& rec, TRecnotype nrec, word lockop)
|
|||||||
|
|
||||||
|
|
||||||
int TBaseisamfile::write(TDate& atdate)
|
int TBaseisamfile::write(TDate& atdate)
|
||||||
|
{
|
||||||
{
|
CHECK(!curr().empty(), "Can't write an empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
int oldkey=getkey();
|
int oldkey=getkey();
|
||||||
browse_null(curr().string(),DB_reclen(_isamfile->fhnd));
|
browse_null(curr().string(),DB_reclen(_isamfile->fhnd));
|
||||||
@ -747,6 +748,8 @@ int TBaseisamfile::write(TDate& atdate)
|
|||||||
int TBaseisamfile::write(const TRectype& rec, TDate& atdate)
|
int TBaseisamfile::write(const TRectype& rec, TDate& atdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CHECK(!rec.empty(), "Can't write an empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
int oldkey=getkey();
|
int oldkey=getkey();
|
||||||
browse_null(rec.string(),DB_reclen(_isamfile->fhnd));
|
browse_null(rec.string(),DB_reclen(_isamfile->fhnd));
|
||||||
@ -770,6 +773,8 @@ int TBaseisamfile::write(const TRectype& rec, TDate& atdate)
|
|||||||
int TBaseisamfile::rewrite(TDate& atdate)
|
int TBaseisamfile::rewrite(TDate& atdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CHECK(!curr().empty(), "Can't rewrite an empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
TRectype save_rec(curr());
|
TRectype save_rec(curr());
|
||||||
|
|
||||||
@ -788,6 +793,8 @@ int TBaseisamfile::rewrite(TDate& atdate)
|
|||||||
int TBaseisamfile::rewrite(const TRectype& rec, TDate& atdate)
|
int TBaseisamfile::rewrite(const TRectype& rec, TDate& atdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CHECK(!rec.empty(), "Can't write an empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
TRectype save_rec(rec);
|
TRectype save_rec(rec);
|
||||||
_lasterr = cisread(_isamfile, save_rec, _isequal + _nolock); // Si Posiziona per sicurezza...
|
_lasterr = cisread(_isamfile, save_rec, _isequal + _nolock); // Si Posiziona per sicurezza...
|
||||||
@ -819,7 +826,6 @@ int TBaseisamfile::rewriteat(TRecnotype nrec)
|
|||||||
|
|
||||||
|
|
||||||
int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
||||||
|
|
||||||
{
|
{
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
if ((_lasterr=DB_go(_isamfile->fhnd,nrec))== NOERR)
|
if ((_lasterr=DB_go(_isamfile->fhnd,nrec))== NOERR)
|
||||||
@ -835,8 +841,9 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
|||||||
|
|
||||||
|
|
||||||
int TBaseisamfile::remove(TDate& atdate)
|
int TBaseisamfile::remove(TDate& atdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CHECK(!curr().empty(), "Can't remove empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
|
|
||||||
// rimozione campi memo
|
// rimozione campi memo
|
||||||
@ -882,6 +889,8 @@ int TBaseisamfile::remove(TDate& atdate)
|
|||||||
int TBaseisamfile::remove(const TRectype& rec, TDate& atdate)
|
int TBaseisamfile::remove(const TRectype& rec, TDate& atdate)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CHECK(!rec.empty(), "Can't remove an empty record");
|
||||||
|
|
||||||
NOT_OPEN();
|
NOT_OPEN();
|
||||||
memcpy(DB_getrecord(_isamfile->fhnd),rec.string(),DB_reclen(_isamfile->fhnd));
|
memcpy(DB_getrecord(_isamfile->fhnd),rec.string(),DB_reclen(_isamfile->fhnd));
|
||||||
if ((_lasterr=cisread(_isamfile, (TRectype&) rec, _isequal + _lock))==NOERR)
|
if ((_lasterr=cisread(_isamfile, (TRectype&) rec, _isequal + _lock))==NOERR)
|
||||||
@ -2797,7 +2806,6 @@ TRecnotype TRecfield::ptr() const
|
|||||||
|
|
||||||
|
|
||||||
void TTransaction::begin()
|
void TTransaction::begin()
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2023,6 +2023,9 @@ const char* TEdit_field::format(const char* d)
|
|||||||
|
|
||||||
if (_flags.uppercase)
|
if (_flags.uppercase)
|
||||||
fpark.upper();
|
fpark.upper();
|
||||||
|
|
||||||
|
for (int p = 0; fpark[p]; p++)
|
||||||
|
if (fpark[p] == '|') fpark[p] = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
return fpark;
|
return fpark;
|
||||||
|
@ -667,7 +667,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
if (_row_dirty && _check_enabled)
|
if (_row_dirty && _check_enabled)
|
||||||
{
|
{
|
||||||
_check_enabled = FALSE; // Avoid recursion!
|
_check_enabled = FALSE; // Avoid recursion!
|
||||||
// str2mask(_cur_rec); // It shouldn't have to be necessary
|
|
||||||
bool ok = sheet_mask().check_fields();
|
bool ok = sheet_mask().check_fields();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
@ -715,8 +714,9 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
c->set_dirty(); // Get it dirty!
|
c->set_dirty(); // Get it dirty!
|
||||||
if (c->on_key(c->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
|
if (c->on_key(c->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
|
||||||
xiev->refused = *nuo != '\0';
|
xiev->refused = *nuo != '\0';
|
||||||
else
|
|
||||||
mask2str(_cur_rec); // Update sheet row
|
if (!xiev->refused)
|
||||||
|
mask2str(_cur_rec); // Update sheet row
|
||||||
}
|
}
|
||||||
_check_enabled = TRUE;
|
_check_enabled = TRUE;
|
||||||
}
|
}
|
||||||
@ -761,6 +761,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
_lastab = _cur_col < 2 ? K_TAB : K_BTAB;
|
_lastab = _cur_col < 2 ? K_TAB : K_BTAB;
|
||||||
break;
|
break;
|
||||||
case K_F1:
|
case K_F1:
|
||||||
|
case K_SHIFT+K_F1:
|
||||||
_check_enabled = FALSE; // Disable checks
|
_check_enabled = FALSE; // Disable checks
|
||||||
_edit_field->on_key(K_F1);
|
_edit_field->on_key(K_F1);
|
||||||
set_focus_cell(_cur_row, _cur_col);
|
set_focus_cell(_cur_row, _cur_col);
|
||||||
@ -770,25 +771,30 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
case K_F3:
|
case K_F3:
|
||||||
case K_F8:
|
case K_F8:
|
||||||
case K_F9:
|
case K_F9:
|
||||||
case K_F11:
|
case K_F11:
|
||||||
if (_check_enabled && active())
|
if (_check_enabled && active())
|
||||||
{
|
{
|
||||||
_check_enabled = FALSE; // Disable checks
|
_check_enabled = FALSE; // Disable checks
|
||||||
notify_change();
|
notify_change();
|
||||||
if (_edit_field->on_key(k) == FALSE && k == K_F9)
|
const bool ok = _edit_field->on_key(k);
|
||||||
|
if (!ok && k == K_F9) // Ricerca non completata?
|
||||||
{
|
{
|
||||||
_edit_field = &_mask.fld(_mask.focus_field());
|
_edit_field = &_mask.fld(_mask.focus_field());
|
||||||
const short foca = _edit_field->dlg();
|
const short foca = _edit_field->dlg();
|
||||||
const int col = (foca - FIRST_FIELD) % 100 +1;
|
const int col = (foca - FIRST_FIELD) % 100 +1;
|
||||||
if (col > 0 && col != _cur_col)
|
if (col > 0 && col != _cur_col) // Ricerca alternativa
|
||||||
{
|
{
|
||||||
_cur_col = col;
|
_cur_col = col;
|
||||||
dispatch_e_char(win(), K_F9);
|
dispatch_e_char(win(), K_F9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mask2str(_cur_rec);
|
if (ok)
|
||||||
set_focus_cell(_cur_row, _cur_col);
|
{
|
||||||
_check_enabled = TRUE; // Enable checks
|
mask2str(_cur_rec);
|
||||||
|
update(_cur_rec); _needs_update = -1; // Update immediately!
|
||||||
|
set_focus_cell(_cur_row, _cur_col);
|
||||||
|
}
|
||||||
|
_check_enabled = TRUE; // Re-enable checks
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_PREV:
|
case K_PREV:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relapp.cpp,v 1.61 1995-06-26 16:51:48 alex Exp $
|
// $Id: relapp.cpp,v 1.62 1995-07-07 14:43:39 guy Exp $
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -423,6 +423,8 @@ void TRelation_application::insert_mode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_mode(MODE_INS);
|
set_mode(MODE_INS);
|
||||||
|
|
||||||
|
get_relation()->zero(); // Azzera tutta la relazione!
|
||||||
init_insert_mode(*_mask);
|
init_insert_mode(*_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,10 +646,8 @@ bool TRelation_application::save(bool check_dirty)
|
|||||||
bool changed = TRUE;
|
bool changed = TRUE;
|
||||||
bool changed_key = FALSE;
|
bool changed_key = FALSE;
|
||||||
|
|
||||||
get_relation()->zero(); // Azzera solo la prima volta!
|
|
||||||
while (changed)
|
while (changed)
|
||||||
{
|
{
|
||||||
// get_relation()->zero(); // Azzera anche in runumerazione!
|
|
||||||
err = write(*_mask);
|
err = write(*_mask);
|
||||||
if (err == _isreinsert)
|
if (err == _isreinsert)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relation.cpp,v 1.51 1995-07-06 15:22:26 guy Exp $
|
// $Id: relation.cpp,v 1.52 1995-07-07 14:43:41 guy Exp $
|
||||||
// relation.cpp
|
// relation.cpp
|
||||||
// fv 12/8/93
|
// fv 12/8/93
|
||||||
// relation class for isam files
|
// relation class for isam files
|
||||||
@ -667,29 +667,25 @@ bool TRelation::isconsistent(bool reset)
|
|||||||
|
|
||||||
int TRelation::write(bool force, TDate& atdate)
|
int TRelation::write(bool force, TDate& atdate)
|
||||||
{
|
{
|
||||||
_errors = NOERR;
|
_errors = file(0).write(atdate);
|
||||||
|
if (_errors != NOERR)
|
||||||
if (file(0).curr().empty())
|
|
||||||
return _errors; // *** no error returned **
|
|
||||||
// programmer must be aware
|
|
||||||
|
|
||||||
if ((_errors = file(0).write(atdate)) != NOERR)
|
|
||||||
return _errors;
|
return _errors;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < _reldefs.items(); i++)
|
for (int i = 0; i < _reldefs.items(); i++)
|
||||||
{
|
{
|
||||||
TRelationdef& rd = reldef(i);
|
TRelationdef& rd = reldef(i);
|
||||||
const int log = rd.num();
|
TLocalisamfile& lf = file(rd.num());
|
||||||
|
|
||||||
if (!rd.write_enable() ||
|
if (!rd.write_enable() || lf.curr().empty())
|
||||||
(file(log).curr()).empty()) continue;
|
continue;
|
||||||
|
|
||||||
int res = file(log).write(atdate);
|
int res = lf.write(atdate);
|
||||||
if (force && res == _isreinsert)
|
if (force && res == _isreinsert)
|
||||||
res = file(log).rewrite(atdate);
|
res = lf.rewrite(atdate);
|
||||||
if (_errors == NOERR) _errors = res;
|
if (_errors == NOERR)
|
||||||
|
_errors = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _errors;
|
return _errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,14 +698,14 @@ int TRelation::rewrite(bool force, TDate& atdate)
|
|||||||
for (int i = 0; i < _reldefs.items(); i++)
|
for (int i = 0; i < _reldefs.items(); i++)
|
||||||
{
|
{
|
||||||
TRelationdef& rd = reldef(i);
|
TRelationdef& rd = reldef(i);
|
||||||
const int log = rd.num();
|
TLocalisamfile& lf = file(rd.num());
|
||||||
|
|
||||||
if (!rd.write_enable() ||
|
if (!rd.write_enable() || lf.curr().empty())
|
||||||
(file(log).curr()).empty()) continue;
|
continue;
|
||||||
|
|
||||||
int res = file(log).rewrite(atdate);
|
int res = lf.rewrite(atdate);
|
||||||
if (force && res == _iskeynotfound)
|
if (force && res == _iskeynotfound)
|
||||||
res = file(log).write(atdate);
|
res = lf.write(atdate);
|
||||||
if (_errors == NOERR) _errors = res;
|
if (_errors == NOERR) _errors = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user