[GRASS5] 5.7: dbf driver and 'double' initialization

Markus Neteler neteler at itc.it
Mon Sep 6 23:54:50 EDT 2004


Hi Gordon,
(cc grass5)

generally I agree, but:

echo "UPDATE dourokukan SET forward=50 WHERE forward is null" | db.execute
DBMI-DBF driver error:
SQL parser error in statement:
UPDATE dourokukan SET forward=50 WHERE forward is null

Error in db_execute_immediate()

WARNING: Error while executing: "UPDATE dourokukan SET forward=50 WHERE
         forward is null
         "

The problem for me is "how to tell GRASS?"...

Regards

 Markus

On Tue, Sep 07, 2004 at 01:44:54PM +1000, Gordon Keith wrote:
> Knowing nothing about dbf in grass, but a bit about SQL, the behaviour 
> indicated would seem to me to be absolutely correct.
> 
> The SQL update (assuming normal SQL rules) you want would be:
> 
> echo "UPDATE dourokukan SET forward=50 WHERE forward is null" | db.execute
> 
> NULL and zero are very different values.
> 
> Regards
> Gordon
> 
> On Tue, 7 Sep 2004 12:55, Markus Neteler wrote:
> > There seems to be a problem with the initialization of
> > double (maybe also int) type in the DBF driver of 5.7:
> >
> > echo "ALTER TABLE dourokukan ADD COLUMN forward double" | db.execute
> > echo "ALTER TABLE dourokukan ADD COLUMN backward double" | db.execute
> > echo "ALTER TABLE dourokukan ADD COLUMN length double" | db.execute
> >
> > dbfdump dourokukan.dbf
> >         cat label      forward             backward              length
> >           1 s3m        (NULL)               (NULL)               (NULL)
> >           3 e3.0m      (NULL)               (NULL)               (NULL)
> >           5 e5.5m      (NULL)               (NULL)               (NULL)
> >          13 s13.0      (NULL)               (NULL)               (NULL)
> >          15 yes        (NULL)               (NULL)               (NULL)
> >
> > I assume that it should be set to zero (0).
> > At least I don't know how to access these (NULL) values in
> > a later SQL update :
> >
> > echo "UPDATE dourokukan SET forward=50 WHERE forward=0" | db.execute
> > echo "SELECT * FROM dourokukan" | db.select
> > cat|label|forward|backward|length
> > 1|s3m|||
> > 3|e3.0m|||
> > 5|e5.5m|||
> > 13|s13.0|||
> > 15|yes|||
> >
> > Any advice is welcome,
> >
> >  Markus
> >
> >
> > _______________________________________________
> > grass5 mailing list
> > grass5 at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grass5
> 
> -- 
> 
> Gordon Keith
> Programmer/Data Analyst
> Marine Acoustics
> CSIRO Marine Research
> http://www.marine.csiro.au
> 
> 
> "Computers in the future may weigh no more than than 1.5 tons."
> - Popular Mechanics, 1949

-- 
Markus Neteler     <neteler itc it>       http://mpa.itc.it
ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18        -       38050 Povo (Trento), Italy




More information about the grass-dev mailing list