[GRASS-SVN] r58244 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 17 03:10:34 PST 2013
Author: martinl
Date: 2013-11-17 03:10:30 -0800 (Sun, 17 Nov 2013)
New Revision: 58244
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: fix producing external formats
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2013-11-17 11:08:06 UTC (rev 58243)
+++ grass/trunk/vector/v.in.ogr/main.c 2013-11-17 11:10:30 UTC (rev 58244)
@@ -77,7 +77,8 @@
/* Vector */
struct Map_info Map, Tmp, *Out;
int cat;
-
+ int delete_table = FALSE; /* for external output format only */
+
/* Attributes */
struct field_info *Fi = NULL;
dbDriver *driver = NULL;
@@ -1094,7 +1095,6 @@
if (!flag.notab->answer) {
db_commit_transaction(driver);
- db_close_database_shutdown_driver(driver);
}
if (nogeom > 0)
@@ -1414,8 +1414,18 @@
}
}
+ delete_table = Vect_maptype(&Map) != GV_FORMAT_NATIVE;
Vect_close(&Map);
-
+ if (delete_table) {
+ sprintf(buf, "drop table %s", Fi->table);
+ db_set_string(&sql, buf);
+ if (db_execute_immediate(driver, &sql) != DB_OK) {
+ G_fatal_error(_("Unable to drop table: '%s'"),
+ db_get_string(&sql));
+ }
+ }
+ db_close_database_shutdown_driver(driver);
+
/* -------------------------------------------------------------------- */
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
More information about the grass-commit
mailing list