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

WIP: String IDs

parent 6a3883be
Branches
Tags
3 merge requests!17Release 6.0,!15External String IDs,!11DRAFT: file system cleanup
Pipeline #41355 passed
...@@ -17,7 +17,6 @@ CREATE TABLE `entity_ids` ( ...@@ -17,7 +17,6 @@ CREATE TABLE `entity_ids` (
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- fill all existing entities into the new entity_ids table. -- fill all existing entities into the new entity_ids table.
INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id>0; INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id>0 AND role!="DOMAIN";
INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id=0;
UPDATE entity_ids SET id = internal_id; UPDATE entity_ids SET id = internal_id;
-- ALTER TABLE entity_ids CHANGE id id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'External ID of an entity. This is the id of an entity which is exposed via the CaosDB API.'; -- ALTER TABLE entity_ids CHANGE id id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'External ID of an entity. This is the id of an entity which is exposed via the CaosDB API.';
...@@ -297,7 +297,7 @@ READS SQL DATA ...@@ -297,7 +297,7 @@ READS SQL DATA
BEGIN BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
SELECT internal_id INTO InternalEntityID FROM entity_ids WHERE id = EntityID; SELECT temp.internal_id INTO InternalEntityID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1;
-- This implementation assumes that the distance from the head equals the -- This implementation assumes that the distance from the head equals the
-- difference between the _iversion numbers. This will not be correct anymore -- difference between the _iversion numbers. This will not be correct anymore
......
...@@ -47,9 +47,9 @@ BEGIN ...@@ -47,9 +47,9 @@ BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
DECLARE InternalDomainID INT UNSIGNED DEFAULT 0; DECLARE InternalDomainID INT UNSIGNED DEFAULT 0;
SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID; SELECT temp.internal_id INTO InternalDomainID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = DomainID UNION SELECT DomainID AS internal_id) AS temp LIMIT 1;
SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID; SELECT temp.internal_id INTO InternalEntityID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1;
SELECT internal_id INTO InternalPropertyID from entity_ids WHERE id = PropertyID; SELECT temp.internal_id INTO InternalPropertyID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = PropertyID UNION SELECT PropertyID AS internal_id) AS temp LIMIT 1;
CASE Datatable CASE Datatable
WHEN 'double_data' THEN WHEN 'double_data' THEN
...@@ -81,7 +81,7 @@ BEGIN ...@@ -81,7 +81,7 @@ BEGIN
END IF; END IF;
ELSE ELSE
SELECT internal_id INTO ReferenceValue FROM entity_ids WHERE id = PropertyValue; SELECT temp.internal_id INTO ReferenceValue FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = PropertyValue UNION SELECT PropertyValue AS internal_id) AS temp LIMIT 1;
END IF; END IF;
......
...@@ -34,20 +34,17 @@ delimiter // ...@@ -34,20 +34,17 @@ delimiter //
CREATE PROCEDURE db_5_0.registerSubdomain(in amount INT UNSIGNED) CREATE PROCEDURE db_5_0.registerSubdomain(in amount INT UNSIGNED)
BEGIN BEGIN
DECLARE ED INTEGER DEFAULT NULL; DECLARE ED INTEGER DEFAULT NULL;
DECLARE NewID INT UNSIGNED DEFAULT NULL;
SELECT COUNT(id) INTO ED FROM entities WHERE Role='DOMAIN' AND id!=0; SELECT COUNT(id) INTO ED FROM entities WHERE Role='DOMAIN' AND id!=0;
WHILE ED < amount DO WHILE ED < amount DO
INSERT INTO entities (description, role, acl) VALUES INSERT INTO entities (description, role, acl) VALUES
(NULL, 'DOMAIN', 0); (NULL, 'DOMAIN', 0);
SET NewID = LAST_INSERT_ID();
INSERT INTO entity_ids (internal_id) VALUES (NewID);
SET ED = ED + 1; SET ED = ED + 1;
END WHILE; END WHILE;
SELECT e.id as DomainID FROM entities AS i LEFT JOIN entity_ids AS e ON e.internal_id = i.id WHERE i.Role='DOMAIN' and e.internal_id!=0; SELECT e.id as DomainID FROM entities AS e WHERE e.Role='DOMAIN' and e.id!=0;
END; END;
// //
......
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2023 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2023 Timm Fitschen <t.fitschen@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* Retrieve the IDs of all direct children.
Parameters
==========
ParentID : INT UNSIGNED
The ID of the parent.
*/
DROP PROCEDURE IF EXISTS db_5_0.retrieveChildren;
delimiter //
CREATE PROCEDURE db_5_0.retrieveChildren(in ParentID INT UNSIGNED)
BEGIN
DECLARE InternalParentID INT UNSIGNED DEFAULT NULL;
SELECT internal_id INTO InternalParentID from entity_ids WHERE id = ParentID;
SELECT eids.id FROM isa_cache AS i JOIN entity_ids AS eids ON i.child = eids.internal_id WHERE i.parent=InternalParentID and i.rpath=i.child;
END;
//
delimiter ;
...@@ -37,15 +37,15 @@ retrieveOverridesBody: BEGIN ...@@ -37,15 +37,15 @@ retrieveOverridesBody: BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
DECLARE InternalDomainID INT UNSIGNED DEFAULT NULL; DECLARE InternalDomainID INT UNSIGNED DEFAULT NULL;
SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID; SELECT temp.internal_id INTO InternalDomainID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = DomainID UNION SELECT DomainID AS internal_id) AS temp LIMIT 1;
SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID; SELECT temp.internal_id INTO InternalEntityID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1;
IF is_feature_config("ENTITY_VERSIONING", "ENABLED") THEN IF is_feature_config("ENTITY_VERSIONING", "ENABLED") THEN
IF Version IS NOT NULL THEN IF Version IS NOT NULL THEN
IF InternalDomainID = 0 THEN IF InternalDomainID = 0 THEN
SELECT get_head_version(InternalEntityID) = Version INTO IsHead; SELECT get_head_version(EntityID) = Version INTO IsHead;
ELSE ELSE
SELECT get_head_version(InternalDomainID) = Version INTO IsHead; SELECT get_head_version(DomainID) = Version INTO IsHead;
END IF; END IF;
END IF; END IF;
...@@ -68,6 +68,7 @@ retrieveOverridesBody: BEGIN ...@@ -68,6 +68,7 @@ retrieveOverridesBody: BEGIN
NULL AS desc_override, NULL AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM archive_name_overrides FROM archive_name_overrides
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -83,6 +84,7 @@ retrieveOverridesBody: BEGIN ...@@ -83,6 +84,7 @@ retrieveOverridesBody: BEGIN
description AS desc_override, description AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM archive_desc_overrides FROM archive_desc_overrides
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -102,6 +104,7 @@ retrieveOverridesBody: BEGIN ...@@ -102,6 +104,7 @@ retrieveOverridesBody: BEGIN
AND property_id = 20 AND property_id = 20
LIMIT 1), datatype) AS type_override, LIMIT 1), datatype) AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM archive_data_type FROM archive_data_type
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -117,6 +120,7 @@ retrieveOverridesBody: BEGIN ...@@ -117,6 +120,7 @@ retrieveOverridesBody: BEGIN
NULL AS desc_override, NULL AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM archive_collection_type FROM archive_collection_type
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -133,6 +137,7 @@ retrieveOverridesBody: BEGIN ...@@ -133,6 +137,7 @@ retrieveOverridesBody: BEGIN
NULL AS desc_override, NULL AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM name_overrides FROM name_overrides
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -146,6 +151,7 @@ retrieveOverridesBody: BEGIN ...@@ -146,6 +151,7 @@ retrieveOverridesBody: BEGIN
description AS desc_override, description AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM desc_overrides FROM desc_overrides
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -162,6 +168,7 @@ retrieveOverridesBody: BEGIN ...@@ -162,6 +168,7 @@ retrieveOverridesBody: BEGIN
AND entity_ID = datatype AND entity_ID = datatype
AND property_id = 20 LIMIT 1), datatype) AS type_override, AND property_id = 20 LIMIT 1), datatype) AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM data_type FROM data_type
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
...@@ -175,6 +182,7 @@ retrieveOverridesBody: BEGIN ...@@ -175,6 +182,7 @@ retrieveOverridesBody: BEGIN
NULL AS desc_override, NULL AS desc_override,
NULL AS type_override, NULL AS type_override,
EntityID AS entity_id, EntityID AS entity_id,
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS property_id
FROM collection_type FROM collection_type
WHERE domain_id = InternalDomainID WHERE domain_id = InternalDomainID
......
...@@ -39,7 +39,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -39,7 +39,7 @@ retrieveEntityPropertiesBody: BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
DECLARE InternalDomainID INT UNSIGNED DEFAULT 0; DECLARE InternalDomainID INT UNSIGNED DEFAULT 0;
SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID; SELECT temp.internal_id INTO InternalEntityID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1;
SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID; SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID;
IF is_feature_config("ENTITY_VERSIONING", "ENABLED") THEN IF is_feature_config("ENTITY_VERSIONING", "ENABLED") THEN
...@@ -65,6 +65,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -65,6 +65,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- double properties #-- double properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -78,6 +79,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -78,6 +79,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- integer properties #-- integer properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -91,6 +93,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -91,6 +93,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- date properties #-- date properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
CONCAT(value, '.NULL.NULL') AS PropertyValue, CONCAT(value, '.NULL.NULL') AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -104,6 +107,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -104,6 +107,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- datetime properties #-- datetime properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
CONCAT(value, 'UTC', IF(value_ns IS NULL, '', value_ns)) CONCAT(value, 'UTC', IF(value_ns IS NULL, '', value_ns))
AS PropertyValue, AS PropertyValue,
...@@ -118,6 +122,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -118,6 +122,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- text properties #-- text properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -131,6 +136,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -131,6 +136,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- enum properties #-- enum properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -144,9 +150,12 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -144,9 +150,12 @@ retrieveEntityPropertiesBody: BEGIN
#-- reference properties #-- reference properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
IF(value_iversion IS NULL, IF(value_iversion IS NULL,
( SELECT id FROM entity_ids WHERE internal_id = value ), IF(status = "REPLACEMENT",
value,
( SELECT id FROM entity_ids WHERE internal_id = value )),
-- make it "value@version" if necessary -- make it "value@version" if necessary
CONCAT( CONCAT(
( SELECT id FROM entity_ids WHERE internal_id = value ), ( SELECT id FROM entity_ids WHERE internal_id = value ),
...@@ -163,6 +172,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -163,6 +172,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- null properties #-- null properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
NULL AS PropertyValue, NULL AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -176,6 +186,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -176,6 +186,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- name properties #-- name properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -192,6 +203,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -192,6 +203,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- double properties #-- double properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -204,6 +216,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -204,6 +216,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- integer properties #-- integer properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -216,6 +229,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -216,6 +229,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- date properties #-- date properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
CONCAT(value, '.NULL.NULL') AS PropertyValue, CONCAT(value, '.NULL.NULL') AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -228,6 +242,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -228,6 +242,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- datetime properties #-- datetime properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
CONCAT(value, 'UTC', IF(value_ns IS NULL, '', value_ns)) CONCAT(value, 'UTC', IF(value_ns IS NULL, '', value_ns))
AS PropertyValue, AS PropertyValue,
...@@ -241,6 +256,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -241,6 +256,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- text properties #-- text properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -253,6 +269,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -253,6 +269,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- enum properties #-- enum properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -265,9 +282,12 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -265,9 +282,12 @@ retrieveEntityPropertiesBody: BEGIN
#-- reference properties #-- reference properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
IF(value_iversion IS NULL, IF(value_iversion IS NULL,
( SELECT id FROM entity_ids WHERE internal_id = value ), IF(status = "REPLACEMENT",
value,
( SELECT id FROM entity_ids WHERE internal_id = value )),
-- make it "value@version" if necessary -- make it "value@version" if necessary
CONCAT( CONCAT(
( SELECT id FROM entity_ids WHERE internal_id = value ), ( SELECT id FROM entity_ids WHERE internal_id = value ),
...@@ -283,6 +303,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -283,6 +303,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- null properties #-- null properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
NULL AS PropertyValue, NULL AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
...@@ -295,6 +316,7 @@ retrieveEntityPropertiesBody: BEGIN ...@@ -295,6 +316,7 @@ retrieveEntityPropertiesBody: BEGIN
#-- name properties #-- name properties
SELECT SELECT
property_id AS InternalPropertyID,
( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID, ( SELECT id FROM entity_ids WHERE internal_id = property_id ) AS PropertyID,
value AS PropertyValue, value AS PropertyValue,
status AS PropertyStatus, status AS PropertyStatus,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment