Skip to content
Snippets Groups Projects
Verified Commit 190571f2 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: retrieve versioning history

parent 6d11e4f5
Branches
Tags
No related merge requests found
...@@ -317,7 +317,10 @@ BEGIN ...@@ -317,7 +317,10 @@ BEGIN
SELECT c.version AS child, SELECT c.version AS child,
NULL as parent, NULL as parent,
t.seconds AS child_seconds, t.seconds AS child_seconds,
t.nanos AS child_nanos t.nanos AS child_nanos,
t.srid AS child_srid,
t.username as child_username,
t.realm as child_realm
FROM entity_version AS c INNER JOIN transactions as t FROM entity_version AS c INNER JOIN transactions as t
ON ( c.srid = t.srid ) ON ( c.srid = t.srid )
WHERE c.entity_id = EntityID WHERE c.entity_id = EntityID
...@@ -331,7 +334,10 @@ BEGIN ...@@ -331,7 +334,10 @@ BEGIN
UNION SELECT c.version AS child, UNION SELECT c.version AS child,
p.version AS parent, p.version AS parent,
t.seconds AS child_seconds, t.seconds AS child_seconds,
t.nanos AS child_nanos t.nanos AS child_nanos,
t.srid AS child_srid,
t.username as child_username,
t.realm as child_realm
FROM entity_version AS p FROM entity_version AS p
INNER JOIN entity_version as c INNER JOIN entity_version as c
INNER JOIN transactions AS t INNER JOIN transactions AS t
......
...@@ -55,6 +55,9 @@ retrieveEntityBody: BEGIN ...@@ -55,6 +55,9 @@ retrieveEntityBody: BEGIN
DECLARE CollectionName VARCHAR(255) DEFAULT NULL; DECLARE CollectionName VARCHAR(255) DEFAULT NULL;
DECLARE VersionSeconds BIGINT UNSIGNED DEFAULT NULL; DECLARE VersionSeconds BIGINT UNSIGNED DEFAULT NULL;
DECLARE VersionNanos INT(10) UNSIGNED DEFAULT NULL; DECLARE VersionNanos INT(10) UNSIGNED DEFAULT NULL;
DECLARE VersionUser VARBINARY(255) DEFAULT NULL;
DECLARE VersionRealm VARBINARY(255) DEFAULT NULL;
DECLARE VersionSRID VARBINARY(255) DEFAULT NULL;
DECLARE IsHead BOOLEAN DEFAULT TRUE; DECLARE IsHead BOOLEAN DEFAULT TRUE;
DECLARE IVersion INT UNSIGNED DEFAULT NULL; DECLARE IVersion INT UNSIGNED DEFAULT NULL;
...@@ -70,14 +73,16 @@ retrieveEntityBody: BEGIN ...@@ -70,14 +73,16 @@ retrieveEntityBody: BEGIN
SELECT get_head_version(EntityID) = Version INTO IsHead; SELECT get_head_version(EntityID) = Version INTO IsHead;
END IF; END IF;
SELECT t.seconds, t.nanos SELECT t.seconds, t.nanos, t.username, t.realm, t.srid
INTO VersionSeconds, VersionNanos INTO VersionSeconds, VersionNanos, VersionUser,
VersionRealm, VersionSRID
FROM entity_version AS e FROM entity_version AS e
INNER JOIN transactions AS t INNER JOIN transactions AS t
ON ( e.srid = t.srid ) ON ( e.srid = t.srid )
WHERE e.entity_id = EntityID WHERE e.entity_id = EntityID
AND e.version = Version; AND e.version = Version;
IF IsHead IS FALSE THEN IF IsHead IS FALSE THEN
SET IVersion=get_iversion(EntityID, Version); SET IVersion=get_iversion(EntityID, Version);
...@@ -189,7 +194,10 @@ retrieveEntityBody: BEGIN ...@@ -189,7 +194,10 @@ retrieveEntityBody: BEGIN
(SELECT acl FROM entity_acl AS a WHERE a.id = e.acl) AS ACL, (SELECT acl FROM entity_acl AS a WHERE a.id = e.acl) AS ACL,
Version AS Version, Version AS Version,
VersionSeconds AS VersionSeconds, VersionSeconds AS VersionSeconds,
VersionNanos AS VersionNanos VersionNanos AS VersionNanos,
VersionUser AS VersionUser,
VersionRealm AS VersionRealm,
VersionSRID AS VersionSRID
FROM entities e WHERE id = EntityID LIMIT 1; FROM entities e WHERE id = EntityID LIMIT 1;
END; END;
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment