-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mysql模块使用结构体生成数据库表,不识别long类型 #11
Comments
你怎么不用int要用long呢? |
int太小,不够长 |
Long long
发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用
…________________________________
发件人: banzhuandemanong <[email protected]>
发送时间: Wednesday, September 5, 2018 1:31:18 PM
收件人: qicosmos/ormpp
抄送: Subscribed
主题: Re: [qicosmos/ormpp] mysql模块使用结构体生成数据库表,不识别long类型 (#11)
int太小,不够长
―
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#11 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFiLgExX_d_XwnHThH8PN3GBMaY83oyMks5uX2GmgaJpZM4WaEbP>.
|
用int64也可以啊。 |
如果不好改,我就移植linux时,脚本都在windows生成好算了。谢啦 |
你用int64_t是可以的啊,不是不好改,已经支持了64位,就不想做重复的事。 |
struct student { |
这个REFLECTION宏是必须要自己定义的。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
windows环境:
windows10,vs2017,编译器最新,支持c++17.
问题描述:
例如结构体:
struct test_create_table
{
//__int64 id; //可以
long id; //不可以,编译报错
string name;
};
REFLECTION(test_create_table, id, name)
void test_creat()
{
try
{
dbng mysql;
mysql.connect("127.0.0.1", "root", "123456", "test");
ormpp_key key{ "id" };
ormpp_not_null not_null{ {"id"} };
ormpp_auto_key auto_key{ "id" };
mysql.create_datatable<test_create_table>(key, not_null);
}
catch (...)
{
cout << "create table fail" << endl;
}
}
报错如下:
1>ormpp_test.cpp
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\utility.hpp(84): error C2665: “ormpp::ormpp_mysql::type_to_name”: 7 个重载中没有一个可以转换所有参数类型
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(50): note: 可能是“std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identitystd::string) noexcept”
1>d:\mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(49): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity<int64_t>) noexcept”
1>d:\mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(48): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity) noexcept”
1>d:\mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(47): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity) noexcept”
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(46): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity) noexcept”
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(45): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity) noexcept”
1>dmayun_git\secondarycounter\ormpp_compile\ormpp-master\type_mapping.hpp(44): note: 或 “std::string_view ormpp::ormpp_mysql::type_to_name(ormpp::identity) noexcept”
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\utility.hpp(84): note: 尝试匹配参数列表“(ormpp::identity)”时
\mayun_git\secondarycounter\ormpp_compile\iguana\iguana\reflection.hpp(476): note: 参见对正在编译的函数 模板 实例化“auto ormpp::get_type_names::<lambda_ce8993546f247617066e6a0f110d02f9>::operator ()<longtest_create_table::* const ,std::integral_constant<size_t,0>>(long test_create_table::* const &,std::integral_constant<size_t,0>) const”的引用
\mayun_git\secondarycounter\ormpp_compile\iguana\iguana\reflection.hpp(484): note: 参见对正在编译的函数 模板 实例化“void iguana::for_each<longtest_create_table::* ,std::stringtest_create_table::* ,_Ty,0,1>(const std::tuple<long test_create_table::* ,std::string test_create_table::* > &,F &&,std::integer_sequence<unsigned int,0,1>)”的引用
1> with
1> [
1> _Ty=ormpp::get_type_names::<lambda_ce8993546f247617066e6a0f110d02f9>,
1> F=ormpp::get_type_names::<lambda_ce8993546f247617066e6a0f110d02f9>
1> ]
1>\mayun_git\secondarycounter\ormpp_compile\ormpp-master\utility.hpp(98): note: 参见对正在编译的函数 模板 实例化“void iguana::for_each<test_create_table,ormpp::get_type_names::<lambda_ce8993546f247617066e6a0f110d02f9>>(T &&,F &&)”的引用
1> with
1> [
1> T=test_create_table,
1> F=ormpp::get_type_names::<lambda_ce8993546f247617066e6a0f110d02f9>
1> ]
1>mayun_git\secondarycounter\ormpp_compile\ormpp-master\mysql.hpp(381): note: 参见对正在编译的函数 模板 实例化“std::arraystd::string,2 ormpp::get_type_names(ormpp::DBType)”的引用
1> with
1> [
1> T=test_create_table
1> ]
1>dmayun_git\secondarycounter\ormpp_compile\ormpp-master\mysql.hpp(67): note: 参见对正在编译的函数 模板 实例化“std::string ormpp::mysql::generate_createtb_sql<T,ormpp_key&,ormpp_not_null&>(ormpp_key &,ormpp_not_null &)”的引用
1> with
1> [
1> T=test_create_table
1> ]
1>d:mayun_git\secondarycounter\ormpp_compile\ormpp-master\dbng.hpp(33): note: 参见对正在编译的函数 模板 实例化“bool ormpp::mysql::create_datatable<T,ormpp_key&,ormpp_not_null&>(ormpp_key &,ormpp_not_null &)”的引用
1> with
1> [
1> T=test_create_table
1> ]
1>d:\mayun_git\secondarycounter\ormpp_compile\ormpp-master\ormpp_test\ormpp_test.cpp(61): note: 参见对正在编译的函数 模板 实例化“bool ormpp::dbngormpp::mysql::create_datatable<test_create_table,ormpp_key&,ormpp_not_null&>(ormpp_key &,ormpp_not_null &)”的引用
1>dmayun_git\secondarycounter\ormpp_compile\ormpp-master\ormpp_test\ormpp_test.cpp(61): note: 参见对正在编译的函数 模板 实例化“bool ormpp::dbngormpp::mysql::create_datatable<test_create_table,ormpp_key&,ormpp_not_null&>(ormpp_key &,ormpp_not_null &)”的引用
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\type_traits(520): note: 参见对正在编译的 类 模板 实例化 "std::basic_string_view<char,std::char_traits>" 的引用
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\type_traits(1358): note: 参见对正在编译的 类 模板 实例化 "std::is_convertible<const _StringViewIsh (&),std::basic_string_view<char,std::char_traits>>" 的引用
1> with
1> [
1> _StringViewIsh=char [2]
1> ]
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\type_traits(1364): note: 参见对正在编译的 类 模板 实例化 "std::conjunction<std::is_convertible<const _StringViewIsh (&),std::basic_string_view<char,std::char_traits>>,std::negation<std::is_convertible<const _StringViewIsh (&),const _Elem *>>>" 的引用
1> with
1> [
1> _StringViewIsh=char [2],
1> _Elem=char
1> ]
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\xstring(2105): note: 查看指向正在编译的变量模板“const bool conjunction_v<std::is_convertible<char const (&)[2],std::basic_string_view<char,std::char_traits > >,std::negation<std::is_convertible<char const (&)[2],char const *> > >”的引用
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\xstring(3748): note: 参见对正在编译的 别名 模板 实例化 "_Is_string_view_ish<char[2]>" 的引用
1>已完成生成项目“ormpp_test.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
无法识别long类型?
The text was updated successfully, but these errors were encountered: