[GRASSLIST:7317] Re: db.execute trouble
glynn at gclements.plus.com
Mon Jun 27 05:50:36 EDT 2005
> > Dear GRASS community,
> > can somebody tell me why the UPDATE operation works with a simple
> > assignement like in:
> > echo "UPDATE soils SET area=1000 WHERE area > 200"| db.execute
> > but return an error with any kind of operation like for example:
> > echo "UPDATE soils SET area=area+1 WHERE area > 200"| db.execute
> > or even simply:
> > echo "UPDATE soils SET area=1+1 WHERE area > 200"| db.execute
> > The output error is:
> > DBMI-DBF driver error:
> > SQL parser error in statement:
> > UPDATE suoli SET area=area+1 WHERE area > 200"
> > Error in db_execute_immediate ()
> > ERROR: Error while executing: "UPDATE suoli SET area=area+1 WHERE area > 200
> > "
> Only a limited set of SQL functions and operators are currently supported.
> Addition is not among them.
> see the GRASS SQL help page:
That page is somewhere between misleading and inaccurate.
First, it appears to relate specifically to the DBF driver, although
it doesn't say so.
Second, arithmetic expressions are supported, but only WHERE clauses,
not in SET clauses.
Given that the DBF driver already has the ability to evaluate
arithmetic expressions, it wouldn't be a lot of work to allow
expressions on the RHS of SET clauses. However, this would require
changes to the DBF driver.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user