[GRASS5] Re: Specifying 'database' in various modules

Radim Blazek blazek at itc.it
Mon Jan 24 04:54:43 EST 2005


Radim Blazek wrote:
> Michael Barton wrote:
> 
>> Radim and Markus,
>>
>> This is a request for a bit of fine tuning on the database modules. But I
>> also want to see what everyone thinks about it as it wouldn't do to make
>> things more difficult.
>>
>> V.in.db and other database modules have a common format for specifying
>> attribute tables--which is a very helpful thing. There are two fields to
>> identify which table to use for attributes: one is called "database" 
>> and the
>> other is called "table". In some cases, the "database" field is a
>> host/database specification string (as in mysql). In other cases it is
>> simply a path to a table location (as in ASCII or dbf tables). I'd 
>> like to
>> suggest that the descriptive text that appears in the autogenerated 
>> GUI be
>> called "specify database or path to data table". This will make it easier
>> for new users (and forgetful old users like me) to know what to put in 
>> this
>> field.
>>
>> A browse button would be nice here too, though only useful for those 
>> cases
>> where database is a path.
>>
>> Thanks
>> Michael
> 
> 
> OK, note that you can use 'label' (name/short description) and 
> 'description' (long description), so something like
> 
> database_opt ->label       = "Database";
> database_opt ->description = "For dbf driver the path to the directory..."
> 
> Radim

Better to add a new standard options to gislib, because both driver and 
database are reused in many modules. Look at G_define_standard_option()
in lib/gis/parser.c, there is already G_OPT_WHERE.
You have to define also new STD_OPT in include/gis.h, (G_OPT_DRIVER, 
G_OPT_DATABASE)
Then in modules use just:

driver_opt = G_define_standard_option(G_OPT_DRIVER);
database_opt = G_define_standard_option(G_OPT_DATABASE);

Radim




More information about the grass-dev mailing list