[GRASS5] [bug #2818] (grass) db.execute: want to do like /bin/sh -e

Markus Neteler neteler at itc.it
Thu Dec 9 09:53:31 EST 2004


On Thu, Dec 09, 2004 at 12:15:44AM +0100, Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=2818
> -------------------------------------------------------------------------
> 
> db.execute should have an option to cause it to stop after the first
> error it encounters back from the driver, not just go on sending the
> next line to the driver. E.g., don't go on after
> DBMI-DBF driver error:
> SQL parser error in statement:
> UPDATE largeHouseNumbers SET housenum = 1 WHERE cat = 1 FROM tmp2
> Error in db_execute_immediate()
> WARNING: Error while executing: "UPDATE largeHouseNumbers SET housenum = 1
>          WHERE cat = 1 FROM tmp2"
> Also
> WARNING: Error
> just like e.g.,
> Error: WARNING
> look silly.

I have added a new flag '-i' to db/base/execute.c:

Usage:
 db.execute [-i] [driver=name] [database=name] [input=filename]

Flags:
  -i   ignore SQL errors and continue

which switches between G_warning and G_fatal_error (default now).
Of course it could be also reverted in functionality to make
G_warning the default as it was before.
However, I agree that it should stop upon error and only continue
with an additional flag to make the user aware of the problem.

Markus




More information about the grass-dev mailing list