Skip to content

is there a way to check whether a column is part of the primary key #1329

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

Open
juandent opened this issue Jun 26, 2024 · 1 comment
Open

Comments

@juandent
Copy link
Contributor

juandent commented Jun 26, 2024

I am doing some work in Qt and creating a Model (as in Model-View-Controller) and the code is generic
I want to make primary key columns non-editable.... what is the best way to find this out?

This is a special case of the general features that would be nice to have access to... by this I mean access to the meta information of the storage object and its subobjects for enabling or making it possible to write code that takes advantage of this information'
(for instance whether a column is part of a primary key)...

@trueqbit
Copy link
Collaborator

sqlite_orm itself needs to access this kind of meta information for its machinery to work, so there are internal (meta) functions.
E.g. look at table_t<>::for_each_primary_key_column(), which passes object fields to a lambda.

Currently you either have to access internal functions or create your own that work with internal classes.

If you find a good way to access or collect meta information, it might be worth making it available in the public namespace.

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

No branches or pull requests

2 participants