You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subject: Help Needed: Resolving Compilation Errors in Drogon Application
Hello Drogon Community,
I am currently developing a C++ application using the Drogon framework and have encountered several compilation errors related to the Drogon ORM and asynchronous SQL execution. I would appreciate any guidance or suggestions to resolve these issues.
Description of the Problem:
I am using Drogon's ORM to interact with a MariaDB database. The application involves creating and retrieving Event objects from the database. However, I am facing compilation errors primarily in the EventRepository class, particularly in the insertEvent and getEventById methods. These methods use the execSqlAsync function to execute SQL queries asynchronously.
Errors:
The compilation errors are mostly related to the SqlBinder class and lambda functions passed to execSqlAsync. Here are some of the error messages:
Error related to conversion in SqlBinder.h: cannot convert '(lambda)' to 'uint16_t' without a conversion operator
Errors in FunctionTraits.h about std::remove_reference<int>::type not being a class, namespace, or enumeration.
Incomplete definition errors in SqlBinder and FunctionTraits.
I suspect the issue might be related to how I'm passing arguments or lambda functions to `execSqlAsync`. The application compiles when I comment out the event values in these methods.
Any insights into what might be causing these errors and how to fix them would be greatly appreciated. Thank you in advance for your help!
Best regards,
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Subject: Help Needed: Resolving Compilation Errors in Drogon Application
Hello Drogon Community,
I am currently developing a C++ application using the Drogon framework and have encountered several compilation errors related to the Drogon ORM and asynchronous SQL execution. I would appreciate any guidance or suggestions to resolve these issues.
Description of the Problem:
I am using Drogon's ORM to interact with a MariaDB database. The application involves creating and retrieving
Event
objects from the database. However, I am facing compilation errors primarily in theEventRepository
class, particularly in theinsertEvent
andgetEventById
methods. These methods use theexecSqlAsync
function to execute SQL queries asynchronously.Errors:
The compilation errors are mostly related to the
SqlBinder
class and lambda functions passed toexecSqlAsync
. Here are some of the error messages:SqlBinder.h
:cannot convert '(lambda)' to 'uint16_t' without a conversion operator
FunctionTraits.h
aboutstd::remove_reference<int>::type
not being a class, namespace, or enumeration.SqlBinder
andFunctionTraits
.Code Snippets:
Here are the key parts of my code:
void EventRepository::insertEvent(const Playfuse::models::Event& event, std::function<void(bool)> callback) {
std::string query = "INSERT INTO events (...) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
dbClient_->execSqlAsync(query, event.getCreatorID(), ..., [callback](const drogon::orm::Result& result) {
// ...
}, [callback](const drogon::orm::DrogonDbException& e) {
// ...
});
}
void EventRepository::getEventById(int eventID, std::function<void(const std::optionalPlayfuse::models::Event&)> callback) {
std::string query = "SELECT ... FROM events WHERE EventID = ?";
dbClient_->execSqlAsync(query, eventID, ...);
}
Beta Was this translation helpful? Give feedback.
All reactions