|
Boost : |
From: Marcelo Zimbres Silva (mzimbres_at_[hidden])
Date: 2023-01-22 21:52:49
On Sat, 21 Jan 2023 at 20:00, Ruben Perez <rubenperez038_at_[hidden]> wrote:
>
> I like how adapt() works. Parsing into compile-time structures is
> always good. However, as a Redis novice I am, I've had a hard time
> debugging things when I got a mismatch between the type passed to
> adapt() and what the command expects. The error happens at parse
> time, which I think is pretty dangerous, as it's very easy to get
> things overlooked.
I am trying to understand how you avoid these risks in Boost.MySql but
it seems it suffers from the same problems?
I mean this: https://github.com/boostorg/mysql/blob/ac7285c62163c0de40a466ecaeca13f7de5af0c4/example/text_queries.cpp#L108
conn.query("SELECT salary FROM employee WHERE first_name =
'Underpaid'", result);
double salary = result.rows().at(0).at(0).as_double();
The query is not type safe [1] and the result can mismatch the the
query. Why would it be considered ok for Boost.MySql and not
Boost.Aedis?
Disclaimer: I am not trying to make a case or open a precedent, it is
purely technical. I might be wrong but I would like to clarify anyway.
Regards,
Marcelo
[1] Typesafe in this sense: https://github.com/rbock/sqlpp11
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk