Patch level : 12.0 no-patch

Files correlati     :
Commento            :
Aggiunte funzioni per leggere colonne (andavano già messe da tempo)
- Aggiunta colonna natura in TCodiceIVA
- Aggiunta causale 770 come recordset
- Aggiunta colonne cassa previdenziale, soggetto a ritenuta e spesa calcolo ritenuta
- Aggiunto nuovo tipo di errore da SQLAPI in TXvt_recordset
This commit is contained in:
Tolla 2019-02-11 14:47:45 +01:00
parent 96a68b0437
commit cb7551773d
5 changed files with 104 additions and 55 deletions

View File

@ -168,6 +168,8 @@ public: // TObject
bool reverse_charge() const; bool reverse_charge() const;
int regime_speciale() const { return get_int("I5");} int regime_speciale() const { return get_int("I5");}
const TString& natura() const { return get("S12"); }
TCodiceIVA(const char* codice = NULL); TCodiceIVA(const char* codice = NULL);
TCodiceIVA(const TRectype & rec) : TRectype(rec) {} TCodiceIVA(const TRectype & rec) : TRectype(rec) {}
TCodiceIVA(const TCodiceIVA & iva) : TRectype(iva) {} TCodiceIVA(const TCodiceIVA & iva) : TRectype(iva) {}

View File

@ -149,9 +149,13 @@ public:
const TString& cms() const { return get("S1").mid(40, 20); } const TString& cms() const { return get("S1").mid(40, 20); }
const TString& fase() const { return get("S1").mid(60); } const TString& fase() const { return get("S1").mid(60); }
const int codtrib() const { return get_int("S10"); } const int codtrib() const { return get_int("S10"); }
const TRectype& rec_caus_770() const;
const int caus_770() const { return get_int("I6"); } const int caus_770() const { return get_int("I6"); }
const int quadro_770() const { return get_int("S12"); } const int quadro_770() const { return get_int("S12"); }
const int quadroLA_770() const { return get_int("S14"); } const int quadroLA_770() const { return get_int("S14"); }
const TString& cassa_previdenziale() const { return get("S13").left(4); }
bool sogg_a_rit() const { return get_bool("B0"); }
bool spe_cal_rit() const { return get_bool("B1"); }
TSpesa_prest(const char* codice = NULL, char tipo = 'S'); TSpesa_prest(const char* codice = NULL, char tipo = 'S');
TSpesa_prest(const TRectype& rec); TSpesa_prest(const TRectype& rec);

View File

@ -229,6 +229,13 @@ char TSpesa_prest::genere() const
return RIGA_ATTREZZATURE; return RIGA_ATTREZZATURE;
return ' '; return ' ';
} }
const TRectype& TSpesa_prest::rec_caus_770() const
{
static TString caus770; caus770.cut(0); caus770.format("%02d", caus_770());
return cache().get("%CA7", caus770);
}
int TSpesa_prest::read(const char* codice) int TSpesa_prest::read(const char* codice)
{ {
const TString8 cod = get("COD"); const TString8 cod = get("COD");

View File

@ -25,8 +25,9 @@ TXvt_recordset::TXvt_recordset() : _freezed(false)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
} }
@ -56,8 +57,9 @@ TXvt_recordset::TXvt_recordset(const char* db, const char* user, const char* pas
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
} }
} }
@ -106,8 +108,8 @@ int TXvt_recordset::connect(const char* db, const char* user, const char* pass,
SAClient_t dbDriver = (SAClient_t)tipoDb; SAClient_t dbDriver = (SAClient_t)tipoDb;
if (dbAddress.IsEmpty() || usr.IsEmpty()) if (dbAddress.IsEmpty() || usr.IsEmpty())
{ {
_codeError = NOT_INITIALIZED; _code_error = NOT_INITIALIZED;
_stringError = NOT_INITIALIZEDS; _string_error = NOT_INITIALIZEDS;
} }
else else
{ {
@ -121,17 +123,18 @@ int TXvt_recordset::connect(const char* db, const char* user, const char* pass,
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
} }
} }
else else
{ {
_codeError = NOT_INITIALIZED; _code_error = NOT_INITIALIZED;
_stringError = NOT_INITIALIZEDS; _string_error = NOT_INITIALIZEDS;
} }
return _codeError; return _code_error;
} }
void TXvt_recordset::disconnect() void TXvt_recordset::disconnect()
@ -142,8 +145,9 @@ void TXvt_recordset::disconnect()
} }
catch(SAException &x) catch(SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
} }
@ -160,8 +164,9 @@ bool TXvt_recordset::commit(bool autoRoll)
{ {
rollback(); rollback();
} }
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return false; return false;
} }
return true; return true;
@ -176,8 +181,9 @@ bool TXvt_recordset::rollback()
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return false; return false;
} }
return true; return true;
@ -295,8 +301,9 @@ bool TXvt_recordset::set(const char* query)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return false; return false;
} }
return true; return true;
@ -316,8 +323,9 @@ bool TXvt_recordset::exec(bool autoF)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
ok = false; ok = false;
} }
return ok; return ok;
@ -343,8 +351,9 @@ bool TXvt_recordset::next()
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
return fetched; return fetched;
} }
@ -362,8 +371,9 @@ bool TXvt_recordset::prev()
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
return fetched; return fetched;
} }
@ -381,8 +391,9 @@ bool TXvt_recordset::first()
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
return fetched; return fetched;
} }
@ -408,8 +419,9 @@ bool TXvt_recordset::last()
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
} }
return fetched; return fetched;
} }
@ -452,8 +464,9 @@ int TXvt_recordset::get_int(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return -1; return -1;
} }
} }
@ -466,9 +479,9 @@ short TXvt_recordset::get_short(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return -1; return -1;
} }
} }
@ -481,9 +494,9 @@ long TXvt_recordset::get_long(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return -1; return -1;
} }
} }
@ -496,8 +509,9 @@ double TXvt_recordset::get_double(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return -1; return -1;
} }
} }
@ -510,8 +524,9 @@ bool TXvt_recordset::get_bool(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return false; return false;
} }
} }
@ -532,8 +547,9 @@ const char* TXvt_recordset::get_date(const char * field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return NULL; return NULL;
} }
} }
@ -546,8 +562,9 @@ const char* TXvt_recordset::get(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return ""; return "";
} }
} }
@ -560,17 +577,18 @@ char TXvt_recordset::get_char(const char* field)
} }
catch (SAException &x) catch (SAException &x)
{ {
_codeError = x.ErrNativeCode(); _code_error = x.ErrNativeCode();
_GET_ERROR(x.ErrMessage(), _stringError); _GET_ERROR(x.ErrMessage(), _string_error);
_GET_ERROR(x.ErrText(), _string_error_full_text);
return '\0'; return '\0';
} }
} }
long TXvt_recordset::get_code_error(bool erase) long TXvt_recordset::get_code_error(bool erase)
{ {
long app = _codeError; long app = _code_error;
if (erase) if (erase)
_codeError = NOERR; _code_error = NOERR;
return app; return app;
} }
@ -581,16 +599,30 @@ const char* TXvt_recordset::get_string_error(bool erase)
if (app != nullptr) if (app != nullptr)
delete app; delete app;
_CPY_STR(_stringError, app); _CPY_STR(_string_error, app);
if (erase) if (erase)
_stringError = ""; _string_error = "";
return app;
}
const char* TXvt_recordset::get_text_error(bool erase)
{
static char* app;
if (app != nullptr)
delete app;
_CPY_STR(_string_error_full_text, app);
if (erase)
_string_error_full_text = "";
return app; return app;
} }
const bool TXvt_recordset::setErrorFreezed() const bool TXvt_recordset::setErrorFreezed()
{ {
_codeError = ERROR_FREEZED; _code_error = ERROR_FREEZED;
_stringError = ERROR_FREEZEDS; _string_error = _string_error_full_text = ERROR_FREEZEDS;
return false; return false;
} }

View File

@ -74,9 +74,11 @@ protected:
/**< Query */ /**< Query */
const char* _query; const char* _query;
/**< Ultima stringa con codice di errore ricevuto */ /**< Ultima stringa con codice di errore ricevuto */
char* _stringError; char* _string_error;
/**< Ultima stringa con codice di errore ricevuto full text */
char* _string_error_full_text;
/**< Ultimo codice di errore ricevuto */ /**< Ultimo codice di errore ricevuto */
long _codeError; long _code_error;
/**< Numero record corrente */ /**< Numero record corrente */
long _recno; long _recno;
/**< Indica se l'oggetto è bloccato, in tal caso non si possono fare set/exec */ /**< Indica se l'oggetto è bloccato, in tal caso non si possono fare set/exec */
@ -202,6 +204,8 @@ public:
long get_code_error(bool erase = true); long get_code_error(bool erase = true);
/**< Ritorno l'ultima stringa di errore segnalato in formato (const char *) */ /**< Ritorno l'ultima stringa di errore segnalato in formato (const char *) */
const char* get_string_error(bool erase = true); const char* get_string_error(bool erase = true);
/**< Ritorno l'ultima stringa di errore (full text) segnalato in formato (const char *) */
const char* get_text_error(bool erase = true);
//char * getCharPointer(const char * field) { return const_cast<char*>(static_cast<const char*>(recset.Field(field).asString())); } //char * getCharPointer(const char * field) { return const_cast<char*>(static_cast<const char*>(recset.Field(field).asString())); }
// Utilities // Utilities