SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.41k stars 477 forks source link

Support for bool, std::filesystem::path, std::unique_ptr, std::shared_ptr #1043

Open e1y4s opened 1 year ago

e1y4s commented 1 year ago
e1y4s commented 1 year ago

You're welcome!

I personally use pointer specializations when the presence or absence of a value can be ambiguous in the context of a "NOT NULL" field. For example, with std::string, this allows me to differentiate between a field left as null and a field set to empty.

I think the specialization for std::filesystem::path is useful when the data stored is clearly a path. This allows for clarification of the data type in the model and enables direct use of the std::filesystem::path API, without having to repeatedly perform conversions between std::filesystem::path and std::string.

Yes, using type_conversion seemed simpler to me at first, but I also agree that it should be handled "natively" without being a kind of "plugin". I will look into changing this as soon as possible.

Thanks for the PR!

I think pointer specializations are useful, although I must admit I had somehow never have any need for them personally, and std::fs::path one might be as well, although it's not totally clear how much advantage it brings compared to just using strings.

But the bool one is probably -- and unless I'm missing something -- not 100% correct and I think we should add "true" boolean support instead.