[GRASS-SVN] r72943 - grass/trunk/db/db.connect

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 2 23:40:42 PDT 2018


Author: mmetz
Date: 2018-07-02 23:40:42 -0700 (Mon, 02 Jul 2018)
New Revision: 72943

Modified:
   grass/trunk/db/db.connect/main.c
Log:
db.connect: enhance default answers

Modified: grass/trunk/db/db.connect/main.c
===================================================================
--- grass/trunk/db/db.connect/main.c	2018-07-02 16:41:14 UTC (rev 72942)
+++ grass/trunk/db/db.connect/main.c	2018-07-03 06:40:42 UTC (rev 72943)
@@ -69,15 +69,25 @@
     def->description = _("Overwrite current settings if already initialized");
     def->guisection = _("Set");
 
-    /* the default answers below for driver, database, schema, and group
-     * are current settings, not GRASS default settings */
+    /* the default answers below are GRASS default settings,
+     * not current settings */
     driver = G_define_standard_option(G_OPT_DB_DRIVER);
     driver->options = db_list_drivers();
-    driver->answer = "sqlite";
+    if (strcmp(DB_DEFAULT_DRIVER, "sqlite") == 0) {
+	driver->answer = "sqlite";
+    }
+    else {
+	driver->answer = "dbf";
+    }
     driver->guisection = _("Set");
 
     database = G_define_standard_option(G_OPT_DB_DATABASE);
-    database->answer = "$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db";
+    if (strcmp(DB_DEFAULT_DRIVER, "sqlite") == 0) {
+	database->answer = "$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db";
+    }
+    else {
+	database->answer = "$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/";
+    }
     database->guisection = _("Set");
 
     schema = G_define_standard_option(G_OPT_DB_SCHEMA);



More information about the grass-commit mailing list