[DB-SIG] MySQL Python module bugs or what?

Jekabs Andrushaitis jekabs.andrusaitis@tietoenator.com
Tue, 8 Oct 2002 10:10:16 +0200


SQL code:
	CREATE TABLE testtable(testfield longint);
	INSERT INTO testtable(testfield) VALUES(1);

Python code:
	...
	# this works
	dbc.execute("SELECT testfield FROM testtable WHERE testfield<1")
	print dbc.fetchall()

	# this fails by saying that integer is required for parameter!!!
	dbc.execute("SELECT testfield FROM testtable WHERE testfield<%d",(1,))
	print dbc.fetchall()

	# this also fails by saying that integer is required for parameter!!!
	dbc.execute("SELECT testfield FROM testtable WHERE
testfield<%(testfield)d",{"testfield":1})
	print dbc.fetchall()

	# and naturally this produces same
	dbc.execute("SELECT testfield FROM testtable WHERE
testfield<%ld",(long(1),))
	print dbc.fetchall()

	# white this works...
	dbc.execute("SELECT testfield FROM testtable WHERE testfield<%s",(1,))
	print dbc.fetchall()

Am I missing something serious, or this is a bug in MySQLdb module? Was
using latest stable release
from sourceforge.net. Also, I never managed to insert a longblob value whose
side exceeded 1Mb into
table.

Not that I care about this much now, I did it couple weeks earlier when I
had to migrate bug/request/feature request
tracking data from our own Python/PostgreSQL/mod_python based solution to
Bugzilla (sad, but I liked our own
tracking application MUCH better than Bugzilla and the PHP).

Jekabs Andrushaitis
Senior system analyst
TietoEnator Financial Solutions
41 Lacplesa Str.
Riga, LV-1011, Latvia
Tel: +371 7286660
Fax: +371 7243000
E-mail: jekabs.andrusaitis@tietoenator.com