Patch level : 2.0 610

Files correlati     : cg1.exe cg3.exe sc2.exe
Ricompilazione Demo : [ ]
Commento            :

AO20112
Migliorate prestazioni stampe con dati condivisi in rete.
ATTENZIONE: verificare anche altri programmi con stampe pesanti


git-svn-id: svn://10.65.10.50/trunk@11518 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-10-21 11:10:01 +00:00
parent 3fc298d5e6
commit 39102f264b
4 changed files with 45 additions and 26 deletions

View File

@ -19,6 +19,7 @@
#include <postman.h> #include <postman.h>
#include <prefix.h> #include <prefix.h>
#include <progind.h> #include <progind.h>
#include <recarray.h>
#include <relation.h> #include <relation.h>
#include <scanner.h> #include <scanner.h>
#include <utility.h> #include <utility.h>
@ -1125,8 +1126,12 @@ int TBaseisamfile::_rewrite(const TRectype& rec)
_recno = DB_recno(fhnd); _recno = DB_recno(fhnd);
prefix().unlock_record(_isam_handle, _recno); prefix().unlock_record(_isam_handle, _recno);
if(_lasterr == NOERR && curr().has_memo( )) if(_lasterr == NOERR)
((TRectype &)rec).write_memo(_isam_handle, _recno ); {
if (curr().has_memo( ))
((TRectype &)rec).write_memo(_isam_handle, _recno );
rec_cache(_logicnum).notify_change();
}
} }
return _lasterr; return _lasterr;
@ -1155,8 +1160,14 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
} else } else
_lasterr = get_error(_lasterr); _lasterr = get_error(_lasterr);
_recno = DB_recno(fhnd); _recno = DB_recno(fhnd);
if(_lasterr == NOERR && curr().has_memo( ))
((TRectype &)rec).write_memo(_isam_handle, _recno ); if(_lasterr == NOERR)
{
if (curr().has_memo( ))
((TRectype &)rec).write_memo(_isam_handle, _recno );
rec_cache(_logicnum).notify_change();
}
return _lasterr; return _lasterr;
} }
@ -1197,8 +1208,12 @@ int TBaseisamfile::_remove(const TRectype& rec)
} }
} }
if(_lasterr == NOERR && curr().has_memo()) if(_lasterr == NOERR)
curr().init_memo(); {
if (curr().has_memo( ))
curr().init_memo();
rec_cache(_logicnum).notify_change();
}
return _lasterr; return _lasterr;
} }
@ -1410,12 +1425,13 @@ bool TBaseisamfile::get_relapp(TString& app) const
bool TBaseisamfile::is_changed_since(long& last) const bool TBaseisamfile::is_changed_since(long& last) const
{ {
bool yes = FALSE; bool yes = FALSE;
const int fh = ::_sopen(filename(), _O_RDONLY, _SH_DENYNO);
const int fh = ::sopen(filename(), _O_RDONLY, _SH_DENYNO);
if (fh > 0) if (fh > 0)
{ {
struct _stat stat; struct stat stat;
if (::_fstat(fh, &stat) == 0) if (::fstat(fh, &stat) == 0)
{ {
const long tim = long(stat.st_mtime) ^ long(stat.st_size); const long tim = long(stat.st_mtime) ^ long(stat.st_size);
yes = tim != last; yes = tim != last;
@ -1423,6 +1439,7 @@ bool TBaseisamfile::is_changed_since(long& last) const
} }
::_close(fh); ::_close(fh);
} }
return yes; return yes;
} }
@ -3520,6 +3537,9 @@ bool TRectype::edit(int logicnum, const char * alternate_key_fields) const
TExternal_app a(app); TExternal_app a(app);
ok = a.run() == 0; ok = a.run() == 0;
xvt_fsys_removefile(ininame); xvt_fsys_removefile(ininame);
if (ok)
rec_cache(logicnum).notify_change();
} }
return ok; return ok;
} }

View File

@ -2384,7 +2384,7 @@ bool TBrowse::do_link(bool insert)
ok = _cursor->ok(); ok = _cursor->ok();
if (ok) if (ok)
{ {
rec_cache(_cursor->file().num()).destroy(); // Svuota eventule cache rec_cache(_cursor->file().num()).notify_change(); // Svuota eventule cache
do_output(); do_output();
} }
} }

View File

@ -797,17 +797,14 @@ TString& TString::format(
// @comm Funziona come la funzione "sprintf" standard del C e ritorna la // @comm Funziona come la funzione "sprintf" standard del C e ritorna la
// stringa formattata con i parametri passati. // stringa formattata con i parametri passati.
{ {
TString& spark = get_tmp_string(512); char spark[512];
va_list pars; va_list pars;
va_start(pars, fmt); va_start(pars, fmt);
const int tot = vsprintf(spark.get_buffer(), fmt, pars); const int tot = vsprintf(spark, fmt, pars);
va_end(pars); va_end(pars);
CHECK(tot >= 0 && tot < spark.size(), "Ue'! Quanto scrivi?"); CHECK(tot < sizeof(spark), "Ue'! Quanto scrivi?");
if (tot > size()) resize(tot, FALSE); return set(spark);
strcpy(_str, spark);
return *this;
} }
// Certified 99% // Certified 99%
@ -1935,13 +1932,14 @@ TToken_string& get_tmp_string(int len)
static int next = 0; static int next = 0;
TToken_string* str = (TToken_string*)ararar.objptr(next); TToken_string* str = (TToken_string*)ararar.objptr(next);
if (str == NULL || str->size() < len) if (str == NULL)
{ {
str = new TToken_string(len); str = new TToken_string(len);
ararar.add(str, next); ararar.add(str, next);
} }
else if (str->size() < len)
str->cut(0); str->spaces(len);
str->cut(0);
if (++next >= ararar.size()) if (++next >= ararar.size())
next = 0; next = 0;

View File

@ -204,15 +204,16 @@ char* format(
{ {
va_list pars; va_list pars;
TString& tmp = get_tmp_string(512); char buf[512];
char* buf = tmp.get_buffer();
va_start(pars, fmt); va_start(pars, fmt);
const int tot = vsprintf(buf, fmt, pars); const int tot = vsprintf(buf, fmt, pars);
va_end(pars); va_end(pars);
CHECK(tot >= 0 && tot < 512, "Ue'! Ma quanto scrivi?"); CHECK(tot < 512, "Ue'! Ma quanto scrivi?");
return buf; TString& tmp = get_tmp_string();
tmp = buf;
return tmp.get_buffer();
} }
// @doc EXTERNAL // @doc EXTERNAL