Page 1 of 1

TZQuery and multistatements

Posted: 14.12.2005, 09:52
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?

Posted: 14.12.2005, 10:38
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.

Posted: 14.12.2005, 10:48
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?

Posted: 14.12.2005, 14:48
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.

Posted: 14.12.2005, 16:29
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: