Subject Re: [firebird-support] Problem with script .. any help appreciated.
Author Helen Borrie
At 01:59 AM 22/06/2009, you wrote:
>Sorry Helen, but do I understand correctly .. setting Auto Commit in IB_Script has no effect as in :
>IB_Script17.SQL.Insert(0,'SET AUTODDL on;');

To cross the "i's" and dot the "t's", SET AUTODDL is not DSQL. It is a statement syntax (not part of SQL) that surfaces ServerAutocommit behaviour in isql. The SET commands work *only* inside the isql application because it's the only place where they are implemented.

When you run a script in your own *DSQL* application, you are NOT somehow accessing the isql application. Under the hood, you are passing a series of isc_dsql_exec_immed2() calls in a transaction with whatever parameters you configured for it.

TIB_Script does know how to recognise *some* SET statements. It can't pass them through the DSQL interface because they are not DSQL. If they appear at the beginning of a script, at a point where it can perform some effective DSQL call to get the desired effect, it will do it. Otherwise, it just skips over them. That's just a hint: you have to study and understand the component yourself.

I wrote:
"(hint) see also the ServerAutocommit property of TIB_Transaction."

That was a hint, too. Look it up.

>If that is so, will Commit Work; do the trick after each statement. I tried that too, and I still had the error.

I'm not sure COMMIT WORK is still a valid syntax in DSQL (if it ever was valid DSQL in the Firebird era). If you want to go that way instead, call COMMIT after each statement and catch exceptions.

This has already gone further off-topic for firebird-support than it should. Study the help and source code for TIB_Script to figure out how you can use the events and properties of that component for both troubleshooting your script and wrapping exception handling around each statement. And use the IBO list to ask questions about the component when you bump into any problems.

^ heLen ^