Patch level : 10.0

Files correlati     : tp0
Ricompilazione Demo : [ ]
Commento            :
Corretta esecuzione transazioni via ODBC.  Necessaria per trasferimento PACK.


git-svn-id: svn://10.65.10.50/trunk@19324 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-09-23 12:04:06 +00:00
parent bd190b4edd
commit 4436cb7970
6 changed files with 43 additions and 22 deletions

View File

@ -574,10 +574,11 @@ void TApplication::print()
void TApplication::preview()
{
const TPrtype oldmode = printer().printtype();
printer().set_printtype(screenvis);
TPrinter& p = printer();
const TPrtype oldmode = p.printtype();
p.set_printtype(screenvis);
print();
printer().set_printtype(oldmode);
p.set_printtype(oldmode);
}
void TApplication::check_menu_item(MENU_TAG item, bool chk)
@ -608,14 +609,13 @@ void TApplication::enable_menu_item(
bool TApplication::has_module(int module, int checktype) const
{
#ifdef _DEMO_
bool ok = true;
const bool ok = true;
#else
bool ok = dongle().active(module);
#endif
// Testa bit di attivazione dell'utente
if (ok && checktype != CHK_DONGLE)
ok = _user_aut[module];
#endif
return ok;
}

View File

@ -31,7 +31,10 @@ long TExternal_app::run(
TFilename path(_path);
TFilename comm_name(_path);
const int p = comm_name.find(" -"); //c'e' uno spazio nella stringa?
int p = comm_name.find(" -"); //c'e' un - nella stringa?
if (p > 0) //se c'e' tronca il nome allo spazio
comm_name.cut(p);
p = comm_name.find(" /"); //c'e' un / nella stringa?
if (p > 0) //se c'e' tronca il nome allo spazio
comm_name.cut(p);
@ -67,8 +70,9 @@ long TExternal_app::run(
if (!utente) // cambio directory se eseguo un programma estero
{
const TFilename dir(comm_name.path());
if (dir.not_empty() && dir.find("custom") < 0)
TFilename dir(comm_name.path());
dir.lower();
if (dir.full() && dir.find("custom") < 0)
{
DIRECTORY d;
if (xvt_fsys_convert_str_to_dir(dir, &d))

View File

@ -315,13 +315,20 @@ bool TODBC_recordset::move_to(TRecnotype n)
long TODBC_recordset::exec(const char* sql)
{
long err = -1;
TString cmd;
// Se la stringa "sql" non contiene parametri di connessione ma essi sono in "_sql"
// allora cerco di effetture la connessione in base a quella
if (_dsn.empty() && strncmp(sql, "ODBC(", 5) != 0 && _sql.starts_with("ODBC("))
parsed_text(cmd);
XVT_ODBC oc = connection();
if (oc != NULL)
{
set(sql);
parsed_text(cmd);
TPerformance_profiler prof("ODBC command");
set(sql);
TString cmd; parsed_text(cmd);
err = xvt_odbc_execute(oc, cmd, NULL, NULL);
}

View File

@ -44,6 +44,9 @@ public:
long exec(const char* sql);
bool connect(const char* dsn, const char* usr = "", const char* pwd = "", const char* dir = "");
const TString& dsn() const { return _dsn; }
TODBC_recordset(const char* sql);
virtual ~TODBC_recordset();
};

View File

@ -326,6 +326,11 @@ void TRelation_application::update_navigation_bar()
bool TRelation_application::save_and_new() const
{ return false; }
bool TRelation_application::save_and_quit() const
{
return (_autoins_caller.full() || _curr_transaction.not_empty()) && _curr_trans_mode != TM_REMAIN;
}
int TRelation_application::set_mode(int mode)
{
static int _mode = NO_MODE;
@ -499,7 +504,7 @@ void TRelation_application::insert_mode()
init_insert_mode(*_mask);
// ....possibilmente spostare questa chiamata .....
if (_curr_transaction == TRANSACTION_INSERT)
if (is_transaction() && _curr_transaction == TRANSACTION_INSERT)
ini2insert_mask();
}
@ -1346,9 +1351,11 @@ void TRelation_application::main_loop()
{
case K_ESC:
if (save(TRUE))
{
query_mode();
if ((_autoins_caller.full() || is_transaction()) && _curr_trans_mode != TM_REMAIN)
k = K_QUIT;
if (save_and_quit())
k = K_QUIT;
}
break;
case K_QUIT:
if (!save(TRUE))
@ -1389,7 +1396,7 @@ void TRelation_application::main_loop()
case K_SAVE:
if (save(FALSE))
{
if ((_autoins_caller.full() || is_transaction()) && _curr_trans_mode != TM_REMAIN)
if (save_and_quit())
{
k = K_QUIT;
}

View File

@ -221,8 +221,10 @@ protected:
void write_disable()
{ write_enable(FALSE); }
// @cmember Salva il record corrente e si predispone per un nuovo inserimento
// @cmember Dopo aver salvato si predispone per un nuovo inserimento
virtual bool save_and_new() const;
// @cmember Deve uscire dal programma dopo aver salvato con successo?
virtual bool save_and_quit() const;
// @cmember Impone il campo da utilizzare col bottone Ricerca
void set_search_field(short id)
@ -259,14 +261,12 @@ public:
// @cmember Costruisce il membro <md TRelation_application::_fixed>
void set_link(TMask & m, const char * keyexpr);
// @cmember Ritorna TRUE se e' stato chiamato col messaggio di link
bool lnflag() const
{ return _lnflag != 0;} // qui
bool lnflag() const { return _lnflag != 0;}
// @cmember Ritorna TRUE se e' una transazione
virtual bool is_transaction() const { return _curr_transaction.not_empty(); }
virtual word class_id() const { return CLASS_RELATION_APPLICATION; }
// @cmember Ritorna TRUE se e' una transazione
bool is_transaction() const { return _curr_transaction.not_empty(); }
// @cmember Costruttore
TRelation_application();
// @cmember Distruttore