mysql 结构体_mysql模块使用结构体生成数据库表,不识别long类型
windows環(huán)境:
windows10,vs2017,編譯器最新,支持c++17.
問題描述:
例如結(jié)構(gòu)體:
struct test_create_table
{
//__int64 id; //可以
long id; //不可以,編譯報(bào)錯(cuò)
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(key, not_null);
}
catch (...)
{
cout << "create table fail" << endl;
}
}
報(bào)錯(cuò)如下:
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 個(gè)重載中沒有一個(gè)可以轉(zhuǎn)換所有參數(shù)類型
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) 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: 嘗試匹配參數(shù)列表“(ormpp::identity)”時(shí)
\mayun_git\secondarycounter\ormpp_compile\iguana\iguana\reflection.hpp(476): note: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“auto ormpp::get_type_names::::operator ()<: const>>(long test_create_table::* const &,std::integral_constant) const”的引用
\mayun_git\secondarycounter\ormpp_compile\iguana\iguana\reflection.hpp(484): note: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“void iguana::for_each<:>(const std::tuple &,F &&,std::integer_sequence)”的引用
1> with
1> [
1> _Ty=ormpp::get_type_names::,
1> F=ormpp::get_type_names::
1> ]
1>\mayun_git\secondarycounter\ormpp_compile\ormpp-master\utility.hpp(98): note: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“void iguana::for_each>(T &&,F &&)”的引用
1> with
1> [
1> T=test_create_table,
1> F=ormpp::get_type_names::
1> ]
1>mayun_git\secondarycounter\ormpp_compile\ormpp-master\mysql.hpp(381): note: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“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: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“std::string ormpp::mysql::generate_createtb_sql(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: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“bool ormpp::mysql::create_datatable(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: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“bool ormpp::dbngormpp::mysql::create_datatable(ormpp_key &,ormpp_not_null &)”的引用
1>dmayun_git\secondarycounter\ormpp_compile\ormpp-master\ormpp_test\ormpp_test.cpp(61): note: 參見對(duì)正在編譯的函數(shù) 模板 實(shí)例化“bool ormpp::dbngormpp::mysql::create_datatable(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: 參見對(duì)正在編譯的 類 模板 實(shí)例化 "std::basic_string_view" 的引用
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\type_traits(1358): note: 參見對(duì)正在編譯的 類 模板 實(shí)例化 "std::is_convertible>" 的引用
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: 參見對(duì)正在編譯的 類 模板 實(shí)例化 "std::conjunction<:is_convertible _stringviewish>>,std::negation<:is_convertible _stringviewish _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<:is_convertible const> >,std::negation<:is_convertible const> > >”的引用
1>d:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\xstring(3748): note: 參見對(duì)正在編譯的 別名 模板 實(shí)例化 "_Is_string_view_ish" 的引用
1>已完成生成項(xiàng)目“ormpp_test.vcxproj”的操作 - 失敗。
========== 生成: 成功 0 個(gè),失敗 1 個(gè),最新 0 個(gè),跳過 0 個(gè) ==========
無法識(shí)別long類型?
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的mysql 结构体_mysql模块使用结构体生成数据库表,不识别long类型的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 萤石新品发布会定档!三款家居机器人升级版
- 下一篇: linux cmake编译源码,linu