kopia lustrzana https://gitlab.com/tomaszg/geostat
Don't generate empty SQL commands if no data is to be changed.
rodzic
2a00a57b3c
commit
ab2f66c87a
6
ocdb.cpp
6
ocdb.cpp
|
@ -164,6 +164,9 @@ bool OCdb::update_cache(json j) {
|
|||
if (j["data"]["owner"].count("uuid") > 0 && !j["data"]["owner"]["uuid"].is_null())
|
||||
fields["owner"] = j["data"]["owner"]["uuid"].get<std::string>();
|
||||
|
||||
if (fields.empty() && fields2.empty())
|
||||
return 2;
|
||||
|
||||
std::string sql = "INSERT INTO caches (code,";
|
||||
for (auto& i : fields)
|
||||
sql += i.first + ',';
|
||||
|
@ -220,6 +223,9 @@ bool OCdb::update_log(json j) {
|
|||
if (j["data"].count("text") > 0 && !j["data"]["text"].is_null())
|
||||
fields["text"] = j["data"]["text"].get<std::string>();
|
||||
|
||||
if (fields.empty())
|
||||
return 2;
|
||||
|
||||
std::string sql = "INSERT INTO logs (uuid,";
|
||||
for (auto& i : fields)
|
||||
sql += i.first + ',';
|
||||
|
|
Ładowanie…
Reference in New Issue