From 7662545c2a325fb86fa56ded9211a94d99cc07d2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 09:39:23 +0200 Subject: [PATCH] SimpleQuery: Provide a getter for the current iterator position refs #8615 --- library/Icinga/Data/SimpleQuery.php | 10 ++++++++++ library/Icinga/Repository/RepositoryQuery.php | 10 ++++++++++ .../library/Monitoring/DataView/DataView.php | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index 2dcecfc9c..ecfaa3aaa 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -143,6 +143,16 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator return $this->ds; } + /** + * Return the current position of this query's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->iteratorPosition; + } + /** * Start or rewind the iteration */ diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index c975654db..98ed6e81f 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -605,6 +605,16 @@ class RepositoryQuery implements QueryInterface, SortRules, Iterator return $this->query->count(); } + /** + * Return the current position of this query's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->query->getIteratorPosition(); + } + /** * Start or rewind the iteration */ diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index 11543351c..31ca426d5 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -69,6 +69,16 @@ abstract class DataView implements QueryInterface, SortRules, IteratorAggregate return $this->getQuery(); } + /** + * Return the current position of the result set's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->query->getIteratorPosition(); + } + /** * Get the query name this data view relies on *