[GRASS-SVN] r73045 - grass/branches/releasebranch_7_4/db/db.execute

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 3 14:50:23 PDT 2018


Author: mmetz
Date: 2018-08-03 14:50:23 -0700 (Fri, 03 Aug 2018)
New Revision: 73045

Modified:
   grass/branches/releasebranch_7_4/db/db.execute/main.c
Log:
db.execute: check return code of db_execute_immediate() also for sql option (backport trunk r72993)

Modified: grass/branches/releasebranch_7_4/db/db.execute/main.c
===================================================================
--- grass/branches/releasebranch_7_4/db/db.execute/main.c	2018-08-03 21:48:20 UTC (rev 73044)
+++ grass/branches/releasebranch_7_4/db/db.execute/main.c	2018-08-03 21:50:23 UTC (rev 73045)
@@ -80,6 +80,18 @@
         /* parms.sql */
         db_set_string(&stmt, parms.sql);
         ret = db_execute_immediate(driver, &stmt);
+
+	if (ret != DB_OK) {
+	    if (parms.i) {	/* ignore SQL errors */
+		G_warning(_("Error while executing: '%s'"),
+			  db_get_string(&stmt));
+		error++;
+	    }
+	    else {
+		G_fatal_error(_("Error while executing: '%s'"),
+			      db_get_string(&stmt));
+	    }
+	}
     }
     else { /* parms.input */
         while (get_stmt(fd, &stmt)) {



More information about the grass-commit mailing list