Skip to content

Cancelable Queries (stop the execution of a query via CancelToken) #1174

@csm101

Description

@csm101

This is the idea:
while this query is running in a task:

   connection.Table<MyRecType>()
     .CancelToken (tok)
     .ToList();

I want another "control task" to be able to abort that query by simply calling CancTokSource.Cancel().

Spoiler: I am already in the process of implementing this feauture: I am checking the status of the cancellation source inside the loops that fetch records, but I am also using the sqlite3_interrupt call to abort any "server-side" processing.

I will issue a pull request when it will be finished. Currently I have implemented cancellable versions of methods of SqliteConnection
(methods: DeferredQuery, Query, QueryScalars, and all linq queries initiated by Table (by adding the CancelToken method shown in my example)

I still have to tackle SqliteAsyncConnection.

I will issue a Pull request as soon as possible... If I can avoid doing some "actual" work.
(in case someone wants to give it a try or give me some early feedback: https://github.com/csm101/sqlite-net/tree/cancelable_queries)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions