[DB-SIG] paramstyles, again

Paul Boddie paul at boddie.org.uk
Sat Jun 2 20:42:37 CEST 2007


Carsten Haese wrote:
>
> The same is true for InformixDB. The good news is that making a parser
> that locates parameter placeholders is not hard. Essentially it boils
> down to "Look for question marks and colons occurring outside of string
> literals".

I have just written tokenisers using both pyparsing and regular expressions 
[1] which split SQL statements into non-literal and literal regions (for 
character string literals, of course). I haven't checked using the various 
"public" specifications to see if there are any special cases in standard SQL 
which would affect this code, but I don't see why we couldn't just have this 
sort of thing in all DB-API modules, support question marks as placeholders, 
and move the ridiculous paramstyle situation forward.

Paul

[1] http://www.python.org/pypi/sqlliterals


More information about the DB-SIG mailing list