[GRASS-SVN] r58703 - grass/trunk/db/db.execute
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 13 10:20:40 PST 2014
Author: martinl
Date: 2014-01-13 10:20:38 -0800 (Mon, 13 Jan 2014)
New Revision: 58703
Modified:
grass/trunk/db/db.execute/main.c
Log:
db.execute: perform statements from input file in one transaction
Modified: grass/trunk/db/db.execute/main.c
===================================================================
--- grass/trunk/db/db.execute/main.c 2014-01-13 17:12:29 UTC (rev 58702)
+++ grass/trunk/db/db.execute/main.c 2014-01-13 18:20:38 UTC (rev 58703)
@@ -75,13 +75,16 @@
if (db_open_database(driver, &handle) != DB_OK)
G_fatal_error(_("Unable to open database <%s>"), parms.database);
G_add_error_handler(error_handler, driver);
-
+
if (parms.sql) {
/* parms.sql */
db_set_string(&stmt, parms.sql);
ret = db_execute_immediate(driver, &stmt);
}
else { /* parms.input */
+ /* perform execution in one transaction if possible */
+ db_begin_transaction(driver);
+
while (get_stmt(fd, &stmt)) {
if (stmt_is_empty(&stmt))
continue;
@@ -101,6 +104,8 @@
}
}
}
+
+ db_commit_transaction(driver);
}
db_close_database(driver);
More information about the grass-commit
mailing list