-
Notifications
You must be signed in to change notification settings - Fork 240
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
Conversion of TEXT[] to std::vector<std::string>. #818
Comments
There is no conversion from array to
See this comment: #769 (comment) |
thx) |
why we doesnt have standard string trait for such cases? |
One annoying problem is that the string conversion API does not have a way to pass the prevailing client encoding. For all the other data types, the encoding is irrelevant — if it's strings, we pass them on unchanged, and for the other data types it's effectively always ASCII. Just for arrays it's different. :-( |
For #841 I intend to make encodings a "thing" in the libpqxx API. That may provide one small step for this. There's another issue though that we haven't touched upon: separators. Each type on the SQL side may set its own separator between elements! Usually it's a comma, but at least one standard type uses a semicolon, and there may be others. This is not hard to support — the But there is a downside to that. Once we go that way, it would become effectively impossible to extend the string conversion API with more template parameters in the future. For example, at some point we might want to implement binary data transfers by adding a "format" parameter. That would then become a source-incompatible API change. So for now, I think the best thing to do is to deprecate (We could be bold and just immediately create a separate |
I don't know why I never mentioned this in here before... We do now have support for reading arrays, but as a separate It's still not quite the same as supporting the regular conversion system that we have for other types, but I hope it covers most use-cases. There's a bunch of work to be done before I want to dive into that: first I want to simplify the plethora of "exec" functions we have. So I think we can close this ticket now, actually. It's not perfect, but I think it's pretty good; and there's not much more I think we can do right now. |
How i can convert TEXT[] column to std::vectorstd::string in prepared statements?
I can insert it with prepared statements but i cant get it through prepared statements. Why?
The text was updated successfully, but these errors were encountered: