#ifndef INVENTORY_DBOPERATIONS_HH #define INVENTORY_DBOPERATIONS_HH #include #include #include #include #include "dbobjectptr.hh" #include "dbobjectvec.hh" #include "dbcontainer.hh" namespace inventory { namespace datamodel { template class DBObject; } namespace db { class DBSession; class DBOperations { DBOperations() {} public: template using StatementConstructorExecute = std::function; template using StatementConstructorSingle = std::function; // + offset, limit template using StatementConstructor = std::function; // only a statement constructor argument class here, operation is the same // for whole database object hierarchy template static void execute( DBSession &session, const K &stmt_arg, const char *prepared_stmt, StatementConstructorExecute cons); template static datamodel::DBObjectPtr get_single( DBSession &session, const K &stmt_arg, const char *prepared_stmt, StatementConstructorSingle cons); template class Container = datamodel::DBObjectVector> static datamodel::DBContainerPtr get_all( DBSession& session, const K &stmt_arg, const char *prepared_stmt, StatementConstructor cons, datamodel::DBObjectInserter inserter, datamodel::DBContainerPtr pcontainer, int offset, int limit); }; } } #endif