[GRASSLIST:4367] Re: v.to.db

Radim Blazek blazek at itc.it
Fri Sep 17 10:29:46 EDT 2004


On Friday 10 September 2004 16:42, Leonardo Lami wrote:
> Hi,
> I'd like to know if is it possible and how make this kind of operation in
> Grass.
> I have a vector linked to a table with this three fields: id, count, area,
> value and I'd like to update the field "value" with the result of this
> operation: "count" value / "area" value
>
> I tried to use v.to.db:
> v.to.db map=g_anfibi field=3 qfield=3 option=query col1=sum
> qcol="count/area" but the output message say:
> Reading data trom the map ...  100%
> Querying database ... DBMI-DBF driver error:
> SQL parser error in statement:
> SELECT sum(valore) FROM g_anfibi WHERE cat = 1
> Error in db_open_select_cursor()

This is possible but too complicated.

> I tried also:
> echo "UPDATE g_anfibi_sum SET sum=count/area" | db.execute
> but the output message say:
> DBMI-DBF driver error:
> SQL parser error in statement:
> UPDATE g_anfibi_sum SET sum=count/area
> Error in db_execute_immediate()
> WARNING: Error while executing: "UPDATE g_anfibi_sum SET sum=count/area

This is better.

For both, set of SQL functions depends on database used. Mathematical
operations are not supported in assignment (update) by DBF driver.


Radim




More information about the grass-user mailing list