[GRASS-dev] Re: [GRASS-SVN] r48507 - grass/branches/releasebranch_6_4/scripts/v.db.univar

Markus Neteler neteler at osgeo.org
Wed Sep 28 03:27:19 EDT 2011


On Tue, Sep 27, 2011 at 11:32 PM, Martin Landa <landa.martin at gmail.com> wrote:
> 2011/9/27  <svn_grass at osgeo.org>:
>> Author: neteler
>> Date: 2011-09-27 14:23:17 -0700 (Tue, 27 Sep 2011)
>> New Revision: 48507
>>
>> Modified:
>>   grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar
>> Log:
>> fix crash
>>
>> Modified: grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar
>> ===================================================================
>> --- grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar    2011-09-27 21:23:07 UTC (rev 48506)
>> +++ grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar    2011-09-27 21:23:17 UTC (rev 48507)
>> @@ -114,6 +114,8 @@
>>     drv="driver=$GIS_OPT_DRIVER"
>>  fi
>>
>> +# strip off mapset
>> +GIS_OPT_TABLE=`echo $GIS_OPT_TABLE | cut -d'@' -f1`
>
> I am confused, it should be table name not map name, at least from
> option key/description...

Hi Martin,

the reason is this (pre-fix version, using wxGUI which adds the
mapset):

v.db.univar table=ticino_traps at ticino column=elevation
...
+ g.message 'Reading column values...'
Reading column values...
+ '[' -z '' ']'
+ db=
+ '[' -z '' ']'
+ drv=
+ '[' -z '' ']'
+ db.select table=ticino_traps at ticino 'sql=select elevation from
ticino_traps at ticino' -c
dbmi: Protocol error
dbmi: Protocol error

Since db.* only works in the current mapset, the SQL string must
be polished and the @mapset removed. But I see the potential issue
with that fix and I have now changed it to this:

+ g.message 'Reading column values...'
Reading column values...
+ '[' -z '' ']'
+ db=
+ '[' -z '' ']'
+ drv=
++ echo ticino_traps at ticino
++ cut -d@ -f1
+ MYGIS_OPT_TABLE=ticino_traps
+ '[' -z '' ']'
+ db.select table=ticino_traps at ticino 'sql=select elevation from
ticino_traps' -c

To be continued in the other thread about general issues with
this modules.

Markus


More information about the grass-dev mailing list