On Thu, Aug 7, 2008 at 1:26 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote:
> String literals in SQL are suppose to be enclosed in single-quotes -
> Pascal-style. Double-quotes are used around table and/or column names
> in cases where the name would otherwise be a keyword or when the name
> contains non-standard characters.
> 3. Double-quoted names fall back to being string literals if
> there is no matching table or column name.
>
> In retrospect, (3) seems to be a bad idea. It is accident-prone and
<snip>
The first time I saw an issue related to this on the mailing list, I thought
that it should be fixed somehow.
The main reason it's been kept was for backward compatibility reasons. I
believe that one of the more recent proposed solutions was to make it a
PRAGMA or something, which was struck down because it would only make the
already-complex parser code *more* complicated.
Is there some way to have SQLite's parser take note of when condition #3
results in a literal, and output a warning or something? Something like
fprintf(stderr, "Warning: The query ''%s' has an invalid table/column name
'%s' delimited by double quotes (\"). I am assuming it should have been a
string literal delimited by single quotes ('). This behavior will be removed
in the future; please update your SQL statements.");
Or perhaps, to be shorter,
fprintf(stderr, "Warning: The query ''%s' has an invalid table/column name
'%s' delimited by double quotes (\"). See
http://www.sqlite.org/blah/blah/blah.");
Warnings could be allowed for "properly" by e.g. having a callback
registered, or adding a new void(*xWarning)(char*str) entry in the VFS.
--
-- Stevie-O
Real programmers use COPY CON PROGRAM.EXE
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users