Skip to content

Commit

Permalink
Fix #377
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed Jun 5, 2019
1 parent c8fb779 commit 5635089
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25327,13 +25327,19 @@ begin
declare assetName varchar(200);
declare piName varchar(1000);
declare personaName varchar(50);
declare linkName varchar(1000);

declare done int default 0;
declare buf LONGTEXT default '';
declare locsCursor cursor for select id,name,diagram from locations order by 2;
declare locCursor cursor for select id,name from location where locations_id = locsId order by 2;
declare aiCursor cursor for select ai.name,a.name from asset_instance ai, asset a where location_id = locId and ai.asset_id = a.id order by 1;
declare piCursor cursor for select pi.name,p.name from persona_instance pi, persona p where location_id = locId and pi.persona_id = p.id order by 1;
declare linkCursor cursor for
select l.name from location l, location_link ll where ll.locations_id = locsId and ll.head_location_id != locId and ll.head_location_id = l.id
union
select l.name from location l, location_link ll where ll.locations_id = locsId and ll.tail_location_id != locId and ll.tail_location_id = l.id;

declare continue handler for not found set done = 1;

open locsCursor;
Expand Down Expand Up @@ -25378,6 +25384,18 @@ begin
end loop pi_loop;
close piCursor;
set done = 0;

open linkCursor;
link_loop: loop
fetch linkCursor into linkName;
if done = 1
then
leave link_loop;
end if;
set buf = concat(buf,' <link name=\"',linkName,'\" />\n');
end loop link_loop;
close linkCursor;
set done = 0;

set buf = concat(buf,' </location>\n');
end loop loc_loop;
Expand Down

0 comments on commit 5635089

Please sign in to comment.