Skip to content

How to properly enable foreign_keys support #22

@nyyakko

Description

@nyyakko

Anyone cares to shed a light on how to enable foreign_keys with this library? I've tried doing the following:

OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::provider::Provider<oatpp::sqlite::Connection>>, dbConnectionProvider)([] {
    auto connectionProvider = std::make_shared<oatpp::sqlite::ConnectionProvider>("database.sqlite");
    auto result = sqlite3_exec(connectionProvider->get().object.get()->getHandle(), "PRAGMA foreign_keys=ON;", nullptr, nullptr, nullptr);
    assert(result == SQLITE_OK && "ERROR ENABLING foreign_keys");
    return oatpp::sqlite::ConnectionPool::createShared(connectionProvider, 10, std::chrono::seconds(5));
}());

without success. if anyone could help me with this I'd be glad.

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