Skip to content
Snippets Groups Projects
Commit 9eeca52e authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

wip

parent ebb1d766
No related branches found
No related tags found
No related merge requests found
Pipeline #61360 failed
notes 0 → 100644
Query
Entry point Retrieve Transaction. In init() make_schedule creates flag jobs:
(db.execute_query("FIND Record ", flags = {"P":"0L2"}))
- P
- query
// subject has complete permissions for this kind of transaction
- > check to easy? Entity permissions ignored?
(filterEntitiesWithoutRetrievePermission)
Warum ruft Query execute von BAckendtransaction auf um RetrieveSparseEntity
zu executen (Query hat außerdem seine eigene execute Funktion)?
is caching user specific?? filtering within query occurs depending on user
permissions!!
alter table reference_data add if not exists real_property_id INTEGER;
update reference_data set real_property_id=property_id where property_id not in (select distinct value from reference_data where status='replacement');
update reference_data join reference_data as ref2 on reference_data.entity_id=ref2.entity_id and reference_data.property_id=ref2.value set reference_data.real_property_id=ref2.property_id;
drop index if exists prop on reference_data;
create index prop on reference_data (real_property_id, value);
drop temporary table if exists tmprealids;
drop temporary table if exists tmpresult;
create temporary table tmprealids select distinct child as real_property_id from isa_cache where parent = 112;
insert into tmprealids select 112;
select count(*) from tmprealids;
create temporary table tmpresult (id INTEGER);
set @start = CURRENT_TIMESTAMP(4);
DELIMITER //
set @length = (SELECT COUNT(*) FROM tmprealids)-1;
FOR i IN 0..@length
DO
insert into tmpresult
select distinct entity_id from reference_data where real_property_id=(
select real_property_id from tmprealids limit i,1) and status!="REPLACEMENT" and value!=518;
END FOR;
//
DELIMITER ;
select TIMESTAMPDIFF( MICROSECOND, @start,CURRENT_TIMESTAMP(4))/1000.0 as "spent(ms)";
select count(distinct id) from tmpresult order by id;
--select * from tmpresult;
drop temporary table if exists sourcesettmp ;
create temporary table sourcesettmp select distinct entity_id as id from reference_data;
call initPOVPropertiesTable(104, "104", "entities");
set @propertiestable = (select SUBSTRING(@tempTableList ,2 ,32));
select @propertiestable;
show index from reference_data;
drop temporary table if exists propertiestab ;
prepare stmt from CONCAT("create temporary table propertiestab SELECT * from ", @propertiestable);
execute stmt;
drop temporary table if exists tmpresult;
create temporary table tmpresult (id INTEGER);
select * from propertiestab;
set @start = CURRENT_TIMESTAMP(4);
insert into tmpresult
SELECT distinct entity_id from (select entity_id, value from reference_data join propertiestab as prop where (prop.id2=NULL OR prop.id2 = reference_data.entity_id) AND
reference_data.property_id=prop.id) as propfiltered
where propfiltered.value=518;
select TIMESTAMPDIFF( MICROSECOND, @start,CURRENT_TIMESTAMP(4))/1000.0 as "spent(ms)";
select count(id) from tmpresult order by id;
......@@ -62,7 +62,7 @@ public class MySQLInsertEntityProperties extends MySQLTransaction
implements InsertEntityPropertiesImpl {
public static final String STMT_INSERT_ENTITY_PROPERTY =
"call insertEntityProperty(?,?,?,?,?,?,?,?,?,?,?,?)";
"call insertEntityProperty(?,?,?,?,?,?,?,?,?,?,?,?,?)";
public MySQLInsertEntityProperties(final Access access) {
super(access);
......@@ -116,6 +116,7 @@ public class MySQLInsertEntityProperties extends MySQLTransaction
stmt.setString(10, fp.type_id);
stmt.setString(11, fp.collection);
stmt.setInt(12, fp.idx);
stmt.setInt(13, fp.real_id);
stmt.execute();
} catch (final SQLIntegrityConstraintViolationException exc) {
throw new IntegrityException(exc);
......
......@@ -36,4 +36,5 @@ public class FlatProperty implements Serializable {
public String type_id = null;
public String type_name = null;
public String collection = null;
public Integer real_id = null;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment