From bf80228fc57e4ec2d1432c186047090f5c0d75c2 Mon Sep 17 00:00:00 2001 From: ShrBox Date: Mon, 18 Mar 2024 14:00:34 +0800 Subject: [PATCH] fix: fix compile --- src/legacy/api/DatabaseAPI.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/legacy/api/DatabaseAPI.cpp b/src/legacy/api/DatabaseAPI.cpp index ab0aa699..0a0874ea 100644 --- a/src/legacy/api/DatabaseAPI.cpp +++ b/src/legacy/api/DatabaseAPI.cpp @@ -252,12 +252,12 @@ Local KVDBClass::listKey(const Arguments& args) { try { if (!isValid()) return Local(); - auto list = kvdb->getAllKeys(); - Local arr = Array::newArray(); - for (auto& key : list) { - arr.add(String::newString(key)); - } - return arr; + Local array = Array::newArray(); + kvdb->iter([&array](std::string_view key, std::string_view value) { + array.add(String::newString(key)); + return true; + }); + return array; } CATCH_AND_THROW("Fail in DbListKey!"); }