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
Is your feature request related to a problem? Please describe.
DbClient is a handy tool for MySQL query even with transaction. Would it be possible to support Mutliple STATEMENT(s) query? To perform following query, it requires the statement be divided into the corresponding sub-statement and execSqlAsync one-by-one.
INSERT INTO tb_a (a, b) VALUES"new_foo", ?
INSERT INTO tb_b (aa) VALUES ?;
INSERT INTO tb_c (aaa) VALUES ?;
DELETEFROM tb_a
WHEREtb_a.a="new_foo"ANDtb_a.b<>"not_new_b";
This quickly resulted in a callbacks hell, e.g.
auto dbErr = [callbackPtr](const DrogonDbException &e){
Json::Value ret;
ret["error"] = e.base().what();
auto resp = HttpResponse::newHttpJsonResponse(std::move(ret));
resp->setStatusCode(k400BadRequest);
(*callbackPtr)(std::move(resp);
};
...
dbClientPtr->execSqlAsync(
"INSERT INTO tb_a (a, b) VALUES "new_foo", ?",
[dbClientPtr,dbErr](const Result &r){
//Checking and other operations
...
dbClientPtr->execSqlAsync("INSERT INTO tb_b (aa) VALUES ?;",
[dbClientPtr,dbErr](const Result &r){
//Checking and other operations
...
dbClientPtr->execSqlAsync("INSERT INTO tb_c (aaa) VALUES ?;",
[dbClientPtr,dbErr](const Result &r){
//Checking and other operations
...
//Futher dbClientPtr->execSqlAsync
},
dbErr,
"new_aaa"
);
},
dbErr,
"new_aa"
);
},
dbErr,
"new_b"
);
...
Would it be worse with transaction since the STATEMENT should be enclosed with transaction. Or how could it be simplified? Sorry for my lack of knowledge in SQL.
Describe the solution you'd like execSqlAsync() and Transaction could support mutli STATEMENTS
Describe alternatives you've considered
I dont know
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
DbClient is a handy tool for MySQL query even with transaction. Would it be possible to support Mutliple STATEMENT(s) query? To perform following query, it requires the statement be divided into the corresponding sub-statement and
execSqlAsync
one-by-one.This quickly resulted in a callbacks hell, e.g.
Would it be worse with transaction since the STATEMENT should be enclosed with transaction. Or how could it be simplified? Sorry for my lack of knowledge in SQL.
Describe the solution you'd like
execSqlAsync()
andTransaction
could support mutli STATEMENTSDescribe alternatives you've considered
I dont know
The text was updated successfully, but these errors were encountered: