[GRASS-user] Re: grass-user Digest, Vol 60, Issue 13

On 6/04/11 4:36 PM, grass-user-request@lists.osgeo.org wrote:

Message: 9
Date: Wed, 6 Apr 2011 16:06:13 +0930
From: Sharon M<morrisxs09@gmail.com>
Subject: [GRASS-user] help with v.db.update
To:grass-user@lists.osgeo.org
Message-ID:<BANLkTi=oHUEGstNAuinLiYAMfo5-P3RBFA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I'm trying to update an attribute table column using v.db.update with
the DBF driver and keep getting a dbmi: Protocol error message.

Example using Spearfish

g.copy vect=fields,myfields

v.db.addcol myfields col="polynum integer"

v.db.select myfields where="label like 'V%'"
cat|label|polynum
59|V. White#1|

v.db.update myfields col=polynum val=42 where="label like 'V%'"
dbmi: Protocol error
ERROR: Error while executing: 'UPDATE myfields SET polynum=42 WHERE
label like V%
'

I've tried this on both winGrass 6.4 rc2 or winGrass 6.5 r45847 on
winXP using the wxGUI via both the v.db.update module and the wxgui
command line and get the same error issue.

What am I doing wrong? Can anyone help please?

Thanks in advance!

The dbf driver doesn't handle "like". Try:

v.db.update myfields column=polynum val=42 where='cat=59'

and see what happens ...

If you need more advanced query parameters such as "like", use a different database driver - pg or mysql.

Richard
If

Richard wrote:

The dbf driver doesn't handle "like".

...

If you need more advanced query parameters such as "like",
use a different database driver - pg or mysql.

would "~" work?

  v.db.update myfields col=polynum val=42 where="label ~ 'V'"

?

Hamish

On 6/04/11 5:06 PM, Hamish wrote:

Richard wrote:

The dbf driver doesn't handle "like".

...

If you need more advanced query parameters such as "like",
use a different database driver - pg or mysql.

would "~" work?

   v.db.update myfields col=polynum val=42 where="label ~ 'V'"

?

Hamish

Hamish,

Thanks. I didn't know about that substitution using the dbf driver!

Richard

No, error message is now...

DBMI-DBF driver error:
Column 'V' not found
Incompatible types in WHERE condition.
Error in selecting rows
Error in db_execute_immediate()
ERROR: Error while executing: 'UPDATE myfields SET polynum=42 WHERE label ~ V
'

On Wed, Apr 6, 2011 at 4:36 PM, Hamish <hamish_b@yahoo.com> wrote:

Richard wrote:

The dbf driver doesn't handle "like".

...

If you need more advanced query parameters such as "like",
use a different database driver - pg or mysql.

would "~" work?

v.db.update myfields col=polynum val=42 where="label ~ 'V'"

?

Hamish