[python-sybase] MemoryError using Sybase, FreeTDS, MS SQL
djc at object-craft.com.au
24 Jan 2003 12:04:10 +1100
> Hi, Dave, thanks for your response. We have a big interest in this
> module because without it, we have to use a combination of Perl and
> Python and it's pretty ugly.
Funny, that is why I wrote the module - I was looking at either Perl
> ct_describe(cmd1, 10, &fmt) -> CS_SUCCEED, datafmt9=[name:"material"
> type:CS_TEXT_TYPE status:CS_CANBENULL format:CS_FMT_UNUSED count:1
I think that maxlength is the problem here. Can you try a little
experiment for me... Try this patch:
--- Sybase.py 23 Jan 2003 10:11:02 -0000 1.56
+++ Sybase.py 24 Jan 2003 01:01:13 -0000
@@ -158,6 +158,8 @@
fmt.count = count
if fmt.datatype == CS_VARBINARY_TYPE:
fmt.datatype = CS_BINARY_TYPE
+ if fmt.maxlngth > 65536:
+ fmx.maxlength = 65536
status, buf = cmd.ct_bind(i + 1, fmt)
if status != CS_SUCCEED:
I am not sure if will solve the problem or not, but it is worth a try.
> There should be two more columns after the "material" column, so it
> seems that it does not finish retrieving one row, but stops at the
> first text type row.
> Knowing this, I've tried a similar query on a table that does not
> have a text column and I get a different error. Here is part of the
> output, the full output is attached in "output2".
> ct_describe(cmd1, 8, &fmt) -> CS_SUCCEED, datafmt7=[name:"energy"
> type:CS_FLOAT_TYPE status:CS_FALSE format:CS_FMT_UNUSED count:1
> maxlength:8 scale:0 precision:0]
> ct_bind(cmd1, 8, &datafmt7->fmt=[name:"energy" type:CS_FLOAT_TYPE
> status:CS_FALSE format:CS_FMT_UNUSED count:32 maxlength:8 scale:0
> precision:0], databuf7->buff, databuf7->copied, databuf7->indicator)
> CS_SUCCEED, databuf7
> ct_fetch(cmd1, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read) ->
> CS_ROW_FAIL, 0
This looks like another column binding problem. Can you send a more
complete debug trace?