[solved] parambyname asstring error

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
cfc
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 15.06.2012, 15:02

[solved] parambyname asstring error

Post by cfc »

Hi,

I'm trying Zeos 7+delphi XE2+Firebird 1.5 and have a problem with parameters in query if is string, only de first character of string is received in firebird.

Example

Stored Procedure

begin
/* Procedure Text */
insert into TEST (VALOR, numero)
values (:VALOR, :numero);
texto=valor;
salida=numero;
suspend;
end

Query:

select *
from sp_test(:usr, :num)


ZQuery1.close;
ZQuery1.ParamByName('usr').AsString:='cfc';
ZQuery1.ParamByName('num').AsInteger:=9876;
ZQuery1.Open;

The query return:

c 9876

The field integer is correct, but the string is truncated.

Thankyou.
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Maybe
select * from sp_test(":usr", :num)

or

select * from sp_test(':usr', :num)
Lazarus 1.0.8 fpc 2.6.0
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ism,

no that's terribly wrong. These are the Parameters which he assigns later... You can't quote them because they where handled as string instead of params afterwards.

cfc,

my first question is did you use the svn relases? And if yes then which one? Can you attach the ddl of sp_test too? Just to see how you assign the resultset you want to have..

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
cfc
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 15.06.2012, 15:02

Post by cfc »

I´ using the last version of svn.

The problem is in TZParamsSQLDA.EncodeString line 1801 of ZDbcInterbase6Utils.pas

In line 1824

Move(PAnsiChar(Str)^, sqldata^, sqllen);

I' declare variable s: RawByteString;
and change de line 1824

s := str;
Move(PAnsiChar(s)^, sqldata^, sqllen);

This works, but not what the best solution
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

cfc,

introducing the RawByteString was a good choise! But that solution isn't neutral compiler for all pascal compileres.

Can you switch to my branch? Just look here: http://zeos.firmos.at/viewtopic.php?t=3427
Tell me if the issue is the same. Actually that RawByteString is'n introduced in my branch too. My idea is to add a ZAnsiString = {$IFDEF DELPHI12_UP}RawByteString{$ELSE}AnsiString{$ENDIF} to the ZCompatibility.pas and use them in the whole Dbc-layer, where we need him.

So please test my branch and tell me if your issue is gone...

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

cfc,

thank you for confirmation, that this bug is solved on my branch.

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Locked