Patch level : 12.0 1214

Files correlati     : ba1.exe ba7.exe ba7100a.msk

Commento:
La conversione era lenta in partenza
Il postino diventa trasferimenti.
aggiunto il profilo e un parametro per caricarlo (-p<nome profilo>)
This commit is contained in:
Alessandro Bonazzi 2022-11-16 08:17:39 +01:00
parent 4de704b6dc
commit 780031ae86
6 changed files with 86 additions and 9 deletions

View File

@ -1,3 +1,3 @@
182
0
$dblog|28|28|411|0|Log Transazioni|||
$dblog|||411|0|Log Transazioni|||

View File

@ -17,4 +17,4 @@ SESSION|2|4|0|Sessione
TRANS|11|10|0|Transazione
2
TIMESTAMP+FILE+RECNO|
FILE+KEY+TIMESTAMP|X
FILE+KEY+TIMESTAMP|X

View File

@ -2065,8 +2065,7 @@ int TSystemisamfile::update(
const TTrec& newrec, // @parm Nuovo tracciato record con cui aggiornare il file
bool interactive) // @parm Indica se riportare i campi personalizzati
{
//if (newrec.len() == 0)
{
if (newrec.len() <= 8)
{
// if (interactive) error_box(FR("Il nuovo tracciato per il file %d e' vuoto"), num()); // Fastidioso per Ilaria
@ -2099,6 +2098,7 @@ int TSystemisamfile::update(
}
int lenr = wrec.len();
if (lenr != 0)
{
const long lev = prefix().filelevel();
@ -2114,7 +2114,7 @@ int TSystemisamfile::update(
}
if (!lcf && wrec == oldrec)
{
{
err = exec_convapp(lev, false); // Post-conversion (SOLO se il record e' rimasto uguale)
setstatus(err);
return err;
@ -2160,7 +2160,12 @@ int TSystemisamfile::update(
wrec.rehash();
lenr = wrec.len();
}
if (wrec == oldrec)
return NOERR;
TFilename fname;
if (toconvert)
fname = filename();
@ -2168,7 +2173,9 @@ int TSystemisamfile::update(
{
TRecnotype ni = 0L;
TFilename tmpfname; tmpfname.temp("tf");
err = open(_excllock);
if (oldrec.len() > 0)
err = open(_excllock);
if (err != NOERR)
{
@ -2176,14 +2183,16 @@ int TSystemisamfile::update(
(const char*)filename(), err);
return err;
}
err=DB_build(tmpfname, &wrec.rec());
close();
err=DB_build(tmpfname, &wrec.rec());
if (oldrec.len() > 0)
close();
if (err != NOERR)
{
err=get_error(err);
return (err);
}
if (dir.eod() > 0 && oldrec.len() > 0)
{
// Apro il file destinazione in modo esclusivo e senza indici

View File

@ -2769,10 +2769,12 @@ int TMask::save_profile(int num, const char* desc) const
int TMask::load_profile(int num, bool reset)
{
TFilename prof;
if (make_profile_name(prof))
{
TConfig ini(prof, "Main");
if (num <= 0)
if (num <= 0)
num = ini.get_int(user());
else
ini.set(user(), num);
@ -2811,6 +2813,69 @@ int TMask::load_profile(int num, bool reset)
return num;
}
int TMask::load_profile(const char * profname, bool reset)
{
TFilename prof;
int num = 0;
if (make_profile_name(prof))
{
// find profile num
TConfig ini(prof, "Main");
TString_array paragraphs;
ini.list_paragraphs(paragraphs);
ini.set_paragraph("Main");
FOR_EACH_ARRAY_ROW(paragraphs, i, para)
{
TString name = ini.get("Description", *para);
if (name == profname)
{
num = atoi(*para);
break;
}
}
ini.set_paragraph("Main");
if (num <= 0)
num = ini.get_int(user());
else
ini.set(user(), num);
TString16 name; name << num;
TAssoc_array& var = ini.list_variables(name);
if (var.items() > 0)
{
for (int pos = fields() - 1; pos >= 0; pos--)
{
TMask_field& f = fld(pos);
if (f.is_loadable() && f.get_default().empty())
{
name.format("F_%d", f.dlg());
if (reset || var.objptr(name) != NULL)
{
if (f.is_sheet())
{
TSheet_field& sf = (TSheet_field&)f;
sf.destroy();
for (int r = 0; ini.exist(name, r); r++)
sf.row(r) = ini.get(name, NULL, r);
sf.force_update();
}
else
{
if (!f.is_firm())
f.set(ini.get(name));
}
}
}
}
}
}
return num;
}
bool TMask::kill_profile(int num)
{
TFilename prof;

View File

@ -464,6 +464,8 @@ public:
int save_profile(int num = 0, const char* desc = NULL) const;
// @cmember Carica il profilo <p num>
int load_profile(int num = 0, bool reset = true);
// @cmember Carica il profilo <p name>
int TMask::load_profile(const char * profname, bool reset = true);
// @cmember Elimina il profilo <p num>
bool kill_profile(int num);

View File

@ -45,6 +45,7 @@ protected:
public:
void reset();
bool log(int severity, const char* msg); // severity: 0=normal; 1=warning; 2=error
bool line() { return log(0, ""); }
void set_title(const char* title);
void kill_duplicates(bool k = true) { _kill_duplicates = k; }
const TString& title() const { return _title; }