diff --git a/include/Connection.hpp b/include/Connection.hpp new file mode 100644 index 0000000..b52b85e --- /dev/null +++ b/include/Connection.hpp @@ -0,0 +1,29 @@ +#ifndef SQLGEN_CONNECTION_HPP_ +#define SQLGEN_CONNECTION_HPP_ + +#include +#include + +#include "Result.hpp" +#include "dynamic/Insert.hpp" +#include "dynamic/SelectFrom.hpp" + +namespace sqlgen { + +/// Abstract base class to be implemented by the different +/// database connections. +struct Connection { + /// 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