[GRASS-SVN] r47479 - in grass/trunk: general/g.parser include
lib/gis lib/vector/Vlib lib/vector/neta raster/r.random
raster/r.to.vect vector/v.convert vector/v.db.connect
vector/v.generalize vector/v.in.ascii vector/v.in.dwg
vector/v.in.dxf vector/v.in.lidar vector/v.in.ogr
vector/v.in.sites vector/v.net.allpairs
vector/v.net.centrality vector/v.net.components
vector/v.net.distance vector/v.net.flow vector/v.net.path
vector/v.net.timetable vector/v.out.ogr vector/v.overlay
vector/v.random vector/v.reclass vector/v.surf.rst
vector/v.to.points vector/v.vol.rst
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 7 10:35:07 EDT 2011
Author: martinl
Date: 2011-08-07 07:35:06 -0700 (Sun, 07 Aug 2011)
New Revision: 47479
Modified:
grass/trunk/general/g.parser/standard_option.c
grass/trunk/include/gis.h
grass/trunk/lib/gis/parser_standard_options.c
grass/trunk/lib/vector/Vlib/field.c
grass/trunk/lib/vector/neta/utils.c
grass/trunk/raster/r.random/random.c
grass/trunk/raster/r.to.vect/main.c
grass/trunk/vector/v.convert/att.c
grass/trunk/vector/v.db.connect/main.c
grass/trunk/vector/v.generalize/misc.c
grass/trunk/vector/v.in.ascii/main.c
grass/trunk/vector/v.in.dwg/main.c
grass/trunk/vector/v.in.dxf/write_vect.c
grass/trunk/vector/v.in.lidar/main.c
grass/trunk/vector/v.in.ogr/main.c
grass/trunk/vector/v.in.sites/main.c
grass/trunk/vector/v.net.allpairs/main.c
grass/trunk/vector/v.net.centrality/main.c
grass/trunk/vector/v.net.components/main.c
grass/trunk/vector/v.net.distance/main.c
grass/trunk/vector/v.net.flow/main.c
grass/trunk/vector/v.net.path/path.c
grass/trunk/vector/v.net.timetable/main.c
grass/trunk/vector/v.out.ogr/attrb.c
grass/trunk/vector/v.out.ogr/main.c
grass/trunk/vector/v.overlay/main.c
grass/trunk/vector/v.random/main.c
grass/trunk/vector/v.reclass/main.c
grass/trunk/vector/v.surf.rst/main.c
grass/trunk/vector/v.to.points/main.c
grass/trunk/vector/v.vol.rst/main.c
Log:
gislib: define G_OPT_DB_KEYCOLUMN and GV_KEY_COLUMN
Modified: grass/trunk/general/g.parser/standard_option.c
===================================================================
--- grass/trunk/general/g.parser/standard_option.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/general/g.parser/standard_option.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -20,6 +20,8 @@
key = G_OPT_DB_COLUMN;
else if (G_strcasecmp(name, "G_OPT_DB_COLUMNS") == 0)
key = G_OPT_DB_COLUMNS;
+ else if (G_strcasecmp(name, "G_OPT_DB_KEYCOLUMN") == 0)
+ key = G_OPT_DB_KEYCOLUMN;
else if (G_strcasecmp(name, "G_OPT_I_GROUP") == 0)
key = G_OPT_I_GROUP;
else if (G_strcasecmp(name, "G_OPT_I_SUBGROUP") == 0)
Modified: grass/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/include/gis.h 2011-08-07 14:35:06 UTC (rev 47479)
@@ -172,6 +172,7 @@
G_OPT_DB_SCHEMA, /* database schema */
G_OPT_DB_COLUMN, /* one attr column */
G_OPT_DB_COLUMNS, /* one or more attr columns */
+ G_OPT_DB_KEYCOLUMN, /* key column */
G_OPT_I_GROUP, /* old input imagery group */
G_OPT_I_SUBGROUP, /* old input imagery subgroup */
@@ -242,6 +243,12 @@
#define GR_FATAL_PRINT 1
#define GR_FATAL_RETURN 2
+/* for vector maps */
+/*!
+ \brief Name of default key column
+*/
+#define GV_KEY_COLUMN "cat"
+
/* Element types */
enum
{ /* Dir */
Modified: grass/trunk/lib/gis/parser_standard_options.c
===================================================================
--- grass/trunk/lib/gis/parser_standard_options.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/lib/gis/parser_standard_options.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -30,13 +30,14 @@
- database:
- G_OPT_DB_WHERE
- - G_OPT_DB_COLUMN
- - G_OPT_DB_COLUMNS
- G_OPT_DB_TABLE
- G_OPT_DB_DRIVER
- G_OPT_DB_DATABASE
- G_OPT_DB_SCHEMA
-
+ - G_OPT_DB_COLUMN
+ - G_OPT_DB_COLUMNS
+ - G_OPT_DB_KEYCOLUMN
+
- imagery:
- G_OPT_I_GROUP
- G_OPT_I_SUBGROUP
@@ -162,6 +163,17 @@
Opt->description = _("Name of attribute column(s)");
Opt->gisprompt = "old,dbcolumn,dbcolumn";
break;
+ case G_OPT_DB_KEYCOLUMN:
+ Opt->key = "key";
+ Opt->type = TYPE_STRING;
+ Opt->key_desc = "name";
+ Opt->required = NO;
+ Opt->multiple = NO;
+ Opt->description = _("Name of key column");
+ Opt->description = _("Must refer to an integer column");
+ /* Opt->gisprompt = "old,dbcolumn,dbcolumn"; */
+ Opt->answer = GV_KEY_COLUMN;
+ break;
/* imagery group */
case G_OPT_I_GROUP:
Modified: grass/trunk/lib/vector/Vlib/field.c
===================================================================
--- grass/trunk/lib/vector/Vlib/field.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/lib/vector/Vlib/field.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -347,7 +347,7 @@
fi->table = G_store(buf);
}
- fi->key = G_store("cat"); /* Should be: id/fid/gfid/... ? */
+ fi->key = G_store(GV_KEY_COLUMN); /* Should be: id/fid/gfid/... ? */
fi->database = G_store(db);
fi->driver = G_store(drv);
Modified: grass/trunk/lib/vector/neta/utils.c
===================================================================
--- grass/trunk/lib/vector/neta/utils.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/lib/vector/neta/utils.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -232,7 +232,7 @@
}
else if (cat) {
if (layer < 1)
- G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", "cat");
+ G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", GV_KEY_COLUMN);
*varray = Vect_new_varray(Vect_get_num_lines(In));
if (Vect_set_varray_from_cat_string
(In, layer, cat, mask_type, 1, *varray) == -1) {
Modified: grass/trunk/raster/r.random/random.c
===================================================================
--- grass/trunk/raster/r.random/random.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/raster/r.random/random.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -73,7 +73,7 @@
G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
Vect_subst_var(fi->database, &Out), fi->driver);
- Vect_map_add_dblink(&Out, 1, NULL, fi->table, "cat", fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, fi->table, GV_KEY_COLUMN, fi->database,
fi->driver);
if (theState->docover == TRUE)
@@ -83,7 +83,7 @@
db_set_table_name(table, fi->table);
column = db_get_table_column(table, 0);
- db_set_column_name(column, "cat");
+ db_set_column_name(column, GV_KEY_COLUMN);
db_set_column_sqltype(column, DB_SQL_TYPE_INTEGER);
column = db_get_table_column(table, 1);
Modified: grass/trunk/raster/r.to.vect/main.c
===================================================================
--- grass/trunk/raster/r.to.vect/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/raster/r.to.vect/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -156,7 +156,7 @@
char buf[1000];
Fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Map, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Map, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
driver =
@@ -202,7 +202,7 @@
G_fatal_error(_("Unable to create table: %s"),
db_get_string(&sql));
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.convert/att.c
===================================================================
--- grass/trunk/vector/v.convert/att.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.convert/att.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -44,7 +44,7 @@
}
fi = Vect_default_field_info(Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(Out, 1, NULL, fi->table, "cat", fi->database,
+ Vect_map_add_dblink(Out, 1, NULL, fi->table, GV_KEY_COLUMN, fi->database,
fi->driver);
/* Get maximum column length */
@@ -82,9 +82,9 @@
db_get_string(&sql));
}
- if (db_create_index2(driver, fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index for table <%s>, key <%s>"),
- fi->table, "cat");
+ fi->table, GV_KEY_COLUMN);
if (db_grant_on_table
(driver, fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
Modified: grass/trunk/vector/v.db.connect/main.c
===================================================================
--- grass/trunk/vector/v.db.connect/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.db.connect/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -71,12 +71,8 @@
dbtable = G_define_standard_option(G_OPT_DB_TABLE);
- dbkey = G_define_standard_option(G_OPT_DB_COLUMN);
- dbkey->key = "key";
- dbkey->answer = "cat";
- dbkey->label = _("Key column name");
- dbkey->description = _("Must refer to an integer column");
-
+ dbkey = G_define_standard_option(G_OPT_DB_KEYCOLUMN);
+
field_opt = G_define_standard_option(G_OPT_V_FIELD);
field_opt->description = _("Format: layer number[/layer name]");
field_opt->gisprompt = "new_layer,layer,layer";
Modified: grass/trunk/vector/v.generalize/misc.c
===================================================================
--- grass/trunk/vector/v.generalize/misc.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.generalize/misc.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -217,7 +217,7 @@
}
else if (cats) {
if (layer < 1)
- G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", "cat");
+ G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", GV_KEY_COLUMN);
*chcat = 1;
varray = Vect_new_varray(Vect_get_num_lines(Map));
Modified: grass/trunk/vector/v.in.ascii/main.c
===================================================================
--- grass/trunk/vector/v.in.ascii/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.ascii/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -375,7 +375,7 @@
/* this link is added with default 'cat' key, later deleted and replaced by true key name,
* otherwise if module crashes when the table exists but link is not written it makes troubles */
- Vect_map_add_dblink(&Map, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Map, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
/* Create table */
@@ -493,7 +493,7 @@
}
if (catcol < 0) {
- key = "cat";
+ key = GV_KEY_COLUMN;
}
else if (!columns_opt->answer) {
Modified: grass/trunk/vector/v.in.dwg/main.c
===================================================================
--- grass/trunk/vector/v.in.dwg/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.dwg/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -202,7 +202,7 @@
/* Add DB link */
Fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Map, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Map, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
driver =
@@ -237,9 +237,9 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index for table <%s>, key <%s>"),
- Fi->table, "cat");
+ Fi->table, GV_KEY_COLUMN);
if (db_grant_on_table
(driver, Fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
Modified: grass/trunk/vector/v.in.dxf/write_vect.c
===================================================================
--- grass/trunk/vector/v.in.dxf/write_vect.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.dxf/write_vect.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -240,7 +240,7 @@
G_warning(_("Unable to create index for table <%s>, key <%s>"),
Fi[i]->table, Fi[i]->key);
- if (Vect_map_add_dblink(Map, *field, field_name, Fi[i]->table, "cat",
+ if (Vect_map_add_dblink(Map, *field, field_name, Fi[i]->table, GV_KEY_COLUMN,
Fi[i]->database, Fi[i]->driver))
G_warning(_("Unable to add database link for vector map <%s>"),
Vect_get_full_name(Map));
Modified: grass/trunk/vector/v.in.lidar/main.c
===================================================================
--- grass/trunk/vector/v.in.lidar/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.lidar/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -497,7 +497,7 @@
/* Add DB link */
if (!notab_flag->answer) {
- char *cat_col_name = "cat";
+ char *cat_col_name = GV_KEY_COLUMN;
Fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.ogr/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -706,7 +706,7 @@
/* Add DB link */
if (!flag.notab->answer) {
- char *cat_col_name = "cat";
+ char *cat_col_name = GV_KEY_COLUMN;
if (nlayers == 1) { /* one layer only */
Fi = Vect_default_field_info(&Map, layer + 1, NULL,
@@ -752,7 +752,7 @@
}
/* avoid that we get the 'cat' column twice */
- if (strcmp(Ogr_fieldname, "cat") == 0) {
+ if (strcmp(Ogr_fieldname, GV_KEY_COLUMN) == 0) {
sprintf(namebuf, "%s_", Ogr_fieldname);
Ogr_fieldname = G_store(namebuf);
}
Modified: grass/trunk/vector/v.in.sites/main.c
===================================================================
--- grass/trunk/vector/v.in.sites/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.in.sites/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -123,7 +123,7 @@
Vect_hist_command(&Map);
fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Map, 1, NULL, fi->table, "cat", fi->database,
+ Vect_map_add_dblink(&Map, 1, NULL, fi->table, GV_KEY_COLUMN, fi->database,
fi->driver);
/* Create new table */
@@ -172,9 +172,9 @@
G_fatal_error(_("Unable to create table: %s"), db_get_string(&sql));
}
- if (db_create_index2(driver, fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index for table <%s>, key <%s>"),
- fi->table, "cat");
+ fi->table, GV_KEY_COLUMN);
if (db_grant_on_table
(driver, fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
Modified: grass/trunk/vector/v.net.allpairs/main.c
===================================================================
--- grass/trunk/vector/v.net.allpairs/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.allpairs/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -131,7 +131,7 @@
/* Create table */
Fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
db_init_string(&sql);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -151,7 +151,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
/*
- * if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ * if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
* G_warning(_("Cannot create index"));
*/
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.centrality/main.c
===================================================================
--- grass/trunk/vector/v.net.centrality/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.centrality/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -214,7 +214,7 @@
/* Create table */
Fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
db_init_string(&sql);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -242,7 +242,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.components/main.c
===================================================================
--- grass/trunk/vector/v.net.components/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.components/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -131,7 +131,7 @@
}
/* Create table */
Fi = Vect_default_field_info(&Out, layer, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, layer, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, layer, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
db_init_string(&sql);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -149,7 +149,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.distance/main.c
===================================================================
--- grass/trunk/vector/v.net.distance/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.distance/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -190,7 +190,7 @@
/* Create table */
Fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
db_init_string(&sql);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -210,7 +210,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.flow/main.c
===================================================================
--- grass/trunk/vector/v.net.flow/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.flow/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -151,7 +151,7 @@
/* Create table */
Fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
db_init_string(&sql);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -170,7 +170,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.path/path.c
===================================================================
--- grass/trunk/vector/v.net.path/path.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.path/path.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -88,7 +88,7 @@
/* Create table */
Fi = Vect_default_field_info(Out, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
driver = db_start_driver_open_database(Fi->driver, Fi->database);
@@ -109,7 +109,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.net.timetable/main.c
===================================================================
--- grass/trunk/vector/v.net.timetable/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.net.timetable/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -85,7 +85,7 @@
/* Create table */
*Fi = Vect_default_field_info(Out, layer, NULL, GV_MTABLE);
- Vect_map_add_dblink(Out, layer, NULL, (*Fi)->table, "cat",
+ Vect_map_add_dblink(Out, layer, NULL, (*Fi)->table, GV_KEY_COLUMN,
(*Fi)->database, (*Fi)->driver);
db_init_string(&sql);
*driver = db_start_driver_open_database((*Fi)->driver, (*Fi)->database);
@@ -103,7 +103,7 @@
G_fatal_error(_("Unable to create table: '%s'"), db_get_string(&sql));
}
- if (db_create_index2(*driver, (*Fi)->table, "cat") != DB_OK)
+ if (db_create_index2(*driver, (*Fi)->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Cannot create index"));
if (db_grant_on_table
Modified: grass/trunk/vector/v.out.ogr/attrb.c
===================================================================
--- grass/trunk/vector/v.out.ogr/attrb.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.out.ogr/attrb.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -21,7 +21,7 @@
/* Attributes */
/* Reset */
if (!doatt) {
- ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, "cat");
+ ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, GV_KEY_COLUMN);
OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
/* doatt reset moved into have cat loop as the table needs to be
open to know the OGR field ID. Hopefully this has no ill consequences */
@@ -130,7 +130,7 @@
db_close_cursor(&cursor);
}
else { /* Use cat only */
- ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, "cat");
+ ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, GV_KEY_COLUMN);
OGR_F_SetFieldInteger(Ogr_feature, ogrfieldnum, cat);
}
}
Modified: grass/trunk/vector/v.out.ogr/main.c
===================================================================
--- grass/trunk/vector/v.out.ogr/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.out.ogr/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -548,15 +548,15 @@
if (flags.append->answer) {
Ogr_field = OGR_L_GetLayerDefn(Ogr_layer);
- if (OGR_FD_GetFieldIndex(Ogr_field, "cat") > -1)
+ if (OGR_FD_GetFieldIndex(Ogr_field, GV_KEY_COLUMN) > -1)
create_field = FALSE;
else
G_warning(_("New attribute column <%s> added to the table"),
- "cat");
+ GV_KEY_COLUMN);
}
if (create_field) {
- Ogr_field = OGR_Fld_Create("cat", OFTInteger);
+ Ogr_field = OGR_Fld_Create(GV_KEY_COLUMN, OFTInteger);
OGR_L_CreateField(Ogr_layer, Ogr_field, 0);
OGR_Fld_Destroy(Ogr_field);
}
Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.overlay/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -463,7 +463,7 @@
db_get_string(&stmt));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index"));
if (db_grant_on_table
@@ -473,7 +473,7 @@
Fi->table);
/* Table created, now we can write dblink */
- Vect_map_add_dblink(&Out, ofield[0], NULL, Fi->table, "cat",
+ Vect_map_add_dblink(&Out, ofield[0], NULL, Fi->table, GV_KEY_COLUMN,
Fi->database, Fi->driver);
}
Modified: grass/trunk/vector/v.random/main.c
===================================================================
--- grass/trunk/vector/v.random/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.random/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -183,7 +183,7 @@
sprintf(buf, "create table %s (cat integer, %s %s)", Fi->table,
parm.zcol->answer, parm.ztype->answer);
db_set_string(&sql, buf);
- Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 1, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
/* Create table */
Modified: grass/trunk/vector/v.reclass/main.c
===================================================================
--- grass/trunk/vector/v.reclass/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.reclass/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -163,7 +163,7 @@
db_init_string(&lastval);
NewFi = Vect_default_field_info(&Out, field, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Out, field, NULL, NewFi->table, "cat",
+ Vect_map_add_dblink(&Out, field, NULL, NewFi->table, GV_KEY_COLUMN,
NewFi->database, NewFi->driver);
Driver2 = db_start_driver_open_database(NewFi->driver,
Modified: grass/trunk/vector/v.surf.rst/main.c
===================================================================
--- grass/trunk/vector/v.surf.rst/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.surf.rst/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -557,7 +557,7 @@
Vect_open_new(&Map2, cvdev, 1);
Vect_hist_command(&Map2);
ff = Vect_default_field_info(&Map2, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Map2, 1, NULL, ff->table, "cat", ff->database,
+ Vect_map_add_dblink(&Map2, 1, NULL, ff->table, GV_KEY_COLUMN, ff->database,
ff->driver);
/* Create new table */
Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.to.points/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -274,7 +274,7 @@
}
Fi = Vect_default_field_info(&Out, 2, NULL, GV_MTABLE);
- Vect_map_add_dblink(&Out, 2, NULL, Fi->table, "cat", Fi->database,
+ Vect_map_add_dblink(&Out, 2, NULL, Fi->table, GV_KEY_COLUMN, Fi->database,
Fi->driver);
/* Open driver */
@@ -294,9 +294,9 @@
db_get_string(&stmt));
}
- if (db_create_index2(driver, Fi->table, "cat") != DB_OK)
+ if (db_create_index2(driver, Fi->table, GV_KEY_COLUMN) != DB_OK)
G_warning(_("Unable to create index for table <%s>, key <%s>"),
- Fi->table, "cat");
+ Fi->table, GV_KEY_COLUMN);
if (db_grant_on_table
(driver, Fi->table, DB_PRIV_SELECT,
Modified: grass/trunk/vector/v.vol.rst/main.c
===================================================================
--- grass/trunk/vector/v.vol.rst/main.c 2011-08-07 14:11:59 UTC (rev 47478)
+++ grass/trunk/vector/v.vol.rst/main.c 2011-08-07 14:35:06 UTC (rev 47479)
@@ -617,13 +617,14 @@
Vect_open_new(&Map, cvdev, 1);
Vect_hist_command(&Map);
f = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
- Vect_map_add_dblink(&Map, 1, NULL, f->table, "cat", f->database,
+ Vect_map_add_dblink(&Map, 1, NULL, f->table, GV_KEY_COLUMN, f->database,
f->driver);
/* Create new table */
db_zero_string(&sql);
sprintf(buf, "create table %s ( ", f->table);
db_append_string(&sql, buf);
- db_append_string(&sql, "cat integer");
+ db_append_string(&sql, GV_KEY_COLUMN);
+ db_append_string(&sql, " integer");
db_append_string(&sql, ", flt1 double precision");
db_append_string(&sql, ")");
G_debug(1, db_get_string(&sql));
More information about the grass-commit
mailing list