From: Dave C. <dj...@ob...> - 2004-05-28 18:19:40
|
Skip Montanaro wrote: >I'm trying to get the Object Craft Sybase module used at work instead of a >homegrown hack. Based upon a lot of use of the homegrown module, one >requirement is that dates be represented as floating point seconds since the >Unix epoch. It appears that Sybase returns some sort of DateTime object. >Given a DateTime object, d, both int(d) and float(d) fail for me with this >sort of message: > > >>> float(d) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/home/titan/skipm/local/lib/python2.3/site-packages/Sybase.py", line 154, in _cslib_cb > raise Error(_fmt_client(msg)) > Error: Layer: 2, Origin: 1 > cs_convert: cslib user api layer: external error: Conversion between 12 and 10 datatypes is not supported. > >Can I cleanly get from a DateTime object to a float or do I have to inject a >new version of _column_value() into Sybase.py? ('Twould be nice if there >was a standard way to establish type converters on a per-connection basis.) > > That is strange. Looking into the Sybase include files this seems to be saying that it will not convert from CS_DATETIME_TYPE to CS_FLOAT_TYPE. I am fairly sure that this should work. What version of the Sybase client libraries are you using? - Dave -- http://www.object-craft.com.au |