[Zope] More sybase weirdness

Malcolm Tredinnick malcolm@commsecure.com.au
Sat, 26 Feb 2000 16:20:47 +1100


On Fri, Feb 25, 2000 at 10:24:02PM -0700, jiva@devware.com wrote:
> So I got the SybaseDA working, but now I notice that my REC_ID's
> (these are autoincrementing numeric columns in my tables) seem to
> always show as their number and an L.  So like REC_ID 10 would be 10L
> to the zope DA.  In ISQL they come out fine.  What's the deal?

Python has normal integers (which are between -2^32+1 and 2^32-1) and long
integers (which can be any size, bounded only by available memory). Without
being familiar with Sybase, I would guess that REC_IDs could get larger than
31 bits in size, so Zope converts them to longs to prevent overflows in
assigning to Python integers.

When you print out a long in Python, it has an 'L' as the suffix to indicate
that. It is sometimes important to realise a number is a long because if you
are comparing types, 2L is not the same as 2 (it has the same value, but one
is a long int, the other is an int).

Cheers,
Malcolm

-- 
Malcolm Tredinnick               ph: +61 2 9440 9885
CommSecure Pty Ltd           mobile: 0409 663 876
                              email: malcolm@commsecure.com.au