[GRASS-SVN] r53761 - grass/trunk/vector/v.distance
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 9 13:44:31 PST 2012
Author: mmetz
Date: 2012-11-09 13:44:31 -0800 (Fri, 09 Nov 2012)
New Revision: 53761
Modified:
grass/trunk/vector/v.distance/main.c
Log:
v.distance: fix to_column bug
Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c 2012-11-09 21:19:36 UTC (rev 53760)
+++ grass/trunk/vector/v.distance/main.c 2012-11-09 21:44:31 UTC (rev 53761)
@@ -438,6 +438,7 @@
to_driver = NULL;
toFi = NULL;
if (opt.to_column->answer) {
+
toFi = Vect_get_field(&To, to_field);
if (toFi == NULL)
G_fatal_error(_("Database connection not defined for layer %d"),
@@ -484,6 +485,17 @@
}
if (fcname) {
+
+ Fi = Vect_get_field(&From, from_field);
+ if (Fi == NULL)
+ G_fatal_error(_("Database connection not defined for layer <%s>"),
+ opt.from_field->answer);
+
+ driver = db_start_driver_open_database(Fi->driver, Fi->database);
+ if (driver == NULL)
+ G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
+ Fi->database, Fi->driver);
+
fctype = db_column_Ctype(driver, Fi->table, fcname);
tctype =
db_column_Ctype(to_driver, toFi->table,
@@ -499,8 +511,12 @@
) {
G_fatal_error(_("Incompatible column types"));
}
+ /* close db connection */
+ db_close_database_shutdown_driver(driver);
+ driver = NULL;
}
}
+ /* close db connection */
db_close_database_shutdown_driver(to_driver);
to_driver = NULL;
}
More information about the grass-commit
mailing list