From b6114a6d8a6e1674b717818ea06c7c240f179b5e Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 29 Sep 2023 09:21:14 +0200 Subject: [PATCH] WIP: String IDs --- .../backend/implementation/MySQL/DatabaseUtils.java | 6 +++++- .../backend/implementation/MySQL/MySQLGetChildren.java | 3 +-- src/main/java/org/caosdb/server/entity/Role.java | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/DatabaseUtils.java b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/DatabaseUtils.java index f7d364ae..c87ef79a 100644 --- a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/DatabaseUtils.java +++ b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/DatabaseUtils.java @@ -152,7 +152,8 @@ public class DatabaseUtils { public static void parseOverrides(final List<ProtoProperty> properties, final ResultSet rs) throws SQLException { while (rs.next()) { - final int property_id = rs.getInt("property_id"); + int property_id = rs.getInt("property_id"); + if (rs.wasNull()) property_id = rs.getInt("InternalPropertyID"); for (final FlatProperty p : properties) { if (p.id == property_id) { final String name = bytes2UTF8(rs.getBytes("name_override")); @@ -181,6 +182,9 @@ public class DatabaseUtils { while (rs.next()) { ProtoProperty pp = new ProtoProperty(); pp.id = rs.getInt("PropertyID"); + if (rs.wasNull()) { + pp.id = rs.getInt("InternalPropertyID"); + } pp.value = bytes2UTF8(rs.getBytes("PropertyValue")); pp.status = bytes2UTF8(rs.getBytes("PropertyStatus")); pp.idx = rs.getInt("PropertyIndex"); diff --git a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLGetChildren.java b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLGetChildren.java index 3c1cebf1..64963941 100644 --- a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLGetChildren.java +++ b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLGetChildren.java @@ -37,8 +37,7 @@ public class MySQLGetChildren extends MySQLTransaction implements GetChildrenImp super(access); } - public static final String STMT_GET_CHILDREN = - "Select child from isa_cache where parent=? and rpath=child"; + public static final String STMT_GET_CHILDREN = "call retrieveChildren(?)"; @Override public List<EntityID> execute(final EntityID entity) throws TransactionException { diff --git a/src/main/java/org/caosdb/server/entity/Role.java b/src/main/java/org/caosdb/server/entity/Role.java index f86158a9..a2a97f92 100644 --- a/src/main/java/org/caosdb/server/entity/Role.java +++ b/src/main/java/org/caosdb/server/entity/Role.java @@ -32,7 +32,6 @@ import org.caosdb.server.entity.xml.ToElementStrategy; public enum Role { RecordType, Record, - Domain, File, Property, DataType, -- GitLab