[GRASSLIST:8334] RE: db.execute syntax

Patton, Eric epatton at nrcan.gc.ca
Mon Sep 19 12:01:41 EDT 2005


Hmm...I gave that a try, with the following results:

 
echo 'UPDATE Opil184a_ship_nav_med_smth SET MOD_60 = 1 WHERE  CAT % 60  = 0'
| db.execute

dbmi: Protocol error (invalid table/column name or unsupported column type)
ERROR: Error while executing: "UPDATE Opil184a_ship_nav_med_smth SET MOD_60
       = 1 WHERE CAT % 60 = 0

db.describe shows that my cat and MOD_60 columns are indeed INT. So I'm not
sure why there's a problem with the table column name/type.


Perhaps quotation marks are needed somewhere?


~ Eric.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-----Original Message-----
From: Glynn Clements [mailto:glynn at gclements.plus.com] 
Sent: Monday, September 19, 2005 12:40 PM
To: Patton, Eric
Cc: GRASSLIST at baylor.edu
Subject: Re: [GRASSLIST:8332] db.execute syntax


Patton, Eric wrote:

> I'm having a bit of trouble getting my syntax right for this SQL
statement.
> I want the query to read through all the cat values in the table, and 
> enter the value "1" in an empty column wherever the cat value is 
> divisible by 60 with no remainder (cat % 60 == 0). Here's what I enetered:
>  
>  echo 'UPDATE Opil184a_ship_nav_med_smth SET MOD_60==1 WHERE 
> (cat%60)==0' | db.execute
                                                     ^^ You're using '=='
for an assignment, when it should be '='.

--
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list