MySQLdb FAQ: Trouble with ZMySQLDA

Next Previous Contents

## 2. Trouble with ZMySQLDA

## 2.1 I installed MySQLdb but ZMySQLDA can't find it.

Probably you installed a binary version of Zope which comes with it's own Python interpreter. You will have to compile MySQLdb against that particular Python installation. Find out where it's python binary lives and use that to run setup.py.

## 2.2 I'm getting these stupid L's on my INTEGER columns.

Yup, they have to be converted to long integers to avoid overflows on UNSIGNED INT columns. Solutions: Use a `fmt=%d` attribute on your `dtml-var` elements; Wait for Zope 2.4 which comes with Python 2.1 which doesn't add the L.

## 2.3 I get SQL syntax errors on a LIMIT clause, and I didn't put in a LIMIT clause!

Z SQL Methods have a `max_rows` parameter. If this is set to a non-zero value, ZMySQLDA adds a LIMIT clause to SELECT statements to enforce this. This is a big performance gain, particularly if the result set could be big. If it is interfering with something, set `max_rows` to zero, and it won't add a LIMIT clause. In particular, you will probably have to do this when inserting rows with AUTO_INCREMENT columns, because typically you use SELECT thereafter to get LAST_INSERT_ID(), and LIMIT can mess this up.

Next Previous Contents