private static void saveLogsWithoutTransaction(final String geocode, final Iterable<LogEntry> logs, final boolean removeAllExistingLogs) {
        try (ContextLogger cLog = new ContextLogger("DataStore.saveLogsWithoutTransaction(%s)", geocode)) {
            if (!logs.iterator().hasNext()) {
                return;
            }
            // TODO delete logimages referring these logs
            if (removeAllExistingLogs) {
                database.delete(dbTableLogs, "geocode = ?", new String[]{geocode});
            } else {
                // instead of deleting all existing logs for this cache, try to merge
                // by deleting only those from same author, same date, same logtype
                final SQLiteStatement deleteLog = PreparedStatement.CLEAN_LOG.getStatement();
                for (final LogEntry log : logs) {
                    final ImmutablePair<Long, Long> dateRange = CalendarUtils.getStartAndEndOfDay(log.date);

                    deleteLog.bindString(1, geocode);
                    deleteLog.bindLong(2, dateRange.left);
                    deleteLog.bindLong(3, dateRange.right);
                    deleteLog.bindLong(4, log.logType.id);
                    deleteLog.bindString(5, log.author);
                    deleteLog.executeUpdateDelete();
                }
            }

            final SQLiteStatement insertLog = PreparedStatement.INSERT_LOG.getStatement();
            final long timestamp = System.currentTimeMillis();
            int logCnt = 0;
            int imgCnt = 0;
            for (final LogEntry log : logs) {
                logCnt++;
                insertLog.bindString(1, geocode);
                insertLog.bindLong(2, timestamp);
                if (log.serviceLogId == null) {
                    insertLog.bindNull(3);
                } else {
                    insertLog.bindString(3, log.serviceLogId);
                }
                insertLog.bindLong(4, log.logType.id);
                insertLog.bindString(5, log.author);
                insertLog.bindString(6, log.authorGuid);
                insertLog.bindString(7, log.log);
                insertLog.bindLong(8, log.date);
                insertLog.bindLong(9, log.found);
                insertLog.bindLong(10, log.friend ? 1 : 0);
                final long logId = insertLog.executeInsert();
                if (log.hasLogImages()) {
                    final SQLiteStatement insertImage = PreparedStatement.INSERT_LOG_IMAGE.getStatement();
                    for (final Image img : log.logImages) {
                        imgCnt++;
                        insertImage.bindLong(1, logId);
                        insertImage.bindString(2, StringUtils.defaultIfBlank(img.title, ""));
                        insertImage.bindString(3, img.getUrl());
                        insertImage.bindString(4, StringUtils.defaultIfBlank(img.getDescription(), ""));
                        if (img.serviceImageId == null) {
                            insertImage.bindNull(5);
                        } else {
                            insertImage.bindString(5, img.serviceImageId);
                        }
                        insertImage.executeInsert();
                    }
                }
            }
            cLog.add("logs:%d, imgs:%d", logCnt, imgCnt);
        }
    }
Retrieve coordinates from a Cursor

@param cursor   a Cursor representing a row in the database
@param indexLat index of the latitude column
@param indexLon index of the longitude column
@return the coordinates, or null if latitude or longitude is null or the coordinates are invalid
main/src/main/java/cgeo/geocaching/storage/DataStore.java