Electroneum
Loading...
Searching...
No Matches
ado_db_helper.h File Reference
#include <vector>
#include <comutil.h>
#include "string_coding.h"
#include "math_helper.h"
#include "file_io_utils.h"
#include "global_stream_operators.h"
Include dependency graph for ado_db_helper.h:

Go to the source code of this file.

Classes

struct  epee::ado_db_helper::profile_entry
class  epee::ado_db_helper::profiler_manager
class  epee::ado_db_helper::timing_guard
struct  epee::ado_db_helper::adapter_zero< TParam1 >
struct  epee::ado_db_helper::adapter_single< TParam1 >
struct  epee::ado_db_helper::adapter_double< TParam1, TParam2 >
struct  epee::ado_db_helper::adapter_triple< TParam1, TParam2, TParam3 >
struct  epee::ado_db_helper::adapter_quad< TParam1, TParam2, TParam3, TParam4 >
struct  epee::ado_db_helper::adapter_quanto< TParam1, TParam2, TParam3, TParam4, TParam5 >
struct  epee::ado_db_helper::adapter_sixto< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 >
struct  epee::ado_db_helper::adapter_sevento< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 >
struct  epee::ado_db_helper::adapter_nine< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 >
class  epee::ado_db_helper::per_thread_connection_pool

Namespaces

namespace  epee
namespace  epee::ado_db_helper

Macros

#define BEGIN_TRY_SECTION()
#define CATCH_TRY_SECTION(ret_val)
#define CATCH_TRY_SECTION_MESS(ret_val, mess_where)
#define PROFILE_SQL(sql)

Typedefs

typedef std::vector< std::vector< _variant_t > > epee::ado_db_helper::table

Functions

profiler_managerepee::ado_db_helper::get_set_profiler (bool need_to_set=false, profiler_manager **pprofiler=NULL)
bool epee::ado_db_helper::init ()
bool epee::ado_db_helper::deinit ()
bool epee::ado_db_helper::push_timing (const std::string sql, DWORD time)
bool epee::ado_db_helper::flush_profiler (const std::string path)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const std::string &parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const std::wstring &parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const __int64 parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const unsigned __int64 parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const int parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const unsigned int parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, float parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, bool parametr)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, _variant_t parametr)
bool epee::ado_db_helper::add_parametr_as_double (ADODB::_CommandPtr cmd, const DATE parametr)
template<typename TParam>
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const std::list< TParam > params)
bool epee::ado_db_helper::add_parametr (ADODB::_CommandPtr cmd, const DATE parametr)
bool epee::ado_db_helper::execute_helper (ADODB::_CommandPtr cmd, _variant_t *pcount_processed=NULL)
bool epee::ado_db_helper::select_helper (ADODB::_CommandPtr cmd, table &result_vector)
template<typename TParam1>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_zero< TParam1 > &params)
template<typename TParam1>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_single< TParam1 > &params)
template<typename TParam1, typename TParam2>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_double< TParam1, TParam2 > &params)
template<typename TParam1, typename TParam2, typename TParam3>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_triple< TParam1, TParam2, TParam3 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_quad< TParam1, TParam2, TParam3, TParam4 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_quanto< TParam1, TParam2, TParam3, TParam4, TParam5 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_sixto< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_sevento< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7, typename TParam8, typename TParam9>
bool epee::ado_db_helper::add_parametrs_multi (ADODB::_CommandPtr cmd, const adapter_nine< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_sevento< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7, typename TParam8, typename TParam9>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_nine< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_sixto< TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_quanto< TParam1, TParam2, TParam3, TParam4, TParam5 > &params)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_quad< TParam1, TParam2, TParam3, TParam4 > &params)
template<typename TParam1, typename TParam2, typename TParam3>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_triple< TParam1, TParam2, TParam3 > &params)
template<typename TParam>
std::string epee::ado_db_helper::get_str_param (const TParam &prm)
template<typename TParam>
std::string epee::ado_db_helper::get_str_param (const std::list< TParam > &prm_lst)
template<typename TParam1, typename TParam2>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_double< TParam1, TParam2 > &params)
template<typename TParam1>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_single< TParam1 > &params)
template<typename TParam1>
std::string epee::ado_db_helper::print_parameters_multi (const adapter_zero< TParam1 > &params)
template<typename TParams>
bool epee::ado_db_helper::execute_helper_multiparam (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParams &parametrs, _variant_t *pcount_processed=NULL)
template<typename TParams>
bool epee::ado_db_helper::select_helper_multiparam (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParams &parametrs, table &result_vector)
template<typename TParams>
bool epee::ado_db_helper::select_helper_param_container (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParams &parametrs, table &result_vector)
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, _variant_t *pvt=NULL)
template<typename TParam>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam &parametr)
template<typename TParam1, typename TParam2>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2)
template<typename TParam1, typename TParam2, typename TParam3>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2, const TParam3 &parametr3)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2, const TParam3 &parametr3, const TParam4 &parametr4)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2, const TParam3 &parametr3, const TParam4 &parametr4, const TParam5 &parametr5)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2, const TParam3 &parametr3, const TParam4 &parametr4, const TParam5 &parametr5, const TParam6 &parametr6)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7>
bool epee::ado_db_helper::execute_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 &parametr1, const TParam2 &parametr2, const TParam3 &parametr3, const TParam4 &parametr4, const TParam5 &parametr5, const TParam6 &parametr6, const TParam7 &parametr7)
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, table &result_vector)
template<typename TParam>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam &parametr, table &result_vector)
template<typename TParam1, typename TParam2>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, const TParam4 parametr4, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, const TParam4 parametr4, const TParam5 parametr5, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, const TParam4 parametr4, const TParam5 parametr5, const TParam6 parametr6, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, const TParam4 parametr4, const TParam5 parametr5, const TParam6 parametr6, const TParam7 parametr7, table &result_vector)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename TParam5, typename TParam6, typename TParam7, typename TParam8, typename TParam9>
bool epee::ado_db_helper::select_helper (ADODB::_ConnectionPtr pconnection, const std::string &sql_statment, const TParam1 parametr1, const TParam2 parametr2, const TParam3 parametr3, const TParam4 parametr4, const TParam5 parametr5, const TParam6 parametr6, const TParam7 parametr7, const TParam8 parametr8, const TParam9 parametr9, table &result_vector)
template<typename TParam1, typename default_id_type, typename t_conn>
bool epee::ado_db_helper::find_or_add_t (const std::string &sql_select_statment, const std::string &sql_insert_statment, OUT default_id_type &id, OUT bool &new_object_added, TParam1 parametr_1, t_conn &c)
template<typename TParam1, typename TParam2, typename default_id_type, typename t_conn>
bool epee::ado_db_helper::find_or_add_t (const std::string &sql_select_statment, const std::string &sql_insert_statment, OUT default_id_type &id, OUT bool &new_object_added, TParam1 parametr_1, TParam2 parametr_2, t_conn &c)
template<typename TParam1, typename TParam2, typename TParam3, typename default_id_type, typename t_conn>
bool epee::ado_db_helper::find_or_add_t (const std::string &sql_select_statment, const std::string &sql_insert_statment, OUT default_id_type &id, OUT bool &new_object_added, TParam1 parametr_1, TParam2 parametr_2, TParam3 parametr_3, t_conn &c)
template<typename TParam1, typename TParam2, typename TParam3, typename TParam4, typename default_id_type, typename t_conn>
bool epee::ado_db_helper::find_or_add_t (const std::string &sql_select_statment, const std::string &sql_insert_statment, OUT default_id_type &id, OUT bool &new_object_added, TParam1 parametr_1, TParam2 parametr_2, TParam3 parametr_3, TParam4 parametr_4, t_conn &c)
template<typename TParams, typename default_id_type, typename t_conn>
bool epee::ado_db_helper::find_or_add_t_multiparametred (const std::string &sql_select_statment, const std::string &sql_insert_statment, OUT default_id_type &id, OUT bool &new_object_added, TParams params, t_conn &c)

Macro Definition Documentation

◆ BEGIN_TRY_SECTION

#define BEGIN_TRY_SECTION ( )
Value:
try {

Definition at line 40 of file ado_db_helper.h.

◆ CATCH_TRY_SECTION

#define CATCH_TRY_SECTION ( ret_val)
Value:
#define CATCH_TRY_SECTION_MESS(ret_val, mess_where)

Definition at line 42 of file ado_db_helper.h.

◆ CATCH_TRY_SECTION_MESS

#define CATCH_TRY_SECTION_MESS ( ret_val,
mess_where )
Value:
}\
catch(const std::exception&ex)\
{\
LOG_PRINT_J("DB_ERROR: " << ex.what(), LOG_LEVEL_0);\
return ret_val;\
}\
catch(const _com_error& comm_err)\
{\
const TCHAR* pstr = comm_err.Description();\
std::string descr = string_encoding::convert_to_ansii(pstr?pstr:TEXT(""));\
const TCHAR* pmessage = comm_err.ErrorMessage();\
pstr = comm_err.Source();\
std::string source = string_encoding::convert_to_ansii(pstr?pstr:TEXT(""));\
LOG_PRINT_J("COM_ERROR " << mess_where << ":\n\tDescriprion:" << descr << ", \n\t Message: " << string_encoding::convert_to_ansii(pmessage) << "\n\t Source: " << source, LOG_LEVEL_0);\
return ret_val;\
}\
catch(...)\
{\
LOG_PRINT_J("..._ERROR: Unknown error.", LOG_LEVEL_0);\
return ret_val;\
}\
const CharType(& source)[N]
Definition pointer.h:1147

Definition at line 44 of file ado_db_helper.h.

44#define CATCH_TRY_SECTION_MESS(ret_val, mess_where) }\
45 catch(const std::exception&ex)\
46 {\
47 LOG_PRINT_J("DB_ERROR: " << ex.what(), LOG_LEVEL_0);\
48 return ret_val;\
49 }\
50 catch(const _com_error& comm_err)\
51 {\
52 const TCHAR* pstr = comm_err.Description();\
53 std::string descr = string_encoding::convert_to_ansii(pstr?pstr:TEXT(""));\
54 const TCHAR* pmessage = comm_err.ErrorMessage();\
55 pstr = comm_err.Source();\
56 std::string source = string_encoding::convert_to_ansii(pstr?pstr:TEXT(""));\
57 LOG_PRINT_J("COM_ERROR " << mess_where << ":\n\tDescriprion:" << descr << ", \n\t Message: " << string_encoding::convert_to_ansii(pmessage) << "\n\t Source: " << source, LOG_LEVEL_0);\
58 return ret_val;\
59 }\
60 catch(...)\
61 {\
62 LOG_PRINT_J("..._ERROR: Unknown error.", LOG_LEVEL_0);\
63 return ret_val;\
64 }\
65

◆ PROFILE_SQL

#define PROFILE_SQL ( sql)
Value:
timing_guard local_timing(sql)

Definition at line 206 of file ado_db_helper.h.