On Mon, Jun 27, 2005 at 10:59:09PM -0600, Warren Young wrote:
> SQL allows you to have a table with a column called "My Bizarre Field
> Name With Spaces In". You'd have to quote that when building SQL
> statements, so you'd need MySQL++ to use the quote manipulator for some
> of its features to work. The feature allowing the SSQLS structure to
> have different data member names than in the SQL table enters the
> picture because you'd also need to use that feature to get your _C++_
> syntax correct.
> All that having been said, is the auto-quoting part a reasonable thing
> to support?
I've written a C++ framework for interfacing with ODBC drivers that turned
out somewhat similar to mysql++ a couple years ago. (Unfortunately not
open source at the moment.) ODBC has the same feature, and can support
quoting all over the place.
Also, since ODBC is database-independent, you don't know what the quote
character(s) is/are until you ask the driver.
And with some drivers, if you quote a field, the case matters, while
unquoted fields are case insensitive.
I supported field quoting because I wanted to be feature-complete,
and I didn't know what tables and databases I'd have to deal with.
In one of the classes, the programmer could turn quoting on and
off via constructor argument.
I favour API's that are able to handle any data thrown at them. In
this case, I view the field names themselves as data that the application
needs to deal with. If you're writing something like a generic database
GUI application, you don't know what wild characters the user will use
for a field name. And if the underlying database supports it, the user
might expect it.
Some of the Ruby-on-Rails web-programming demos come very close to making
the field names something that you type in once in the MySQL DB admin GUI,
and it appears on the screen as an HTML label, which emphasizes
the idea that field names are data too.
I think it is a worthy feature to support, but optional. Looks like I'm
contrary yet again. :-)