Patch level : 2.0 552
Files correlati : cg2.exe Ricompilazione Demo : [ ] Commento : Aggiunti flag necessari per segnalre in prima nota i movimenti gia' inviati durante la navigazione tramite la nuova toolbar git-svn-id: svn://10.65.10.50/trunk@11385 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c2098e7eab
commit
65eb669bfb
@ -31,7 +31,6 @@
|
|||||||
#include <codeb.h>
|
#include <codeb.h>
|
||||||
#include <rectypes.h>
|
#include <rectypes.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <checks.h>
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
numero massimo di database aperti contemporaneamente
|
numero massimo di database aperti contemporaneamente
|
||||||
@ -382,13 +381,8 @@ int DB_recall(int handle)
|
|||||||
int DB_flush(int handle)
|
int DB_flush(int handle)
|
||||||
{
|
{
|
||||||
int rt;
|
int rt;
|
||||||
|
|
||||||
while ((rt = d4flush(dbdata[handle])) == r4locked)
|
while ((rt = d4flush(dbdata[handle])) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_flush");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,25 +394,19 @@ int DB_rewrite(int handle)
|
|||||||
int rt;
|
int rt;
|
||||||
if(!handle_ok(handle)) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
while ((rt=d4write(dbdata[handle],d4recNo(dbdata[handle]))) == r4locked)
|
while ((rt=d4write(dbdata[handle],d4recNo(dbdata[handle]))) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_rewrite");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
if (rt == 0)
|
if (rt == 0)
|
||||||
{
|
{
|
||||||
while ((rt = d4flush(dbdata[handle])) == r4locked)
|
while ((rt = d4flush(dbdata[handle])) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_rewrite (d4flush)");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (rt == e4unique)
|
if (rt == e4unique)
|
||||||
{
|
{
|
||||||
|
char msg[256];
|
||||||
DB_get_error();
|
DB_get_error();
|
||||||
fatal_box("Errore in DB_rewrite(): chiave duplicata nel record %ld, file %s",
|
sprintf(msg, "Errore in DB_rewrite(): chiave duplicata nel record %ld, file %s",
|
||||||
d4recNo(dbdata[handle]) + 1, d4fileName(dbdata[handle]));
|
d4recNo(dbdata[handle]) + 1, d4fileName(dbdata[handle]));
|
||||||
|
xvt_dm_post_fatal_exit(msg);
|
||||||
}
|
}
|
||||||
rt=DB_unlock(handle);
|
rt=DB_unlock(handle);
|
||||||
return (rt);
|
return (rt);
|
||||||
@ -439,35 +427,27 @@ int DB_add(int handle)
|
|||||||
if (is_locked == 0) /* Se non e' stato gia' bloccato in modo esclusivo */
|
if (is_locked == 0) /* Se non e' stato gia' bloccato in modo esclusivo */
|
||||||
{
|
{
|
||||||
while (d4lockAll(data) == r4locked)
|
while (d4lockAll(data) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_add");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
while ((rt = d4appendStart(data,0)) == r4locked)
|
while ((rt = d4appendStart(data,0)) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_add (d4append_start)");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
if (rt == 0)
|
if (rt == 0)
|
||||||
{
|
{
|
||||||
d4recall(data);
|
d4recall(data);
|
||||||
while ((rt = d4append(data)) == r4locked)
|
while ((rt = d4append(data)) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_add (d4append)");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
if (rt == e4unique)
|
if (rt == e4unique)
|
||||||
{
|
{
|
||||||
long rec_num = d4recNo(data);
|
long rec_num = d4recNo(data);
|
||||||
|
|
||||||
DB_get_error();
|
DB_get_error();
|
||||||
if (rec_num > 0)
|
if (rec_num > 0)
|
||||||
fatal_box("Errore in DB_add(): chiave duplicata nell' indice %ld, file %s",
|
{
|
||||||
|
char msg[256];
|
||||||
|
sprintf(msg, "Errore in DB_add(): chiave duplicata nell' indice %ld, file %s",
|
||||||
rec_num + 1, d4fileName(data));
|
rec_num + 1, d4fileName(data));
|
||||||
|
xvt_dm_post_fatal_exit(msg);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rt = _isreinsert;
|
rt = _isreinsert;
|
||||||
}
|
}
|
||||||
@ -475,11 +455,7 @@ int DB_add(int handle)
|
|||||||
if (rt == 0)
|
if (rt == 0)
|
||||||
{
|
{
|
||||||
while ((rt = d4flush(data)) == r4locked)
|
while ((rt = d4flush(data)) == r4locked)
|
||||||
#ifdef DBG
|
|
||||||
yesnofatal_box("Sono in attesa nella DB_add (d4flush)");
|
|
||||||
#else
|
|
||||||
u4delaySec();
|
u4delaySec();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB_unlock(handle);
|
DB_unlock(handle);
|
||||||
@ -745,6 +721,12 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis)
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Compatta gli indici
|
Compatta gli indici
|
||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int DB_yesnobox(const char* msg)
|
||||||
|
{
|
||||||
|
return xvt_dm_post_ask("Si", "No", NULL, msg) == RESP_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool ask)
|
int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool ask)
|
||||||
{
|
{
|
||||||
int rt=0,handle;
|
int rt=0,handle;
|
||||||
@ -760,7 +742,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
|||||||
if (handle >= 0)
|
if (handle >= 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *ff = find_slash_backslash((char *)filename);
|
char *ff = find_slash_backslash(filename);
|
||||||
if (vis)
|
if (vis)
|
||||||
progind_create((long)r->NKeys,s,0,1,60);
|
progind_create((long)r->NKeys,s,0,1,60);
|
||||||
if ((ff == NULL) || *ff == '\0')
|
if ((ff == NULL) || *ff == '\0')
|
||||||
@ -778,7 +760,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
|||||||
if (rt == e4unique || rt == r4unique)
|
if (rt == e4unique || rt == r4unique)
|
||||||
{
|
{
|
||||||
rt = 0;
|
rt = 0;
|
||||||
if (!ask || yesno_box("Sono stati rilevati alcuni records duplicati nel file %s. Devo eliminarli ?",filename))
|
if (!ask || DB_yesnobox("Sono stati rilevati alcuni records duplicati:\nsi desidera eliminarli?"))
|
||||||
rt = DB_clean_file(handle, (char*) filename, ff, r, vis);
|
rt = DB_clean_file(handle, (char*) filename, ff, r, vis);
|
||||||
else
|
else
|
||||||
tags[0].unique = r4unique_continue;
|
tags[0].unique = r4unique_continue;
|
||||||
@ -839,7 +821,7 @@ int DB_build(const char * filename, RecDes *r)
|
|||||||
TAG4INFO tag_info[MaxKeys+1]; /* Numero di chiavi in un file */
|
TAG4INFO tag_info[MaxKeys+1]; /* Numero di chiavi in un file */
|
||||||
DATA4 *dbuilded;
|
DATA4 *dbuilded;
|
||||||
int rt=0,i;
|
int rt=0,i;
|
||||||
char *ff = find_slash_backslash((char *)filename);
|
char *ff = find_slash_backslash(filename);
|
||||||
|
|
||||||
|
|
||||||
for (i=0; ((i<r->NFields) && (i<MaxFields)); i++) /* Construct field_info */
|
for (i=0; ((i<r->NFields) && (i<MaxFields)); i++) /* Construct field_info */
|
||||||
@ -940,7 +922,11 @@ int DB_recinfo(const char * filename, FileDes *d, RecDes *r, char* keys)
|
|||||||
field_info = d4fieldInfo(data_file);
|
field_info = d4fieldInfo(data_file);
|
||||||
index_file = d4index(data_file,"" /*(char*)filename */);
|
index_file = d4index(data_file,"" /*(char*)filename */);
|
||||||
if (index_file == NULL)
|
if (index_file == NULL)
|
||||||
fatal_box("Il file %s e' senza indici.",filename);
|
{
|
||||||
|
char msg[256];
|
||||||
|
sprintf(msg, "Il file %s e' senza indici.",filename);
|
||||||
|
xvt_dm_post_fatal_exit(msg);
|
||||||
|
}
|
||||||
tag_info = i4tagInfo(index_file);
|
tag_info = i4tagInfo(index_file);
|
||||||
d->EOD = d->EOX = d4recCount(data_file);
|
d->EOD = d->EOX = d4recCount(data_file);
|
||||||
d->LenR = (word)d4recWidth(data_file);
|
d->LenR = (word)d4recWidth(data_file);
|
||||||
@ -1221,7 +1207,7 @@ bool handle_ok(int handle)
|
|||||||
return handle >=0 && handle < CB4FILES && dbdata[handle] !=0;
|
return handle >=0 && handle < CB4FILES && dbdata[handle] !=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char * find_slash_backslash(char * str)
|
static char * find_slash_backslash(const char * str)
|
||||||
{
|
{
|
||||||
static char* xstr = NULL;
|
static char* xstr = NULL;
|
||||||
int l=strlen(str);
|
int l=strlen(str);
|
||||||
@ -2014,7 +2000,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
|||||||
if (handle > -1)
|
if (handle > -1)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *ff = find_slash_backslash((char *)filename);
|
char *ff = find_slash_backslash(filename);
|
||||||
if (vis)
|
if (vis)
|
||||||
progind_create((long)r->NKeys,s,0,1,60);
|
progind_create((long)r->NKeys,s,0,1,60);
|
||||||
if ((ff == NULL) || *ff == '\0')
|
if ((ff == NULL) || *ff == '\0')
|
||||||
@ -2099,7 +2085,7 @@ int DB_build(const char * filename, RecDes *r)
|
|||||||
TAG4INFO tag_info[MaxKeys+1]; /* Numero di chiavi in un file */
|
TAG4INFO tag_info[MaxKeys+1]; /* Numero di chiavi in un file */
|
||||||
DATA4 *dbuilded;
|
DATA4 *dbuilded;
|
||||||
int rt=0,i;
|
int rt=0,i;
|
||||||
char *ff = find_slash_backslash((char *)filename);
|
char *ff = find_slash_backslash(filename);
|
||||||
|
|
||||||
|
|
||||||
for (i=0; ((i<r->NFields) && (i<MaxFields)); i++) /* Construct field_info */
|
for (i=0; ((i<r->NFields) && (i<MaxFields)); i++) /* Construct field_info */
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TRelation_application::TRelation_application()
|
TRelation_application::TRelation_application()
|
||||||
: _mask(NULL), _search_id(-1), _lnflag(FALSE),
|
: _mask(NULL), _search_id(-1), _lnflag(0),
|
||||||
_autodelete(FALSE)
|
_autodelete(0), _navigating(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TRelation_application::~TRelation_application()
|
TRelation_application::~TRelation_application()
|
||||||
@ -483,8 +483,11 @@ bool TRelation_application::modify_mode()
|
|||||||
{
|
{
|
||||||
TRelation* rel = get_relation();
|
TRelation* rel = get_relation();
|
||||||
if (!user_can_read(rel))
|
if (!user_can_read(rel))
|
||||||
return warning_box("I dati non sono accessibili per l'utente %s",
|
{
|
||||||
(const char*)user());
|
warning_box(TR("I dati non sono accessibili per l'utente %s"), (const char*)user());
|
||||||
|
query_mode();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
const TReclock block = user_can_write(rel) ? _testandlock : _nolock;
|
const TReclock block = user_can_write(rel) ? _testandlock : _nolock;
|
||||||
int err = rel->read(_isequal, block);
|
int err = rel->read(_isequal, block);
|
||||||
@ -522,6 +525,7 @@ bool TRelation_application::modify_mode()
|
|||||||
init_modify_mode(*_mask);
|
init_modify_mode(*_mask);
|
||||||
|
|
||||||
// ....possibilmente spostare questa chiamata .....
|
// ....possibilmente spostare questa chiamata .....
|
||||||
|
// Forse deve essere fatta prima della init_modify_mode()!
|
||||||
if (_curr_transaction == TRANSACTION_MODIFY)
|
if (_curr_transaction == TRANSACTION_MODIFY)
|
||||||
ini2insert_mask();
|
ini2insert_mask();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1164,7 +1168,11 @@ bool TRelation_application::relation_remove()
|
|||||||
if (ok || is_transaction())
|
if (ok || is_transaction())
|
||||||
set_limits();
|
set_limits();
|
||||||
else
|
else
|
||||||
return error_box(FR("Errore di cancellazione %d"), r.status());
|
{
|
||||||
|
const int err = r.status();
|
||||||
|
if (err != NOERR) // Succede nei remove con richiesta di conferma all'utente
|
||||||
|
return error_box(FR("Errore di cancellazione %d"), err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1392,7 +1400,11 @@ void TRelation_application::main_loop()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err == NOERR || err == _islocked)
|
if (err == NOERR || err == _islocked)
|
||||||
|
{
|
||||||
|
_navigating = true;
|
||||||
modify_mode();
|
modify_mode();
|
||||||
|
_navigating = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
query_mode();
|
query_mode();
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,8 @@ class TRelation_application : public TSkeleton_application
|
|||||||
TString _curr_trans_from;
|
TString _curr_trans_from;
|
||||||
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
|
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
|
||||||
int _autodelete;
|
int _autodelete;
|
||||||
|
// @cmember:(INTERNAL) Flag di navigazione tramite toolbar
|
||||||
|
bool _navigating;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// @cmember:(INTERNAL) Carica la transazione corrente (protocollo via .ini)
|
// @cmember:(INTERNAL) Carica la transazione corrente (protocollo via .ini)
|
||||||
@ -220,6 +222,7 @@ protected:
|
|||||||
void set_search_field(short id)
|
void set_search_field(short id)
|
||||||
{ _search_id = id;}
|
{ _search_id = id;}
|
||||||
byte autodeleting() const { return _autodelete; }
|
byte autodeleting() const { return _autodelete; }
|
||||||
|
bool navigating() const { return _navigating; }
|
||||||
bool parse_command_line();
|
bool parse_command_line();
|
||||||
void ini2query_mask();
|
void ini2query_mask();
|
||||||
void ini2insert_mask();
|
void ini2insert_mask();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user