real.cpp Sostituita bisciolina residua col cappello di Pinocchio:
in altri termini ~ --> ^ recarray.cpp Corretto metodo TFile_cache::fill nel caso delle tabelle relapp.cpp Migliorata gestione get_next_key relapp.h Aggiunta macro TRANSACTION_RUN tokens.h Aggiunto token CURRENCY xvtility Aggiunto HIDDEN alla funzione xvt_error_hook git-svn-id: svn://10.65.10.50/trunk@6654 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d5db644881
commit
83a616f99a
@ -1188,6 +1188,7 @@ char *real::eng2ita (char *s)
|
||||
return s;
|
||||
}
|
||||
|
||||
// Elimina gli spazi ed i punti, converte le virgole in punti
|
||||
char *real::ita2eng (const char *s)
|
||||
{
|
||||
int j = 0;
|
||||
@ -1241,8 +1242,8 @@ bool real::is_natural (const char *s)
|
||||
s++;
|
||||
ok = *s == '\0';
|
||||
}
|
||||
else ok = FALSE;
|
||||
|
||||
else
|
||||
ok = FALSE;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -1399,7 +1400,7 @@ HIDDEN int get_picture_decimals (const TString& picture, char& decsep)
|
||||
{
|
||||
const int len = picture.len ();
|
||||
for (int i = virgola + 1; i < len; i++)
|
||||
if (strchr ("#@~", picture[i]))
|
||||
if (strchr ("#@^", picture[i]))
|
||||
decimali++;
|
||||
}
|
||||
return decimali;
|
||||
@ -1411,7 +1412,7 @@ char* real::string(const char *picture) const
|
||||
return string ();
|
||||
if (*picture == '.')
|
||||
return points (atoi (picture + 1));
|
||||
if (strcmp (picture, "LETTERE") == 0)
|
||||
if (stricmp (picture, "LETTERE") == 0)
|
||||
return literals ();
|
||||
|
||||
TString v (string());
|
||||
@ -1423,9 +1424,12 @@ char* real::string(const char *picture) const
|
||||
f.rtrim(1);
|
||||
decsep = '.';
|
||||
}
|
||||
|
||||
// Calcola il numero di decimali voluti ed eventualmente
|
||||
// determina il vero separatore dei decimali
|
||||
const int voluti = get_picture_decimals (f, decsep);
|
||||
const char migsep = decsep == '.' ? ',' : '.'; // Separatore delle migliaia
|
||||
|
||||
const int voluti = get_picture_decimals (f, decsep);
|
||||
const int virgola = v.find ('.'); // v e' la nostra cifra, certamente in english format
|
||||
int decimali = (virgola >= 0) ? v.len () - virgola - 1 : 0;
|
||||
|
||||
|
@ -407,13 +407,13 @@ TFile_cache::TFile_cache(TLocalisamfile *f , int key)
|
||||
}
|
||||
|
||||
TFile_cache::TFile_cache(int num, int key)
|
||||
: _file(NULL), _key(key)
|
||||
: _file(NULL), _key(key), _last_firm(-883)
|
||||
{
|
||||
_code << num;
|
||||
}
|
||||
|
||||
TFile_cache::TFile_cache(const char* tab, int key)
|
||||
: _file(NULL), _key(key)
|
||||
: _file(NULL), _key(key), _last_firm(-883)
|
||||
{
|
||||
_code = tab;
|
||||
}
|
||||
@ -426,9 +426,10 @@ TFile_cache::~TFile_cache()
|
||||
|
||||
void TFile_cache::init_file(TLocalisamfile* f)
|
||||
{
|
||||
CHECK(_file == NULL, "File already initialized");
|
||||
if (_file != NULL)
|
||||
delete _file;
|
||||
|
||||
if (f==NULL)
|
||||
if (f == NULL)
|
||||
{
|
||||
int logicnum = atoi(_code);
|
||||
if (logicnum == 0)
|
||||
@ -444,15 +445,18 @@ void TFile_cache::init_file(TLocalisamfile* f)
|
||||
else
|
||||
_file = f;
|
||||
|
||||
TDir dir;
|
||||
dir.get(_file->num());
|
||||
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
|
||||
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
|
||||
if (_file != NULL)
|
||||
{
|
||||
TDir dir;
|
||||
dir.get(_file->num());
|
||||
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
|
||||
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
|
||||
}
|
||||
}
|
||||
|
||||
void TFile_cache::test_firm()
|
||||
{
|
||||
if (_file == NULL)
|
||||
if (_last_firm < -1)
|
||||
init_file();
|
||||
|
||||
if (_last_firm >= 0) // Se e' un file di ditta ...
|
||||
@ -472,15 +476,17 @@ const TObject& TFile_cache::query(const char* code)
|
||||
|
||||
_error = NOERR;
|
||||
_code = code;
|
||||
|
||||
TObject* obj = _cache.objptr(_code);
|
||||
if (obj == NULL)
|
||||
{
|
||||
TRectype& curr = _file->curr();
|
||||
TLocalisamfile& f = file();
|
||||
TRectype& curr = f.curr();
|
||||
if (_code.not_empty())
|
||||
{
|
||||
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
|
||||
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave
|
||||
for (int i = _file->tab() ? 1 :0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
for (int i = f.tab() ? 1 :0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
{
|
||||
const int nf = kd.FieldSeq[i] % MaxFields;
|
||||
const RecFieldDes& rf = recd->Fd[nf];
|
||||
@ -490,8 +496,8 @@ const TObject& TFile_cache::query(const char* code)
|
||||
else
|
||||
NFCHECK("Valore del campo chiave %s non specificato per la cache", rf.Name);
|
||||
}
|
||||
_file->setkey(_key);
|
||||
_error = _file->read();
|
||||
f.setkey(_key);
|
||||
_error = f.read();
|
||||
} else
|
||||
_error = _iskeyerr;
|
||||
switch (_error)
|
||||
@ -503,6 +509,7 @@ const TObject& TFile_cache::query(const char* code)
|
||||
case _isemptyfile:
|
||||
default:
|
||||
curr.zero();
|
||||
break;
|
||||
}
|
||||
obj = rec2obj(curr);
|
||||
_cache.add(_code, obj);
|
||||
@ -519,16 +526,17 @@ int TFile_cache::io_result()
|
||||
int TFile_cache::fill()
|
||||
{
|
||||
test_firm();
|
||||
_file->setkey(_key);
|
||||
|
||||
TRectype& curr = _file->curr();
|
||||
TLocalisamfile& f = file();
|
||||
|
||||
TRectype& curr = f.curr();
|
||||
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
|
||||
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave
|
||||
|
||||
for (int err = _file->first(); err == NOERR; err = _file->next())
|
||||
for (int err = f.first(); err == NOERR; err = f.next())
|
||||
{
|
||||
_code.cut(0);
|
||||
for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
for (int i = f.tab() ? 1 :0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
{
|
||||
const int nf = kd.FieldSeq[i] % MaxFields;
|
||||
const RecFieldDes& rf = recd->Fd[nf];
|
||||
@ -538,13 +546,16 @@ int TFile_cache::fill()
|
||||
TObject* obj = rec2obj(curr);
|
||||
_cache.add(_code, obj);
|
||||
}
|
||||
|
||||
// Non serve piu'
|
||||
delete _file; _file = NULL;
|
||||
|
||||
return _cache.items();
|
||||
}
|
||||
|
||||
TLocalisamfile & TFile_cache::file()
|
||||
TLocalisamfile& TFile_cache::file()
|
||||
{
|
||||
if (!_file)
|
||||
if (_file == NULL)
|
||||
init_file();
|
||||
return *_file;
|
||||
}
|
||||
|
@ -251,8 +251,9 @@ bool TRelation_application::autonum(
|
||||
TToken_string k;
|
||||
if (!get_next_key(k))
|
||||
{
|
||||
NFCHECK("La 'const char* get_next_key()' verra' sostituita dalla 'bool get_next_key(TToken_string&)'");
|
||||
k = get_next_key();
|
||||
if (k.not_empty())
|
||||
NFCHECK("La 'const char* get_next_key()' verra' sostituita dalla 'bool get_next_key(TToken_string&)'");
|
||||
}
|
||||
|
||||
if (!rec && !m->query_mode())
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define TRANSACTION_INSERT "INSERT"
|
||||
#define TRANSACTION_MODIFY "MODIFY"
|
||||
#define TRANSACTION_DELETE "DELETE"
|
||||
#define TRANSACTION_RUN "RUN"
|
||||
#define TM_INTERACTIVE 'I'
|
||||
#define TM_AUTOMATIC 'A'
|
||||
// @doc EXTERNAL
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define COPY CO
|
||||
#define DATE DA
|
||||
#define DISPLAY DI
|
||||
#define DRIVENBY DR
|
||||
#define EMPTY 0
|
||||
#define END EN
|
||||
#define ENDPAGE EN
|
||||
|
@ -21,7 +21,7 @@ void ignore_xvt_errors(bool ixe)
|
||||
_ignore_xvt_errors = ixe;
|
||||
}
|
||||
|
||||
BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
|
||||
HIDDEN BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
|
||||
{
|
||||
if (_ignore_xvt_errors)
|
||||
return TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user