Kevin Regan wrote:
> I'm wondering why you do this:
>
> connection->set_option(new mysqlpp::FoundRowsOption(true));
It's needed by set_option_default(), which lets you set an option only
if it hasn't already been given an option. It looks through the list of
already-applied options and sets the given option only if one like it
hasn't already been seen.
It could also be useful if the semantics of the underlying API ever
change such that some options can only be set after the connection is
up. We could thus add a deferred option list, applying them
automatically in DBDriver::connect() on successful connection. Then
MySQL++ client code that assumes you can set options at any time
wouldn't have to change.
Sure, we could do both things without requiring dynamic allocation in
client code by making copies of the objects when adding them to our
internal lists, but why? Much more efficient to just keep lists of
pointers.