Rosetta Utilities  2014.35
Namespaces | Classes | Typedefs | Functions | Variables
basic::database Namespace Reference

Namespaces

 insert_statement_generator
 
 schema_generator
 

Classes

class  DatabaseSessionFactory
 
class  DatabaseSessionLoader
 
class  DatabaseSessionLoaderCreator
 
class  DatabaseSessionOptions
 
class  DatabaseSessionOptionsCreator
 

Typedefs

typedef
utility::pointer::owning_ptr
< DatabaseSessionLoader
DatabaseSessionLoaderOP
 
typedef
utility::pointer::owning_ptr
< DatabaseSessionLoader const > 
DatabaseSessionLoaderCOP
 
typedef
utility::pointer::owning_ptr
< DatabaseSessionOptions
DatabaseSessionOptionsOP
 
typedef
utility::pointer::owning_ptr
< DatabaseSessionOptions const > 
DatabaseSessionOptionsCOP
 

Functions

bool open (utility::io::izstream &db_stream, std::string const &db_file, bool warn)
 Open a database file on a provided stream. More...
 
std::string full_name (std::string const &db_file, bool warn)
 Full-path database file name. More...
 
sessionOP get_db_session ()
 Aquire a database session using the command line options transaction type is set to standard. More...
 
sessionOP get_db_session (std::string const &db_name, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard. More...
 
sessionOP get_db_session (string const &db_name, TransactionMode::e transaction_mode, Size chunk_size, string const &pq_schema)
 
utility::sql_database::sessionOP get_db_session (utility::sql_database::DatabaseMode::e db_mode, std::string const &db_name, std::string const &pq_schema)
 
sessionOP get_db_session (DatabaseMode::e db_mode, TransactionMode::e transaction_mode, Size chunk_size, string const &db_name, string const &pq_schema)
 
platform::SSize db_partition_from_options (DatabaseMode::e db_mode)
 @ More...
 
platform::SSize resolve_db_partition (bool partition_by_mpi_process, platform::SSize manual_partition=-1)
 Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1. More...
 
statement safely_prepare_statement (string const &statement_string, sessionOP db_session)
 
void safely_write_to_database (statement &statement)
 
result safely_read_from_database (statement &statement)
 
bool table_exists (sessionOP db_session, string const &table_name)
 
void check_statement_sanity (string sql)
 
void insert_or_ignore (string table_name, std::vector< string > column_names, std::vector< string > values, sessionOP db_session)
 
void write_schema_to_database (string schema_str, sessionOP db_session)
 
void set_cache_size (sessionOP db_session, Size cache_size)
 
std::string make_compound_statement (std::string const &table_name, std::vector< std::string > const &column_names, platform::Size const &row_count)
 
utility::sql_database::sessionOP parse_database_connection (utility::tag::TagCOP tag)
 
utility::sql_database::sessionOP get_db_session (std::string const &db_name, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More...
 
utility::sql_database::sessionOP get_db_session (utility::sql_database::DatabaseMode::e db_mode, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &db_name, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More...
 
void safely_write_to_database (cppdb::statement &statement)
 
cppdb::result safely_read_from_database (cppdb::statement &statement)
 
void set_cache_size (utility::sql_database::sessionOP db_session, platform::Size cache_size)
 set the number of 1kb pages to use for cache More...
 

Variables

static basic::Tracer TR ("basic.database.databaseSessionFactory")
 
static basic::Tracer TR ("basic.io.database")
 
static basic::Tracer TR ("basic.database.sql_utils")
 
static
numeric::random::RandomGenerator 
RG (345264)
 

Typedef Documentation

Function Documentation

void basic::database::check_statement_sanity ( string  sql)
platform::SSize basic::database::db_partition_from_options ( DatabaseMode::e  db_mode)
std::string basic::database::full_name ( std::string const &  db_file,
bool  warn 
)

Full-path database file name.

References in::path::database(), utility::file::file_exists(), name, option, options, and basic::Warning().

Referenced by open().

utility::sql_database::sessionOP basic::database::get_db_session ( std::string const &  db_name,
utility::sql_database::TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  pq_schema = "" 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.

utility::sql_database::sessionOP basic::database::get_db_session ( utility::sql_database::DatabaseMode::e  db_mode,
utility::sql_database::TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  db_name,
std::string const &  pq_schema = "" 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.

utility::sql_database::sessionOP basic::database::get_db_session ( )

Aquire a database session using the command line options transaction type is set to standard.

References inout::dbms::database_name(), get_db_session(), option, options, inout::dbms::pq_schema(), and utility::sql_database::TransactionMode::standard.

utility::sql_database::sessionOP basic::database::get_db_session ( string const &  db_name,
string const &  pq_schema 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard.

References utility::sql_database::database_mode_from_name(), get_db_session(), inout::dbms::mode(), option, options, and utility::sql_database::TransactionMode::standard.

sessionOP basic::database::get_db_session ( string const &  db_name,
TransactionMode::e  transaction_mode,
Size  chunk_size,
string const &  pq_schema 
)
utility::sql_database::sessionOP basic::database::get_db_session ( utility::sql_database::DatabaseMode::e  db_mode,
std::string const &  db_name,
std::string const &  pq_schema 
)
sessionOP basic::database::get_db_session ( DatabaseMode::e  db_mode,
TransactionMode::e  transaction_mode,
Size  chunk_size,
string const &  db_name,
string const &  pq_schema 
)
void basic::database::insert_or_ignore ( string  table_name,
std::vector< string >  column_names,
std::vector< string >  values,
sessionOP  db_session 
)
std::string basic::database::make_compound_statement ( std::string const &  table_name,
std::vector< std::string > const &  column_names,
platform::Size const &  row_count 
)
bool basic::database::open ( utility::io::izstream db_stream,
std::string const &  db_file,
bool  warn = true 
)
utility::sql_database::sessionOP basic::database::parse_database_connection ( utility::tag::TagCOP  tag)
platform::SSize basic::database::resolve_db_partition ( bool  partition_by_mpi_process,
platform::SSize  manual_partition 
)

Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1.

References utility::mpi_rank().

Referenced by db_partition_from_options(), and parse_database_connection().

cppdb::statement basic::database::safely_prepare_statement ( string const &  statement_string,
sessionOP  db_session 
)
cppdb::result basic::database::safely_read_from_database ( cppdb::statement &  statement)
result basic::database::safely_read_from_database ( statement &  statement)
void basic::database::safely_write_to_database ( cppdb::statement &  statement)
void basic::database::safely_write_to_database ( statement &  statement)
void basic::database::set_cache_size ( utility::sql_database::sessionOP  db_session,
platform::Size  cache_size 
)

set the number of 1kb pages to use for cache

void basic::database::set_cache_size ( sessionOP  db_session,
Size  cache_size 
)
bool basic::database::table_exists ( sessionOP  db_session,
string const &  table_name 
)
void basic::database::write_schema_to_database ( string  schema_str,
sessionOP  db_session 
)

Variable Documentation

numeric::random::RandomGenerator basic::database::RG(345264)
static
basic::Tracer basic::database::TR("basic.database.databaseSessionFactory")
static

Referenced by open().

basic::Tracer basic::database::TR("basic.io.database")
static
basic::Tracer basic::database::TR("basic.database.sql_utils")
static