zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #04489
[Branch ~zeitgeist/zeitgeist/bluebird] Rev 358: Merge lp:~zeitgeist/zeitgeist/bluebird-no-distinct
Merge authors:
Siegfried Gevatter (rainct)
Related merge proposals:
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird-no-distinct/+merge/87175
proposed by: Siegfried Gevatter (rainct)
review: Approve - Michal Hruby (mhr3)
------------------------------------------------------------
revno: 358 [merge]
committer: Michal Hruby <michal.mhr@xxxxxxxxx>
branch nick: bluebird
timestamp: Sat 2011-12-31 19:17:04 +0100
message:
Merge lp:~zeitgeist/zeitgeist/bluebird-no-distinct
modified:
src/engine.vala
--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird
Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/engine.vala'
--- src/engine.vala 2011-12-31 18:15:06 +0000
+++ src/engine.vala 2011-12-31 18:17:04 +0000
@@ -207,7 +207,7 @@
//if (!where.may_have_results ())
// return new uint32[0];
- string sql = "SELECT DISTINCT id FROM event_view ";
+ string sql = "SELECT id FROM event_view ";
string where_sql = "";
if (!where.is_empty ())
{
@@ -321,9 +321,6 @@
throw new EngineError.INVALID_ARGUMENT (error_message);
}
- if (max_events > 0)
- sql += " LIMIT %u".printf (max_events);
-
int rc;
Sqlite.Statement stmt;
@@ -342,11 +339,15 @@
while ((rc = stmt.step()) == Sqlite.ROW)
{
- var id = (uint32) uint64.parse(
+ var event_id = (uint32) uint64.parse(
stmt.column_text (EventViewRows.ID));
- event_ids += id;
+ // Events are supposed to be contiguous in the database
+ if (event_ids.length == 0 || event_ids[event_ids.length-1] != event_id) {
+ event_ids += event_id;
+ if (event_ids.length == max_events) break;
+ }
}
- if (rc != Sqlite.DONE)
+ if (rc != Sqlite.DONE && rc != Sqlite.ROW)
{
string error_message = "Error in find_event_ids: %d, %s".printf (
rc, db.errmsg ());