List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:May 28 2005 8:44pm
Subject:Re: RELEASE: v1.7.40
View as plain text  
On Fri, May 27, 2005 at 12:02:36PM -0600, Warren Young wrote:
> This is a monster release!  Most of it's documentation, but there's a
> fair bit of functional change, too:

Some comments while reading through the patch:

In the wishlist:
+       o There are operator<<(SQLQuery&, ColData...) functions in addition
+         to the normal (ostream&, ColData) ones.  (See manip.h)  It looks
+         like a workaround for a compiler's type system weakness.  If this
+         is no longer needed, the obvious change plays into the decision for
+         the previous item: if Query is no longer an ostream, those
+         separate operators still need to exist, but the casts in the
+         implementation will break things.

The difference is that any stream based on SQLQuery will *always* have
the quoting logic run on it.  For any stream based only on std::ostream,
an additional check is done where quoting is skipped if being sent
to std::cout or std::cerr.

This allows code like:

	ColData something;
	Query query;
	std::cout << something;		// no quoting
	query << something;		// quoting

And the right thing is supposed to happen.

Personally, I'd ponder changing that in the future, so that any ostream-based
overload gets no quoting logic at all.  This would simplify the std::ostream
based operator<<() (and would need to be tested of course :-)).  I don't think
that an fstream should get any special quoting treatment if cout doesn't,
for example; but currently it would, since the code only checks for std::cout
and std::cerr streambufs.

On the other hand, perhaps quoting should always be available in
any stream, which would mean that the SQLQuery overload could go away
entirely, as well as the special check in the std::ostream version.

The question then becomes, how do you turn quoting off if you want to write
pure data to a file?  You'd have to mess with casting like:

	fstream file(...);
	file << (std::string) something;

- Chris

RELEASE: v1.7.40Warren Young27 May
  • Re: RELEASE: v1.7.40Chris Frey28 May
    • Re: RELEASE: v1.7.40Warren Young1 Jun
  • Re: RELEASE: v1.7.40Chris Frey29 May
    • Re: RELEASE: v1.7.40Warren Young1 Jun