On Tue, Sep 27, 2011 at 11:32 PM, Martin Landa <[email protected]> wrote:
> 2011/9/27  <[email protected]>:
>> 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@ticino column=elevation
...
+ g.message 'Reading column values...'
Reading column values...
+ '[' -z '' ']'
+ db=
+ '[' -z '' ']'
+ drv=
+ '[' -z '' ']'
+ db.select table=ticino_traps@ticino 'sql=select elevation from
ticino_traps@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@ticino
++ cut -d@ -f1
+ MYGIS_OPT_TABLE=ticino_traps
+ '[' -z '' ']'
+ db.select table=ticino_traps@ticino 'sql=select elevation from
ticino_traps' -c

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

Markus
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to