diff --git a/include/sqlpp11/alias_provider.h b/include/sqlpp11/alias_provider.h index 86dba643..fafc875e 100644 --- a/include/sqlpp11/alias_provider.h +++ b/include/sqlpp11/alias_provider.h @@ -35,7 +35,7 @@ {\ struct _alias_t\ {\ - static constexpr const char _literal[] = #name;\ + static constexpr const char _literal[sizeof(#name)] = #name;\ using _name_t = sqlpp::make_char_sequence;\ template\ struct _member_t\ diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index 80e0063b..e71047a4 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -146,7 +146,7 @@ for tableCreation in tableCreations: print(' {', file=header) print(' struct _alias_t', file=header) print(' {', file=header) - print(' static constexpr const char _literal[] = "' + sqlColumnName + '";', file=header) + print(' static constexpr const char _literal[' + str(len(sqlColumnName) + 1) + '] = "' + sqlColumnName + '";', file=header) print(' using _name_t = sqlpp::make_char_sequence;', file=header) print(' template', file=header) print(' struct _member_t', file=header) @@ -178,7 +178,7 @@ for tableCreation in tableCreations: print(' {', file=header) print(' struct _alias_t', file=header) print(' {', file=header) - print(' static constexpr const char _literal[] = "' + sqlTableName + '";', file=header) + print(' static constexpr const char _literal[' + str(len(sqlTableName) + 1) + '] = "' + sqlTableName + '";', file=header) print(' using _name_t = sqlpp::make_char_sequence;', file=header) print(' template', file=header) print(' struct _member_t', file=header) diff --git a/tests/Sample.h b/tests/Sample.h index 2fa909e5..fe87589c 100644 --- a/tests/Sample.h +++ b/tests/Sample.h @@ -13,7 +13,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "delta"; + static constexpr const char _literal[6] = "delta"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -29,7 +29,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "epsilon"; + static constexpr const char _literal[8] = "epsilon"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -45,7 +45,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "omega"; + static constexpr const char _literal[6] = "omega"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -66,7 +66,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "tab_foo"; + static constexpr const char _literal[8] = "tab_foo"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -83,7 +83,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "alpha"; + static constexpr const char _literal[6] = "alpha"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -99,7 +99,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "beta"; + static constexpr const char _literal[5] = "beta"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -115,7 +115,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "gamma"; + static constexpr const char _literal[6] = "gamma"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -131,7 +131,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "delta"; + static constexpr const char _literal[6] = "delta"; using _name_t = sqlpp::make_char_sequence; template struct _member_t @@ -153,7 +153,7 @@ namespace test { struct _alias_t { - static constexpr const char _literal[] = "tab_bar"; + static constexpr const char _literal[8] = "tab_bar"; using _name_t = sqlpp::make_char_sequence; template struct _member_t