36 lines
980 B
C++
36 lines
980 B
C++
#include "matador/sql/column_generator.hpp"
|
|
|
|
#include "matador/sql/table.hpp"
|
|
|
|
namespace matador::sql {
|
|
|
|
column_generator::column_generator(std::vector<column> &column_infos,
|
|
const object::schema &scm,
|
|
const std::string &table_name,
|
|
const bool force_lazy,
|
|
const bool has_many_to_many)
|
|
: column_infos_(column_infos)
|
|
, table_schema_(scm)
|
|
, force_lazy_(force_lazy)
|
|
, has_many_to_many_(has_many_to_many)
|
|
{
|
|
table_name_stack_.push(table_name);
|
|
seen_tables.insert(table_name);
|
|
}
|
|
|
|
void column_generator::on_revision(const char *id, unsigned long long int &)
|
|
{
|
|
if (has_many_to_many_) {
|
|
return;
|
|
}
|
|
push(id);
|
|
}
|
|
|
|
void column_generator::push(const std::string &column_name)
|
|
{
|
|
char str[4];
|
|
snprintf(str, 4, "c%02d", ++column_index);
|
|
column_infos_.emplace_back(table{table_name_stack_.top()}, column_name, str);
|
|
}
|
|
|
|
} |