mdbxmou 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dbimou.cpp +13 -0
package/package.json
CHANGED
package/src/dbimou.cpp
CHANGED
|
@@ -169,6 +169,13 @@ Napi::Value dbimou::for_each(const Napi::CallbackInfo& info) {
|
|
|
169
169
|
|
|
170
170
|
try {
|
|
171
171
|
auto cursor = dbi::open_cursor(*txn);
|
|
172
|
+
auto stat = dbi::get_stat(*txn);
|
|
173
|
+
|
|
174
|
+
// Проверяем, есть ли записи в базе данных
|
|
175
|
+
if (stat.ms_entries == 0) {
|
|
176
|
+
return Napi::Number::New(env, 0);
|
|
177
|
+
}
|
|
178
|
+
|
|
172
179
|
uint32_t index{};
|
|
173
180
|
|
|
174
181
|
if (key_mode_.val & key_mode::ordinal) {
|
|
@@ -254,6 +261,12 @@ Napi::Value dbimou::for_each_from(const Napi::CallbackInfo& info) {
|
|
|
254
261
|
|
|
255
262
|
try {
|
|
256
263
|
auto cursor = dbi::open_cursor(*txn);
|
|
264
|
+
auto stat = dbi::get_stat(*txn);
|
|
265
|
+
|
|
266
|
+
// Проверяем, есть ли записи в базе данных
|
|
267
|
+
if (stat.ms_entries == 0) {
|
|
268
|
+
return Napi::Number::New(env, 0);
|
|
269
|
+
}
|
|
257
270
|
|
|
258
271
|
// Парсим начальный ключ
|
|
259
272
|
std::uint64_t t;
|