Re: [Zope] MYSQL Problem

2001-01-29 Thread Andy Dustman

On Sun, 28 Jan 2001, Jens Grewen wrote:

> I installed 
> 
> mySQL-3.23.32
> mySQLdb 0.3.1
> ZmySQLDA 2.0.4
> 
> When I change to mediumint (database field description) I get the
> expected 233.
> 
> How can I fix this.

You just did. :) If a mediumint is big enough for you, use that. As Ron
points out, INTEGER (particularly UNSIGNED) can overflow in Python, so
they need to be returned as Python long integers. Python adds the L when
doing str(), but Python 2.0+ does not do this (only on repr()).

-- 
Andy Dustman PGP: 0xC72F3F1D
@   .net http://dustman.net/andy
"Normally with carbonara you use eggs, but I used lobster brains instead."
-- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster Battle


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] MYSQL Problem

2001-01-27 Thread Ron Bickers

The trailing L identifies a long int in Python.  As of ZMySQLDA 2.0.4, MySQL
integers use Python longs because an unsigned MySQL integer could overflow a
Python int.  So, it's a bug fix.

A couple solutions (found at http://dustman.net/andy/python/ZMySQLDA/2.0.4)
are to use  or something similar to strip the L, or
use Python 2.x, which would not display the L in this case.  You could also
modify MySQLDA to use a Python int if you know you're not going to have
integers that will overflow.

Note that Python 2 is not officially supported by Digital Creations, though
it does happen to work with Zope 2.3.0.
___

Ron Bickers
Logic Etc, Inc.
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jens
Grewen
Sent: Saturday, January 27, 2001 11:36 PM
To: Zope Maillist
Subject: [Zope] MYSQL Problem

>From the following SQL statment I get the result  233L and not 233 as
expected

select count(PID)
from product

When I run this SQL Statment from another program I get the expected value
233.


In my installation there are a lot of Z SQL Methods that should return an
int value and when I use field description int in the database I always get
this 'L' behind the expected result. A lot of things don´t work because of
this.

When I change to mediumint (database field description) I get the expected
233.

How can I fix this.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] MYSQL Problem

2001-01-27 Thread Jens Grewen



I installed 
 
mySQL-3.23.32
mySQLdb 0.3.1
ZmySQLDA 2.0.4
 
on Win98
 
 
From the following SQL statment I get the 
result  233L and not 233 as expected
 
select count(PID)from product
 
When I run this SQL Statment from another program I 
get the expected value 233.
 
 
In my installation there are a lot of Z SQL Methods 
that should return an int value and when I use field description int in the 
database I always get this 'L' behind the expected result. A lot of things 
don´t work because of this.
 
When I change to mediumint (database field 
description) I get the expected 233.
 
How can I fix this.
 
 
Thanks
 
Jens