#ifndef SQLGEN_CONNECTION_HPP_ #define SQLGEN_CONNECTION_HPP_ #include #include #include "Result.hpp" #include "dynamic/CreateTable.hpp" #include "dynamic/Insert.hpp" #include "dynamic/SelectFrom.hpp" namespace sqlgen { /// Abstract base class to be implemented by the different /// database connections. struct Connection { /// Executes a statement. /// TODO: Abstract away the different statements using a lambda function. virtual Result execute(const CreateTable& _stmt) = 0; /// Reads the results of a SelectFrom statement. virtual Result>> read( const dynamic::SelectFrom& _query) = 0; /// Writes data into a table. Each vector in data MUST have the same length as /// _stmt.columns. virtual Result write( const dynamic::Insert& _stmt, const std::vector>& _data) = 0; }; } // namespace sqlgen #endif