From d8e8d4cd7c6b7baca11c52f0aff0a1443973088d Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Thu, 5 Aug 2021 17:17:20 +0200
Subject: [PATCH] DRAFT: Sketch idea for COUNT queries

---
 include/caosdb/transaction.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/caosdb/transaction.h b/include/caosdb/transaction.h
index ee84846..26982cd 100644
--- a/include/caosdb/transaction.h
+++ b/include/caosdb/transaction.h
@@ -249,6 +249,17 @@ private:
   std::unique_ptr<Entity> entity;
 };
 
+// TODO(fspreck) One possibility for count-queries: Transaction gets a
+// GetQueryCount function that returns exactly this. In case of a
+// single FIND Query this will be equivalent to the Size of the
+// ResultSet, but it may be different in case of Query + RetrieveById,
+// and in case of COUNT queries which have an empty ResultSet. We have
+// to think about how to extend this to transactions with more than
+// one query in the future. My suggestion is to treat a transaction
+// with more than one query as the union of the query results in which
+// case the query count would return the cumulative number of
+// results. This would even allow the combination of FIND, FIND
+// unique, and COUNT, albeit a little strangely.
 /**
  * @brief Create a transaction via `CaosDBConnection.createTransaction()`
  */
-- 
GitLab