enabled use of sql_logger in statement.cpp
This commit is contained in:
parent
621c3703fd
commit
b2d5db2702
|
|
@ -1,6 +1,5 @@
|
||||||
#include "matador/sql/statement.hpp"
|
#include "matador/sql/statement.hpp"
|
||||||
#include "matador/sql/record.hpp"
|
#include "matador/sql/record.hpp"
|
||||||
#include "matador/sql/field.hpp"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
@ -62,13 +61,12 @@ utils::result<query_result<record>, utils::error> statement::fetch() const {
|
||||||
if (!result.is_ok()) {
|
if (!result.is_ok()) {
|
||||||
return utils::failure(result.err());
|
return utils::failure(result.err());
|
||||||
}
|
}
|
||||||
// logger_.info(statement_->query_.sql);
|
logger_->on_fetch(statement_proxy_->sql());
|
||||||
const auto prototype = result.value()->prototype();
|
const auto prototype = result.value()->prototype();
|
||||||
return utils::ok(query_result<record>(std::move(*result), prototype));
|
return utils::ok(query_result<record>(std::move(*result), prototype));
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::result<std::optional<record>, utils::error> statement::fetch_one() const {
|
utils::result<std::optional<record>, utils::error> statement::fetch_one() const {
|
||||||
// logger_.info(statement_->query_.sql);
|
|
||||||
auto result = statement_proxy_->fetch(*bindings_);
|
auto result = statement_proxy_->fetch(*bindings_);
|
||||||
if (!result.is_ok()) {
|
if (!result.is_ok()) {
|
||||||
return utils::failure(result.err());
|
return utils::failure(result.err());
|
||||||
|
|
@ -80,7 +78,7 @@ utils::result<std::optional<record>, utils::error> statement::fetch_one() const
|
||||||
if (first == records.end()) {
|
if (first == records.end()) {
|
||||||
return utils::ok(std::optional<record>{std::nullopt});
|
return utils::ok(std::optional<record>{std::nullopt});
|
||||||
}
|
}
|
||||||
|
logger_->on_fetch(statement_proxy_->sql());
|
||||||
return utils::ok(std::optional{first.release()});
|
return utils::ok(std::optional{first.release()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,8 +99,8 @@ utils::result<std::unique_ptr<query_result_impl>, utils::error> statement::fetch
|
||||||
if (!result.is_ok()) {
|
if (!result.is_ok()) {
|
||||||
return utils::failure(result.err());
|
return utils::failure(result.err());
|
||||||
}
|
}
|
||||||
|
logger_->on_fetch(statement_proxy_->sql());
|
||||||
|
|
||||||
// logger_.info(statement_->query_.sql);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue