From ee4ea6de8dffc87c1a62dd46a5725bb726200603 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 23 Nov 2020 14:59:00 +0200 Subject: [PATCH] Fix #10233 --- .../plus/helpers/SearchHistoryHelper.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java index 0f4af1f68d..693227f434 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java @@ -376,7 +376,10 @@ public class SearchHistoryHelper { SQLiteConnection db = openConnection(false); if (db != null) { try { - removeQuery(e.getSerializedName(), db); + db.execSQL("DELETE FROM " + HISTORY_TABLE_NAME + " WHERE " + + HISTORY_COL_NAME + " = ? AND " + + HISTORY_COL_LAT + " = ? AND " + HISTORY_COL_LON + " = ?", + new Object[] {e.getSerializedName(), e.getLat(), e.getLon()}); } finally { db.close(); } @@ -385,11 +388,6 @@ public class SearchHistoryHelper { return false; } - private void removeQuery(String name, SQLiteConnection db) { - db.execSQL("DELETE FROM " + HISTORY_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + " = ?", - new Object[]{name}); - } - public boolean removeAll() { SQLiteConnection db = openConnection(false); if (db != null) { @@ -411,9 +409,10 @@ public class SearchHistoryHelper { "UPDATE " + HISTORY_TABLE_NAME + " SET " + HISTORY_COL_TIME + "= ? " + ", " + HISTORY_COL_FREQ_INTERVALS + " = ? " + ", " + HISTORY_COL_FREQ_VALUES + "= ? WHERE " + - HISTORY_COL_NAME + " = ?", - new Object[]{e.getLastAccessTime(), e.getIntervals(), e.getIntervalsValues(), - e.getSerializedName()}); + HISTORY_COL_NAME + " = ? AND " + + HISTORY_COL_LAT + " = ? AND " + HISTORY_COL_LON + " = ?", + new Object[] {e.getLastAccessTime(), e.getIntervals(), e.getIntervalsValues(), + e.getSerializedName(), e.getLat(), e.getLon()}); } finally { db.close(); }