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
No related tags found
No related merge requests found
......@@ -317,7 +317,10 @@ BEGIN
SELECT c.version AS child,
NULL as parent,
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
ON ( c.srid = t.srid )
WHERE c.entity_id = EntityID
......@@ -331,7 +334,10 @@ BEGIN
UNION SELECT c.version AS child,
p.version AS parent,
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
INNER JOIN entity_version as c
INNER JOIN transactions AS t
......
......@@ -55,6 +55,9 @@ retrieveEntityBody: BEGIN
DECLARE CollectionName VARCHAR(255) DEFAULT NULL;
DECLARE VersionSeconds BIGINT 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 IVersion INT UNSIGNED DEFAULT NULL;
......@@ -70,14 +73,16 @@ retrieveEntityBody: BEGIN
SELECT get_head_version(EntityID) = Version INTO IsHead;
END IF;
SELECT t.seconds, t.nanos
INTO VersionSeconds, VersionNanos
SELECT t.seconds, t.nanos, t.username, t.realm, t.srid
INTO VersionSeconds, VersionNanos, VersionUser,
VersionRealm, VersionSRID
FROM entity_version AS e
INNER JOIN transactions AS t
ON ( e.srid = t.srid )
WHERE e.entity_id = EntityID
AND e.version = Version;
IF IsHead IS FALSE THEN
SET IVersion=get_iversion(EntityID, Version);
......@@ -189,7 +194,10 @@ retrieveEntityBody: BEGIN
(SELECT acl FROM entity_acl AS a WHERE a.id = e.acl) AS ACL,
Version AS Version,
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;
END;
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment