Boost logo

Boost :

From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2024-01-06 15:39:59


>
> PPS: Perhaps with Peter's Boost.Describe (awaiting native C++ support), and
> the no-annotation
> variant for simple structs (PFR?), at least each wrapper could provide
> auto-magic assignments to
> structs from the SQLite stepped rows? I think I saw something like that for
> Boost.MySQL, no?

Yes, Boost.MySQL supports parsing into user-defined Describe structs and
tuples using what we call "static interface"
(https://www.boost.org/doc/libs/master/libs/mysql/doc/html/mysql/static_interface.html).
There are plans on adding support for PFR types soon.

In its simplest form, given a Describe struct type T, you can write:

static_results<T> r;
conn.execute("SELECT a, b FROM mytable", r);

Which will parse all rows returned from the query into objects of
type T and store them in r. More advanced uses (like reading row-by-row)
also exist and are described in the link above.

Regards,
Ruben.


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