lsst.daf.persistence  13.0-36-gb9d951e
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Types | Public Member Functions | List of all members
lsst::daf::persistence::DbTsvStorage Class Reference

Class for database storage with data loading from TSV files. More...

#include <DbTsvStorage.h>

Inheritance diagram for lsst::daf::persistence::DbTsvStorage:
lsst::daf::persistence::DbStorage lsst::daf::persistence::FormatterStorage

Public Types

typedef std::shared_ptr
< DbTsvStorage
Ptr
 
- Public Types inherited from lsst::daf::persistence::DbStorage
typedef std::shared_ptr
< DbStorage
Ptr
 
- Public Types inherited from lsst::daf::persistence::FormatterStorage
typedef std::shared_ptr
< FormatterStorage
Ptr
 
typedef std::vector< PtrList
 

Public Member Functions

 DbTsvStorage (void)
 Constructor. More...
 
 ~DbTsvStorage (void)
 Minimal destructor. More...
 
virtual void setPolicy (lsst::pex::policy::Policy::Ptr policy)
 Allow a policy to be used to configure the DbTsvStorage. More...
 
virtual void setPersistLocation (LogicalLocation const &location)
 Set the database location to persist to. More...
 
virtual void setRetrieveLocation (LogicalLocation const &location)
 Set the database location to retrieve from. More...
 
virtual void startTransaction (void)
 Start a transaction. More...
 
virtual void endTransaction (void)
 End a transaction. More...
 
virtual void createTableFromTemplate (std::string const &tableName, std::string const &templateName, bool mayAlreadyExist=false)
 Create a new table from an existing template table. More...
 
virtual void dropTable (std::string const &tableName)
 Drop a table. More...
 
virtual void truncateTable (std::string const &tableName)
 Truncate a table. More...
 
virtual void setTableForInsert (std::string const &tableName)
 Set the table to insert rows into. More...
 
template<typename T >
void setColumn (std::string const &columnName, T const &value)
 Set the value to insert in a given column. More...
 
virtual void setColumnToNull (std::string const &columnName)
 Set a given column to NULL. More...
 
virtual void insertRow (void)
 Insert the row. More...
 
template<typename T >
void outParam (std::string const &columnName, T *location, bool isExpr=false)
 Request a column in the query output and bind a destination location. More...
 
template<typename T >
void condParam (std::string const &paramName, T const &value)
 Bind a value to a WHERE condition parameter. More...
 
template<typename T >
T const & getColumnByPos (int pos)
 Get the value of a column of the query result row by position. More...
 
template<>
void setColumn (std::string const &columnName, char const &value)
 
template<>
void setColumn (std::string const &columnName, double const &value)
 
template<>
void setColumn (std::string const &columnName, float const &value)
 
template<>
void setColumn (std::string const &columnName, DateTime const &value)
 
- Public Member Functions inherited from lsst::daf::persistence::DbStorage
 DbStorage (void)
 Constructor. More...
 
 ~DbStorage (void)
 Minimal destructor. More...
 
virtual void executeSql (std::string const &sqlStatement)
 Execute an arbitrary SQL statement. More...
 
template<typename T >
void setColumn (std::string const &columnName, T const &value)
 Set the value to insert in a given column. More...
 
virtual void setTableForQuery (std::string const &tableName, bool isExpr=false)
 Set the table to query (single-table queries only). More...
 
virtual void setTableListForQuery (std::vector< std::string > const &tableNameList)
 Set a list of tables to query (multiple-table queries). More...
 
virtual void outColumn (std::string const &columnName, bool isExpr=false)
 Request a column in the query output. More...
 
template<typename T >
void outParam (std::string const &columnName, T *location, bool isExpr=false)
 Request a column in the query output and bind a destination location. More...
 
template<typename T >
void condParam (std::string const &paramName, T const &value)
 Bind a value to a WHERE condition parameter. More...
 
virtual void orderBy (std::string const &expression)
 Request that the query output be sorted by an expression. More...
 
virtual void groupBy (std::string const &expression)
 Request that the query output be grouped by an expression. More...
 
virtual void setQueryWhere (std::string const &whereClause)
 Set the condition for the WHERE clause of the query. More...
 
virtual void query (void)
 Execute the query. More...
 
virtual bool next (void)
 Move to the next (first) row of the query result. More...
 
template<typename T >
T const & getColumnByPos (int pos)
 Get the value of a column of the query result row by position. More...
 
bool columnIsNull (int pos)
 Determine if the value of a column is NULL. More...
 
virtual void finishQuery (void)
 Indicate that query processing is finished. More...
 
- Public Member Functions inherited from lsst::daf::persistence::FormatterStorage
virtual ~FormatterStorage (void)
 Minimal destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst::daf::persistence::FormatterStorage
static Ptr createInstance (std::string const &name, LogicalLocation const &location, bool persist, lsst::pex::policy::Policy::Ptr policy)
 Create and configure a FormatterStorage subclass instance. More...
 
- Protected Member Functions inherited from lsst::daf::persistence::DbStorage
 DbStorage (std::type_info const &type)
 Constructor with subclass type. More...
 
- Protected Member Functions inherited from lsst::daf::persistence::FormatterStorage
 FormatterStorage (std::type_info const &type)
 Constructor. More...
 
void verifyPathName (std::string const &pathName)
 Ensure that all directories along a path exist, creating them if necessary. More...
 

Detailed Description

Class for database storage with data loading from TSV files.

Subclass of DbStorage, overriding persistence methods.

Persists data to a database using TSV files as an intermediary for performance. Provides methods for writing rows to a table and retrieving rows from a query.

Definition at line 66 of file DbTsvStorage.h.

Member Typedef Documentation

Definition at line 68 of file DbTsvStorage.h.

Constructor & Destructor Documentation

lsst::daf::persistence::DbTsvStorage::DbTsvStorage ( void  )

Constructor.

Definition at line 67 of file DbTsvStorage.cc.

lsst::daf::persistence::DbTsvStorage::~DbTsvStorage ( void  )

Minimal destructor.

Definition at line 72 of file DbTsvStorage.cc.

Member Function Documentation

template<typename T >
void lsst::daf::persistence::DbTsvStorage::condParam ( std::string const &  paramName,
T const &  value 
)

Bind a value to a WHERE condition parameter.

Parameters
[in]paramNameName of the parameter (prefixed by ":" in the WHERE clause)
[in]valueValue to be bound to the parameter.

Definition at line 368 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::createTableFromTemplate ( std::string const &  tableName,
std::string const &  templateName,
bool  mayAlreadyExist = false 
)
virtual

Create a new table from an existing template table.

Parameters
[in]tableNameName of the new table
[in]templateNameName of the existing template table
[in]mayAlreadyExistFalse (default) if the table must not be present

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 183 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::dropTable ( std::string const &  tableName)
virtual

Drop a table.

Parameters
[in]tableNameName of the table to drop

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 202 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::endTransaction ( void  )
virtual

End a transaction.

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 114 of file DbTsvStorage.cc.

template<typename T >
T const & lsst::daf::persistence::DbTsvStorage::getColumnByPos ( int  pos)

Get the value of a column of the query result row by position.

Parameters
[in]posPosition of the column (starts at 0)

Definition at line 376 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::insertRow ( void  )
virtual

Insert the row.

Row values must have been set with setColumn() calls.

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 334 of file DbTsvStorage.cc.

template<typename T >
void lsst::daf::persistence::DbTsvStorage::outParam ( std::string const &  columnName,
T *  location,
bool  isExpr = false 
)

Request a column in the query output and bind a destination location.

Parameters
[in]columnNameName of the column
[in]locationPointer to the destination
[in]isExprTrue if the name is actually an expression

The order of outParam() calls is the order of appearance in the output row. Use either outColumn() or outParam() but not both.

Definition at line 357 of file DbTsvStorage.cc.

template<typename T >
void lsst::daf::persistence::DbTsvStorage::setColumn ( std::string const &  columnName,
T const &  value 
)

Set the value to insert in a given column.

Parameters
[in]columnNameName of the column
[in]valueValue to set in the column

Definition at line 270 of file DbTsvStorage.cc.

template<>
void lsst::daf::persistence::DbTsvStorage::setColumn ( std::string const &  columnName,
char const &  value 
)

Definition at line 284 of file DbTsvStorage.cc.

template<>
void lsst::daf::persistence::DbTsvStorage::setColumn ( std::string const &  columnName,
double const &  value 
)

Definition at line 294 of file DbTsvStorage.cc.

template<>
void lsst::daf::persistence::DbTsvStorage::setColumn ( std::string const &  columnName,
float const &  value 
)

Definition at line 303 of file DbTsvStorage.cc.

template<>
void lsst::daf::persistence::DbTsvStorage::setColumn ( std::string const &  columnName,
DateTime const &  value 
)

Definition at line 313 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::setColumnToNull ( std::string const &  columnName)
virtual

Set a given column to NULL.

Parameters
[in]columnNameName of the column

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 326 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::setPersistLocation ( LogicalLocation const &  location)
virtual

Set the database location to persist to.

Parameters
[in]locationDatabase connection string to insert to.

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 91 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::setPolicy ( lsst::pex::policy::Policy::Ptr  policy)
virtual

Allow a policy to be used to configure the DbTsvStorage.

Parameters
[in]policy

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 78 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::setRetrieveLocation ( LogicalLocation const &  location)
virtual

Set the database location to retrieve from.

Parameters
[in]locationDatabase connection string to retrieve from.

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 101 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::setTableForInsert ( std::string const &  tableName)
virtual

Set the table to insert rows into.

Parameters
[in]tableNameName of the table

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 234 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::startTransaction ( void  )
virtual

Start a transaction.

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 108 of file DbTsvStorage.cc.

void lsst::daf::persistence::DbTsvStorage::truncateTable ( std::string const &  tableName)
virtual

Truncate a table.

Parameters
[in]tableNameName of the table to truncate

Reimplemented from lsst::daf::persistence::DbStorage.

Definition at line 218 of file DbTsvStorage.cc.


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