38 lines
807 B
C++
38 lines
807 B
C++
#ifndef QUERY_CONNECTION_HPP
|
|
#define QUERY_CONNECTION_HPP
|
|
|
|
#include "matador/sql/connection_info.hpp"
|
|
#include "matador/sql/dialect.hpp"
|
|
#include "matador/sql/query_result.hpp"
|
|
#include "matador/sql/record.hpp"
|
|
|
|
#include <string>
|
|
|
|
namespace matador::sql {
|
|
|
|
class connection_impl;
|
|
|
|
class connection
|
|
{
|
|
public:
|
|
explicit connection(connection_info info);
|
|
explicit connection(const std::string& dns);
|
|
~connection();
|
|
|
|
void open();
|
|
void close();
|
|
[[nodiscard]] bool is_open() const;
|
|
[[nodiscard]] const connection_info& info() const;
|
|
|
|
query_result<record> fetch(const std::string &sql);
|
|
std::pair<size_t, std::string> execute(const std::string &sql);
|
|
|
|
private:
|
|
const connection_info connection_info_;
|
|
bool is_open_{false};
|
|
connection_impl *connection_{};
|
|
};
|
|
|
|
}
|
|
#endif //QUERY_CONNECTION_HPP
|