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

#include <DatabaseSessionManager.hh>

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

Public Member Functions

virtual ~DatabaseSessionManager ()
 
sessionOP get_db_session (DatabaseMode::e db_mode, TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &db_name, std::string const &pq_schema, std::string const &host, std::string const &user, std::string const &password, platform::Size port, bool readonly=false, platform::SSize db_partition=-1)
 Acquire a database session. More...
 
sessionOP get_session_sqlite3 (std::string const &database, TransactionMode::e transaction_mode=utility::sql_database::TransactionMode::standard, platform::Size chunk_size=0, bool const readonly=false, platform::SSize db_partition=-1)
 Acquire a sqlite3 database session. More...
 
sessionOP get_session_mysql (std::string const &database, TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &host, std::string const &user, std::string const &password, platform::Size port)
 Acquire a mysql database session. More...
 
sessionOP get_session_postgres (std::string const &database, TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &pq_schema, std::string const &host, std::string const &user, std::string const &password, platform::Size port)
 Acquire a postgres database session. More...
 
- Public Member Functions inherited from utility::SingletonBase< DatabaseSessionManager >
 SingletonBase ()
 public constructor (the derived class must have a private constructor, of course). More...
 

Protected Member Functions

 DatabaseSessionManager ()
 
 DatabaseSessionManager (const DatabaseSessionManager &src)=delete
 
DatabaseSessionManageroperator= (const DatabaseSessionManager &src)=delete
 

Private Member Functions

void set_postgres_schema_search_path (sessionOP db_session, utility::vector1< std::string > const &schema_search_path)
 

Friends

class utility::SingletonBase< DatabaseSessionManager >
 

Additional Inherited Members

- Static Public Member Functions inherited from utility::SingletonBase< DatabaseSessionManager >
static DatabaseSessionManager * get_instance ()
 Safely instantiate a singleton class in a (possibly) multithreaded context. More...
 

Constructor & Destructor Documentation

utility::sql_database::DatabaseSessionManager::DatabaseSessionManager ( )
protecteddefault
utility::sql_database::DatabaseSessionManager::DatabaseSessionManager ( const DatabaseSessionManager src)
protecteddelete
utility::sql_database::DatabaseSessionManager::~DatabaseSessionManager ( )
virtualdefault

Member Function Documentation

sessionOP utility::sql_database::DatabaseSessionManager::get_db_session ( DatabaseMode::e  db_mode,
TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  db_name,
std::string const &  pq_schema,
std::string const &  host,
std::string const &  user,
std::string const &  password,
platform::Size  port,
bool  readonly = false,
platform::SSize  db_partition = -1 
)
sessionOP utility::sql_database::DatabaseSessionManager::get_session_mysql ( std::string const &  database,
TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  host,
std::string const &  user,
std::string const &  password,
platform::Size  port 
)
sessionOP utility::sql_database::DatabaseSessionManager::get_session_postgres ( std::string const &  database,
TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  pq_schema,
std::string const &  host,
std::string const &  user,
std::string const &  password,
platform::Size  port 
)
sessionOP utility::sql_database::DatabaseSessionManager::get_session_sqlite3 ( std::string const &  database,
TransactionMode::e  transaction_mode = utility::sql_database::TransactionMode::standard,
platform::Size  chunk_size = 0,
bool const  readonly = false,
platform::SSize  db_partition = -1 
)

Acquire a sqlite3 database session.

details@ For SQLite3 database, the db_partition is app appends "_<mpi_rank>" to the end of the database filename This is useful when writing to an sqlite database not through the job distributor where locking causes problems

References basic::options::OptionKeys::in::file::s, and utility::sql_database::DatabaseMode::sqlite3.

Referenced by basic::database::get_db_session(), and get_db_session().

DatabaseSessionManager& utility::sql_database::DatabaseSessionManager::operator= ( const DatabaseSessionManager src)
protecteddelete
void utility::sql_database::DatabaseSessionManager::set_postgres_schema_search_path ( sessionOP  db_session,
utility::vector1< std::string > const &  schema_search_path 
)
private

postgres does not allow queries between databases, instead it allows tables to be created in different namespaces called "schemas". By specifing the search path, statements will be executed in a specified namespace. Note setting the search path only affects this session.

For example, to use the schema UBQdesign_stage1_r456644_120323, set set the search path with the vector ["UBQdesign_stage1_r456644_120323"]. See: http://www.postgresql.org/docs/8.1/static/ddl-schemas.html

Friends And Related Function Documentation


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