Hi, I started using SOCI some time ago and implemented a simple mapping for a "User" object. First I tried with SQLite because it is easy to setup. I used camelcase for the column names and it works fine. I now also want to have a PostgreSQL database as the backend and found out that it does not support capital letters in table and column names when not quoted. Also the piece of code below does not work anymore, because of the capitals.
static void from_base(values const& v, indicator /* ind */, core::User& user) { user.UUID = v.get<std::string>("UUID"); user.login = v.get<std::string>("Login"); user.setPasswordHash(v.get<std::string>("Password")); user.firstName = v.get<std::string>("FirstName"); user.lastName = v.get<std::string>("LastName"); user.email = v.get<std::string>("Email"); } static void to_base(const core::User& user, values& v, indicator& ind) { v.set("UUID", user.UUID); v.set("Login", user.login); v.set("Password", user.getPasswordHash()); v.set("FirstName", user.firstName); v.set("LastName", user.lastName); v.set("Email", user.email); ind = i_ok; } Is there a way to make these wrappers work for any underlying backend regardless of case, or should I stick with all lower case identifiers? Currently it is not much work to refactor my code, but I don't know if there is a "general" guideline to this problem. I could imagine that an other backend for example may only support everything capitalised. Kind regards, Christian ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk _______________________________________________ soci-users mailing list soci-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/soci-users