George Ionescu said:

> notice the uppercase F from Field1, although field1 is requested.
> So, it seems that sqlite returns column names as defined in schema, not as
> requested by the user. This may not seem a big problem, but it becomes one
> when working with columns and trying to refer them by name and not wanting
> to do a case-insensitive comparison (I'm using a std::map to store
> columns).

This may just be me being silly, but it seems incumbent upon a programmer
to be capable of maintaining just a little bit of consistency in their
code. As a C++ programmer I am under the onus of case-sensitivity all of
the time.  It therefor doesn't seem terribly difficult to me that I should
remember that "Field" and "field" are different values.  While SQL does
recognize that they are the same field, my C++ program is going to treat
the strings used to identify them differently.

It follows then that I should create the tables with the same case that I
intend to write my queries in, must as I should declare variables with the
same case that I intend to refer to them in the code.  It does
unfortunately require a little discipline on my part when creating fields.
 Since programming is a field which does require discipline, I don't find
this terribly difficult.

Possibly you should conform your own programming practices to those
imposed by the language you have chosen to use.  If the language refuses
to recognize the same word in different case as being the same, it seems
perfectly reasonable not to get into a situation where that is necessary. 
If you find that this conformity is too restrictive, the libc implementers
have graciously provided strcasecmp(3).

Clay Dowling


-- 
Lazarus Notes from Lazarus Internet Development
http://www.lazarusid.com/notes/
Articles, Reviews and Commentary on web development

Reply via email to