Skip to content

How to properly enable foreign_keys support #22

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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