|
Boost : |
From: Maciej Sobczak (prog_at_[hidden])
Date: 2008-03-25 13:18:54
Jeff Garland wrote:
>> 1) overloads of operator<< and operator,
>> It confuses me to use operator<< to get information _out_ of
>> something.
>
> Ok, but I don't think SOCI does that. It uses operator<< on an SQL
> statement to bind variables -- the variables can be input or output
> depending on what you're doing.
Well, not exactly. :-)
string name;
int id = ...;
sql << "select name from persons where id = :id", into(name), use(id);
Above:
- operator<< is used to *send* query to the server,
- "into element" is used to bind variable that will get results,
- "use element" binds variable that provides data for the query,
- operator, is used to bunch all parts of the query together.
In other words, operator<< is not used to "get something out" (into
elements serve this purpose instead), but to "make things happen".
-- Maciej Sobczak * www.msobczak.com * www.inspirel.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk