Skip to content

Set std::optional to std::nullopt instead of throwing sqlite::errors::no_rows #226

@ghost

Description

I think this would be better since that is the entire point of std::optional.
I don't see the point of throwing an exception with std::optional.
It makes sense to throw an exception if , say, we have:

int i;
try {
   db << "SELECT..." >> i{};
}
catch (errors::no_rows& e) {...}

but with std::optional it'd be better to do this:

std::optional<int> i{};
db << "SELECT..." >> i;
if (not i) {...}

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