class SQLiteIndex extends AbstractAttributeIndex<A, O> implements SortedKeyStatisticsAttributeIndex<A, O>, NonHeapTypeIndex {

    @Override
    public boolean removeAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions) {
        try {
            ConnectionManager connectionManager = getConnectionManager(queryOptions);
            if (!connectionManager.isApplyUpdateForIndexEnabled(this)) {
                return false;
            }

            final Connection connection = connectionManager.getConnection(this, queryOptions);
            final boolean isBulkImport = queryOptions.get(BulkImportExternallyManged.class) != null || FlagsEnabled.isFlagEnabled(queryOptions, SQLiteIndexFlags.BULK_IMPORT);
            if (isBulkImport) {
                // It's a bulk import, avoid creating the index on the SQLite table...
                DBQueries.createIndexTable(tableName, primaryKeyAttribute.getAttributeType(), getAttribute().getAttributeType(), connection);
            }
            else {
                // It's NOT a bulk import, create both table and index on the table...
                createTableIndexIfNeeded(connection);
            }

            Iterable<K> objectKeys = objectKeyIterable(objectSet, primaryKeyAttribute, queryOptions);

            if (canModifySyncAndJournaling) {
                // Explicitly (re-)set the configured sync and journaling settings,
                // because we performed some DDL operations above. Because, it seems performing some
                // DDL operations can cause the previous sync and journaling settings settings to be lost.
                // For more details see: https://github.com/npgall/cqengine/issues/227
                DBQueries.setSyncAndJournaling(connection, pragmaSynchronous, pragmaJournalMode);
            }

            int rowsModified = DBQueries.bulkRemove(objectKeys, tableName, connection);
            return rowsModified > 0;
        }
        finally {
            objectSet.close();
        }
    }

    public  SQLiteIndex(final Attribute<O, A> attribute,
                       final SimpleAttribute<O, K> primaryKeyAttribute,
                       final SimpleAttribute<K, O> foreignKeyAttribute,
                       final String tableNameSuffix);

}