[GRASS-SVN] r64281 - grass/trunk/vector/v.overlay
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 22 02:26:46 PST 2015
Author: mmetz
Date: 2015-01-22 02:26:46 -0800 (Thu, 22 Jan 2015)
New Revision: 64281
Modified:
grass/trunk/vector/v.overlay/main.c
Log:
v.overlay: accommodate SQLite
Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c 2015-01-22 09:50:42 UTC (rev 64280)
+++ grass/trunk/vector/v.overlay/main.c 2015-01-22 10:26:46 UTC (rev 64281)
@@ -237,8 +237,6 @@
Fi->database, Fi->driver);
}
db_set_error_handler_driver(driver);
-
- db_begin_transaction(driver);
}
else {
driver = NULL;
@@ -392,12 +390,20 @@
continue;
}
- in_driver =
- db_start_driver_open_database(inFi->driver, inFi->database);
- if (in_driver == NULL) {
- G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
- inFi->database, inFi->driver);
+ /* Open input driver and database */
+ if (strcmp(inFi->driver, Fi->driver) == 0
+ && strcmp(inFi->database, Vect_subst_var(Fi->database, &Out)) == 0) {
+ G_debug(3, "Use the same driver");
+ in_driver = driver;
}
+ else {
+ in_driver =
+ db_start_driver_open_database(inFi->driver, inFi->database);
+ if (in_driver == NULL) {
+ G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
+ inFi->database, inFi->driver);
+ }
+ }
sprintf(buf, "select * from %s", inFi->table);
db_set_string(&sql, buf);
@@ -538,7 +544,8 @@
db_table_to_sql(Table, &sql);
- db_close_database_shutdown_driver(in_driver);
+ if (in_driver != driver)
+ db_close_database_shutdown_driver(in_driver);
}
}
@@ -583,6 +590,8 @@
/* Table created, now we can write dblink */
Vect_map_add_dblink(&Out, ofield[0], NULL, Fi->table, GV_KEY_COLUMN,
Fi->database, Fi->driver);
+
+ db_begin_transaction(driver);
}
/* AREA x AREA */
More information about the grass-commit
mailing list