NetCDF Timestamp Mapper  1.0
Maps timestamps (and variables) to netCDF files using sqlite3.
tsm::Database Class Reference

#include <Database.hpp>

Public Member Functions

 Database (const std::filesystem::path &inputPath, const std::filesystem::path &outputPath, const std::string &datasetName)
 
 ~Database ()
 
bool open ()
 Opens database. More...
 
void insertData (const ds::DatasetDesc &datasetDesc)
 

Private Types

using stmtPtr = utils::deleted_unique_ptr< sqlite3_stmt >
 

Private Member Functions

void configureSQLITE ()
 
void configureDBConnection ()
 
void closeConnection ()
 Close connection to database. More...
 
void execStatement (const std::string &sqlStatement, int(*callback)(void *, int, char **, char **)=nullptr)
 Ideal for 1-shot SQL statements (like setting PRAGMAs, etc.). More...
 
stmtPtr prepareStatement (const std::string &sqlStatement)
 Ideal for repetitive SQL statements. More...
 
void insertHistoricalCombined (const ds::DatasetDesc &datasetDesc)
 
void insertHistorical (const ds::DatasetDesc &datasetDesc)
 
void createDimensionsTable ()
 
void createVariablesTable ()
 
void createVariablesDimensionsTable ()
 
void populateHistoricalJoinTable (const ds::DatasetDesc &datasetDesc)
 
void populateVarsDimTable (const std::unordered_set< ds::VariableDesc > &insertedVariables)
 
void createHistoricalTable ()
 

Private Attributes

sqlite3 * m_DBHandle { nullptr }
 
const std::filesystem::path m_inputPath
 
const std::filesystem::path m_outputFilePath
 

Member Typedef Documentation

using tsm::Database::stmtPtr = utils::deleted_unique_ptr<sqlite3_stmt>
private

Constructor & Destructor Documentation

tsm::Database::Database ( const std::filesystem::path &  inputPath,
const std::filesystem::path &  outputPath,
const std::string &  datasetName 
)
tsm::Database::~Database ( )

Member Function Documentation

void tsm::Database::closeConnection ( )
private

Close connection to database.

void tsm::Database::configureDBConnection ( )
private
void tsm::Database::configureSQLITE ( )
private
void tsm::Database::createDimensionsTable ( )
private
void tsm::Database::createHistoricalTable ( )
private
void tsm::Database::createVariablesDimensionsTable ( )
private
void tsm::Database::createVariablesTable ( )
private
void tsm::Database::execStatement ( const std::string &  sqlStatement,
int(*)(void *, int, char **, char **)  callback = nullptr 
)
private

Ideal for 1-shot SQL statements (like setting PRAGMAs, etc.).

void tsm::Database::insertData ( const ds::DatasetDesc datasetDesc)
void tsm::Database::insertHistorical ( const ds::DatasetDesc datasetDesc)
private
void tsm::Database::insertHistoricalCombined ( const ds::DatasetDesc datasetDesc)
private
bool tsm::Database::open ( )

Opens database.

void tsm::Database::populateHistoricalJoinTable ( const ds::DatasetDesc datasetDesc)
private
void tsm::Database::populateVarsDimTable ( const std::unordered_set< ds::VariableDesc > &  insertedVariables)
private
Database::stmtPtr tsm::Database::prepareStatement ( const std::string &  sqlStatement)
private

Ideal for repetitive SQL statements.

Member Data Documentation

sqlite3* tsm::Database::m_DBHandle { nullptr }
private
const std::filesystem::path tsm::Database::m_inputPath
private
const std::filesystem::path tsm::Database::m_outputFilePath
private

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