fixed backend test compilation
This commit is contained in:
@@ -40,6 +40,7 @@ add_library(matador-orm STATIC
|
||||
../../include/matador/query/query_intermediates.hpp
|
||||
../../include/matador/query/query_part.hpp
|
||||
../../include/matador/query/value_extractor.hpp
|
||||
../../include/matador/orm/error_code.hpp
|
||||
../../include/matador/orm/session.hpp
|
||||
../../include/matador/orm/session_query_builder.hpp
|
||||
../../include/matador/sql/abstract_sql_logger.hpp
|
||||
@@ -104,6 +105,7 @@ add_library(matador-orm STATIC
|
||||
query/query_part.cpp
|
||||
query/query_update_intermediate.cpp
|
||||
query/value_extractor.cpp
|
||||
orm/error_code.cpp
|
||||
orm/session.cpp
|
||||
orm/session_query_builder.cpp
|
||||
sql/backend_provider.cpp
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "matador/orm/error_code.hpp"
|
||||
|
||||
namespace matador::orm {
|
||||
|
||||
const char * orm_category_impl::name() const noexcept {
|
||||
return "orm";
|
||||
}
|
||||
|
||||
std::string orm_category_impl::message(const int ev) const {
|
||||
switch (static_cast<error_code>(ev)) {
|
||||
case error_code::Ok:
|
||||
return "OK";
|
||||
case error_code::NoConnectionAvailable:
|
||||
return "No connection available";
|
||||
case error_code::UnknownType:
|
||||
return "Unknown type";
|
||||
case error_code::FailedToBuildQuery:
|
||||
return "Failed to build query";
|
||||
case error_code::FailedToFindObject:
|
||||
return "Failed to find object";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
const std::error_category & orm_category() {
|
||||
static orm_category_impl instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
std::error_code make_error_code(error_code e) {
|
||||
return {static_cast<int>(e), orm_category()};
|
||||
}
|
||||
|
||||
std::error_condition make_error_condition(error_code e) {
|
||||
return {static_cast<int>(e), orm_category()};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
namespace matador::orm {
|
||||
|
||||
utils::error make_error( const error_code ec, const std::string& msg ) {
|
||||
return utils::error(ec, msg);
|
||||
}
|
||||
|
||||
session::session(sql::connection_pool<sql::connection> &pool)
|
||||
: pool_(pool)
|
||||
, dialect_(sql::backend_provider::instance().connection_dialect(pool_.info().type))
|
||||
@@ -26,8 +30,7 @@ utils::result<void, utils::error> session::create_schema() const {
|
||||
return utils::ok<void>();
|
||||
}
|
||||
|
||||
void session::drop_table(const std::string &table_name)
|
||||
{
|
||||
void session::drop_table(const std::string &table_name) const {
|
||||
auto c = pool_.acquire();
|
||||
if (!c.valid()) {
|
||||
throw std::logic_error("no database connection available");
|
||||
@@ -114,7 +117,7 @@ const class sql::dialect &session::dialect() const
|
||||
// return c->fetch(sql);
|
||||
// }
|
||||
|
||||
query::fetchable_query session::build_select_query(sql::connection_ptr<sql::connection> &conn, entity_query_data &&data) {
|
||||
query::fetchable_query session::build_select_query(entity_query_data &&data) {
|
||||
return query::query::select(data.columns)
|
||||
.from(data.root_table_name)
|
||||
.join_left(data.joins)
|
||||
|
||||
@@ -14,4 +14,11 @@ executable_query query_into_intermediate::values(std::vector<std::variant<utils:
|
||||
return {context_};
|
||||
}
|
||||
|
||||
executable_query query_into_intermediate::values( std::vector<utils::database_type>&& values ) {
|
||||
std::vector<std::variant<utils::placeholder, utils::database_type>> transformed_values;
|
||||
for (auto&& val : values) {
|
||||
transformed_values.emplace_back(val);
|
||||
}
|
||||
return this->values(std::move(transformed_values));
|
||||
}
|
||||
} // namespace matador::query
|
||||
|
||||
@@ -45,6 +45,11 @@ connection &connection::operator=(const connection &x) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
connection::connection( connection&& x ) noexcept
|
||||
: connection_info_(std::move(x.connection_info_))
|
||||
, connection_(std::move(x.connection_))
|
||||
, logger_(std::move(x.logger_)) {}
|
||||
|
||||
connection & connection::operator=(connection &&x) noexcept {
|
||||
connection_info_ = std::move(x.connection_info_);
|
||||
connection_ = std::move(x.connection_);
|
||||
|
||||
Reference in New Issue
Block a user