#ifndef QUERY_SESSION_HPP #define QUERY_SESSION_HPP #include "matador/sql/column_name_generator.hpp" #include "matador/sql/connection.hpp" #include "matador/sql/connection_pool.hpp" #include "matador/sql/query_builder.hpp" #include "matador/sql/query_intermediates.hpp" #include "matador/sql/table_repository.hpp" #include namespace matador::sql { class session { public: explicit session(connection_pool &pool); query_create_intermediate create(); query_drop_intermediate drop(); template < class Type > query_select_intermediate select() { return query_select_intermediate{*this, query_.select(column_name_generator::generate())}; } query_select_intermediate select(std::initializer_list column_names); query_insert_intermediate insert(); query_update_intermediate update(const std::string &table); query_delete_intermediate remove(); [[nodiscard]] query_result fetch(const std::string &sql) const; [[nodiscard]] std::pair execute(const std::string &sql) const; template void attach(const std::string &table_name) { table_repository_.attach(table_name); } [[nodiscard]] const table_repository& tables() const; private: friend class query_select_finish; [[nodiscard]] std::unique_ptr call_fetch(const std::string &sql) const; private: connection_pool &pool_; query_builder query_; table_repository table_repository_; }; } #endif //QUERY_SESSION_HPP