diff --git a/include/ircd/db/cursor.h b/include/ircd/db/cursor.h index d32dd82b8..e2eb93c78 100644 --- a/include/ircd/db/cursor.h +++ b/include/ircd/db/cursor.h @@ -203,7 +203,12 @@ const { if(stale) { - set(v, row); + for(const auto &cell : row) + if(cell.valid() && cell.key() == idx->first) + json::set(v, cell.col(), cell.val()); + else + json::set(v, cell.col(), string_view{}); + stale = false; } diff --git a/include/ircd/db/json.h b/include/ircd/db/json.h index 4780980ca..c925998e9 100644 --- a/include/ircd/db/json.h +++ b/include/ircd/db/json.h @@ -25,9 +25,7 @@ namespace ircd::db { - template json::tuple &set(json::tuple &, const row &r); template tuple make_tuple(const row &r); - template void set_index(it begin, it end, const string_view &index); template void write(database &, const string_view &index, const json::tuple &, const sopts & = {}); } @@ -68,17 +66,3 @@ ircd::db::make_tuple(const row &row) set(ret, row); return ret; } - -template -ircd::json::tuple & -ircd::db::set(json::tuple &tuple, - const row &row) -{ - for(const auto &cell : row) - if(cell.valid()) - json::set(tuple, cell.col(), cell.val()); - else - json::set(tuple, cell.col(), string_view{}); - - return tuple; -}