[GRASS-SVN] r29782 - grass/trunk/vector/v.lrs/v.lrs.create

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 21 09:56:25 EST 2008


Author: neteler
Date: 2008-01-21 09:56:24 -0500 (Mon, 21 Jan 2008)
New Revision: 29782

Modified:
   grass/trunk/vector/v.lrs/v.lrs.create/main.c
Log:
added support for rsdriver and rsdatabase

Modified: grass/trunk/vector/v.lrs/v.lrs.create/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.create/main.c	2008-01-21 14:53:58 UTC (rev 29781)
+++ grass/trunk/vector/v.lrs/v.lrs.create/main.c	2008-01-21 14:56:24 UTC (rev 29782)
@@ -93,10 +93,10 @@
     struct Option *lfield_opt, *pfield_opt;
     struct Option *lidcol_opt, *pidcol_opt;
     struct Option *start_mp_opt, *start_off_opt, *end_mp_opt, *end_off_opt;
-    struct Option *thresh_opt;
-    struct Option *table_opt;
+    struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
     struct GModule *module;
     char   *mapset, buf[2000];
+    char   *drv, *db;
     struct Map_info In, Out, PMap, EMap;
     struct line_cats *LCats, *PCats; 
     struct line_pnts *LPoints, *L2Points, *PPoints;
@@ -186,6 +186,22 @@
     end_off_opt->description = _("Column containing offset from milepost for the end "
 				 "of previous segment");
     
+    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 ;
@@ -268,8 +284,8 @@
     /* Open database for RS table */
     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