use of net.osmand.plus.api.SQLiteAPI.SQLiteCursor in project Osmand by osmandapp.
the class MapMarkersDbHelper method getMarkersHistory.
public List<MapMarker> getMarkersHistory() {
List<MapMarker> markers = new ArrayList<>();
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ACTIVE + " = ?", new String[] { String.valueOf(0) });
if (query.moveToFirst()) {
do {
markers.add(readItem(query));
} while (query.moveToNext());
}
query.close();
} finally {
db.close();
}
}
return markers;
}
use of net.osmand.plus.api.SQLiteAPI.SQLiteCursor in project Osmand by osmandapp.
the class GPXDatabase method getItems.
public List<GpxDataItem> getItems() {
List<GpxDataItem> items = new ArrayList<>();
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(GPX_TABLE_SELECT, null);
if (query.moveToFirst()) {
do {
items.add(readItem(query));
} while (query.moveToNext());
}
query.close();
} finally {
db.close();
}
}
return items;
}
use of net.osmand.plus.api.SQLiteAPI.SQLiteCursor in project Osmand by osmandapp.
the class GPXDatabase method getItem.
@Nullable
public GpxDataItem getItem(File file) {
GpxDataItem result = null;
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
String fileName = getFileName(file);
String fileDir = getFileDir(file);
SQLiteCursor query = db.rawQuery(GPX_TABLE_SELECT + " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", new String[] { fileName, fileDir });
if (query.moveToFirst()) {
result = readItem(query);
}
query.close();
} finally {
db.close();
}
}
return result;
}
use of net.osmand.plus.api.SQLiteAPI.SQLiteCursor in project Osmand by osmandapp.
the class MapMarkersDbHelper method getMarker.
@Nullable
public MapMarker getMarker(String id) {
MapMarker res = null;
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ID + " = ?", new String[] { id });
if (query.moveToFirst()) {
res = readItem(query);
}
query.close();
} finally {
db.close();
}
}
return res;
}
use of net.osmand.plus.api.SQLiteAPI.SQLiteCursor in project Osmand by osmandapp.
the class MapMarkersDbHelper method getAllGroupsMap.
public Map<String, MapMarkersGroup> getAllGroupsMap() {
Map<String, MapMarkersGroup> res = new LinkedHashMap<>();
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(GROUPS_TABLE_SELECT, null);
if (query.moveToFirst()) {
do {
MapMarkersGroup group = readGroup(query);
res.put(group.getId(), group);
} while (query.moveToNext());
}
query.close();
} finally {
db.close();
}
}
return res;
}
Aggregations