Merge pull request #10258 from osmandapp/fix_10233

Fix_10233
This commit is contained in:
alex-osm 2020-11-23 19:22:37 +03:00 committed by GitHub
commit 5a6a32bf1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}