Page 1 of 1

Exception with Firebird and large varchar

Posted: 04.05.2009, 13:47
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.

Posted: 04.05.2009, 15:18
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

Posted: 04.05.2009, 16:12
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.

Posted: 04.05.2009, 22:12
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