[GRASS-user] POW() in SQLite?
Hamish
hamish_b at yahoo.com
Tue Mar 2 05:04:47 EST 2010
> Hamish wrote:
> > I am trying to use POW(x,n) with SQLite but it fails:
...
> > no such function: POW
Glynn:
> Nope; not in SQLite:
> http://www.sqlite.org/lang_corefunc.html
>
..
> > Similar problem if I try x^n:
> > unrecognized token: "^"
>
> SQLite doesn't have a power operator:
> http://www.sqlite.org/lang_expr.html#binaryops
> > this random webhit suggests that it should be possible:
> > http://osdir.com/ml/sqlite-users/2009-03/msg00248.html
>
> That says:
..
> Note: "in addition to the SQLite default". IOW, those
> functions are added by SQLiteSpy, and are not part of SQLite.
ah, skimming error.
Rich:
> I'd manipulate those values first, then pass them to SQLite.
solution:
#no good:
#v.db.update basemap column=volume value="POW(length,3)" --verbose
#good:
v.db.select basemap column=cat,length | awk -F'|' \
'{printf("UPDATE basemap SET volume=%f WHERE cat=%d;\n", $2^3, $1)}' \
| db.execute
thanks,
Hamish
More information about the grass-user
mailing list