[Zope] More sybase weirdness

Brian Takashi Hooper brian@garage.co.jp
Sat, 26 Feb 2000 14:20:08 +0900


Hi,

In Python, a number followed by an 'L' is a Python long (which can be
any integer, of arbitrary length).

The SybaseDA figures out what type to return for numeric based on the
length of the numeric - any numeric with no precision after the decimal
point which might be too big to fit in a regular 32 bit integer is
stuffed into a Python long.

This works fine for most things, actually, except you have to cut off
the end when you display the number as a string, and when you want to
put things back in the DB, you have to somehow convert the value back
into something that looks proper to SQL.  I have a patch to sqlvar.py 
(in the lib/python/Shared/DC/ZRDB directory of your Zope installation)
that adds long support to the sqlvar tag, so that you can write:

<dtml-sqlvar REC_ID type=long>

and Zope will cut the L off for you.  This patch has been submitted to
the Collector, but if you need it earlier I will put it on my Zope home
page:

http://www.zope.org/Members/brianh

Hope this clears things up,
Brian Hooper

On Fri, 25 Feb 2000 22:24:02 -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?
> 
> -- 
> Let us never negotiate out of fear, but let us never fear to negotiate.
> 		-- John F. Kennedy
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> 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 )
> 
>