TZQuery and multistatements

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
paul999
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.12.2005, 09:23

TZQuery and multistatements

Post by paul999 »

Hello all. I'm using zde6.5.1+delphi7+mysql4.1 and i can't make tzquery do more then 1 statement at a time. I do this:
ZQuery1.SQL.Add('INSERT INTO BankPlatez (DOC_NO) VALUES (''1'');');
ZQuery1.SQL.Add('INSERT INTO BankPlatez (DOC_NO) VALUES (''2'');');
ZQuery1.ExecSQL;
ang got error. mysql accepts them as 1 line. Fmultistatements is false, FSQL.StatementCount=1. TZQuery has no direct access to FMultistatements property. WHat did i do wrong? What shell i do?
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

I don't think that TZQuery can do that. Take a look at TZSQLProcessor, it has a "script" property where you put your statements in.
paul999
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.12.2005, 09:23

Post by paul999 »

And how about article on this server "The ZeosLib DBOs 6.1.5 - With Delphi 7 and Firebird 1.5"
:
With Query do Begin
Sql.Clear;
Sql.Add('DELETE FROM table1;');
Sql.Add('INSERT INTO table1 VALUES (:Val1, :Val2);');
Sql.Add('INSERT INTO table2 VALUES (:Val3, :Val2);');
Sql.Add('UPDATE table3 SET field1 = :Val4;');
Params.ParamByName('Val1').AsInteger := 123;
:
ExecSql;
End;
:
maybe i missunderstand something? maybe it applies only to firebird? not to mysql?
User avatar
fduenas
Zeos Dev Team
Zeos Dev Team
Posts: 132
Joined: 26.08.2005, 08:12
Location: Cancún

Post by fduenas »

wel maybe in 6.1.5 that was possible. now in 6.5.1 it is limited to only 1 query at a time, why? i don't know, maybe the new structure. so if you wan to use multiple statements use the TZSQLProcessor. in the latest version it supports parameters so you can use it as tzquery.
Michael
ZeosLib's Handyman :o)
ZeosLib's Handyman :o)
Posts: 189
Joined: 15.08.2005, 16:08
Location: Wehrheim
Contact:

Post by Michael »

As far as I know, only TZUdateSQL is capable of executing multiple statements. So: Yes, this has to be corrected in the article :oops:
:prog2: Use the source, dude!

[align=right]..::.. ZeosLib on SourceForge ..::..[/align]
Post Reply