Patch level : 12.0 656
Files correlati : xvtext Commento : Corretta gestione stringhe interna in TXvt_recordset
This commit is contained in:
parent
d16464a1cb
commit
ec72a396cc
@ -141,7 +141,8 @@
|
|||||||
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
|
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
|
||||||
</Bscmake>
|
</Bscmake>
|
||||||
<PostBuildEvent>
|
<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>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#define _RCS(a) ((SACommand *)a)
|
#define _RCS(a) ((SACommand *)a)
|
||||||
#define _ERR(a) ((SAException *)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 *
|
* TXvt_recordset *
|
||||||
* Classe per esecuzioni di query temporanee (wrapper semplice per SACommand) *
|
* Classe per esecuzioni di query temporanee (wrapper semplice per SACommand) *
|
||||||
@ -22,7 +26,7 @@ TXvt_recordset::TXvt_recordset() : _freezed(false)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_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)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_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)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +143,7 @@ void TXvt_recordset::disconnect()
|
|||||||
catch(SAException &x)
|
catch(SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +161,7 @@ bool TXvt_recordset::commit(bool autoRoll)
|
|||||||
rollback();
|
rollback();
|
||||||
}
|
}
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -173,7 +177,7 @@ bool TXvt_recordset::rollback()
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -292,7 +296,7 @@ bool TXvt_recordset::set(const char* query)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -313,7 +317,7 @@ bool TXvt_recordset::exec(bool autoF)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -340,7 +344,7 @@ bool TXvt_recordset::next()
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
return fetched;
|
return fetched;
|
||||||
}
|
}
|
||||||
@ -359,7 +363,7 @@ bool TXvt_recordset::prev()
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
return fetched;
|
return fetched;
|
||||||
}
|
}
|
||||||
@ -378,7 +382,7 @@ bool TXvt_recordset::first()
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
return fetched;
|
return fetched;
|
||||||
}
|
}
|
||||||
@ -405,7 +409,7 @@ bool TXvt_recordset::last()
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
}
|
}
|
||||||
return fetched;
|
return fetched;
|
||||||
}
|
}
|
||||||
@ -449,7 +453,7 @@ int TXvt_recordset::get_int(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,7 +467,7 @@ short TXvt_recordset::get_short(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -478,7 +482,7 @@ long TXvt_recordset::get_long(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -493,7 +497,7 @@ double TXvt_recordset::get_double(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,7 +511,7 @@ bool TXvt_recordset::get_bool(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,7 +533,7 @@ const char* TXvt_recordset::get_date(const char * field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,7 +547,7 @@ const char* TXvt_recordset::get(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,7 +561,7 @@ char TXvt_recordset::get_char(const char* field)
|
|||||||
catch (SAException &x)
|
catch (SAException &x)
|
||||||
{
|
{
|
||||||
_codeError = x.ErrNativeCode();
|
_codeError = x.ErrNativeCode();
|
||||||
_stringError = x.ErrMessage();
|
_GET_ERROR(x.ErrMessage(), _stringError);
|
||||||
return '\0';
|
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* 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)
|
if (erase)
|
||||||
_stringError = "";
|
_stringError = "";
|
||||||
return app;
|
return app;
|
||||||
|
@ -74,7 +74,7 @@ protected:
|
|||||||
/**< Query */
|
/**< Query */
|
||||||
const char* _query;
|
const char* _query;
|
||||||
/**< Ultima stringa con codice di errore ricevuto */
|
/**< Ultima stringa con codice di errore ricevuto */
|
||||||
const char* _stringError;
|
char* _stringError;
|
||||||
/**< Ultimo codice di errore ricevuto */
|
/**< Ultimo codice di errore ricevuto */
|
||||||
long _codeError;
|
long _codeError;
|
||||||
/**< Numero record corrente */
|
/**< Numero record corrente */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user