34 lines
651 B
C++
34 lines
651 B
C++
#ifndef QUERY_CONNECTION_HPP
|
|
#define QUERY_CONNECTION_HPP
|
|
|
|
#include "matador/sql/query_intermediates.hpp"
|
|
#include "matador/sql/dialect.hpp"
|
|
#include "matador/sql/query_builder.hpp"
|
|
|
|
#include <string>
|
|
|
|
namespace matador::sql {
|
|
|
|
class connection
|
|
{
|
|
public:
|
|
connection() = default;
|
|
explicit connection(std::string dns);
|
|
|
|
void open();
|
|
void close();
|
|
[[nodiscard]] bool is_open() const;
|
|
|
|
[[nodiscard]] const std::string& dns() const;
|
|
|
|
query_result<record> fetch(const std::string &sql);
|
|
std::pair<size_t, std::string> execute(const std::string &sql);
|
|
|
|
private:
|
|
std::string dns_;
|
|
bool is_open_{false};
|
|
};
|
|
|
|
}
|
|
#endif //QUERY_CONNECTION_HPP
|