diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-17 22:32:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:49 +0200 |
commit | e661bd33b7bf8da546cbdbe23c9ddcf568930a1a (patch) | |
tree | 03317c8fc984f88c1a8ed27477a482f4f5f18815 /common/resultset.cpp | |
parent | 9e1850071a471ce275194f3882054694cea798e7 (diff) | |
download | sink-e661bd33b7bf8da546cbdbe23c9ddcf568930a1a.tar.gz sink-e661bd33b7bf8da546cbdbe23c9ddcf568930a1a.zip |
Simplified replaySet
Diffstat (limited to 'common/resultset.cpp')
-rw-r--r-- | common/resultset.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/resultset.cpp b/common/resultset.cpp index 13b5f16..9883f44 100644 --- a/common/resultset.cpp +++ b/common/resultset.cpp | |||
@@ -98,6 +98,22 @@ void ResultSet::skip(int number) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | qint64 ResultSet::replaySet(int offset, int batchSize, const Callback &callback) | ||
102 | { | ||
103 | skip(offset); | ||
104 | int counter = 0; | ||
105 | while (!batchSize || (counter < batchSize)) { | ||
106 | const bool ret = next([this, &counter, callback](const ResultSet::Result &result) { | ||
107 | counter++; | ||
108 | callback(result); | ||
109 | }); | ||
110 | if (!ret) { | ||
111 | break; | ||
112 | } | ||
113 | }; | ||
114 | return counter; | ||
115 | } | ||
116 | |||
101 | QByteArray ResultSet::id() | 117 | QByteArray ResultSet::id() |
102 | { | 118 | { |
103 | if (mIt) { | 119 | if (mIt) { |