aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/DataStore.java6
-rw-r--r--main/src/cgeo/geocaching/geopoint/Viewport.java12
2 files changed, 9 insertions, 9 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index bb8b427..0345e30 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -1675,7 +1675,7 @@ public class DataStore {
* @return
*/
- private static String buildCoordinateWhere(final String dbTable, final Viewport viewport) {
+ private static StringBuilder buildCoordinateWhere(final String dbTable, final Viewport viewport) {
return viewport.resize(1.5).sqlWhere(dbTable);
}
@@ -2265,7 +2265,7 @@ public class DataStore {
}
// viewport limitation
- final StringBuilder selection = new StringBuilder(buildCoordinateWhere(dbTableCaches, viewport));
+ final StringBuilder selection = buildCoordinateWhere(dbTableCaches, viewport);
// cacheType limitation
String[] selectionArgs = null;
@@ -2870,7 +2870,7 @@ public class DataStore {
*/
public static Set<Waypoint> loadWaypoints(final Viewport viewport, boolean excludeMine, boolean excludeDisabled, CacheType type) {
- final StringBuilder where = new StringBuilder(buildCoordinateWhere(dbTableWaypoints, viewport));
+ final StringBuilder where = buildCoordinateWhere(dbTableWaypoints, viewport);
if (excludeMine) {
where.append(" and ").append(dbTableCaches).append(".found == 0");
}
diff --git a/main/src/cgeo/geocaching/geopoint/Viewport.java b/main/src/cgeo/geocaching/geopoint/Viewport.java
index 21dc7fa..9d55f69 100644
--- a/main/src/cgeo/geocaching/geopoint/Viewport.java
+++ b/main/src/cgeo/geocaching/geopoint/Viewport.java
@@ -3,12 +3,11 @@ package cgeo.geocaching.geopoint;
import cgeo.geocaching.ICoordinates;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
-import java.util.Locale;
import java.util.Set;
-
public class Viewport {
public final @NonNull Geopoint center;
@@ -104,11 +103,12 @@ public class Viewport {
* the database table to use as prefix, or null if no prefix is required
* @return the string without the "where" keyword
*/
- public String sqlWhere(final String dbTable) {
+ public StringBuilder sqlWhere(@Nullable final String dbTable) {
final String prefix = dbTable == null ? "" : (dbTable + ".");
- return String.format((Locale) null,
- "%slatitude >= %s and %slatitude <= %s and %slongitude >= %s and %slongitude <= %s",
- prefix, getLatitudeMin(), prefix, getLatitudeMax(), prefix, getLongitudeMin(), prefix, getLongitudeMax());
+ return new StringBuilder(prefix).append("latitude >= ").append(getLatitudeMin()).append(" and ")
+ .append(prefix).append("latitude <= ").append(getLatitudeMax()).append(" and ")
+ .append(prefix).append("longitude >= ").append(getLongitudeMin()).append(" and ")
+ .append(prefix).append("longitude <= ").append(getLongitudeMax());
}
/**