From 6cb61593ada98e659d970fc671d897255b5c6926 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 26 Sep 2010 15:52:22 +0300 Subject: [PATCH] * mu-store: add mu_store_count --- src/mu-store.cc | 14 ++++++++++++++ src/mu-store.h | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/src/mu-store.cc b/src/mu-store.cc index 973c14a0..c7cb3491 100644 --- a/src/mu-store.cc +++ b/src/mu-store.cc @@ -75,6 +75,20 @@ mu_store_new (const char* xpath) +unsigned +mu_store_count (MuStore *store) +{ + g_return_val_if_fail (store, NULL); + + try { + return store->_db->get_doccount(); + + } MU_XAPIAN_CATCH_BLOCK; + + return 0; +} + + char* mu_store_version (MuStore *store) { diff --git a/src/mu-store.h b/src/mu-store.h index 0d7c7ef4..c866a38e 100644 --- a/src/mu-store.h +++ b/src/mu-store.h @@ -48,6 +48,15 @@ MuStore* mu_store_new (const char* path); void mu_store_destroy (MuStore *store); +/** + * get the numbers of documents in the database + * + * @param index a valid MuStore instance + * + * @return the number of documents in the database; 0 in case of error + * or an empty database + */ +unsigned mu_store_count (MuStore *store); /** * get a version string for the database