[GRASS-SVN] r29779 - grass/trunk/vector/v.lrs/v.lrs.where
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 21 09:46:48 EST 2008
Author: neteler
Date: 2008-01-21 09:46:48 -0500 (Mon, 21 Jan 2008)
New Revision: 29779
Modified:
grass/trunk/vector/v.lrs/v.lrs.where/main.c
Log:
Bill Perkins: added support for rsdriver and rsdatabase
Modified: grass/trunk/vector/v.lrs/v.lrs.where/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.where/main.c 2008-01-21 12:52:52 UTC (rev 29778)
+++ grass/trunk/vector/v.lrs/v.lrs.where/main.c 2008-01-21 14:46:48 UTC (rev 29779)
@@ -39,9 +39,10 @@
double thresh, multip;
struct Option *lines_opt, *points_opt;
struct Option *lfield_opt, *pfield_opt;
- struct Option *table_opt, *thresh_opt;
+ struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
struct GModule *module;
char *mapset;
+ char *drv, *db;
struct Map_info LMap, PMap;
struct line_cats *LCats, *PCats;
struct line_pnts *LPoints, *PPoints;
@@ -74,6 +75,22 @@
pfield_opt->answer = "1";
pfield_opt->description = _("Point layer");
+ driver_opt = G_define_option() ;
+ driver_opt->key = "rsdriver" ;
+ driver_opt->type = TYPE_STRING ;
+ driver_opt->required = NO;
+ driver_opt->description = _("Driver name for reference system table");
+ if ( (drv=db_get_default_driver_name()) )
+ driver_opt->answer = drv;
+
+ database_opt = G_define_option() ;
+ database_opt->key = "rsdatabase" ;
+ database_opt->type = TYPE_STRING ;
+ database_opt->required = NO;
+ database_opt->description = _("Database name for reference system table");
+ if ( (db=db_get_default_database_name()) )
+ database_opt->answer = db;
+
table_opt = G_define_option() ;
table_opt->key = "rstable" ;
table_opt->type = TYPE_STRING ;
@@ -118,8 +135,8 @@
db_init_handle (&rshandle);
db_init_string (&rsstmt);
- rsdriver = db_start_driver(NULL);
- db_set_handle (&rshandle, NULL, NULL);
+ rsdriver = db_start_driver(driver_opt->answer);
+ db_set_handle (&rshandle, database_opt->answer, NULL);
if (db_open_database(rsdriver, &rshandle) != DB_OK)
G_fatal_error(_("Unable to open database for reference table"));
More information about the grass-commit
mailing list