In the release "gamma3" the parameter "args" in
execute is handled in a to simple way. If I leave it
blank things happen like this:
Error in query: 'SELECT * FROM kontakt WHERE state=1
and (themenfelder like '%,1,%') LIMIT 1' (original
error message: not enough arguments for format string)
execute should check if args is empty and if isn't try
to work line #101: r = self._query(query %
self.connection.literal(args))
this is also an incompatibility to previous releases.
Andy Dustman
2002-07-16
Logged In: YES
user_id=71372
The old way was broken, because it did not handle % in the
query consistently. Do this instead:
c.execute('SELECT * FROM kontact WHERE state=%s and
(themenfelder like %s) LIMIT 1', (1, '%,1,%'))
Dirk Holtwick
2002-07-16
Logged In: YES
user_id=58843
I fixed it this way in MySQLdb.cursors:
if args: r = self._query(query %
self.connection.literal(args))
else:
r = self._query(query)
I think it doesn't make sense to get an argument error if
there are no arguments at all. Maybe you should set the
dafult of args to None to explicitly say if you don't wanna
use args at all.
The main problem for me is the incompatibility with older
versions.
Andy Dustman
2002-07-16
Logged In: YES
user_id=71372
This has been fixed in the current CVS tree.