Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
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-server
Commits
483ab16e
Verified
Commit
483ab16e
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Finalize MR
parent
bcceeb66
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/caosdb/server/query/RoleFilter.java
+10
-21
10 additions, 21 deletions
src/main/java/org/caosdb/server/query/RoleFilter.java
with
10 additions
and
21 deletions
src/main/java/org/caosdb/server/query/RoleFilter.java
+
10
−
21
View file @
483ab16e
...
...
@@ -91,30 +91,19 @@ public class RoleFilter implements EntityFilterInterface {
final
String
targetSet
,
final
boolean
versioned
)
throws
SQLException
{
if
(!
sourceSet
.
equals
(
"entities"
))
{
throw
new
UnsupportedOperationException
(
"SourceSet is supposed to be the `entities` table."
);
}
final
String
sql
=
(
"INSERT IGNORE INTO `"
+
targetSet
+
(
sourceSet
.
equals
(
"entities"
)
?
(
versioned
?
"` (id, _iversion) SELECT e.id, _get_head_iversion(e.id) FROM `entities` AS e WHERE e.role "
+
operator
+
" ? UNION SELECT a.id, a._iversion FROM `archive_entities` AS a WHERE a.role"
+
operator
+
"?"
:
"` (id) SELECT e.id FROM `entities` AS e WHERE e.role"
+
operator
+
"?"
)
// FIXME The second branch is probably never run. Remove completely and raise an
// exception instead?
:
(
versioned
?
"` (id, _iversion) SELECT s.id, s._iversion FROM `"
+
sourceSet
+
"` LEFT JOIN archive_entities AS a ON (s.id = a.id AND s._iversion = a._iversion) WHERE a.role"
+
operator
+
"? UNION SELECT s.id, s._iversion FROM `"
+
sourceSet
+
"` LEFT JOIN entities AS e ON (s.id = e.id) WHERE e.role"
+
operator
+
"? AND a._iversion = _get_head_iversion(s.id)"
:
"` (id) SELECT e.id FROM `entities` AS e WHERE e.role = ?"
)));
+
(
versioned
?
"` (id, _iversion) SELECT e.id, _get_head_iversion(e.id) FROM `entities` AS e WHERE e.role "
+
operator
+
" ? UNION SELECT a.id, a._iversion FROM `archive_entities` AS a WHERE a.role"
+
operator
+
"?"
:
"` (id) SELECT e.id FROM `entities` AS e WHERE e.role"
+
operator
+
"?"
));
final
PreparedStatement
filterRoleStmt
=
connection
.
prepareCall
(
sql
);
int
params
=
(
versioned
?
2
:
1
);
while
(
params
>
0
)
{
...
...
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