Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2022-05-13 13:42:00


Ruben Perez wrote:
> But the library is not an ORM or a SQL framework, and the documentation
> may not be clear enough in scope.

I have little use for ORM or SQL frameworks. I do, however, have use for
two things:

1. A way to say

conn.query( "SELECT * FROM tb_something WHERE id = ?", id );

There is a school of thought that holds that I shouldn't be doing that
and using prepared statements instead, but managing the lifetime of
prepared statements is inconvenient enough to steer people, including
myself, towards sprintf-ing their way to victory, which of course invites
security issues.

The above interface is easier than sprintf, which will steer people away
from sprintf, which will be a big win in both usability and safety.

2. A way to obtain a described struct from a result row of the above
query.

Pretty self-explanatory (*). This is almost always what one wants, if
the query returns more than one column, and is what everyone ends up
reinventing and coding by hand.

Both of these features contain a significant amount of
protocol-independent code, which makes them out of scope under a
strict reading, but they are worth having IMO.

(*) Except for the question of whether out of order columns should be
automatically put into proper order based on the member names.


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