Changeset: cc5150473d38 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc5150473d38
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql.mal
sql/scripts/85_htm.sql
Branch: HTM
Log Message:
Initial work on result set return for pre/persist commit
diffs (103 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -347,8 +347,9 @@ SQLprecommit(Client cntxt, MalBlkPtr mb,
mvc *sql = NULL;
str msg;
int result;
- (void) stk;
- (void) pci;
+ backend *b = NULL;
+ wrd nr;
+ str *w = getArgReference_str(stk, pci, 3);
if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL)
return msg;
@@ -356,12 +357,19 @@ SQLprecommit(Client cntxt, MalBlkPtr mb,
return msg;
if (sql->session->auto_commit != 0)
- throw(SQL, "sql.trans", "2DM30!PRECOMMIT: not allowed in auto
commit mode");
-
+ throw(SQL, "sql.precommit", "precommit not allowed in auto
commit mode");
+
+ /* execute the precommit */
result = mvc_precommit(sql, 0, 0, id);
if (result < 0) {
- throw(SQL, "sql.trans", "2D000!PRECOMMIT: failed");
+ throw(SQL, "sql.precommit", "failed");
}
+
+ /* get the result set */
+ nr = *getArgReference_wrd(stk, pci, 2);
+ b = cntxt->sqlcontext;
+ if (mvc_export_affrows(b, b->out, nr, *w))
+ throw(SQL, "sql.precommit", "failed - could not get affected
rows");
return msg;
}
@@ -371,8 +379,9 @@ SQLpersistcommit(Client cntxt, MalBlkPtr
mvc *sql = NULL;
str msg;
int result;
- (void) stk;
- (void) pci;
+ backend *b = NULL;
+ wrd nr;
+ str *w = getArgReference_str(stk, pci, 3);
if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL)
return msg;
@@ -380,12 +389,19 @@ SQLpersistcommit(Client cntxt, MalBlkPtr
return msg;
if (sql->session->auto_commit != 0)
- throw(SQL, "sql.trans", "2DM30!PERSISTCOMMIT: not allowed in
auto commit mode");
-
+ throw(SQL, "sql.persistcommit", "persistcommit not allowed in
auto commit mode");
+
+ /* execute the persistcommit */
result = mvc_persistcommit(sql, 0, 0, id);
if (result < 0) {
- throw(SQL, "sql.trans", "2D000!PERSISTCOMMIT: failed");
+ throw(SQL, "sql.persistcommit", "failed");
}
+
+ /* get the result set */
+ nr = *getArgReference_wrd(stk, pci, 2);
+ b = cntxt->sqlcontext;
+ if (mvc_export_affrows(b, b->out, nr, *w))
+ throw(SQL, "sql.persistcommit", "failed - could not get
affected rows");
return msg;
}
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -55,10 +55,10 @@ pattern abort()
address SQLabort
comment "Trigger the abort operation for a MAL block";
-pattern precommit(id:lng)
+pattern precommit(id:lng) :int
address SQLprecommit
comment "Pre-commit changes, writing them only to the WAL.";
-pattern persistcommit(id:lng)
+pattern persistcommit(id:lng) :int
address SQLpersistcommit
comment "Persists the per-committed changes, rolling-forward the transaction.";
diff --git a/sql/scripts/85_htm.sql b/sql/scripts/85_htm.sql
--- a/sql/scripts/85_htm.sql
+++ b/sql/scripts/85_htm.sql
@@ -4,8 +4,8 @@
--
-- Copyright 2008-2015 MonetDB B.V.
-CREATE FUNCTION precommit(id bigint) RETURNS STRING
+CREATE PROCEDURE precommit(id bigint)
EXTERNAL name sql.precommit;
-CREATE FUNCTION persistcommit(id bigint) RETURNS STRING
+CREATE PROCEDURE persistcommit(id bigint)
EXTERNAL name sql.persistcommit;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list