[GRASS-SVN] r43836 - grass/trunk/vector/v.db.connect

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 9 14:39:49 EDT 2010


Author: martinl
Date: 2010-10-09 18:39:49 +0000 (Sat, 09 Oct 2010)
New Revision: 43836

Modified:
   grass/trunk/vector/v.db.connect/main.c
Log:
v.db.connect: use default driver/database only if defined


Modified: grass/trunk/vector/v.db.connect/main.c
===================================================================
--- grass/trunk/vector/v.db.connect/main.c	2010-10-09 18:35:12 UTC (rev 43835)
+++ grass/trunk/vector/v.db.connect/main.c	2010-10-09 18:39:49 UTC (rev 43836)
@@ -30,6 +30,8 @@
 int main(int argc, char **argv)
 {
     char *input;
+    const char *driver_default, *database_default;
+    
     struct GModule *module;
     struct Option *inopt, *dbdriver, *dbdatabase, *dbtable, *field_opt,
 	*dbkey, *sep_opt;
@@ -56,11 +58,15 @@
 
     dbdriver = G_define_standard_option(G_OPT_DB_DRIVER);
     dbdriver->options = db_list_drivers();
-    dbdriver->answer = G_store(db_get_default_driver_name());
+    driver_default = db_get_default_driver_name();
+    if (driver_default)
+	dbdriver->answer = G_store(driver_default);
     dbdriver->guisection = _("Settings");
 
     dbdatabase = G_define_standard_option(G_OPT_DB_DATABASE);
-    dbdatabase->answer = G_store(db_get_default_database_name());
+    database_default = db_get_default_database_name();
+    if (database_default)
+	dbdatabase->answer = G_store(database_default);
     dbdatabase->guisection = _("Settings");
 
     dbtable = G_define_standard_option(G_OPT_DB_TABLE);



More information about the grass-commit mailing list