aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/DataStore.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-04-13 16:50:48 +0200
committerSamuel Tardieu <sam@rfc1149.net>2014-04-13 16:52:00 +0200
commite1832f8943f53a50dd6cd50482753779e12cd31a (patch)
treefc0ffc37511be1b8fbb2687526fa5ffe4499730f /main/src/cgeo/geocaching/DataStore.java
parent4fcb1d141cf197be1de67002db932c1f9167b2f3 (diff)
downloadcgeo-e1832f8943f53a50dd6cd50482753779e12cd31a.zip
cgeo-e1832f8943f53a50dd6cd50482753779e12cd31a.tar.gz
cgeo-e1832f8943f53a50dd6cd50482753779e12cd31a.tar.bz2
work on #3727: limit the number of waypoints that can be loaded
Limit the number of waypoints that can be loaded from the database to two times the number of caches under which the waypoints are not shown anymore.
Diffstat (limited to 'main/src/cgeo/geocaching/DataStore.java')
-rw-r--r--main/src/cgeo/geocaching/DataStore.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index ee6c9ef..2c0404d 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -2891,7 +2891,9 @@ public class DataStore {
for (int i = 0; i < WAYPOINT_COLUMNS.length; i++) {
query.append(i > 0 ? ", " : "").append(dbTableWaypoints).append('.').append(WAYPOINT_COLUMNS[i]).append(' ');
}
- query.append(" FROM ").append(dbTableWaypoints).append(", ").append(dbTableCaches).append(" WHERE ").append(dbTableWaypoints).append(".geocode == ").append(dbTableCaches).append(".geocode and ").append(where);
+ query.append(" FROM ").append(dbTableWaypoints).append(", ").append(dbTableCaches).append(" WHERE ").append(dbTableWaypoints)
+ .append(".geocode == ").append(dbTableCaches).append(".geocode and ").append(where)
+ .append(" LIMIT " + (Settings.SHOW_WP_THRESHOLD_MAX * 2)); // Hardcoded limit to avoid memory overflow
return cursorToColl(database.rawQuery(query.toString(), null), new HashSet<Waypoint>(), new Func1<Cursor, Waypoint>() {
@Override