25 #ifndef LSST_MWI_PERSISTENCE_DBTSVSTORAGE_H 26 #define LSST_MWI_PERSISTENCE_DBTSVSTORAGE_H 64 namespace persistence {
68 typedef std::shared_ptr<DbTsvStorage>
Ptr;
73 virtual void setPolicy(lsst::pex::policy::Policy::Ptr policy);
81 std::string
const& templateName,
82 bool mayAlreadyExist =
false);
83 virtual void dropTable(std::string
const& tableName);
88 void setColumn(std::string
const& columnName, T
const& value);
93 template <
typename T>
void outParam(std::string
const& columnName,
94 T* location,
bool isExpr =
false);
95 template <
typename T>
void condParam(std::string
const& paramName,
102 std::string _tempPath;
104 std::string _location;
105 std::string _tableName;
106 std::map<std::string, int> _colMap;
107 std::ostringstream _convertStream;
108 std::vector<std::string> _rowBuffer;
109 std::unique_ptr<std::ofstream> _osp;
111 int _getColumnIndex(std::string
const& columnName);
DbTsvStorage(void)
Constructor.
virtual void startTransaction(void)
Start a transaction.
virtual void setPersistLocation(LogicalLocation const &location)
Set the database location to persist to.
Interface for DbStorage class.
Class for logical location of a persisted Persistable instance.
virtual void setPolicy(lsst::pex::policy::Policy::Ptr policy)
Allow a policy to be used to configure the DbTsvStorage.
virtual void setColumnToNull(std::string const &columnName)
Set a given column to NULL.
Class for database storage.
void outParam(std::string const &columnName, T *location, bool isExpr=false)
Request a column in the query output and bind a destination location.
~DbTsvStorage(void)
Minimal destructor.
virtual void truncateTable(std::string const &tableName)
Truncate a table.
virtual void setTableForInsert(std::string const &tableName)
Set the table to insert rows into.
Class for database storage with data loading from TSV files.
virtual void endTransaction(void)
End a transaction.
std::shared_ptr< DbTsvStorage > Ptr
T const & getColumnByPos(int pos)
Get the value of a column of the query result row by position.
virtual void createTableFromTemplate(std::string const &tableName, std::string const &templateName, bool mayAlreadyExist=false)
Create a new table from an existing template table.
virtual void insertRow(void)
Insert the row.
Interface for LogicalLocation class.
void setColumn(std::string const &columnName, T const &value)
Set the value to insert in a given column.
virtual void setRetrieveLocation(LogicalLocation const &location)
Set the database location to retrieve from.
void condParam(std::string const ¶mName, T const &value)
Bind a value to a WHERE condition parameter.
virtual void dropTable(std::string const &tableName)
Drop a table.