Boost logo

Boost :

From: Dennis Luehring (dl.soluz_at_[hidden])
Date: 2022-05-11 04:11:33


Am 10.05.2022 um 22:33 schrieb Marcelo Zimbres Silva via Boost:
> users could do
>
> boost::mysql::row<T1, T2, T3, T3> row;
> while (result.async_read_one(row, additional_info, yield[ec]))
>
> avoiding unnecessary further copies. In principle it would be even
> possible to parse directly in a custom data structure, for example,
> when storing json string in the database.

i've developed a small C++17 example of how to work with
Input/Output transformers to write the statements more compact
and type-safe

the base idea is that the MySQL <-> C++ needs sometimes some sort
of conversions and to combine most of the infos at one point so its
easier or at least possible to optimize better - the current interface
looks very runtime allocation stylish :)

the Input- and Output Transformers help to work with basic types
and also with SQL/MySQL special types like Null-string etc. - its not
possible to map MySQL types always 1:1 to C++ and back, sometimes you
want to
behave the transformation different

the Transformers aren't visible when used with basic types

its just an example to promote the Idea: https://pastebin.com/raw/vepbTAKL

the best combination would be some sort of fluent SQL interface like:
https://github.com/rbock/sqlpp11

but i still think a plain string+binding interface like Boost.MySql
currently got is also needed


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk