added logger
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "matador/sql/query_result.hpp"
|
||||
#include "matador/sql/record.hpp"
|
||||
|
||||
#include "matador/utils/logger.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace matador::sql {
|
||||
@@ -32,21 +34,13 @@ public:
|
||||
[[nodiscard]] record describe(const std::string &table_name) const;
|
||||
[[nodiscard]] bool exists(const std::string &table_name) const;
|
||||
|
||||
template<class Type>
|
||||
query_result<Type> fetch(const std::string &sql)
|
||||
{
|
||||
return query_result<Type>(connection_->fetch(sql));
|
||||
}
|
||||
[[nodiscard]] std::unique_ptr<query_result_impl> fetch(const std::string &sql) const;
|
||||
[[nodiscard]] std::pair<size_t, std::string> execute(const std::string &sql) const;
|
||||
|
||||
private:
|
||||
friend class session;
|
||||
|
||||
[[nodiscard]] std::unique_ptr<query_result_impl> call_fetch(const std::string &sql) const;
|
||||
|
||||
private:
|
||||
connection_info connection_info_;
|
||||
std::unique_ptr<connection_impl> connection_;
|
||||
utils::logger logger_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ struct any_type_to_string_visitor
|
||||
column alias(const std::string &column, const std::string &as);
|
||||
column alias(column &&col, const std::string &as);
|
||||
column count(const std::string &column);
|
||||
column count_all();
|
||||
|
||||
enum class join_type_t {
|
||||
INNER, OUTER, LEFT, RIGHT
|
||||
|
||||
@@ -54,8 +54,7 @@ public:
|
||||
template<typename Type>
|
||||
Type fetch_value()
|
||||
{
|
||||
auto result = fetch_all();
|
||||
return {};
|
||||
return fetch_one().at(0).as<Type>();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
private:
|
||||
friend class query_select_finish;
|
||||
|
||||
[[nodiscard]] std::unique_ptr<query_result_impl> call_fetch(const std::string &sql) const;
|
||||
[[nodiscard]] std::unique_ptr<query_result_impl> fetch(const std::string &sql) const;
|
||||
|
||||
private:
|
||||
connection_pool<connection> &pool_;
|
||||
|
||||
Reference in New Issue
Block a user