Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-mysqlbackend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-mysqlbackend
Commits
6bdfb8fe
Verified
Commit
6bdfb8fe
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: EHN: version history
parent
5fb99009
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
procedures/entityVersioning.sql
+10
-5
10 additions, 5 deletions
procedures/entityVersioning.sql
procedures/retrieveEntity.sql
+2
-16
2 additions, 16 deletions
procedures/retrieveEntity.sql
with
12 additions
and
21 deletions
procedures/entityVersioning.sql
+
10
−
5
View file @
6bdfb8fe
...
...
@@ -330,7 +330,8 @@ END;
DROP
PROCEDURE
IF
EXISTS
db_2_0
.
get_version_history
//
/**
* Select version timestamps of an entity.
* Select the complete transaction history of an entity (Who created which
* version and when).
*
* Parameters
* ----------
...
...
@@ -339,8 +340,8 @@ DROP PROCEDURE IF EXISTS db_2_0.get_version_history //
*
* Selects
* -------
* Tuples (child, parent, child_seconds, child_nanos
). `
child
` and `parent` are
* version IDs.
* Tuples (child, parent, child_seconds, child_nanos
,
child
_username,
*
child_realm). `child` and `parent` are
version IDs.
*/
CREATE
PROCEDURE
db_2_0
.
get_version_history
(
in
EntityID
INT
UNSIGNED
)
...
...
@@ -349,7 +350,9 @@ 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
.
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
...
...
@@ -363,7 +366,9 @@ 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
.
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
...
...
This diff is collapsed.
Click to expand it.
procedures/retrieveEntity.sql
+
2
−
16
View file @
6bdfb8fe
...
...
@@ -53,8 +53,6 @@ retrieveEntityBody: BEGIN
DECLARE
FileHash
VARCHAR
(
255
)
DEFAULT
NULL
;
DECLARE
DatatypeID
INT
UNSIGNED
DEFAULT
NULL
;
DECLARE
CollectionName
VARCHAR
(
255
)
DEFAULT
NULL
;
DECLARE
VersionSeconds
BIGINT
UNSIGNED
DEFAULT
NULL
;
DECLARE
VersionNanos
INT
(
10
)
UNSIGNED
DEFAULT
NULL
;
DECLARE
IsHead
BOOLEAN
DEFAULT
TRUE
;
DECLARE
IVersion
INT
UNSIGNED
DEFAULT
NULL
;
...
...
@@ -70,14 +68,6 @@ retrieveEntityBody: BEGIN
SELECT
get_head_version
(
EntityID
)
=
Version
INTO
IsHead
;
END
IF
;
SELECT
t
.
seconds
,
t
.
nanos
INTO
VersionSeconds
,
VersionNanos
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
);
...
...
@@ -136,9 +126,7 @@ retrieveEntityBody: BEGIN
FilePath
AS
FilePath
,
FileHash
AS
FileHash
,
(
SELECT
acl
FROM
entity_acl
AS
a
WHERE
a
.
id
=
e
.
acl
)
AS
ACL
,
Version
AS
Version
,
VersionSeconds
AS
VersionSeconds
,
VersionNanos
AS
VersionNanos
Version
AS
Version
FROM
archive_entities
AS
e
WHERE
e
.
id
=
EntityID
AND
e
.
_iversion
=
IVersion
...
...
@@ -187,9 +175,7 @@ retrieveEntityBody: BEGIN
FilePath
AS
FilePath
,
FileHash
AS
FileHash
,
(
SELECT
acl
FROM
entity_acl
AS
a
WHERE
a
.
id
=
e
.
acl
)
AS
ACL
,
Version
AS
Version
,
VersionSeconds
AS
VersionSeconds
,
VersionNanos
AS
VersionNanos
Version
AS
Version
FROM
entities
e
WHERE
id
=
EntityID
LIMIT
1
;
END
;
//
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment