QuoteSQL
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Mon Sep 25 19:09:58 EDT 2006
In message <slrnehg538.hi7.sybrenUSE at schuimige.stuvel.eu>, Sybren Stuvel
wrote:
> Lawrence D'Oliveiro enlightened us with:
>>> An escaping function should be small and not do all kinds of
>>> escaping for different situations at once.
>>
>> Even when the two situations are related?
>
> Yup, even then. Different situations need different escaping
> functions.
You're proposing two separate functions:
1) quoting of non-wildcard specials
2) quoting of wildcard specials
The trouble with this is that, instead of offering extra functionality, it
leaves the door open to making two stupid mistakes:
1) quoting of wildcards WITHOUT quoting of non-wildcards
2) quoting of wildcards BEFORE quoting of non-wildcards
There are only two non-stupid solutions to this problem that I can see.
Either:
* A pair of functions that perform
1) quoting of non-wildcard specials only
2) quoting of both non-wildcard and wildcard specials
Or:
* A single function that performs either of the above two operations,
depending on a boolean flag--which is what QuoteSQL does.
I guess I don't have a strong preference for which way we do it, but I would
suggest confining our discussion to non-stupid solutions.
More information about the Python-list
mailing list