[GRASS-SVN] r62146 - in grass/branches/releasebranch_7_0: raster/r.random vector/v.random

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 1 09:00:37 PDT 2014


Author: neteler
Date: 2014-10-01 09:00:37 -0700 (Wed, 01 Oct 2014)
New Revision: 62146

Modified:
   grass/branches/releasebranch_7_0/raster/r.random/random.c
   grass/branches/releasebranch_7_0/vector/v.random/main.c
Log:
r.random/v.random: create DB index

Modified: grass/branches/releasebranch_7_0/raster/r.random/random.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.random/random.c	2014-10-01 15:59:48 UTC (rev 62145)
+++ grass/branches/releasebranch_7_0/raster/r.random/random.c	2014-10-01 16:00:37 UTC (rev 62146)
@@ -249,6 +249,14 @@
 	Rast_close(cinfd);
     if (theState->outvector) {
 	db_commit_transaction(driver);
+	if (db_create_index2(driver, fi->table, GV_KEY_COLUMN) != DB_OK)
+	    G_warning(_("Unable to create index"));
+	if (db_grant_on_table
+	    (driver, fi->table, DB_PRIV_SELECT,
+	     DB_GROUP | DB_PUBLIC) != DB_OK) {
+	    G_fatal_error(_("Unable to grant privileges on table <%s>"),
+			  fi->table);
+	}
 	db_close_database_shutdown_driver(driver);
 	if (theState->notopol != 1)
 	    Vect_build(&Out);

Modified: grass/branches/releasebranch_7_0/vector/v.random/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.random/main.c	2014-10-01 15:59:48 UTC (rev 62145)
+++ grass/branches/releasebranch_7_0/vector/v.random/main.c	2014-10-01 16:00:37 UTC (rev 62146)
@@ -144,7 +144,7 @@
     parm.seed->type = TYPE_INTEGER;
     parm.seed->required = NO;
     parm.seed->description =
-	_("The seed to initialize the random generator. If not set the process id is used.");
+	_("The seed to initialize the random generator. If not set the process ID is used");
 
     parm.zcol = G_define_standard_option(G_OPT_DB_COLUMN);
     parm.zcol->label = _("Name of column for z values");
@@ -252,6 +252,10 @@
 			  db_get_string(&sql));
 	}
 
+	/* Create index */
+	if (db_create_index2(driver, Fi->table, Fi->key) != DB_OK)
+	    G_warning(_("Unable to create index"));
+
 	/* Grant */
 	if (db_grant_on_table
 	    (driver, Fi->table, DB_PRIV_SELECT,



More information about the grass-commit mailing list