Patch level : 12.0 656

Files correlati     : xvtext
Commento            : Corretta gestione stringhe interna in TXvt_recordset
This commit is contained in:
Mattia Tollari 2018-12-11 14:16:34 +01:00
parent d16464a1cb
commit ec72a396cc
3 changed files with 34 additions and 23 deletions

View File

@ -141,7 +141,8 @@
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -6,6 +6,10 @@
#define _RCS(a) ((SACommand *)a)
#define _ERR(a) ((SAException *)a)
#define _CPY_STR(from,to) (to = strdup(from));
#define _GET_ERROR(from,to) _CPY_STR(from,to)
/******************************************************************************
* TXvt_recordset *
* Classe per esecuzioni di query temporanee (wrapper semplice per SACommand) *
@ -22,7 +26,7 @@ TXvt_recordset::TXvt_recordset() : _freezed(false)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
}
@ -53,7 +57,7 @@ TXvt_recordset::TXvt_recordset(const char* db, const char* user, const char* pas
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
}
}
@ -118,7 +122,7 @@ int TXvt_recordset::connect(const char* db, const char* user, const char* pass,
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
}
}
@ -139,7 +143,7 @@ void TXvt_recordset::disconnect()
catch(SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
}
@ -157,7 +161,7 @@ bool TXvt_recordset::commit(bool autoRoll)
rollback();
}
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return false;
}
return true;
@ -173,7 +177,7 @@ bool TXvt_recordset::rollback()
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return false;
}
return true;
@ -292,7 +296,7 @@ bool TXvt_recordset::set(const char* query)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return false;
}
return true;
@ -313,7 +317,7 @@ bool TXvt_recordset::exec(bool autoF)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
ok = false;
}
return ok;
@ -340,7 +344,7 @@ bool TXvt_recordset::next()
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
return fetched;
}
@ -359,7 +363,7 @@ bool TXvt_recordset::prev()
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
return fetched;
}
@ -378,7 +382,7 @@ bool TXvt_recordset::first()
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
return fetched;
}
@ -405,7 +409,7 @@ bool TXvt_recordset::last()
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
}
return fetched;
}
@ -449,7 +453,7 @@ int TXvt_recordset::get_int(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return -1;
}
}
@ -463,7 +467,7 @@ short TXvt_recordset::get_short(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return -1;
}
@ -478,7 +482,7 @@ long TXvt_recordset::get_long(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return -1;
}
@ -493,7 +497,7 @@ double TXvt_recordset::get_double(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return -1;
}
}
@ -507,7 +511,7 @@ bool TXvt_recordset::get_bool(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return false;
}
}
@ -529,7 +533,7 @@ const char* TXvt_recordset::get_date(const char * field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return NULL;
}
}
@ -543,7 +547,7 @@ const char* TXvt_recordset::get(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return "";
}
}
@ -557,7 +561,7 @@ char TXvt_recordset::get_char(const char* field)
catch (SAException &x)
{
_codeError = x.ErrNativeCode();
_stringError = x.ErrMessage();
_GET_ERROR(x.ErrMessage(), _stringError);
return '\0';
}
}
@ -572,7 +576,13 @@ long TXvt_recordset::get_code_error(bool erase)
const char* TXvt_recordset::get_string_error(bool erase)
{
const char* app = _stringError;
static char* app;
if (app != nullptr)
delete app;
_CPY_STR(_stringError, app);
if (erase)
_stringError = "";
return app;

View File

@ -74,7 +74,7 @@ protected:
/**< Query */
const char* _query;
/**< Ultima stringa con codice di errore ricevuto */
const char* _stringError;
char* _stringError;
/**< Ultimo codice di errore ricevuto */
long _codeError;
/**< Numero record corrente */