32 lines
807 B
C++
32 lines
807 B
C++
#include "test_backend_service.hpp"
|
|
#include "test_connection.hpp"
|
|
|
|
#include "matador/sql/dialect_builder.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
namespace matador::test::orm {
|
|
|
|
sql::connection_impl *test_backend_service::create(const sql::connection_info &info) {
|
|
return noop_connections_.insert(std::make_unique<test_connection>(info)).first->get();
|
|
}
|
|
|
|
void test_backend_service::destroy(sql::connection_impl *impl)
|
|
{
|
|
auto it = std::find_if(noop_connections_.begin(), noop_connections_.end(), [impl](const auto &item) {
|
|
return impl == item.get();
|
|
});
|
|
if (it != noop_connections_.end()) {
|
|
noop_connections_.erase(it);
|
|
}
|
|
}
|
|
|
|
const sql::dialect *test_backend_service::dialect() const
|
|
{
|
|
static sql::dialect dialect_ = sql::dialect_builder::builder()
|
|
.create()
|
|
.build();
|
|
return &dialect_;
|
|
}
|
|
|
|
} |