Solved TD-16488: TD 6.0 PTF3 Unable to concatenate Sybase Long String

Post found bugs and possible workarounds.
Brian Howard

TD-16488: TD 6.0 PTF3 Unable to concatenate Sybase Long String

Post by Brian Howard » 07 Oct 2011, 05:36

Hi,

A long string fetch from a sybase database can not have other strings appened to it.

i.e.
Long String: ls = 'mmm' ! fetched from DB
String: s = 'ABC' || ls || 'XYZ'
s should be 'ABCmmmXYZ' but it is 'ABCmmm'

The work around is to convert to MultiByte then back to WideChar, but this will have to happen to every instance of this.

Repro case attached.

Please respond.

regards

Brian
You do not have the required permissions to view the files attached to this post.

Jeff Luther

Re: TD-16488: TD 6.0 PTF3 Unable to concatenate Sybase Long String

Post by Jeff Luther » 07 Oct 2011, 22:11

Well, I see it all right. This was looked at one time but see that's it's not fixed with v6 SP3 EMP5368. Here's the workaround:

Correct the buffer length of your INTO ls variable. The explanation:
In testing I see that at 10*40, the length after fetch should be 400. That's correct.
I also see, however, that the buffer length = 804 and should be 802 (400*2 + 2 bytes for end-of-string char).

A workaround is to 'fix' the string buffer length before concatenating:
Call SalSetBufferLength( ls, (SalStrLength( ls )*2) + 2 ) ! corrects ls length so concat. works

That sets it to buffer length = 802 and now your concat. works OK. I'm looking into getting this reported in our defect DB and will provide the TD bug # when I get one.

UPDATE: I opened TD defect TD-16488 for this issue.

Brian Howard

Re: TD-16488: TD 6.0 PTF3 Unable to concatenate Sybase Long String

Post by Brian Howard » 09 Oct 2011, 22:09

Thanks Jeff,

Your work around is a lot nicer than mine, so I will implement yours.

At the moment we are only converting some small applications, soon we will need to convert our larger apps and it would be really nice if this was fixed and in a PTF before then.

FYI, I raised this issue in TD 5.1 but with Strings instead of Long Strings. It was fixed for Strings back then, but between the lines, I guess Long Strings were not looked at.

Cheers

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 0 guests