diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-11-29 00:11:45 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-11-29 00:11:45 +0100 |
| commit | 06af2c35b54d94660f27ef7587cb2770590693d9 (patch) | |
| tree | 07f3e583e09d3105a13336d6bd1d7a464818cf7a /main/src/cgeo/geocaching/cgData.java | |
| parent | 7076e85b2042f21ee1a4b4fe2607e7bd28d2717b (diff) | |
| download | cgeo-06af2c35b54d94660f27ef7587cb2770590693d9.zip cgeo-06af2c35b54d94660f27ef7587cb2770590693d9.tar.gz cgeo-06af2c35b54d94660f27ef7587cb2770590693d9.tar.bz2 | |
workaround for wrong statement binding on Android 3.0
* repeatedly set also unchanged values
Diffstat (limited to 'main/src/cgeo/geocaching/cgData.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 8104c16..a38dc12 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1058,9 +1058,10 @@ public class cgData { return; } SQLiteStatement statement = PreparedStatements.getInsertAttribute(); - statement.bindLong(2, System.currentTimeMillis()); + final long timestamp = System.currentTimeMillis(); for (String attribute : cache.getAttributes()) { statement.bindString(1, geocode); + statement.bindLong(2, timestamp); statement.bindString(3, attribute); statement.executeInsert(); @@ -1224,9 +1225,10 @@ public class cgData { List<cgImage> spoilers = cache.getSpoilers(); if (CollectionUtils.isNotEmpty(spoilers)) { SQLiteStatement insertSpoiler = PreparedStatements.getInsertSpoiler(); - insertSpoiler.bindLong(2, System.currentTimeMillis()); + final long timestamp = System.currentTimeMillis(); for (cgImage spoiler : spoilers) { insertSpoiler.bindString(1, geocode); + insertSpoiler.bindLong(2, timestamp); insertSpoiler.bindString(3, spoiler.getUrl()); insertSpoiler.bindString(4, spoiler.getTitle()); final String description = spoiler.getDescription(); @@ -1250,9 +1252,10 @@ public class cgData { } SQLiteStatement insertLog = PreparedStatements.getInsertLog(); - insertLog.bindLong(2, System.currentTimeMillis()); + final long timestamp = System.currentTimeMillis(); for (LogEntry log : logs) { insertLog.bindString(1, geocode); + insertLog.bindLong(2, timestamp); insertLog.bindLong(3, log.type.id); insertLog.bindString(4, log.author); insertLog.bindString(5, log.log); @@ -1262,8 +1265,8 @@ public class cgData { long logId = insertLog.executeInsert(); if (log.hasLogImages()) { SQLiteStatement insertImage = PreparedStatements.getInsertLogImage(); - insertImage.bindLong(1, logId); for (cgImage img : log.getLogImages()) { + insertImage.bindLong(1, logId); insertImage.bindString(2, img.getTitle()); insertImage.bindString(3, img.getUrl()); insertImage.executeInsert(); @@ -1280,9 +1283,10 @@ public class cgData { if (MapUtils.isNotEmpty(logCounts)) { Set<Entry<LogType, Integer>> logCountsItems = logCounts.entrySet(); SQLiteStatement insertLogCounts = PreparedStatements.getInsertLogCounts(); - insertLogCounts.bindLong(2, System.currentTimeMillis()); + final long timestamp = System.currentTimeMillis(); for (Entry<LogType, Integer> pair : logCountsItems) { insertLogCounts.bindString(1, geocode); + insertLogCounts.bindLong(2, timestamp); insertLogCounts.bindLong(3, pair.getKey().id); insertLogCounts.bindLong(4, pair.getValue()); @@ -2535,9 +2539,9 @@ public class cgData { database.beginTransaction(); try { SQLiteStatement setVisit = PreparedStatements.getUpdateVisitDate(); - setVisit.bindLong(1, visitedDate); for (String geocode : geocodes) { + setVisit.bindLong(1, visitedDate); setVisit.bindString(2, geocode); setVisit.execute(); } |
