diff --git a/tests/test_entity_versioning.sql b/tests/test_entity_versioning.sql index de4c6498856b4a9ed80bd195d98e39568c72e246..ad321c2584e24f3ef76c57c5461068efb6e710ea 100644 --- a/tests/test_entity_versioning.sql +++ b/tests/test_entity_versioning.sql @@ -34,6 +34,13 @@ CALL tap.no_plan(); -- SETUP +SET @EntityID1 = 10001; +SET @EntityID2 = 10002; +SET @EntityID3 = 10003; +SET @EntityID4 = 10004; +SET @EntityID5 = 10005; +SET @EntityID6 = 10006; + -- Disable versioning because we want to test `insert_single_child_version` -- separately from `insertEntity` but the former is called inside the latter -- when versioning is enabled. @@ -46,22 +53,22 @@ INSERT INTO transactions (srid,seconds,nanos,username,realm) VALUES ("SRIDblieb", 3456, 4576, "you", "home"); DELETE FROM entities WHERE id > 99; CALL entityACL(@ACLID1, "{acl1}"); -CALL insertEntity("EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); -SELECT entity_id INTO @EntityID FROM name_data WHERE value="EntityName"; +CALL insertEntity(@EntityID1, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); +SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; -- TEST insert_single_child_version SELECT count(*) INTO @x FROM entity_version; SELECT tap.eq(@x, 0, "no versions there yet"); -CALL insert_single_child_version(@EntityID, "hashbla", "versionbla", NULL, "SRIDbla"); +CALL insert_single_child_version(@InternalEntityID, "hashbla", "versionbla", NULL, "SRIDbla"); SELECT _ipparent INTO @x from entity_version WHERE version="versionbla"; SELECT tap.eq(@x, NULL, "no parent for the first version"); -- add a second version SELECT count(*) INTO @x FROM entity_version; SELECT tap.eq(@x, 1, "one version there already"); -CALL insert_single_child_version(@EntityID, "hashblub", "versionblub", "versionbla", "SRIDblub"); +CALL insert_single_child_version(@InternalEntityID, "hashblub", "versionblub", "versionbla", "SRIDblub"); SELECT _ipparent INTO @x from entity_version WHERE version="versionblub"; SELECT tap.eq(@x, 1, "the original entity is the parent"); @@ -72,7 +79,7 @@ SELECT tap.eq(@x, 2, "two versions there already"); CALL tap._assert_throws( concat("CALL insert_single_child_version(", - @EntityID, ', "hashblieb", "versionblieb", "non-existing-parent", "SRIDBlieb")'), + @InternalEntityID, ', "hashblieb", "versionblieb", "non-existing-parent", "SRIDBlieb")'), "non existing parent throws"); SELECT count(*) INTO @x FROM entity_version; @@ -80,15 +87,15 @@ SELECT tap.eq(@x, 2, "still two versions there"); -- TEST get_primary_parent_version -SELECT tap.eq(get_primary_parent_version(@EntityID, "versionblub"), "versionbla", "returns correct parent for versionblub"); -SELECT tap.eq(get_primary_parent_version(@EntityID, "versionbla"), NULL, "versionbla has no parent"); +SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionblub"), "versionbla", "returns correct parent for versionblub"); +SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionbla"), NULL, "versionbla has no parent"); -- TEST delete_all_entity_versions SELECT count(*) INTO @x FROM entity_version; SELECT tap.ok(@x > 0, "several versions in the table"); -CALL delete_all_entity_versions(@EntityID); +CALL delete_all_entity_versions(@EntityID1); SELECT count(*) INTO @x FROM entity_version; SELECT tap.eq(@x, 0, "no versions there any more"); @@ -109,20 +116,20 @@ SELECT tap.eq(@x, 0, "before insertEntity, no versions there"); -- TEST insertEntity - should produce a version w/o parent SET @SRID = "SRIDbla"; -CALL insertEntity("EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); -SELECT entity_id INTO @EntityID FROM name_data WHERE value="EntityName"; -CALL insertEntity("ParentName", "ParentDesc", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); +SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; +CALL insertEntity(@EntityID3, "ParentName", "ParentDesc", "RECORDTYPE", "{acl1}"); SELECT entity_id INTO @ParentID FROM name_data WHERE value="ParentName"; -CALL insertIsa(@EntityID, @ParentID); -CALL insertEntityProperty(0, @EntityID, 17, "null_data", NULL, NULL, +CALL insertIsa(@EntityID2, @EntityID3); +CALL insertEntityProperty(0, @EntityID2, 17, "null_data", NULL, NULL, "RECOMMENDED", NULL, "DescOverride", NULL, NULL, 0); -SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @EntityID; +SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT tap.eq(@x, 1, "after insertEntity, a version is there."); -SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @EntityID and _ipparent is NULL; +SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent is NULL; SELECT tap.eq(@x, 1, "after insertEntity, the _iversion number is 1."); -SELECT _ipparent INTO @x from entity_version WHERE entity_id = @EntityID; +SELECT _ipparent INTO @x from entity_version WHERE entity_id = @InternalEntityID; SELECT tap.eq(@x, NULL, "no parent for the freshly inserted entity"); SELECT tap.eq(count(*), 0, "no entity in archive_entities before first update") FROM archive_entities; @@ -130,14 +137,14 @@ SELECT tap.eq(count(*), 0, "no entity in archive_entities before first update") -- TEST updateEntity - should produce a version with a parent SET @SRID = "SRIDblub"; -CALL deleteEntityProperties(@EntityID); -CALL updateEntity(@EntityID, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl1}"); -SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @EntityID; +CALL deleteEntityProperties(@EntityID2); +CALL updateEntity(@EntityID2, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl1}"); +SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT tap.eq(@x, 2, "after updateEntity, a second version is there."); -SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @EntityID and _ipparent = 1; +SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 1; SELECT tap.eq(@x, 2, "after updateEntity, the _iversion number incremented."); -SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @EntityID and _ipparent = 1; +SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 1; SELECT tap.eq(@x, 1, "after updateEntity, the _pparent points to the first version"); SELECT tap.eq(count(*), 1, "after updateEntity, one entity in archive_entities") @@ -145,60 +152,60 @@ SELECT tap.eq(count(*), 1, "after updateEntity, one entity in archive_entities") -- TEST get_version_history -CALL get_version_history(@EntityID); +CALL get_version_history(@EntityID2); -- TEST retrieveEntity SELECT version INTO @x FROM entity_version - WHERE entity_id = @EntityID + WHERE entity_id = @InternalEntityID AND _iversion = 2; -CALL retrieveEntity(@EntityID, NULL); -CALL retrieveEntity(@EntityID, "non-existing-version"); -CALL retrieveEntity(@EntityID, get_head_version(@EntityID)); -CALL retrieveEntity(@EntityID, @x); +CALL retrieveEntity(@EntityID2, NULL); +CALL retrieveEntity(@EntityID2, "non-existing-version"); +CALL retrieveEntity(@EntityID2, get_head_version(@EntityID2)); +CALL retrieveEntity(@EntityID2, @x); -- TEST retrieveEntityParents -CALL retrieveEntityParents(@EntityID, NULL); -CALL retrieveEntityParents(@EntityID, "non-existing-version"); -CALL retrieveEntityParents(@EntityID, get_head_version(@EntityID)); -CALL retrieveEntityParents(@EntityID, @x); +CALL retrieveEntityParents(@EntityID2, NULL); +CALL retrieveEntityParents(@EntityID2, "non-existing-version"); +CALL retrieveEntityParents(@EntityID2, get_head_version(@EntityID2)); +CALL retrieveEntityParents(@EntityID2, @x); -- TEST retrieveEntityProperties -CALL retrieveEntityProperties(0, @EntityID, NULL); -CALL retrieveEntityProperties(0, @EntityID, "non-existing-version"); -CALL retrieveEntityProperties(0, @EntityID, get_head_version(@EntityID)); -CALL retrieveEntityProperties(0, @EntityID, @x); +CALL retrieveEntityProperties(0, @EntityID2, NULL); +CALL retrieveEntityProperties(0, @EntityID2, "non-existing-version"); +CALL retrieveEntityProperties(0, @EntityID2, get_head_version(@EntityID2)); +CALL retrieveEntityProperties(0, @EntityID2, @x); -- TEST retrieveOverrides -CALL retrieveOverrides(0, @EntityID, NULL); -CALL retrieveOverrides(0, @EntityID, "non-existing-version"); -CALL retrieveOverrides(0, @EntityID, get_head_version(@EntityID)); -CALL retrieveOverrides(0, @EntityID, @x); +CALL retrieveOverrides(0, @EntityID2, NULL); +CALL retrieveOverrides(0, @EntityID2, "non-existing-version"); +CALL retrieveOverrides(0, @EntityID2, get_head_version(@EntityID2)); +CALL retrieveOverrides(0, @EntityID2, @x); -- and 2nd updateEntity SET @SRID = "SRIDblieb"; -CALL updateEntity(@EntityID, "EntityName", "EntityDesc", "RECORDTYPE", NULL, NULL, "{acl1}"); -SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @EntityID; +CALL updateEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", NULL, NULL, "{acl1}"); +SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT tap.eq(@x, 3, "after 2nd updateEntity, a 3rd version is there."); -SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @EntityID and _ipparent = 2; +SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 2; SELECT tap.eq(@x, 3, "after 2nd updateEntity, the _iversion number incremented again."); -SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @EntityID and _iversion = 3; +SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _iversion = 3; SELECT tap.eq(@x, 2, "after 2nd updateEntity, the _pparent points to the 2nd version"); -SELECT tap.eq("SRIDblieb", srid, "correct transaction was stored") FROM entity_version WHERE entity_id = @EntityID AND _ipparent = 2; +SELECT tap.eq("SRIDblieb", srid, "correct transaction was stored") FROM entity_version WHERE entity_id = @InternalEntityID AND _ipparent = 2; -- TEST deleteEntity - should remove all versions -CALL deleteIsa(@EntityID); -CALL deleteEntity(@EntityID); -SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @EntityID; +CALL deleteIsa(@EntityID3); +CALL deleteEntity(@EntityID2); +SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT tap.eq(@x, 0, "no versions there any more"); -CALL deleteEntity(@ParentID); +CALL deleteEntity(@EntityID3); CALL tap.finish(); ROLLBACK; @@ -218,21 +225,21 @@ DELETE FROM transactions; -- insert entity without versioning DELETE FROM feature_config WHERE _key = "ENTITY_VERSIONING"; CALL entityACL(@ACLID1, "{acl1}"); -CALL insertEntity("EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID4, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); SELECT count(*) INTO @NumOfEntities FROM entities; -SELECT entity_id INTO @EntityID FROM name_data WHERE value="EntityName"; +SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; SET @TheUser = "TheUser"; -- used to identify the matching entry in transaction_log -- fill transaction_log: one entity with two updates (and one insert) and another entity with insert and delete. INSERT INTO transaction_log (transaction, entity_id, username, realm, seconds, nanos) -- the first entry is the one which is be found by _fix_unversioned VALUES - ("Update", @EntityID, @TheUser, "CaosDB", 23458, 254), + ("Update", @InternalEntityID, @TheUser, "CaosDB", 23458, 254), -- the rest is dummy data - ("Update", @EntityID, "OtherUser", "CaosDB", 2345, 633), -- not the latest transaction - ("Insert", @EntityID, "OtherUser", "CaosDB", 245, 633), -- not the latest transaction - ("Insert", @EntityID + 1, @TheUser, "CaosDB", 2325, 653), -- not the right entity, inserted before our target - ("Delete", @EntityID + 1, @TheUser, "CaosDB", 232526, 653); -- not the right entity, deleted after our target + ("Update", @InternalEntityID, "OtherUser", "CaosDB", 2345, 633), -- not the latest transaction + ("Insert", @InternalEntityID, "OtherUser", "CaosDB", 245, 633), -- not the latest transaction + ("Insert", @InternalEntityID + 1, @TheUser, "CaosDB", 2325, 653), -- not the right entity, inserted before our target + ("Delete", @InternalEntityID + 1, @TheUser, "CaosDB", 232526, 653); -- not the right entity, deleted after our target SELECT tap.eq(COUNT(*), 5, "five entries in transaction_log") FROM transaction_log; @@ -252,11 +259,11 @@ SELECT tap.eq(COUNT(*), 2, "after _fix_unversioned, one entry for our test entity in transactions, one for the standard entities.") FROM transactions; -SELECT tap.eq(entity_id, @EntityID, "versioned entity has correct id") FROM entity_version WHERE entity_id > 99; +SELECT tap.eq(entity_id, @InternalEntityID, "versioned entity has correct id") FROM entity_version WHERE entity_id > 99; SELECT tap.ok(srid IS NOT NULL, "srid was generated and user/time matches entries from transaction_log") FROM transactions AS t JOIN transaction_log AS l ON (l.seconds = t.seconds AND l.nanos = t.nanos AND l.username = t.username AND l.realm = t.realm) - WHERE l.entity_id = @EntityID AND l.username = @TheUser; + WHERE l.entity_id = @InternalEntityID AND l.username = @TheUser; CALL tap.finish(); ROLLBACK; @@ -276,18 +283,18 @@ DELETE FROM transactions; DELETE FROM feature_config WHERE _key = "ENTITY_VERSIONING"; CALL entityACL(@ACLID1, "{acl1}"); -CALL insertEntity("EntityName1", "EntityDesc1", "RECORDTYPE", "{acl1}"); -CALL insertEntity("EntityName2", "EntityDesc2", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID5, "EntityName1", "EntityDesc1", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID6, "EntityName2", "EntityDesc2", "RECORDTYPE", "{acl1}"); SELECT count(*) INTO @NumOfEntities FROM entities; -SELECT entity_id INTO @EntityID1 FROM name_data WHERE value="EntityName1"; -SELECT entity_id INTO @EntityID2 FROM name_data WHERE value="EntityName2"; +SELECT entity_id INTO @InternalEntityID1 FROM name_data WHERE value="EntityName1"; +SELECT entity_id INTO @InternalEntityID2 FROM name_data WHERE value="EntityName2"; INSERT INTO transaction_log (transaction, entity_id, username, realm, seconds, nanos) -- the first entry is the one which will be found by _fix_unversioned - VALUES ("INSERT", @EntityID1, "User", "CaosDB", 10000, 250), - ("INSERT", @EntityID2, "User", "CaosDB", 10000, 250), - ("UPDATE", @EntityID2, "User", "CaosDB", 20000, 250); + VALUES ("INSERT", @InternalEntityID1, "User", "CaosDB", 10000, 250), + ("INSERT", @InternalEntityID2, "User", "CaosDB", 10000, 250), + ("UPDATE", @InternalEntityID2, "User", "CaosDB", 20000, 250); SELECT tap.eq(COUNT(*), 3, "three entries in transaction_log") FROM transaction_log; @@ -310,10 +317,10 @@ SELECT tap.eq(COUNT(*), 3, SELECT tap.eq(seconds, 10000, "version seconds of entity 1 is correct") FROM entity_version AS v JOIN transactions AS t - ON (v.srid = t.srid) WHERE v.entity_id = @EntityID1; + ON (v.srid = t.srid) WHERE v.entity_id = @InternalEntityID1; SELECT tap.eq(seconds, 20000, "version seconds of entity 2 is correct") FROM entity_version AS v JOIN transactions AS t - ON (v.srid = t.srid) WHERE v.entity_id = @EntityID2; + ON (v.srid = t.srid) WHERE v.entity_id = @InternalEntityID2; CALL tap.finish(); ROLLBACK; diff --git a/tests/test_insert_update_delete.sql b/tests/test_insert_update_delete.sql index a11b05e3d9a72d6038800adebf5b73c699c2a2b8..20b3a3f59098a15a3ae8036f1a86d2ec9a17b805 100644 --- a/tests/test_insert_update_delete.sql +++ b/tests/test_insert_update_delete.sql @@ -4,6 +4,9 @@ CALL tap.no_plan(); -- SETUP +SET @EntityID1 = 10001; +SET @EntityID2 = 10002; + -- Disable versioning and only test the non-versioning behavior DELETE FROM feature_config WHERE _key = "ENTITY_VERSIONING"; @@ -16,31 +19,31 @@ SELECT entity_id into @TextDatatypeID FROM name_data WHERE value ="TEXT"; -- TEST insertEntity SELECT tap.eq(COUNT(id), 0, "No entities") FROM entities WHERE id>=100; -CALL insertEntity("EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID1, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); SELECT tap.eq(COUNT(entity_id), 1, "Entity has been inserted") FROM name_data WHERE value="EntityName"; -SELECT entity_id INTO @EntityID FROM name_data WHERE value="EntityName"; -SELECT tap.ok(@EntityID >= 100, "EntityID greater 99"); +SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; +SELECT tap.ok(@InternalEntityID >= 100, "EntityID greater 99"); SELECT tap.eq(acl, @ACLID1, "correct acl id had been assigned") - FROM entities WHERE id=@EntityID; + FROM entities WHERE id=@InternalEntityID; -- TEST insertEntityProperty -CALL insertEntity("AProperty", "APropDesc", "PROPERTY", "{acl1}"); -SELECT entity_id INTO @PropID FROM name_data WHERE value="AProperty"; -INSERT INTO data_type (domain_id, entity_id, property_id, datatype) VALUES (0, 0, @PropID, @TextDatatypeID); +CALL insertEntity(@EntityID2, "AProperty", "APropDesc", "PROPERTY", "{acl1}"); +SELECT entity_id INTO @InternalPropertyID FROM name_data WHERE value="AProperty"; +INSERT INTO data_type (domain_id, entity_id, property_id, datatype) VALUES (0, 0, @InternalPropertyID, @TextDatatypeID); SELECT COUNT(*) INTO @x FROM null_data; SELECT tap.eq(@x, 0, "No data in null_data table"); -CALL insertEntityProperty(0, @EntityID, @PropID, "null_data", NULL, NULL, "RECOMMENDED", NULL, NULL, NULL, NULL, 0); +CALL insertEntityProperty(0, @EntityID1, @EntityID2, "null_data", NULL, NULL, "RECOMMENDED", NULL, NULL, NULL, NULL, 0); SELECT COUNT(*) INTO @x FROM null_data; SELECT tap.eq(@x, 1, "One row in null_data table"); -- TEST updateEntity -CALL updateEntity(@EntityID, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl2}"); +CALL updateEntity(@EntityID1, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl2}"); SELECT tap.eq(COUNT(entity_id), 0, "Old Entity name not present") FROM name_data WHERE value="EntityName"; @@ -48,21 +51,21 @@ SELECT tap.eq(COUNT(entity_id), 1, "Entity name has been updated") FROM name_data WHERE value="NewEntityName"; SELECT tap.eq(acl, @ACLID2, "acl has been updated") - FROM entities WHERE id=@EntityID; + FROM entities WHERE id=@InternalEntityID; -- CALL updateEntity again an update the Name -CALL updateEntity(@EntityID, "NewerEntityName", "NewerEntityDesc", "RECORD", NULL, NULL, "{acl2}"); -CALL updateEntity(@EntityID, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl2}"); +CALL updateEntity(@EntityID2, "NewerEntityName", "NewerEntityDesc", "RECORD", NULL, NULL, "{acl2}"); +CALL updateEntity(@EntityID2, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl2}"); -- TEST deleteEntityProperties -CALL deleteEntityProperties(@EntityID); +CALL deleteEntityProperties(@EntityID1); SELECT COUNT(*) INTO @x FROM null_data; SELECT tap.eq(@x, 0, "data removed from null_data table"); -- TEST deleteEntity -CALL deleteEntity(@EntityID); -CALL deleteEntity(@PropID); +CALL deleteEntity(@EntityID1); +CALL deleteEntity(@EntityID2); SELECT COUNT(id) INTO @x FROM entities WHERE id>100; SELECT tap.eq(@x, 0, "entity deleted"); diff --git a/tests/test_issues.sql b/tests/test_issues.sql index ab64de844e01c2ad3e273d6ea1e0c24709781a09..ded706adb4b78b399c6890d2349e285d2b4cacef 100644 --- a/tests/test_issues.sql +++ b/tests/test_issues.sql @@ -1,5 +1,4 @@ /** - * ** header v3.0 * This file is a part of the CaosDB Project. * * Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> @@ -25,6 +24,10 @@ USE _caosdb_schema_unit_tests; BEGIN; CALL tap.no_plan(); +SET @EntityID1 = 10001; +SET @EntityID2 = 10002; +SET @EntityID3 = 10003; +SET @EntityID4 = 10004; -- ######################################################################## -- TEST Issues from https://gitlab.com/caosdb/caosdb-mysqlbackend/-/issues @@ -42,23 +45,18 @@ INSERT INTO transactions (srid,seconds,nanos,username,realm) VALUES CALL entityACL(@ACLID1, "{acl1}"); -- Insert entities and obtain IDs -CALL insertEntity("A", "Desc A", "RECORDTYPE", "{acl1}"); -CALL insertEntity("B", "Desc B", "RECORDTYPE", "{acl1}"); -CALL insertEntity("C", "Desc C", "RECORDTYPE", "{acl1}"); -CALL insertEntity("rec", "Desc rec", "RECORD", "{acl1}"); - -SELECT entity_id INTO @ID_A FROM name_data WHERE value="A"; -SELECT entity_id INTO @ID_B FROM name_data WHERE value="B"; -SELECT entity_id INTO @ID_C FROM name_data WHERE value="C"; -SELECT entity_id INTO @ID_rec FROM name_data WHERE value="rec"; +CALL insertEntity(@EntityID1, "A", "Desc A", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID2, "B", "Desc B", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID3, "C", "Desc C", "RECORDTYPE", "{acl1}"); +CALL insertEntity(@EntityID4, "rec", "Desc rec", "RECORD", "{acl1}"); -- Insert is-a relationships -CALL insertIsA(@ID_A, @ID_B); -CALL insertIsA(@ID_B, @ID_C); -CALL insertIsA(@ID_rec, @ID_A); +CALL insertIsA(@EntityID1, @EntityID2); +CALL insertIsA(@EntityID2, @EntityID3); +CALL insertIsA(@EntityID4, @EntityID1); -- Try to delete last child -- leads to failure in issue #21 -CALL deleteIsa(@ID_rec); +CALL deleteIsa(@EntityID4); ROLLBACK;