Subject Re: [firebird-support] system tables - second attempt.
Author Mitchell Peek
Geoff Worboys wrote:

>(As you know) if you are talking to a dialect 3 database then
>quoted names are possible - BUT there is no "flag" to indicate
>whether a field was originally created with quotes or not.
And finally, a direct answer to my question.

>"FROM" is a valid identifier whereas FROM is a keyword and
>cannot be used as an identifier.
Good point. And just a check looking for lowercase and/or spaces will
not reveal.

>"1ST" is a valid identifier whereas 1ST would cause an
another good point.

>If your database policy allows the use of quoted identifiers
>then you have (at least) two options...
>* You could try to be smart and determine whether the characters
>in the name will require quoting - just remember that the first
>character has different requirements to the rest (eg: "1ST").
>If you follow this approach you also need a list of keywords to
>check whether quotes are needed regardless of the validity of
>the characters (eg: "FIRST").
>This can be somewhat arduous to code but having seen it in
>action (in IBObjects) it works pretty well.
And is what I have now. As I said, it is working, but yes, it was
arduous, and I was searching to see if there was a shortcut that I
didn't know about. Obviously there isn't, but, nothing ventured....

>* Quote everything. There is no harm in creating trigger and
>stored procedure code that uses redundant quotes (eg: "THIS").
>Since the code is automatically produced who cares whether it
>looks exactly like what the user would have written.
It also

>has the advantage of "future proofing" the SQL code for new
>versions of FB that may introduce new keywords. (Take a look
>at some of the new keywords that came with v1 and v1.5 and
>you can see the potential hazards.)
Agreed, no one cares what it "looks" like. The other thing missing from
my knowledge, before the question, was the fact that "THIS" and THIS
was equivalent, until pointed out by Martijn. Now that this is known,
you are correct, double quotes everywhere won't hurt anything.

I removed all the extraneous parsing routines. It is certainly less
code, more readable and maintainable and appears to be working.

>There is also another way to approach your particular
>requirement. Use something already written for the task. See
>IBLogManager at
It wasn't that hard of a task, and doing it myself, I can customize to
my liking.