Exception with Firebird and large varchar

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
cariad
Junior Boarder
Junior Boarder
Posts: 36
Joined: 20.10.2005, 14:07

Exception with Firebird and large varchar

Post by cariad »

Hello,

I think this is a regression from Zeos-6. An exception is thrown (assert failed) from TZAbstractBlob.GetUnicodeString (specifically "Assert(Len mod 2 = 0);") with large varchar fields (I triggered it first with a varchar(2561)). As far as I know this is way lower than the Firebird row size limit (64K).

I'm not sure I understand the code for this function. If the fetched data length mod 2 is equal 0 the assertion is not thrown, but the returned data is corrupted.

I've made a simple test case in Delphi 2009. I can upload it if it helps. I did not made extensive testing, but it occurs with Delphi 2009, ZEOS trunk 619 and Firebird (embedded) 2.1.2.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

It may help,... when we find an active 2009 developer to use it... I'm afraid the 2009 users don't want to join the dev team. I propose you file a bug report and add the test project to the bug tracker. (http://zeosbugs.firmos.at/) So at least this post isn't lost when a D2009 developer shows up.

(I know, this isn't a satisfying answer, but... it's just reality)

Mark
Image
cariad
Junior Boarder
Junior Boarder
Posts: 36
Joined: 20.10.2005, 14:07

Post by cariad »

No problem, I understand. I created the issue in the bug tracker just in case. I'll try to dig a little deeper (I'm not sure if it's only a Delphi 2009 problem or if it's related to Firebird 2.1 vs 2.0, or if - god forbid - I did something wrong), but I'm still widely unfamiliar with the Zeos codebase.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

ZAbstractBlob.GetUnicodeString in ZdbcResultset.pas is not correct.
I mean "Buffer" is declared as AnsiString so obviously 1 byte = 1 char

Thus :

Assert(Len mod 2 = 0);
SetLength(Result, Len div 2);

it makes no sense
Locked