Changeset: d3aa0efd3717 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d3aa0efd3717
Modified Files:
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
Branch: default
Log Message:
Pull up autocommit mode change notifications so they always happen
See #7988
diffs (40 lines):
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1572,13 +1572,10 @@ mvc_export_operation(backend *b, stream
if (mnstr_printf(s, "&3 " LLFMT " " LLFMT "\n", starttime > 0 ?
GDKusec() - starttime : 0, mal_optimizer) < 0)
return -4;
} else {
- if (m->session->auto_commit) {
- if (mnstr_write(s, "&4 t\n", 5, 1) != 1)
- return -4;
- } else {
- if (mnstr_write(s, "&4 f\n", 5, 1) != 1)
- return -4;
- }
+ /* We used to send notifications of auto commit mode changes
here but
+ * that has been pulled up to the Scenario level because this
function
+ * doesn't get executed when an error happens before the end of
a
+ * transaction. */
}
if (mvc_export_warning(s, w) != 1)
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1777,7 +1777,15 @@ SQLengine_(Client c)
sqlcleanup(be, 0);
c->query = NULL;
} else {
+ bool pre_autocommit = be->mvc->session->auto_commit;
msg = SQLparser(c, be);
+ bool post_autocommit = be->mvc->session->auto_commit;
+ if (pre_autocommit != post_autocommit && be->out != NULL) {
+ /* Notify client of change in auto commit mode */
+ int n = mnstr_printf(be->out, "&4 %s\n",
post_autocommit ? "t" : "f");
+ if (n < 0 && msg == NULL)
+ msg = createException(SQL, "SQLparser",
SQLSTATE(HY002) "Error while sending autocommit notification: %s\n",
mnstr_peek_error(be->out));
+ }
if (msg == MAL_SUCCEED && (be->mvc->emode == m_deallocate ||
be->mvc->emode == m_prepare))
return msg;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]