aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2013-01-29 11:27:54 +0100
committerSamuel Tardieu <sam@rfc1149.net>2013-01-29 11:27:54 +0100
commit9e562e59324f28cfcc70d71ec7d7c47e068ff670 (patch)
tree636644e8ec806883d81d47f27d7e9b767e454281
parenta702fa6976e998477c1818079dc3cbea551ae90a (diff)
downloadcgeo-9e562e59324f28cfcc70d71ec7d7c47e068ff670.zip
cgeo-9e562e59324f28cfcc70d71ec7d7c47e068ff670.tar.gz
cgeo-9e562e59324f28cfcc70d71ec7d7c47e068ff670.tar.bz2
Revert "Keep the Waypoint Ids stable. Fixes #2341"
This reverts commit 6335693959709d1d1f6cd08379e70b726731809a. The fix caused problems that were partially fixed in the master branch, but the changes are too broad to integrate in the release branch.
-rw-r--r--main/src/cgeo/geocaching/cgData.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index b080f7c..94eb3fd 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -1160,6 +1160,7 @@ public class cgData {
private void saveOriginalWaypointsWithoutTransaction(final cgCache cache) {
String geocode = cache.getGeocode();
+ database.delete(dbTableWaypoints, "geocode = ? and type <> ? and own = 0", new String[]{geocode, "own"});
List<cgWaypoint> waypoints = cache.getWaypoints();
if (CollectionUtils.isNotEmpty(waypoints)) {
@@ -1182,12 +1183,8 @@ public class cgData {
values.put("note", oneWaypoint.getNote());
values.put("own", oneWaypoint.isUserDefined() ? 1 : 0);
- if (oneWaypoint.getId() < 0) {
- final long rowId = database.insert(dbTableWaypoints, null, values);
- oneWaypoint.setId((int) rowId);
- } else {
- database.update(dbTableWaypoints, values, "_id = ?", new String[] { Integer.toString(oneWaypoint.getId(), 10) });
- }
+ final long rowId = database.insert(dbTableWaypoints, null, values);
+ oneWaypoint.setId((int) rowId);
}
}
}