Details Ticket 4136


Comment | Reply | Take | Open


Serial Number 4136
Subject sqlite fails for ADD COLUMN
Area grass6
Queue grass
Requestors dassau@gdf-hannover.de
Owner none
Status resolved
Last User Contact Mon Jul 17 17:48:00 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Mon Jul 17 17:48:03 2006 (2 yr ago)
Created Fri Mar 3 08:16:59 2006 (2 yr ago)

Transaction History Ticket 4136


Fri, Mar 3 2006 08:16:59    Request created by guest  
Subject: sqlite fails for ADD COLUMN

Platform: GNU/Linux/x86
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: G61 CVS from 20060103

Hi, 

I use GRASS with sqlite driver and cannot add columns to attribute tables: 
echo "ALTER TABLE ammcom ADD COLUMN area double" | db.execute

DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "ADD": syntax error
ERROR: Error while executing: "ALTER TABLE map ADD COLUMN area double
  
it works with dbf and is also supported by sqlite3, as far as I know. Is it 
possible to change/add this?
 
  thanks
     Otto
Mon, Apr 17 2006 13:47:27    Mail sent by msieczka  
Hi Otto,

Your example works perfectly for me on my Grass 6.1 cvs 2006-04-05, sqlite
3.3. Can you re-test?

What does your db.connect -p say?

PLEASE CC ME werchowyna at epf dot pl. OTHERWISE I WILL NOT BE INFORMED YOU
REPLIED.

Maciek
Tue, May 2 2006 10:59:19    Mail sent by guest  
Hi, 

ok, here are some more tests...

GRASS 6.1.cvs (spearfish60):~ > db.connect -p
driver:dbf
database:$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
schema:(null)
group:(null)

GRASS 6.1.cvs (spearfish60):~ > echo "ALTER TABLE soils ADD COLUMN test
double" | db.execute

=> works fine

v.out.ogr -c dsn=. in=soils olayer=soils type=area
db.connect driver=sqlite database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
db.connect -p
  driver:sqlite
  database:$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db
  schema:(null)
  group:(null)

v.in.ogr dsn=./soils.shp out=test

v.db.connect test -p
Vector map <test> is connected by:
layer <1> table <test> in database
</grassdata/spearfish60/PERMANENT/sqlite.db> through driver <sqlite> with key
<cat>

echo "ALTER TABLE test ADD COLUMN test2 double" | db.execute
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "ADD": syntax error

ERROR: Error while executing: "ALTER TABLE test ADD COLUMN test2 double

sqlite3 -version
3.1.3

maybe I need to update to sqlite 3.3? Maybe my GRASS needs an update, too? 
regards,
 Otto









Mon, Jul 17 2006 17:48:00    Mail sent by mneteler  
Hi,

I have tested this and it works.

# Spearfish
g.copy vect=roads,mmm
echo "ALTER TABLE mmmADD COLUMN myarea double precision" | db.execute
v.info -c mmm
Displaying column types/names for database connection of layer 1:
INTEGER|cat
TEXT|label
DOUBLE PRECISION|myarea

ldd grass61/dist.x86_64-unknown-linux-gnu/driver/db/sqlite  | grep sq
        libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x0000002a95b76000)
rpm -qf /usr/lib64/libsqlite3.so.0
sqlite-3.3.4-6

Probably your sqlite version is outdated.
Closing report.

Markus
Mon, Jul 17 2006 17:48:03    Status changed to resolved by mneteler  
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request