Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated_always_as(length(&Object::name)) produces exception in sync_schema() #893

Closed
juandent opened this issue Feb 8, 2022 · 1 comment

Comments

@juandent
Copy link
Contributor

juandent commented Feb 8, 2022

This code below causes exception in sync_schema() but the one below it doesn't (an important clue in solving it):

    struct Object {
        std::string name;
        int nameLen;
        int number;
    };
    constexpr int offset = 0;
    auto storage = make_storage("",
                                make_table("objects",
                                           make_column("name", &Object::name),
                                           make_column("name_len", &Object::nameLen, generated_always_as(length(&Object::name))),
                                           make_column("number", &Object::number)));
    storage.sync_schema();

this one does not break:

    struct Object {
        std::string name;
        int nameLen;
        int number;
    };
    constexpr int offset = 0;
    auto storage = make_storage("",
                                make_table("objects",
                                           make_column("name", &Object::name),
                                           make_column("name_len", &Object::nameLen, generated_always_as( offset + length(&Object::name))),
                                           make_column("number", &Object::number)));
    storage.sync_schema();

so?

@fnc12
Copy link
Owner

fnc12 commented Feb 10, 2022

fixed in dev

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

No branches or pull requests

2 participants