0.39/svn, on Linux against Sybase 12.5
If a varchar column is longer than (and filled with more than) 255 bytes, then the select statement returns the content of that column truncated to 255 bytes.
Setting in sybasect.c the version
int version = CS_VERSION_125;
however will change the behaviour and the full content is returned. We have tried to change only Sybase.py from
if _ctx.ct_init() != CS_SUCCEED:
to
if _ctx.ct_init(12500) != CS_SUCCEED:
as it had been suggested to us, but this did not bring the hoped result neither in 0.39 nor in the svn tree.
Just came across the same issue.
Here's how I fixed it locally. Instead of hardcoding a specific version I just put the current one. Definition found in $SYBASE/$SYBASE_OCS/include/cspublic.h
So this line works for me [v0.40, file: sybasect.c, function: sybasect_cs_ctx_alloc]:
Last edit: Igor Shurshin 2015-11-27
This has an easy fix in Python-level code (assuming you use at least version 12.5 of ctlib):
Index: Sybase.py
--- Sybase.py (revision 6648)
+++ Sybase.py (working copy)
@@ -298,7 +298,7 @@
# Setup global library context
-status, _ctx = cs_ctx_alloc()
+status, _ctx = cs_ctx_alloc(CS_VERSION_125)
if status != CS_SUCCEED:
raise InternalError('cs_ctx_alloc failed')
#_ctx.debug = 0
Above patch to Sybase.py works for reading long data from the DB but not uploading long data. See patch #13 for a more complete solution.
I maintained Python Sybase while at a previous employer, but I no longer have access to a Sybase server. If someone would like to take over I would be happy to give someone the permissions.
Thanks
Robert Boehne
On Nov 3, 2016 1:49 AM, Gregory Bond gnbond@users.sf.net wrote:
Above patch to Sybase.py works for reading long data from the DB but not uploading long data. See patch #13 for a more complete solution.
[bugs:#29]https://sourceforge.net/p/python-sybase/bugs/29/ varchar column > 255 characters truncated
Status: open
Group:
Created: Fri Jun 19, 2009 01:43 PM UTC by nobdy
Last Updated: Tue Oct 18, 2016 11:37 PM UTC
Owner: nobody
0.39/svn, on Linux against Sybase 12.5
If a varchar column is longer than (and filled with more than) 255 bytes, then the select statement returns the content of that column truncated to 255 bytes.
Setting in sybasect.c the version
int version = CS_VERSION_125;
however will change the behaviour and the full content is returned. We have tried to change only Sybase.py from
if _ctx.ct_init() != CS_SUCCEED:
to
if _ctx.ct_init(12500) != CS_SUCCEED:
as it had been suggested to us, but this did not bring the hoped result neither in 0.39 nor in the svn tree.
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/python-sybase/bugs/29/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #29