kopia lustrzana https://gitlab.com/tomaszg/geostat
Pull more cache data from local db
rodzic
10b4562ac0
commit
46a7321434
11
ocdb.cpp
11
ocdb.cpp
|
@ -315,8 +315,8 @@ Caches OCdb::get_user_caches(std::string uuid, __attribute__((unused)) int count
|
|||
int res;
|
||||
Caches cc;
|
||||
Cache c;
|
||||
|
||||
std::string sql = "SELECT code, location FROM caches WHERE EXISTS (SELECT cache_code FROM logs WHERE cache_code = code AND type = 'Found it' and user = ?);";
|
||||
//code TEXT PRIMARY KEY, name TEXT, location TEXT, type TEXT, status TEXT, size TEXT, difficulty REAL, terrain REAL, country TEXT, region TEXT, owner TEXT)
|
||||
std::string sql = "SELECT code, location, type, size, difficulty, terrain, country, region, owner FROM caches WHERE EXISTS (SELECT cache_code FROM logs WHERE cache_code = code AND type = 'Found it' and user = ?);";
|
||||
|
||||
res = sqlite3_prepare_v2(db, sql.c_str(), sql.length() + 1, &stmt, NULL);
|
||||
if (res != SQLITE_OK) {
|
||||
|
@ -329,6 +329,13 @@ Caches OCdb::get_user_caches(std::string uuid, __attribute__((unused)) int count
|
|||
while (res == SQLITE_ROW) {
|
||||
c.code = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
|
||||
c.pos = get_lat_lon(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)));
|
||||
c.type = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 2));
|
||||
c.size = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 3));
|
||||
c.diff = sqlite3_column_double(stmt, 4);
|
||||
c.terr = sqlite3_column_double(stmt, 5);
|
||||
// c.country = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 6));
|
||||
c.region = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 7));
|
||||
c.owner_uuid = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 8)); // TODO: we don't know owner's nick
|
||||
cc.insert(c);
|
||||
res = sqlite3_step(stmt);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue