SQL: fix previous commits by adding missing to_string

sql-rework
Tomasz Golinski 2020-09-14 21:30:31 +02:00
rodzic 1db28d00c4
commit 4a3bf45a86
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -120,7 +120,7 @@ bool OCdb::parse_item(const json& j) {
} else if (j.count("change_type") && j["change_type"] == "delete") {
Debug(2) << "Deleting cache " << j["object_key"]["code"].get<std::string>() << ".\n";
sql = "DELETE FROM caches WHERE code='";
sql += cache_code_to_int(j["object_key"]["code"].get<std::string>());
sql += std::to_string(cache_code_to_int(j["object_key"]["code"].get<std::string>()));
sql += "';";
request(sql);
} else {
@ -323,9 +323,9 @@ Caches OCdb::get_user_caches_not_found(const std::string& uuid) const {
Caches cc;
sql = "SELECT code, location, region FROM caches WHERE status = ";
sql += ok;
sql += std::to_string(ok);
sql += " AND NOT EXISTS (SELECT cache_code FROM logs WHERE cache_code = code AND type = ";
sql += found;
sql += std::to_string(found);
sql += " and user = ?1) AND owner != ?1;";
res = sqlite3_prepare_v2(db, sql.c_str(), sql.length() + 1, &stmt, NULL);
@ -361,7 +361,7 @@ Caches OCdb::get_user_caches(const std::string& uuid, __attribute__((unused)) in
//code INTEGER PRIMARY KEY, name TEXT, location TEXT, type TEXT, status INTEGER, size TEXT, difficulty INTEGER, terrain INTEGER, country TEXT, region TEXT, owner TEXT)
sql = "SELECT code, location, type, size, difficulty, terrain, country, region, owner, status, name FROM caches WHERE EXISTS (SELECT cache_code FROM logs WHERE cache_code = code AND type = ";
sql += found;
sql += std::to_string(found);
sql += " and user = ?);";
res = sqlite3_prepare_v2(db, sql.c_str(), sql.length() + 1, &stmt, NULL);
@ -455,7 +455,7 @@ std::map<std::string, int> OCdb::get_region_stats() {
//code TEXT PRIMARY KEY, name TEXT, location TEXT, type TEXT, status INTEGER, size TEXT, difficulty INTEGER, terrain INTEGER, country TEXT, region TEXT, owner TEXT)
sql = "SELECT COUNT(code) FROM caches WHERE status = ";
sql += ok;
sql += std::to_string(ok);
sql += " AND region = ?;";
res = sqlite3_prepare_v2(db, sql.c_str(), sql.length() + 1, &stmt, NULL);