drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

error ares_gethostbyname #1987

Closed AmdRyZen closed 2 months ago

AmdRyZen commented 3 months ago

drogon/trantor/trantor/net/inner/AresResolver.cc:127:23: error: 'void ares_gethostbyname(ares_channel_t, const char, int, ares_host_callback, void*)' is deprecated: Use ares_getaddrinfo instead [-Werror=deprecated-declarations] 127 | aresgethostbyname(ctx, | ~~~~^~~~ 128 | hostname.c_str(), | ~~~~~ 129 | AF_INET, | ~~~~ 130 | &AresResolver::areshostcallback, | ~~~~~~~~~~ 131 | queryData);

an-tao commented 2 months ago

we fixed this issue in https://github.com/an-tao/trantor/pull/331

AmdRyZen commented 2 months ago

nice

marty1885 commented 2 months ago

@AmdRyZen Can you confirm the lastest mater fixed the issue for you? I want to close the issue if possible.

AmdRyZen commented 2 months ago

master 没有更新 @marty1885

AmdRyZen commented 2 months ago

@an-tao 我到现在还没找到一个 动态sql的方式 且支持 getFastDbClient 的 execSqlCoro

auto criteria = Criteria(XxlJobInfo::Cols::_id, CompareOperator::EQ, 1) && Criteria(XxlJobInfo::Cols::_author, CompareOperator::EQ, "aa"); 这种方式是阻塞的 且也不是动态的

co_await transPtr->execSqlCoro("update xxl_job_info set author = ? where id = ? limit 1", "aa", 1); 这种方式参数是固定的 "aa", 1 不能是 vec...

类似golang if len(req.TemplateName) > 0 { tx = tx.Where("template_name = ?", req.TemplateName) }

marty1885 commented 2 months ago

@AmdRyZen 試試手工把trantor更新?沒問題的話我發個PR更新master上的 trantor

AmdRyZen commented 2 months ago

@marty1885 我已经git submodule update --init 没有更新

an-tao commented 2 months ago

@an-tao 我到现在还没找到一个 动态sql的方式 且支持 getFastDbClient 的 execSqlCoro

auto criteria = Criteria(XxlJobInfo::Cols::_id, CompareOperator::EQ, 1) && Criteria(XxlJobInfo::Cols::_author, CompareOperator::EQ, "aa"); 这种方式是阻塞的 且也不是动态的

co_await transPtr->execSqlCoro("update xxl_job_info set author = ? where id = ? limit 1", "aa", 1); 这种方式参数是固定的 "aa", 1 不能是 vec...

类似golang if len(req.TemplateName) > 0 { tx = tx.Where("template_name = ?", req.TemplateName) }

Drogon里还有个sql构建工具QueryBuilder你可以尝试

marty1885 commented 2 months ago

@AmdRyZen

cd trantor
git pull origin master

然後重新build

AmdRyZen commented 2 months ago

Author: Martin Chang marty1885@users.noreply.github.com Date: Wed Apr 3 13:03:18 2024 +0800

Fix build on latest c-ares (#331)

commit c92280119a6ebaf71fe6aca0d128222edd028b22

构建成功了

image
AmdRyZen commented 2 months ago

github/drogon/lib/src/HttpUtils.cc:62:10: warning: 'drogon::CT_APPLICATION_X_JAVASCRIPT' is deprecated: use CT_TEXT_JAVASCRIPT [-Wdeprecated-declarations] 62 | {CT_APPLICATION_X_JAVASCRIPT,

不过有个警告 看看是不是有时间改一下

AmdRyZen commented 2 months ago

@an-tao我还没有找到一个动态sql的方式且支持 getFastDbClient 的 execSqlCoro 自动标准 = Criteria(XxlJobInfo::Cols::_id, CompareOperator::EQ, 1) && Criteria(XxlJobInfo::Cols::_author, CompareOperator::EQ, "aa");这种方式是阻塞的且也不是动态的 co_await transPtr->execSqlCoro("更新 xxl_job_info setauthor = ? where id = ? limit 1", "aa", 1);这种方式参数是固定的“aa”,1 不能是 vec... 类似golang if len(req.TemplateName) > 0 { tx = tx.Where("template_name = ?", req.TemplateName) }

Drogon 里还有一个 sql 构建工具 QueryBuilder 你可以尝试

@an-tao QueryBuilder 我看demo是同步阻塞的 并不支持协成

AmdRyZen commented 2 months ago

这2 种方式也不能通用

image