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:
parent
96a68b0437
commit
cb7551773d
@ -168,6 +168,8 @@ public: // TObject
|
||||
bool reverse_charge() const;
|
||||
int regime_speciale() const { return get_int("I5");}
|
||||
|
||||
const TString& natura() const { return get("S12"); }
|
||||
|
||||
TCodiceIVA(const char* codice = NULL);
|
||||
TCodiceIVA(const TRectype & rec) : TRectype(rec) {}
|
||||
TCodiceIVA(const TCodiceIVA & iva) : TRectype(iva) {}
|
||||
|
@ -149,9 +149,13 @@ public:
|
||||
const TString& cms() const { return get("S1").mid(40, 20); }
|
||||
const TString& fase() const { return get("S1").mid(60); }
|
||||
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 quadro_770() const { return get_int("S12"); }
|
||||
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 TRectype& rec);
|
||||
|
@ -229,6 +229,13 @@ char TSpesa_prest::genere() const
|
||||
return RIGA_ATTREZZATURE;
|
||||
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)
|
||||
{
|
||||
const TString8 cod = get("COD");
|
||||
|
@ -25,8 +25,9 @@ TXvt_recordset::TXvt_recordset() : _freezed(false)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_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)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_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;
|
||||
if (dbAddress.IsEmpty() || usr.IsEmpty())
|
||||
{
|
||||
_codeError = NOT_INITIALIZED;
|
||||
_stringError = NOT_INITIALIZEDS;
|
||||
_code_error = NOT_INITIALIZED;
|
||||
_string_error = NOT_INITIALIZEDS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,17 +123,18 @@ int TXvt_recordset::connect(const char* db, const char* user, const char* pass,
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_codeError = NOT_INITIALIZED;
|
||||
_stringError = NOT_INITIALIZEDS;
|
||||
_code_error = NOT_INITIALIZED;
|
||||
_string_error = NOT_INITIALIZEDS;
|
||||
}
|
||||
return _codeError;
|
||||
return _code_error;
|
||||
}
|
||||
|
||||
void TXvt_recordset::disconnect()
|
||||
@ -142,8 +145,9 @@ void TXvt_recordset::disconnect()
|
||||
}
|
||||
catch(SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_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();
|
||||
}
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -176,8 +181,9 @@ bool TXvt_recordset::rollback()
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -295,8 +301,9 @@ bool TXvt_recordset::set(const char* query)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -316,8 +323,9 @@ bool TXvt_recordset::exec(bool autoF)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
@ -343,8 +351,9 @@ bool TXvt_recordset::next()
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
}
|
||||
return fetched;
|
||||
}
|
||||
@ -362,8 +371,9 @@ bool TXvt_recordset::prev()
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
}
|
||||
return fetched;
|
||||
}
|
||||
@ -381,8 +391,9 @@ bool TXvt_recordset::first()
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
}
|
||||
return fetched;
|
||||
}
|
||||
@ -408,8 +419,9 @@ bool TXvt_recordset::last()
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
}
|
||||
return fetched;
|
||||
}
|
||||
@ -452,8 +464,9 @@ int TXvt_recordset::get_int(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -466,9 +479,9 @@ short TXvt_recordset::get_short(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -481,9 +494,9 @@ long TXvt_recordset::get_long(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -496,8 +509,9 @@ double TXvt_recordset::get_double(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -510,8 +524,9 @@ bool TXvt_recordset::get_bool(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -532,8 +547,9 @@ const char* TXvt_recordset::get_date(const char * field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -546,8 +562,9 @@ const char* TXvt_recordset::get(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -560,17 +577,18 @@ char TXvt_recordset::get_char(const char* field)
|
||||
}
|
||||
catch (SAException &x)
|
||||
{
|
||||
_codeError = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||
_code_error = x.ErrNativeCode();
|
||||
_GET_ERROR(x.ErrMessage(), _string_error);
|
||||
_GET_ERROR(x.ErrText(), _string_error_full_text);
|
||||
return '\0';
|
||||
}
|
||||
}
|
||||
|
||||
long TXvt_recordset::get_code_error(bool erase)
|
||||
{
|
||||
long app = _codeError;
|
||||
long app = _code_error;
|
||||
if (erase)
|
||||
_codeError = NOERR;
|
||||
_code_error = NOERR;
|
||||
return app;
|
||||
}
|
||||
|
||||
@ -581,16 +599,30 @@ const char* TXvt_recordset::get_string_error(bool erase)
|
||||
if (app != nullptr)
|
||||
delete app;
|
||||
|
||||
_CPY_STR(_stringError, app);
|
||||
_CPY_STR(_string_error, app);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const bool TXvt_recordset::setErrorFreezed()
|
||||
{
|
||||
_codeError = ERROR_FREEZED;
|
||||
_stringError = ERROR_FREEZEDS;
|
||||
_code_error = ERROR_FREEZED;
|
||||
_string_error = _string_error_full_text = ERROR_FREEZEDS;
|
||||
return false;
|
||||
}
|
||||
|
@ -74,9 +74,11 @@ protected:
|
||||
/**< Query */
|
||||
const char* _query;
|
||||
/**< 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 */
|
||||
long _codeError;
|
||||
long _code_error;
|
||||
/**< Numero record corrente */
|
||||
long _recno;
|
||||
/**< 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);
|
||||
/**< Ritorno l'ultima stringa di errore segnalato in formato (const char *) */
|
||||
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())); }
|
||||
|
||||
// Utilities
|
||||
|
Loading…
x
Reference in New Issue
Block a user