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

WIP: string ids

parent f9ecefef
Branches
Tags
3 merge requests!17Release 6.0,!15External String IDs,!11DRAFT: file system cleanup
Pipeline #41560 failed
...@@ -10,7 +10,7 @@ DROP PROCEDURE IF EXISTS setPassword; ...@@ -10,7 +10,7 @@ DROP PROCEDURE IF EXISTS setPassword;
-- new entity_ids table -- new entity_ids table
DROP TABLE IF EXISTS `entity_ids`; DROP TABLE IF EXISTS `entity_ids`;
CREATE TABLE `entity_ids` ( CREATE TABLE `entity_ids` (
`id` int(10) unsigned NOT NULL, `id` VARCHAR(255) NOT NULL,
`internal_id` int(10) unsigned NOT NULL COMMENT 'Internal ID of an entity. This id is used internally in the *_data tables and elsewhere. This ID is never exposed via the CaosDB API.', `internal_id` int(10) unsigned NOT NULL COMMENT 'Internal ID of an entity. This id is used internally in the *_data tables and elsewhere. This ID is never exposed via the CaosDB API.',
PRIMARY KEY `entity_ids_pk` (`id`), PRIMARY KEY `entity_ids_pk` (`id`),
CONSTRAINT `entity_ids_internal_id` FOREIGN KEY (`internal_id`) REFERENCES `entities` (`id`) CONSTRAINT `entity_ids_internal_id` FOREIGN KEY (`internal_id`) REFERENCES `entities` (`id`)
...@@ -18,5 +18,3 @@ CREATE TABLE `entity_ids` ( ...@@ -18,5 +18,3 @@ CREATE TABLE `entity_ids` (
-- 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 AND role!="DOMAIN"; INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id>0 AND role!="DOMAIN";
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.';
...@@ -38,8 +38,8 @@ delimiter // ...@@ -38,8 +38,8 @@ delimiter //
* EntityID : VARCHAR(255) * EntityID : VARCHAR(255)
* The entity id. * The entity id.
* *
* Selects * ResultSet
* ------- * ---------
* EntityID : VARCHAR(255) * EntityID : VARCHAR(255)
* *
*/ */
...@@ -85,8 +85,7 @@ BEGIN ...@@ -85,8 +85,7 @@ BEGIN
INSERT IGNORE INTO refering (id) SELECT entity_id from data_type WHERE datatype=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO refering (id) SELECT entity_id from data_type WHERE datatype=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id from data_type WHERE datatype=InternalEntityID; INSERT IGNORE INTO refering (id) SELECT domain_id from data_type WHERE datatype=InternalEntityID;
-- TODO activate after `retrieveChildren` has been removed. INSERT IGNORE INTO refering (id) SELECT child FROM isa_cache WHERE parent = InternalEntityID AND rpath=child;
-- INSERT IGNORE INTO refering (id) SELECT child FROM isa_cache WHERE parent = InternalParentID AND rpath=child;
SELECT e.id FROM refering AS r LEFT JOIN entity_ids AS e ON r.id = e.internal_id WHERE r.id!=0 AND e.internal_id!=InternalEntityID; SELECT e.id FROM refering AS r LEFT JOIN entity_ids AS e ON r.id = e.internal_id WHERE r.id!=0 AND e.internal_id!=InternalEntityID;
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
*/ */
DROP PROCEDURE IF EXISTS db_5_0.insertFile; DROP PROCEDURE IF EXISTS db_5_0.insertFile;
/*
DELIMITER // DELIMITER //
*/
/* /*
* Insert the file properties of a File entity. * Insert the file properties of a File entity.
...@@ -36,6 +38,8 @@ DELIMITER // ...@@ -36,6 +38,8 @@ DELIMITER //
* FileSize : BIGINT UNSIGNED * FileSize : BIGINT UNSIGNED
* Size of the file in bytes. * Size of the file in bytes.
*/ */
/*
CREATE PROCEDURE db_5_0.insertFile(in EntityID VARCHAR(255), in Hash VARCHAR(255), in FileSize BIGINT UNSIGNED, in FilePath TEXT) CREATE PROCEDURE db_5_0.insertFile(in EntityID VARCHAR(255), in Hash VARCHAR(255), in FileSize BIGINT UNSIGNED, in FilePath TEXT)
BEGIN BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
...@@ -46,3 +50,4 @@ BEGIN ...@@ -46,3 +50,4 @@ BEGIN
END; END;
// //
DELIMITER ; DELIMITER ;
*/
/*
* 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/>.
*/
-- TODO: REMOVE
DROP PROCEDURE IF EXISTS db_5_0.retrieveChildren;
delimiter //
CREATE PROCEDURE db_5_0.retrieveChildren(in ParentID VARCHAR(255))
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 ;
...@@ -2733,12 +2733,5 @@ SELECT tap.procedure_is_deterministic('_caosdb_schema_unit_tests','insert_single ...@@ -2733,12 +2733,5 @@ SELECT tap.procedure_is_deterministic('_caosdb_schema_unit_tests','insert_single
SELECT tap.procedure_security_type_is('_caosdb_schema_unit_tests','insert_single_child_version','DEFINER',''); SELECT tap.procedure_security_type_is('_caosdb_schema_unit_tests','insert_single_child_version','DEFINER','');
SELECT tap.procedure_sql_data_access_is('_caosdb_schema_unit_tests','insert_single_child_version','CONTAINS SQL',''); SELECT tap.procedure_sql_data_access_is('_caosdb_schema_unit_tests','insert_single_child_version','CONTAINS SQL','');
-- PROCEDURES _caosdb_schema_unit_tests.delete_all_entity_versions
SELECT tap.has_procedure('_caosdb_schema_unit_tests', 'delete_all_entity_versions', '');
SELECT tap.procedure_is_deterministic('_caosdb_schema_unit_tests','delete_all_entity_versions','NO','');
SELECT tap.procedure_security_type_is('_caosdb_schema_unit_tests','delete_all_entity_versions','DEFINER','');
SELECT tap.procedure_sql_data_access_is('_caosdb_schema_unit_tests','delete_all_entity_versions','CONTAINS SQL','');
CALL tap.finish(); CALL tap.finish();
ROLLBACK; ROLLBACK;
...@@ -54,21 +54,21 @@ INSERT INTO transactions (srid,seconds,nanos,username,realm) VALUES ...@@ -54,21 +54,21 @@ INSERT INTO transactions (srid,seconds,nanos,username,realm) VALUES
DELETE FROM entities WHERE id > 99; DELETE FROM entities WHERE id > 99;
CALL entityACL(@ACLID1, "{acl1}"); CALL entityACL(@ACLID1, "{acl1}");
CALL insertEntity(@EntityID1, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID1, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}");
SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; SELECT entity_id INTO @InternalEntityID1 FROM name_data WHERE value="EntityName";
-- TEST insert_single_child_version -- TEST insert_single_child_version
SELECT count(*) INTO @x FROM entity_version; SELECT count(*) INTO @x FROM entity_version;
SELECT tap.eq(@x, 0, "no versions there yet"); SELECT tap.eq(@x, 0, "no versions there yet");
CALL insert_single_child_version(@InternalEntityID, "hashbla", "versionbla", NULL, "SRIDbla"); CALL insert_single_child_version(@InternalEntityID1, "hashbla", "versionbla", NULL, "SRIDbla");
SELECT _ipparent INTO @x from entity_version WHERE version="versionbla"; SELECT _ipparent INTO @x from entity_version WHERE version="versionbla";
SELECT tap.eq(@x, NULL, "no parent for the first version"); SELECT tap.eq(@x, NULL, "no parent for the first version");
-- add a second version -- add a second version
SELECT count(*) INTO @x FROM entity_version; SELECT count(*) INTO @x FROM entity_version;
SELECT tap.eq(@x, 1, "one version there already"); SELECT tap.eq(@x, 1, "one version there already");
CALL insert_single_child_version(@InternalEntityID, "hashblub", "versionblub", "versionbla", "SRIDblub"); CALL insert_single_child_version(@InternalEntityID1, "hashblub", "versionblub", "versionbla", "SRIDblub");
SELECT _ipparent INTO @x from entity_version WHERE version="versionblub"; SELECT _ipparent INTO @x from entity_version WHERE version="versionblub";
SELECT tap.eq(@x, 1, "the original entity is the parent"); SELECT tap.eq(@x, 1, "the original entity is the parent");
...@@ -79,7 +79,7 @@ SELECT tap.eq(@x, 2, "two versions there already"); ...@@ -79,7 +79,7 @@ SELECT tap.eq(@x, 2, "two versions there already");
CALL tap._assert_throws( CALL tap._assert_throws(
concat("CALL insert_single_child_version(", concat("CALL insert_single_child_version(",
@InternalEntityID, ', "hashblieb", "versionblieb", "non-existing-parent", "SRIDBlieb")'), @InternalEntityID1, ', "hashblieb", "versionblieb", "non-existing-parent", "SRIDBlieb")'),
"non existing parent throws"); "non existing parent throws");
SELECT count(*) INTO @x FROM entity_version; SELECT count(*) INTO @x FROM entity_version;
...@@ -91,11 +91,13 @@ SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionblub"), "versionbla ...@@ -91,11 +91,13 @@ SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionblub"), "versionbla
SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionbla"), NULL, "versionbla has no parent"); SELECT tap.eq(get_primary_parent_version(@EntityID1, "versionbla"), NULL, "versionbla has no parent");
-- Reactivate when versioning's FORGET is being implemented
-- TEST delete_all_entity_versions -- TEST delete_all_entity_versions
SELECT count(*) INTO @x FROM entity_version; SELECT count(*) INTO @x FROM entity_version;
SELECT tap.ok(@x > 0, "several versions in the table"); SELECT tap.ok(@x > 0, "several versions in the table");
CALL delete_all_entity_versions(@EntityID1); -- CALL delete_all_entity_versions(@EntityID1);
DELETE FROM entity_version WHERE entity_id = @InternalEntityID1;
SELECT count(*) INTO @x FROM entity_version; SELECT count(*) INTO @x FROM entity_version;
SELECT tap.eq(@x, 0, "no versions there any more"); SELECT tap.eq(@x, 0, "no versions there any more");
...@@ -117,19 +119,19 @@ SELECT tap.eq(@x, 0, "before insertEntity, no versions there"); ...@@ -117,19 +119,19 @@ SELECT tap.eq(@x, 0, "before insertEntity, no versions there");
-- TEST insertEntity - should produce a version w/o parent -- TEST insertEntity - should produce a version w/o parent
SET @SRID = "SRIDbla"; SET @SRID = "SRIDbla";
CALL insertEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}");
SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; SELECT entity_id INTO @InternalEntityID2 FROM name_data WHERE value="EntityName";
CALL insertEntity(@EntityID3, "ParentName", "ParentDesc", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID3, "ParentName", "ParentDesc", "RECORDTYPE", "{acl1}");
SELECT entity_id INTO @ParentID FROM name_data WHERE value="ParentName"; SELECT entity_id INTO @ParentID FROM name_data WHERE value="ParentName";
CALL insertIsa(@EntityID2, @EntityID3); CALL insertIsa(@EntityID2, @EntityID3);
CALL insertEntityProperty(0, @EntityID2, 17, "null_data", NULL, NULL, CALL insertEntityProperty(0, @EntityID2, 17, "null_data", NULL, NULL,
"RECOMMENDED", NULL, "DescOverride", NULL, NULL, 0); "RECOMMENDED", NULL, "DescOverride", NULL, NULL, 0);
SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2;
SELECT tap.eq(@x, 1, "after insertEntity, a version is there."); SELECT tap.eq(@x, 1, "after insertEntity, a version is there.");
SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent is NULL; SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2 and _ipparent is NULL;
SELECT tap.eq(@x, 1, "after insertEntity, the _iversion number is 1."); SELECT tap.eq(@x, 1, "after insertEntity, the _iversion number is 1.");
SELECT _ipparent INTO @x from entity_version WHERE entity_id = @InternalEntityID; SELECT _ipparent INTO @x from entity_version WHERE entity_id = @InternalEntityID2;
SELECT tap.eq(@x, NULL, "no parent for the freshly inserted entity"); 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") SELECT tap.eq(count(*), 0, "no entity in archive_entities before first update")
FROM archive_entities; FROM archive_entities;
...@@ -139,12 +141,12 @@ SELECT tap.eq(count(*), 0, "no entity in archive_entities before first update") ...@@ -139,12 +141,12 @@ SELECT tap.eq(count(*), 0, "no entity in archive_entities before first update")
SET @SRID = "SRIDblub"; SET @SRID = "SRIDblub";
CALL deleteEntityProperties(@EntityID2); CALL deleteEntityProperties(@EntityID2);
CALL updateEntity(@EntityID2, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl1}"); CALL updateEntity(@EntityID2, "NewEntityName", "NewEntityDesc", "RECORD", NULL, NULL, "{acl1}");
SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2;
SELECT tap.eq(@x, 2, "after updateEntity, a second version is there."); SELECT tap.eq(@x, 2, "after updateEntity, a second version is there.");
SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 1; SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2 and _ipparent = 1;
SELECT tap.eq(@x, 2, "after updateEntity, the _iversion number incremented."); SELECT tap.eq(@x, 2, "after updateEntity, the _iversion number incremented.");
SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 1; SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2 and _ipparent = 1;
SELECT tap.eq(@x, 1, "after updateEntity, the _pparent points to the first version"); 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") SELECT tap.eq(count(*), 1, "after updateEntity, one entity in archive_entities")
...@@ -157,7 +159,7 @@ CALL get_version_history(@EntityID2); ...@@ -157,7 +159,7 @@ CALL get_version_history(@EntityID2);
-- TEST retrieveEntity -- TEST retrieveEntity
SELECT version INTO @x FROM entity_version SELECT version INTO @x FROM entity_version
WHERE entity_id = @InternalEntityID WHERE entity_id = @InternalEntityID2
AND _iversion = 2; AND _iversion = 2;
CALL retrieveEntity(@EntityID2, NULL); CALL retrieveEntity(@EntityID2, NULL);
CALL retrieveEntity(@EntityID2, "non-existing-version"); CALL retrieveEntity(@EntityID2, "non-existing-version");
...@@ -189,20 +191,20 @@ CALL retrieveOverrides(0, @EntityID2, @x); ...@@ -189,20 +191,20 @@ CALL retrieveOverrides(0, @EntityID2, @x);
-- and 2nd updateEntity -- and 2nd updateEntity
SET @SRID = "SRIDblieb"; SET @SRID = "SRIDblieb";
CALL updateEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", NULL, NULL, "{acl1}"); CALL updateEntity(@EntityID2, "EntityName", "EntityDesc", "RECORDTYPE", NULL, NULL, "{acl1}");
SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2;
SELECT tap.eq(@x, 3, "after 2nd updateEntity, a 3rd version is there."); SELECT tap.eq(@x, 3, "after 2nd updateEntity, a 3rd version is there.");
SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _ipparent = 2; SELECT _iversion INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2 and _ipparent = 2;
SELECT tap.eq(@x, 3, "after 2nd updateEntity, the _iversion number incremented again."); SELECT tap.eq(@x, 3, "after 2nd updateEntity, the _iversion number incremented again.");
SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID and _iversion = 3; SELECT _ipparent INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2 and _iversion = 3;
SELECT tap.eq(@x, 2, "after 2nd updateEntity, the _pparent points to the 2nd version"); 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 = @InternalEntityID AND _ipparent = 2; SELECT tap.eq("SRIDblieb", srid, "correct transaction was stored") FROM entity_version WHERE entity_id = @InternalEntityID2 AND _ipparent = 2;
-- TEST deleteEntity - should remove all versions -- TEST deleteEntity - should remove all versions
CALL deleteIsa(@EntityID3); CALL deleteIsa(@EntityID3);
CALL deleteEntity(@EntityID2); CALL deleteEntity(@EntityID2);
SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID; SELECT count(*) INTO @x FROM entity_version WHERE entity_id = @InternalEntityID2;
SELECT tap.eq(@x, 0, "no versions there any more"); SELECT tap.eq(@x, 0, "no versions there any more");
CALL deleteEntity(@EntityID3); CALL deleteEntity(@EntityID3);
...@@ -227,19 +229,19 @@ DELETE FROM feature_config WHERE _key = "ENTITY_VERSIONING"; ...@@ -227,19 +229,19 @@ DELETE FROM feature_config WHERE _key = "ENTITY_VERSIONING";
CALL entityACL(@ACLID1, "{acl1}"); CALL entityACL(@ACLID1, "{acl1}");
CALL insertEntity(@EntityID4, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID4, "EntityName", "EntityDesc", "RECORDTYPE", "{acl1}");
SELECT count(*) INTO @NumOfEntities FROM entities; SELECT count(*) INTO @NumOfEntities FROM entities;
SELECT entity_id INTO @InternalEntityID FROM name_data WHERE value="EntityName"; SELECT entity_id INTO @InternalEntityID4 FROM name_data WHERE value="EntityName";
SET @TheUser = "TheUser"; -- used to identify the matching entry in transaction_log 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. -- 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) INSERT INTO transaction_log (transaction, entity_id, username, realm, seconds, nanos)
-- the first entry is the one which is be found by _fix_unversioned -- the first entry is the one which is be found by _fix_unversioned
VALUES VALUES
("Update", @InternalEntityID, @TheUser, "CaosDB", 23458, 254), ("Update", @InternalEntityID4, @TheUser, "CaosDB", 23458, 254),
-- the rest is dummy data -- the rest is dummy data
("Update", @InternalEntityID, "OtherUser", "CaosDB", 2345, 633), -- not the latest transaction ("Update", @InternalEntityID4, "OtherUser", "CaosDB", 2345, 633), -- not the latest transaction
("Insert", @InternalEntityID, "OtherUser", "CaosDB", 245, 633), -- not the latest transaction ("Insert", @InternalEntityID4, "OtherUser", "CaosDB", 245, 633), -- not the latest transaction
("Insert", @InternalEntityID + 1, @TheUser, "CaosDB", 2325, 653), -- not the right entity, inserted before our target ("Insert", @InternalEntityID4 + 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 ("Delete", @InternalEntityID4 + 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; SELECT tap.eq(COUNT(*), 5, "five entries in transaction_log") FROM transaction_log;
...@@ -259,11 +261,11 @@ SELECT tap.eq(COUNT(*), 2, ...@@ -259,11 +261,11 @@ SELECT tap.eq(COUNT(*), 2,
"after _fix_unversioned, one entry for our test entity in transactions, one for the standard entities.") "after _fix_unversioned, one entry for our test entity in transactions, one for the standard entities.")
FROM transactions; FROM transactions;
SELECT tap.eq(entity_id, @InternalEntityID, "versioned entity has correct id") FROM entity_version WHERE entity_id > 99; SELECT tap.eq(entity_id, @InternalEntityID4, "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") 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 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) ON (l.seconds = t.seconds AND l.nanos = t.nanos AND l.username = t.username AND l.realm = t.realm)
WHERE l.entity_id = @InternalEntityID AND l.username = @TheUser; WHERE l.entity_id = @InternalEntityID4444 AND l.username = @TheUser;
CALL tap.finish(); CALL tap.finish();
ROLLBACK; ROLLBACK;
...@@ -286,15 +288,15 @@ CALL entityACL(@ACLID1, "{acl1}"); ...@@ -286,15 +288,15 @@ CALL entityACL(@ACLID1, "{acl1}");
CALL insertEntity(@EntityID5, "EntityName1", "EntityDesc1", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID5, "EntityName1", "EntityDesc1", "RECORDTYPE", "{acl1}");
CALL insertEntity(@EntityID6, "EntityName2", "EntityDesc2", "RECORDTYPE", "{acl1}"); CALL insertEntity(@EntityID6, "EntityName2", "EntityDesc2", "RECORDTYPE", "{acl1}");
SELECT count(*) INTO @NumOfEntities FROM entities; SELECT count(*) INTO @NumOfEntities FROM entities;
SELECT entity_id INTO @InternalEntityID1 FROM name_data WHERE value="EntityName1"; SELECT entity_id INTO @InternalEntityID5 FROM name_data WHERE value="EntityName1";
SELECT entity_id INTO @InternalEntityID2 FROM name_data WHERE value="EntityName2"; SELECT entity_id INTO @InternalEntityID6 FROM name_data WHERE value="EntityName2";
INSERT INTO transaction_log (transaction, entity_id, username, realm, seconds, INSERT INTO transaction_log (transaction, entity_id, username, realm, seconds,
nanos) nanos)
-- the first entry is the one which will be found by _fix_unversioned -- the first entry is the one which will be found by _fix_unversioned
VALUES ("INSERT", @InternalEntityID1, "User", "CaosDB", 10000, 250), VALUES ("INSERT", @InternalEntityID5, "User", "CaosDB", 10000, 250),
("INSERT", @InternalEntityID2, "User", "CaosDB", 10000, 250), ("INSERT", @InternalEntityID6, "User", "CaosDB", 10000, 250),
("UPDATE", @InternalEntityID2, "User", "CaosDB", 20000, 250); ("UPDATE", @InternalEntityID6, "User", "CaosDB", 20000, 250);
SELECT tap.eq(COUNT(*), 3, "three entries in transaction_log") FROM transaction_log; SELECT tap.eq(COUNT(*), 3, "three entries in transaction_log") FROM transaction_log;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment