Subject Re: [IBO] executing a script
Author TeamIBO
> 1. which is the way to programmatically clear, prepare and execute a
> TIB_Script ?

Yes, although prepare does not apply in this situation. Here is a
simplified snippet from my DBak application (which actually creates
its own TIB_Script instance to work with, but you can use an existing
one if you prefer)...

with TIB_Script.Create(Self) do
try
IB_Connection := MyConnection;
IB_Transaction := MyTransaction;
OnError := DoScriptError;
OnStatement := DoScriptProgress;
SQL.AddStrings( StringList_Of_Statements );
Execute;
finally
Free;
end;

DoScriptError and DoScriptProgress are my event handler code.

> 2. how do I understand if there were errors ?

See the OnError event.


> 3. is it possible to insert several SQL commands in a TIB_Script and
> have them executed one after another ?

Just assign the entire script of a series of commands that you want
executed to the SQL property (as shown above).

Several of the sample applications use TIB_Script to create the
database if it does not exist, so take a look at the samples for more
information.

hth

--
Geoff Worboys - TeamIBO
Telesis Computing