#include <ado_db_helper.h>
|
| bool | init (const std::string &connection_string, const std::string &login, const std::string &pass) |
| ADODB::_ConnectionPtr & | get_db_connection () |
| bool | check_status () |
Definition at line 931 of file ado_db_helper.h.
◆ check_status()
| bool epee::ado_db_helper::per_thread_connection_pool::check_status |
( |
| ) |
|
|
inline |
Definition at line 984 of file ado_db_helper.h.
985 {
988 {
989
990 try{
991 HRESULT
res = rconn->Close();
992 }
993 catch(...)
994 {
995
996 };
998
999 HRESULT
res = rconn->Open(_bstr_t(m_connection_string.c_str()), _bstr_t(m_login.c_str()), _bstr_t(m_password.c_str()), NULL);
1001 {
1002 LOG_PRINT("Failed to restore connection to local AI DB", LOG_LEVEL_1);
1003 return false;
1004 }
1006 }
1007
1008 return true;
1009 }
#define CATCH_TRY_SECTION(ret_val)
#define BEGIN_TRY_SECTION()
ADODB::_ConnectionPtr & get_db_connection()
bool execute_helper(ADODB::_CommandPtr cmd, _variant_t *pcount_processed=NULL)
◆ get_db_connection()
| ADODB::_ConnectionPtr & epee::ado_db_helper::per_thread_connection_pool::get_db_connection |
( |
| ) |
|
|
inline |
Definition at line 945 of file ado_db_helper.h.
946 {
947
948
949
950 m_db_connections_lock.lock();
951 boost::shared_ptr<ADODB::_ConnectionPtr>& conn_ptr = m_db_connections[::GetCurrentThreadId()];
952 m_db_connections_lock.unlock();
953 if(!conn_ptr.get())
954 {
955 conn_ptr.reset(new ADODB::_ConnectionPtr());
956 ADODB::_ConnectionPtr& conn = *conn_ptr.get();
957
958
960
961
962 if(S_OK != conn.CreateInstance(__uuidof(ADODB::Connection)))
963 {
964 LOG_ERROR(
"Failed to Create, instance, was CoInitialize called ???!");
965 return conn;
966 }
967
968 HRESULT
res = conn->Open(_bstr_t(m_connection_string.c_str()), _bstr_t(m_login.c_str()), _bstr_t(m_password.c_str()), NULL);
970 {
971 LOG_ERROR(
"Failed to connect do DB, connection str:" << m_connection_string);
972 return conn;
973 }
975 LOG_PRINT("New DB Connection added for threadid=" << ::GetCurrentThreadId(), LOG_LEVEL_0);
977 return conn;
978 }
979
980 return *conn_ptr.get();
981 }
#define CATCH_TRY_SECTION_MESS(ret_val, mess_where)
◆ init()
| bool epee::ado_db_helper::per_thread_connection_pool::init |
( |
const std::string & | connection_string, |
|
|
const std::string & | login, |
|
|
const std::string & | pass ) |
|
inline |
Definition at line 934 of file ado_db_helper.h.
935 {
936 m_connection_string = connection_string;
937 m_login = login;
938 m_password = pass;
940 return false;
941
942 return true;
943 }
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/contrib/epee/include/ado_db_helper.h