Subject Re: [firebird-support] Re: Errorhandling in isql
Author Milan Babuskov
rcrfb wrote:
> As I mentioned above, I'm doing (nightly) batch jobs using either
> bash or ksh scripts. Within these scripts in need to do different
> things in case one (or more) SQL statements fail, so I need the
> result status of the isql command.

You could use PHP or Python inside bash scripts.
php -f script.php

You can use php's interbase module, or kinderbasdb for Python to "talk"
to database.

> It will help me if the isql exists with failure status if any
> sql statement fails.

Unfortunatelly, isql always return the same value. You can try my tool
FBExport that returns 0 on success, and negative numbers on error.
However, it can only execute inline scripts, so you would have to create
the entire lines by yourself, for example:

fbexport -X -D/path/to/db -Q "EXECUTE PROCEDURE xyz..."

> But it will be better if I could decide for
> each statement which result code to return (depending on the SQLCODE
> of the statement) or only do a rollback and continue with the
> next sql statements.

What you need does not exists, but you can add feature request for isql,
since it would be a really useful feature.

I'm even considering to add this feature to fbexport... until then, I
still suggest you to use PHP or Python or even C++ (via IBPP) for this.

--
Milan Babuskov
http://fbexport.sourceforge.net