Message from C, C++ discussions

December 2019

— And if you use the Sync method of it, please use try-catch

— 

std::this_thread::sleep_for(3s);
try
{
auto result = sql->execSqlSync("SELECT * FROM log"); // Block until we get the result or catch the exception;

— Sure.

— Yes

— U shall be judged for this!

— Which means there should be a way to know when conn is done, maybe a callback since it's a non-blocking method.

Message permanent page

— Almost all methods in drogon are non-blocking.

— Yes, this is a good idea, but when DbClient is created at the beginning of the application and used throughout its lifecycle, the callback is not very necessary.

Message permanent page

— Or an bool connected() DbClient member function .

— Oh, I get the last part.

— But the interface is quite strange compared to http etc.

— Thanks, I'll think about this.