Skip to content

schema-qualified table names result in broken struct names in identity mode #113

@rbock

Description

@rbock

From #106, thanks @MeanSquaredError :

arguably there is a bug in the way ddl2cpp handles schema qualified table names when --naming-style identity is enabled. In that mode this definition

CREATE TABLE mysc.mytbl (
myid bigint NOT NULL
);

will generate a header which looks like this :

struct mysc.mytbl_ {
struct myid {
SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(myid, myid);
using data_type = ::sqlpp::integral;
using has_default = std::false_type;
};
SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(mysc.mytbl, mysc.mytbl);
template
using table_columns = sqlpp::table_columns<T,
myid>;
using required_insert_columns = sqlpp::detail::type_set<
sqlpp::column_t<sqlpp::table_t<mysc.mytbl
>, myid>>;
};
using mysc.mytbl = ::sqlpp::table_t<mysc.mytbl
>;

This is clearly broken because struct mysc.mytbl_ and using mysc.mytbl are obviously incorrect definitions. However this can be fixed relatively easily by fixing ModelWriter._to_class_name and ModelWriter._to_member_name, which currently replace . with _ in camel-case mode, but incorrectly don't make that replacement in identity mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions