Page 1 of 1

Params Empty MySQL 5-Delphi 2010-Zeos 7

Posted: 05.04.2010, 11:18
by zhalcon
Hi to everybody, first at all, thanks very much to all people do possible these great components and all of one help us in this forum.



My problem is:

With MySQL Server 5.0, Zeos 7.0 and Delphi 2010. If I test this:

ZQuery1.Close;
ZQuery1.SQL.Clear;
ZQuery1.SQL.Add('select * from table1 where field1= :param1');
ZQuery1.Params.ParamByName('param1').Value:=variable1;
ZQuery1.Open;


It launch an exception with the message of a sintax error in SQL command.
Monitoring commands to MySQL I see this sentence:

select * from table1 where field1=

Like empty param ????? But debugging I can see that variable1 has a value.

Posted: 05.04.2010, 13:16
by bravecobra
Since this resembles my experience perfectly...there is/was a bug concerning D2010 since widestrings are used there to pass param values instead of ansistrings.
I provided the patch here: http://zeos.firmos.at/viewtopic.php?t=2659. It has been commited to the trunk as rev 770, so you can update your checkout and try again.

If the problem persists, let us know.

Sorry, I've erased by error the question, repeat here

Posted: 05.04.2010, 13:54
by zhalcon
Thanks very much, Brave, I've downloaded your patch, because I don't know how download the REV 770 from SVN. I'll test it and write here the result.

I'll change ZDbcMySqlStatement.pas adding stUnicodeString like I've seen in your patch, build Zeos again and test it.


Again, thanks very much for your fast help.

FIX !!!

Posted: 06.04.2010, 09:22
by zhalcon
Hi Brave, certainly it was the answer. I applied your patch to ZDbcMySqlStatement.pas and it run OK.

Then, I saw another extrange thing. I used Zeos 6.5.1 and with that version, in ZQuerys linked like master and detail (by properties masterfield and mastersource, etc), when I inserted a record on detail, automatically, the keyfields on ZQuery detail were filled with the values of master ZQuery, but with Zeos 7 they are not. I had to fill property "LinkedFields" with the keyfields of detail to do automatically filled.

Thanks very much for your help, Brave.

Posted: 10.05.2010, 14:47
by slaut
Hi,

I have the same Problem with real Unicode parameters. I tried these:

Code: Select all

Query.SQL.Text := 'SELECT COUNT( IMPERIUM ) ANZ FROM IMPERIUM WHERE IMPERIUM = :IMP';
Query.ParamByName('IMP').AsString := '≡δŊΛ©Ξlөρюŋſ≡';
But the GetEscapeString Method is called with AnsiStrings, so that my Query has is 0.

Is there any fix?

Thanks,
slaut