Electroneum
Loading...
Searching...
No Matches
soci::per_thread_session Class Reference

#include <soci_helper.h>

Public Member Functions

bool init (const std::string &connection_string)
soci::session & get ()
bool reopen ()
bool check_status ()

Detailed Description

Definition at line 86 of file soci_helper.h.

Member Function Documentation

◆ check_status()

bool soci::per_thread_session::check_status ( )
inline

Definition at line 130 of file soci_helper.h.

131 {
132 return true;
133 }

◆ get()

soci::session & soci::per_thread_session::get ( )
inline

Definition at line 96 of file soci_helper.h.

97 {
98
99 //soci::session
100
101 m_db_connections_lock.lock();
102 boost::shared_ptr<soci::session>& conn_ptr = m_db_connections[epee::misc_utils::get_thread_string_id()];
103 m_db_connections_lock.unlock();
104 if(!conn_ptr.get())
105 {
106 conn_ptr.reset(new soci::session(soci::postgresql, m_connection_string));
107 }
108 //init new connection
109 return *conn_ptr.get();
110 }
std::string get_thread_string_id()
Here is the call graph for this function:

◆ init()

bool soci::per_thread_session::init ( const std::string & connection_string)
inline

Definition at line 89 of file soci_helper.h.

90 {
91 m_connection_string = connection_string;
92
93 return true;
94 }

◆ reopen()

bool soci::per_thread_session::reopen ( )
inline

Definition at line 112 of file soci_helper.h.

113 {
114 //soci::session
115
116 m_db_connections_lock.lock();
117 boost::shared_ptr<soci::session>& conn_ptr = m_db_connections[misc_utils::get_thread_string_id()];
118 m_db_connections_lock.unlock();
119 if(conn_ptr.get())
120 {
121 conn_ptr->close();
122 conn_ptr.reset(new soci::session(soci::postgresql, m_connection_string));
123 }
124
125 //init new connection
126 return true;
127 }
Here is the call graph for this function:

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/soci_helper.h