Rosetta  2020.28
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
utility::sql_database::session Class Reference

#include <DatabaseSessionManager.hh>

Inheritance diagram for utility::sql_database::session:
Inheritance graph
[legend]

Public Member Functions

 session ()
 
 ~session () override
 
void set_db_mode (DatabaseMode::e const db_mode)
 
DatabaseMode::e get_db_mode () const
 
void set_transaction_mode (TransactionMode::e const transaction_mode)
 
TransactionMode::e get_transaction_mode () const
 
void set_chunk_size (platform::Size const chunk_size)
 
platform::Size get_chunk_size ()
 
void set_db_name (std::string const &db_name)
 
std::string const & get_db_name () const
 
void set_pq_schema (std::string const &pq_schema)
 
std::string const & get_pq_schema () const
 
platform::SSize get_db_partition ()
 
void set_db_partition (platform::SSize db_partition)
 
bool is_db_partitioned ()
 
void begin_transaction ()
 indicate that a transaction block has begun. More...
 
void commit_transaction ()
 indicate that a transaction block has completed. NOTE: When in chunk transaction mode, this may not actually write to the database. More...
 
void force_commit_transaction ()
 force a transaction to be committed. This should only be used when writing data that is required by other processes, such as protocol and batch ids. More...
 
void open_sqlite3_session (bool read_only=false)
 Convenience function to open an sqlite3 session. More...
 
void open_mysql_session (std::string const &host, std::string const &user, std::string const &password, platform::Size port)
 Convenience function to open a mysql session. More...
 
void open_postgres_session (std::string const &host, std::string const &user, std::string const &password, platform::Size port)
 Convenience function to open a postgres session. More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Private Attributes

DatabaseMode::e db_mode_
 
std::string db_name_
 
std::string pq_schema_
 
platform::SSize db_partition_
 
transactionOP cur_transaction_
 
TransactionMode::e transaction_mode_
 
platform::Size chunk_size_
 
platform::Size transaction_counter_
 

Constructor & Destructor Documentation

utility::sql_database::session::session ( )
inline
utility::sql_database::session::~session ( )
override

Member Function Documentation

void utility::sql_database::session::begin_transaction ( )
void utility::sql_database::session::commit_transaction ( )
void utility::sql_database::session::force_commit_transaction ( )

force a transaction to be committed. This should only be used when writing data that is required by other processes, such as protocol and batch ids.

References utility::sql_database::TransactionMode::chunk, cur_transaction_, utility::sql_database::name_from_transaction_mode(), utility::sql_database::TransactionMode::none, utility::sql_database::TransactionMode::standard, transaction_mode_, and utility_exit_with_message.

Referenced by ~session().

platform::Size utility::sql_database::session::get_chunk_size ( )
inline

References chunk_size_.

DatabaseMode::e utility::sql_database::session::get_db_mode ( ) const
inline

References db_mode_.

std::string const& utility::sql_database::session::get_db_name ( ) const
inline
platform::SSize utility::sql_database::session::get_db_partition ( )
inline

References db_partition_.

Referenced by open_sqlite3_session().

std::string const& utility::sql_database::session::get_pq_schema ( ) const
inline

References pq_schema_.

Referenced by open_postgres_session().

TransactionMode::e utility::sql_database::session::get_transaction_mode ( ) const
inline

References transaction_mode_.

bool utility::sql_database::session::is_db_partitioned ( )
inline

References db_partition_.

Referenced by open_sqlite3_session().

void utility::sql_database::session::open_mysql_session ( std::string const &  host,
std::string const &  user,
std::string const &  password,
platform::Size  port 
)
void utility::sql_database::session::open_postgres_session ( std::string const &  host,
std::string const &  user,
std::string const &  password,
platform::Size  port 
)
void utility::sql_database::session::open_sqlite3_session ( bool  read_only = false)
void utility::sql_database::session::set_chunk_size ( platform::Size const  chunk_size)
inline

References chunk_size_.

void utility::sql_database::session::set_db_mode ( DatabaseMode::e const  db_mode)
inline

References db_mode_.

void utility::sql_database::session::set_db_name ( std::string const &  db_name)
inline

References db_name_.

void utility::sql_database::session::set_db_partition ( platform::SSize  db_partition)
inline

References db_partition_.

void utility::sql_database::session::set_pq_schema ( std::string const &  pq_schema)
inline
void utility::sql_database::session::set_transaction_mode ( TransactionMode::e const  transaction_mode)
inline

References transaction_mode_.

Member Data Documentation

platform::Size utility::sql_database::session::chunk_size_
private
transactionOP utility::sql_database::session::cur_transaction_
private
DatabaseMode::e utility::sql_database::session::db_mode_
private

Referenced by get_db_mode(), and set_db_mode().

std::string utility::sql_database::session::db_name_
private

Referenced by get_db_name(), and set_db_name().

platform::SSize utility::sql_database::session::db_partition_
private
std::string utility::sql_database::session::pq_schema_
private

Referenced by get_pq_schema(), and set_pq_schema().

platform::Size utility::sql_database::session::transaction_counter_
private

Referenced by commit_transaction().

TransactionMode::e utility::sql_database::session::transaction_mode_
private

The documentation for this class was generated from the following files: