hi @an-tao, we have an issue related to LOG_DEBUG macro. When we integrate our system with an external logging system which uses syslog, as syslog has same macro it is overriding. Is it possbile to use some prefix before those macros. LOG_DEBUG, LOG_ERROR etc is very common and mostly logging libraries uses them.
The solution I can think of is to compile your app with dragon source code, then resolve the conflict by string replacing
Hi everyone,
what is the equivalent of:
auto cmd = R"(
update public.account_verification_email set token_expired=true where email=$1;
)";
db->execSqlAsyncFuture(cmd, u_email);
in drogon::orm ?
<br>
I tried:
orm::Mapper<AccountVerificationEmail> aveMP(db);
aveMP.updateFutureBy(
AccountVerificationEmail::Cols::_token_expired,
orm::Criteria(AccountVerificationEmail::Cols::_email,
orm::CompareOperator::Like, u_email),
true);
but gets error:
[build] /home/prg/backend/beCPP/db/postgresdb.h:326:53: note: cannot convert ‘drogon_model::database_name::AccountVerificationEmail::Cols::_token_expired’ (type ‘const string’ {aka ‘const std::__cxx11::basic_string<char>’}) to type ‘const std::vector<std::__cxx11::basic_string<char> >&’
[build] 326 | AccountVerificationEmail::Cols::_token_expired,
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
these column was actually boolean.
Can someone correct me which part should be change?
Raw sql command is fine, but I want to maximize using drogon orm.
newFileUploadRequest
? — https://drogon.docsforge.com/master/api/drogon/HttpRequest/newFileUploadRequest/
make && sudo make install
Hi.
In documents written response->getJsonObject() will return an empty shared_ptr of response is not json object but for me it's cause crash
20220725 08:28:44.788119 UTC 45246 ERROR * Line 1, Column 1
Syntax error: value, object or array expected.
- HttpResponseImpl.cc:832
20220725 08:28:44.788201 UTC 45246 ERROR body: <html>
<head><title>404 Not Found</title></head>
<body bgcolor="white" text="black">
<center><h1>404 Not Found</h1></center>
<hr><center>drogon/1.7.5</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
- HttpResponseImpl.cc:833
Press <RETURN> to close this window...
Am I mistaken?
Hi, I have a question regarding the AOP of drogon (https://drogon.docsforge.com/master/aop-aspect-oriented-programming/#aop-schematic)
Is it possible to graft somewhere between the pre-handling join-point and the Hander to do some kind of task during the processing of the data of an http request? The default handler is called only at the end of the upload.
For example: on a file upload, insert a callback that creates on start a database entry, so that the file is immediately available for clients, then updates the databse entry during the upload.
Intended usage: record audio and send it chunked to the server until the end of the recording, AND make the partial audio file immediately available for re-serving for other clients (play during record).
trantor::InetAddress inetInfo("127.0.0.1", 1102);
auto socketClient =
trantor::TcpClient(trantor::EventLoop::getEventLoopOfCurrentThread(), inetInfo, "kick-ass-gamer");
try {
socketClient.setConnectionCallback([](const trantor::TcpConnectionPtr &conn) {
if (conn->connected()) {
LOG_INFO << "connected to db";
} else {
LOG_ERROR << "connect to db failed";
}
});
socketClient.setConnectionErrorCallback([]() { LOG_DEBUG << "connect to db error"; });
socketClient.connect();
const auto connPtr = socketClient.connection();
if (!connPtr) {
throw std::runtime_error("Connect to db failed #" + std::to_string(server.getValueOfId()));
}
// connPtr->send(reinterpret_cast<const char *>(&packets[0]), packets.size());
socketClient.disconnect();
} catch (const std::exception &e) {
LOG_ERROR << e.what();
}
socketClient.stop();