backend tests progress
This commit is contained in:
+2
-2
@@ -16,8 +16,8 @@ column::column(std::string name, std::string alias)
|
||||
: name_(std::move(name)), attributes_(utils::null_attributes), alias_(std::move(alias))
|
||||
{}
|
||||
|
||||
column::column(std::string name, data_type_t type, utils::field_attributes attr, null_option null_opt)
|
||||
: name_(std::move(name)), type_(type), attributes_(attr), null_option_(null_opt)
|
||||
column::column(std::string name, data_type_t type, utils::field_attributes attr, null_option null_opt, size_t index)
|
||||
: name_(std::move(name)), index_(index), type_(type), attributes_(attr), null_option_(null_opt)
|
||||
{}
|
||||
|
||||
column::column(std::string name, data_type_t type, size_t index, std::string ref_table, std::string ref_column,
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace matador::sql {
|
||||
connection::connection(connection_info info)
|
||||
: connection_info_(std::move(info))
|
||||
, logger_(stdout, "SQL")
|
||||
, dialect_(backend_provider::instance().connection_dialect(info.type))
|
||||
{
|
||||
connection_.reset(backend_provider::instance().create_connection(connection_info_.type, connection_info_));
|
||||
}
|
||||
@@ -22,6 +23,7 @@ connection::connection(const std::string& dns)
|
||||
connection::connection(const connection &x)
|
||||
: connection_info_(x.connection_info_)
|
||||
, logger_(x.logger_)
|
||||
, dialect_(x.dialect_)
|
||||
{
|
||||
if (x.connection_) {
|
||||
throw std::runtime_error("couldn't copy connection with valid connection impl");
|
||||
@@ -93,4 +95,9 @@ statement connection::prepare(query_context &&query) const
|
||||
return statement(connection_->prepare(std::move(query)), logger_);
|
||||
}
|
||||
|
||||
const class dialect &connection::dialect() const
|
||||
{
|
||||
return dialect_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,30 @@ record::record(const std::vector<column> &columns)
|
||||
init();
|
||||
}
|
||||
|
||||
record::record(const record &x)
|
||||
: columns_(x.columns_)
|
||||
, pk_index_(x.pk_index_)
|
||||
{
|
||||
for (auto& col : columns_) {
|
||||
add_to_map(col, col.index());
|
||||
}
|
||||
}
|
||||
|
||||
record &record::operator=(const record &x)
|
||||
{
|
||||
if (&x == this) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
columns_ = x.columns_;
|
||||
columns_by_name_.clear();
|
||||
pk_index_ = x.pk_index_;
|
||||
for (auto& col : columns_) {
|
||||
add_to_map(col, col.index());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
const std::vector<column> &record::columns() const
|
||||
{
|
||||
return columns_;
|
||||
@@ -37,6 +61,7 @@ const column &record::primary_key() const
|
||||
|
||||
const column &record::at(const std::string &name) const
|
||||
{
|
||||
auto ref = columns_by_name_.at(name).first;
|
||||
return columns_by_name_.at(name).first;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user