From 3025f09b6a29fd25ab0f58d4e6232d4802564f03 Mon Sep 17 00:00:00 2001 From: mtollari Date: Thu, 9 Nov 2017 11:01:56 +0000 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Commento : Tolti errori linker, trasformato _stringError in const char* git-svn-id: svn://10.65.10.50/branches/R_10_00@24188 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/xvtdb/xvtdb.cpp | 10 ++++++++-- src/xvtdb/xvtdb.h | 20 ++++++-------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/xvtdb/xvtdb.cpp b/src/xvtdb/xvtdb.cpp index 8d796f0e8..ec616a28b 100644 --- a/src/xvtdb/xvtdb.cpp +++ b/src/xvtdb/xvtdb.cpp @@ -304,6 +304,12 @@ bool TXvt_recordset::exec(bool autoF) return true; } +bool TXvt_recordset::setExec(const char* query, bool autoF) +{ + set(query); + return exec(autoF); +} + bool TXvt_recordset::next() { bool fetched = false; @@ -547,8 +553,8 @@ long TXvt_recordset::getCodeError(bool erase) const char* TXvt_recordset::getStringError(bool erase) { - const char* app = _stringError.c_str(); + const char* app = _stringError; if (erase) - _stringError.erase(); + _stringError = ""; return app; } \ No newline at end of file diff --git a/src/xvtdb/xvtdb.h b/src/xvtdb/xvtdb.h index 1eba6f1d2..2b1453e9b 100644 --- a/src/xvtdb/xvtdb.h +++ b/src/xvtdb/xvtdb.h @@ -69,9 +69,7 @@ protected: /**< Oggetto della connessione */ P_COMM_VOID _con; /**< Ultima stringa con codice di errore ricevuto */ - // Con la trasformazione in DLL questa variabile da il warning C4251, teoricamente si può evitare il workaround perchè la variabile _ITERATOR_DEBUG_LEVEL è uguale su tutti i nostri progetti - // link: https://stackoverflow.com/questions/8976617/when-exporting-stl-stdbasic-string-template-from-dll-i-get-a-lnk2005-error - std::string _stringError; + const char* _stringError; /**< Ultimo codice di errore ricevuto */ long _codeError; /**< Numero record corrente */ @@ -93,7 +91,7 @@ public: /**< Costruttore, accetta in ingresso una connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */ TXvt_recordset(P_CONN_VOID c, const char * query = "", bool ex = false); /**< Distruttore */ - virtual ~TXvt_recordset(); + ~TXvt_recordset(); /************************************************************************************************** * Gestione Connection * @@ -146,16 +144,12 @@ public: **************************************************************************************************/ // Conguration - /**< Imposta la query ricevuta come (const char *) nel recordset */ + /**< Imposta la query ricevuta nel recordset */ bool set(const char* query); - /**< Imposta la query ricevuta come (string) nel recordset */ - bool set(std::string query) { return set(query.c_str()); } /**< Esegue la query impostata nel recordset, se viene passato autoF == true esegue anche un comando Next() */ bool exec(bool autoF = true); - /**< Unisce le funzioni Set e Exec, riceve la query come (const char *) */ - bool setExec(const char* query, bool autoF = true) { set(query); return exec(autoF); } - /**< Unisce le funzioni Set e Exec, riceve la query come (string) */ - bool setExec(std::string query, bool autoF = true) { set(query); return exec(autoF); } + /**< Unisce le funzioni Set e Exec, riceve la query */ + bool setExec(const char* query, bool autoF = true); /**< Si sposta avanti di un record, in caso di esito negativo valorizza _stringError e _codeError */ bool next(); /**< Si sposta indietro di un record, in caso di esito negativo valorizza _stringError e _codeError */ @@ -180,10 +174,8 @@ public: bool get_bool(const char* field); /**< Ritorna il valore nel campo (field) in formato (const char *)->(DD-MM-YYYY) */ const char* getDate(const char* field); - /**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */ + /**< Ritorna il valore nel campo (field) passato in formato (const char *) */ const char* get(const char* field); - /**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */ - const char* get(std::string field) { return get(field.c_str()); } /**< Ritorna il valore nel campo (field) in formato (char) */ char get_char(const char* field); /**< Ritorna la posizione attuale */