Explorar o código

v.patch: create index for table

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58803 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz %!s(int64=11) %!d(string=hai) anos
pai
achega
e6fd7d49ae
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      vector/v.patch/main.c

+ 11 - 0
vector/v.patch/main.c

@@ -290,6 +290,17 @@ int main(int argc, char *argv[])
 		G_fatal_error(_("Unable to create table <%s>"),
 		G_fatal_error(_("Unable to create table <%s>"),
 			      fi_out->table);
 			      fi_out->table);
 	    }
 	    }
+
+	    /* do not allow duplicate keys */
+	    if (db_create_index2(driver_out, fi_out->table, fi_out->key) != DB_OK)
+		G_warning(_("Unable to create index"));
+
+	    if (db_grant_on_table
+		(driver_out, fi_out->table, DB_PRIV_SELECT,
+		 DB_GROUP | DB_PUBLIC) != DB_OK)
+		G_fatal_error(_("Unable to grant privileges on table <%s>"),
+			      fi_out->table);
+
 	    Vect_map_add_dblink(&OutMap, 1, NULL, fi_out->table,
 	    Vect_map_add_dblink(&OutMap, 1, NULL, fi_out->table,
 				fi_in->key, fi_out->database, fi_out->driver);
 				fi_in->key, fi_out->database, fi_out->driver);
 	}
 	}