Hi,

Where is ':' a valid character in Firebird SQL? In particular, is it
ever valid outside of "-delimited identifiers and '-delimited strings?

Context: In the LibreOffice integration of Firebird, we would like to
allow users to use named parameters, that is things like ':foo' instead
of '?' (without the single quotes). E.g.

 SELECT foo, bar FROM qux WHERE item_year = :year

instead of

 SELECT foo, bar FROM qux WHERE item_year = ?

Which means we have to go through the SQL statement passed by the user
and replace such ':foo' parameters by '?' before giving the SQL
statement to Firebird.

I'd like to avoid completely parsing the SQL statement for that,
mainly so that the SQL statement is not modified by the LibreOffice
SQL parser (and in particular quoting keywords it doesn't know as
identifiers). So I'm hoping to simply go through the string, keep
track of single and double quotes, and replace any word (outside of
quotes) that starts with ':' by '?'. This wouldn't work for
e.g. PostgreSQL because of its cast syntax (namely 'data::type'), but
is it OK for Firebird?

Thanks in advance,

-- 
Lionel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to