Subject | Re: [Firebird-Architect] Literal strings and quotes |
---|---|
Author | Geoff Worboys |
Post date | 2009-05-24T23:27:30Z |
> Oracle has a feature where you can use quotes inside strings[...]
> without need to double them.
> Here is a example:
> select q'!where name = 'xyz'!' from dual;
> Result: where name = 'xyz'
Interesting. Does this make "q" a keyword or some sort?
> My real intention is beyond that (i.e., it's related toFor hand-written code the feature could be very useful.
> another new functionality I'm thinking), but the feature is
> great in general, especially for usage with EXECUTE STATEMENT.
It even has potential for machine-generated code, simply
because the result is so much easier for a human to read.
q'{ I am thinking of my own situation where I use quoted
field names, so I have statements with a mix of double
"identity" and single 'literal' quote characters that quickly
become an unreadable mess when writing exec statements;
""identity""=''literal'' and so on. }'
Given that it would be rare for even C/Java code to contain
q'<}'>' in that order the quote system seems quite practical.
OK, so we would not want to wrap gigabytes of unknown text in
this quote system, but for it's intended purpose I think it
could be neat.
--
Geoff Worboys
Telesis Computing