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

List of column types #483

Closed
yasek opened this issue May 24, 2023 · 6 comments
Closed

List of column types #483

yasek opened this issue May 24, 2023 · 6 comments

Comments

@yasek
Copy link

yasek commented May 24, 2023

Hi!
I am working on a custom connection object for some DB and in order to make a request I need to provide a list of types which are requested by the select statement. How do I get it from the select object? Thanks!

@rbock
Copy link
Owner

rbock commented Jun 4, 2023

Not sure what you are looking for? Something like std::tuple<std::string, int64_t, bool>?

@yasek
Copy link
Author

yasek commented Jun 9, 2023

Yes, or, just to be able to work with dynamic columns, std::vector<SomeEnum>{SomeEnum::TEXT, SomeEnum::INTEGRAL}

I was able to do it, manually traversing policies in the same manner as serialize function does, but I am not sure it's a correct way of doing it and it's a lot of boilerplate code

@rbock
Copy link
Owner

rbock commented Jun 10, 2023

Yeah, right now, there is no great access to it. Here's what I would do for static columns:

const auto selected_column_tuple = query.selected_columns._data._columns;

This gives you a tuple of column_t instances.

@yasek
Copy link
Author

yasek commented Jun 12, 2023

Thanks! It helped to get rid of some code.
And for dynamic columns we can simply set strings, can't we?
BTW, do you have any plans on adding typed versions of dynamic columns?

@rbock
Copy link
Owner

rbock commented Jun 13, 2023

Thanks! It helped to get rid of some code.

Glad to read that :-)

And for dynamic columns we can simply set strings, can't we?

Yes

BTW, do you have any plans on adding typed versions of dynamic columns?

Not in sqlpp11. Future versions of sqlpp (see also discussion in #482) will probably use std::optional to handle dynamic columns.

@rbock
Copy link
Owner

rbock commented Jun 19, 2023

Closing.

@rbock rbock closed this as completed Jun 19, 2023
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