Skip to content

Sqlite: Improve efficiency of getOne and getMaybeOne #44

@robinheghan

Description

@robinheghan

Sqlite.getMaybeOne is currently implemented using getAll. This can be very inefficient when the underlying query returns many results, as all of them will be returned and decoded before the function fails with a ManyResults error.

Instead, we should make use of the underlying sqlite.iterate, which returns a JavaScript iterator. We should use this to decode the first result, then check if next().done is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions