[Zope-dev] ZSQL problem when upgrading from Zope 2.3.0 to 2.3.3 (ZMySQL

Brian E. Pearson brianp@nplus1.net
Tue, 14 Aug 2001 08:40:28 -0400


2.0.x to 2.0.6)
Reply-To: 

I have searched the archives from March 2001 thru current, and could not
find any information on the following problem that I am experiencing.

I have actually discovered a work-a-round, but thought that I would post
this message in the event others out there have experienced or are
experiencing this problem.


Previously when running Zope 2.3.0, and consequently a version of
ZMySQLDA prior to 2.0.4, I was able to display the values of int(11)
fields from MySQL without any problem.

However, upon upgrading to Zope 2.3.3 and ZMySQLDA 2.0.6, this broke.
All of my DTML-Methods and Documents were now displaying the long
integer indicator "1L", "2L", etc.  Additionally, other ZSQL methods
that I had created which took integer arguments were now breaking as
they were trying to query the database with values of "1L", "2L", etc.
rather than 1, 2, etc.

The solution:

	According to the CHANGES document for ZMYSQLDA:

		As of ZMYSQLDA 2.0.4, all integers are returned as long integers
		in Python.  Unfortunately, Python 1.5.2 appends an "L" to these
		values when rendering them.

	To resolve the formatting/printing/display issue, either:

		a.)  Upgrade to Python 2.0 or greater
		b.)  Use a format string on the integer columns <dtml-var
varname fmt="%d">

	To resolve the ZSQL methods from blowing up either:

		a.)  Upgrade to Python 2.0 or greater
		b.)  Use <dtml-sqlvar varname type=int> instead of <dtml-var
varname> in your ZSQL methods

Hope this helps someone else.

-Brian