[Zope] More sybase weirdness

jiva@devware.com jiva@devware.com
Fri, 25 Feb 2000 23:12:30 -0700


Thanks for the great replies.  I finally worked around it by doing a
convert(int, fieldname) as field  this will probably due for now, I
don't expect to overflow an int for a while yet.  This was still very
useful to know tho... thanks!


On Sat, Feb 26, 2000 at 02:20:08PM +0900, Brian Takashi Hooper wrote:
> 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?
> > 
> 
> 
> _______________________________________________
> 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 )

-- 
"Out of register space (ugh)"
-- vi