In message <[EMAIL PROTECTED]>, Duncan Booth wrote:
> Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
>
>> I use the above when I can, when I can't I fall back on
>><http://groups.google.co.nz/[EMAIL PROTECTED]>,
>><http://groups.google.co.nz/[EMAIL PROTECTED]>.
>
> Yes, so you said, but you never came up with a convincing use case where
> that function was better than using the parameterised queries.
First of all, the parametrization doesn't handle wildcards, as we discussed
previously.
Secondly, it's less convenient for cases where a dynamic query is being
built. I previously gave the SQLStringList example. If that's not enough,
here's another (simple) one:
Conditions = []
if Name != None :
Conditions.append("name = %s" % SQLString(Name))
#end if
if Address != None :
Conditions.append("address = %s" % SQLString(Address))
#end if
if PhoneNr != None :
Conditions.append("phone_nr = %s" % SQLString(PhoneNr))
#end if
Query = "select * from table"
if len(Conditions) != 0 :
Query += " where " + " and ".join(Conditions)
#end if
--
http://mail.python.org/mailman/listinfo/python-list