# sql_statements_log

time_start: 2019-05-15T08:19:01.813Z
time_end: 2019-05-15T08:19:01.835Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), 0, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), 0, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-05-15T08:19:05.519Z
time_end: 2019-05-15T08:19:05.547Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsDelete
after UPDATE on poles
FOR EACH ROW
WHEN NEW.c < -2
BEGIN
DELETE FROM fingerprints WHERE poleId == NEW.id OR otherId == NEW.id;
DELETE FROM poles WHERE id = NEW.id;
END;


time_start: 2019-05-15T08:19:08.952Z
time_end: 2019-05-15T08:19:08.975Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsUpdate
after UPDATE on poles
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprints 
 SET dist = SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), angle = ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x)
 WHERE otherId = NEW.id;
UPDATE fingerprints 
 SET x = NEW.x, y = NEW.y,
    dist = 
		(SELECT SQRT(POWER(o.x-NEW.x,2)+POWER(o.y-NEW.y, 2))
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	angle = 
		(SELECT ACOS((o.y-NEW.y)/SQRT(POWER(o.x-NEW.x,2) + POWER(o.y-NEW.y, 2))) * SIGN(o.x-NEW.x)
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	Geometry = MakePoint(NEW.x, NEW.y, 32633)
 WHERE poleId = NEW.id;
END;


time_start: 2019-05-17T13:51:23.860Z
time_end: 2019-05-17T13:51:23.890Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TABLE 'fingerprintsWalls' (
id INTEGER,
x1 DOUBLE,
y1 DOUBLE,
x2 DOUBLE,
y2 DOUBLE,
otherId INTEGER,
dist DOUBLE,
angle DOUBLE, 
type INTEGER
)


time_start: 2019-05-17T13:52:42.660Z
time_end: 2019-05-17T13:52:42.677Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
SELECT Count(*), GeometryType("Geometry"), Srid("Geometry"), CoordDimension("Geometry")
FROM "fingerprintsWalls"
GROUP BY 2, 3, 4


time_start: 2019-05-17T14:55:10.148Z
time_end: 2019-05-17T14:55:10.161Z
user_agent: spatialite_gui
error_cause: SQL error: incomplete input
sql_statement:
select ACOS(((((0-1) * SIGN(0-1)) * ((0-0) * SIGN(0-0) + ((0-0) * SIGN(0-1)) * ((0-1) * SIGN(0-0)))/(SQRT(POWER(x1,2)+POWER(y1,2)) * SQRT(POWER(ox1,2)+POWER(oy1,2)))


time_start: 2019-05-17T15:00:41.942Z
time_end: 2019-05-17T15:00:41.955Z
user_agent: spatialite_gui
error_cause: SQL error: near "ACOS": syntax error
sql_statement:
ACOS((((0-1) * SIGN(0-1)) * ((0-0) * SIGN(0-0)) + ((0-0) * SIGN(0-1)) * ((0-1) * SIGN(0-0)))/(SQRT(POWER((0-1),2)+POWER((0-0),2)) * SQRT(POWER((0-0),2)+POWER((0-1),2)))


time_start: 2019-05-17T15:00:55.200Z
time_end: 2019-05-17T15:00:55.212Z
user_agent: spatialite_gui
error_cause: SQL error: incomplete input
sql_statement:
select ACOS((((0-1) * SIGN(0-1)) * ((0-0) * SIGN(0-0)) + ((0-0) * SIGN(0-1)) * ((0-1) * SIGN(0-0)))/(SQRT(POWER((0-1),2)+POWER((0-0),2)) * SQRT(POWER((0-0),2)+POWER((0-1),2)))


time_start: 2019-05-17T15:01:11.149Z
time_end: 2019-05-17T15:01:11.166Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
select ACOS((((0-1) * SIGN(0-1)) * ((0-0) * SIGN(0-0)) + ((0-0) * SIGN(0-1)) * ((0-1) * SIGN(0-0)))/(SQRT(POWER((0-1),2)+POWER((0-0),2)) * SQRT(POWER((0-0),2)+POWER((0-1),2))))


time_start: 2019-05-17T15:18:24.727Z
time_end: 2019-05-17T15:18:24.749Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), ACOS((POWER((NEW.x1-NEW.x2) * SIGN(NEW.x1-NEW.x2),2) + ((NEW.y1-NEW.y2) * SIGN(NEW.x1-NEW.x2)) * 100)/(SQRT(POWER((NEW.x1-NEW.x2),2)+POWER((NEW.y1-NEW.y2),2)) * SQRT(POWER((NEW.x1-NEW.x2),2)+10000))), 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-05-17T15:26:33.425Z
time_end: 2019-05-17T15:26:33.437Z
user_agent: spatialite_gui
error_cause: SQL error: near "id": syntax error
sql_statement:
insert into edges id,x1,y1,x2,y2,angle,Geometry VALUES (3615, 383600.514696, 5812552.14867, 383610.758197, 5812542.49308, 0, 2.326658, MakeLine(MakePoint(383600.514696, 5812552.14867, 32633), MakePoint(383610.758197, 5812542.49308,32633)))


time_start: 2019-05-17T15:27:00.602Z
time_end: 2019-05-17T15:27:00.614Z
user_agent: spatialite_gui
error_cause: SQL error: 8 values for 7 columns
sql_statement:
insert into edges (id,x1,y1,x2,y2,angle,Geometry) VALUES (3615, 383600.514696, 5812552.14867, 383610.758197, 5812542.49308, 0, 2.326658, MakeLine(MakePoint(383600.514696, 5812552.14867, 32633), MakePoint(383610.758197, 5812542.49308,32633)))


time_start: 2019-05-17T15:27:17.609Z
time_end: 2019-05-17T15:27:17.623Z
user_agent: spatialite_gui
error_cause: SQL error: no such column: NEW.x
sql_statement:
insert into edges (id,x1,y1,x2,y2,angle,Geometry) VALUES (3615, 383600.514696, 5812552.14867, 383610.758197, 5812542.49308, 2.326658, MakeLine(MakePoint(383600.514696, 5812552.14867, 32633), MakePoint(383610.758197, 5812542.49308,32633)))


time_start: 2019-05-17T15:28:38.378Z
time_end: 2019-05-17T15:28:38.400Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), ACOS((POWER((NEW.x1-NEW.x2) * SIGN(NEW.x1-NEW.x2),2) + ((NEW.y1-NEW.y2) * SIGN(NEW.x1-NEW.x2)) * 100)/(SQRT(POWER((NEW.x1-NEW.x2),2)+POWER((NEW.y1-NEW.y2),2)) * SQRT(POWER((NEW.x1-NEW.x2),2)+10000))), 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-05-17T15:30:27.994Z
time_end: 2019-05-17T15:30:28.020Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
INSERT INTO edges VALUES (3615, 383600.514696, 5812552.148670, 383610.758197, 5812542.493080, 2.326658, MakeLine(MakePoint(383600.514696, 5812552.148670, 32633), MakePoint(383610.758197, 5812542.493080, 32633)))


time_start: 2019-05-17T15:41:32.795Z
time_end: 2019-05-17T15:41:32.816Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-05-23T15:27:48.503Z
time_end: 2019-05-23T15:27:48.594Z
user_agent: spatialite_gui
error_cause: SQL error: table "fingerprintsWalls" already exists
sql_statement:
CREATE TABLE "fingerprintsWalls" (
"id" INTEGER,
"x1" DOUBLE,
"y1" DOUBLE,
"x2" DOUBLE,
"y2" DOUBLE,
"otherId" INTEGER,
"dist" DOUBLE,
"angle" DOUBLE,
"type" INTEGER, "Geometry" LINESTRING)


time_start: 2019-05-23T15:29:34.928Z
time_end: 2019-05-23T15:29:34.956Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, 0, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-05-23T15:29:45.960Z
time_end: 2019-05-23T15:29:45.978Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsUpdate
after UPDATE on edges
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprintsWalls 
 SET dist = ABS(angle - NEW.angle)
 WHERE otherId = NEW.id;
UPDATE fingerprintsWalls 
 SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
    dist = 
		(SELECT ABS(NEW.angle - o.angle)
		FROM fingerprintsWalls o
		INNER JOIN fingerprintsWalls u on u.otherId = o.id 
			WHERE o.otherId = u.id AND u.id = NEW.id AND u.otherId=fingerprintsWalls.otherId),
	angle = NEW.angle,
	Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
 WHERE id = NEW.id;
UPDATE fingerprintsWalls
  SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
	dist=(SELECT DISTINCT ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
	angle = NEW.angle, Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
  WHERE id = NEW.id;
UPDATE fingerprints
  SET
    dist=ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)),
    angle=NEW.angle
  WHERE otherId = NEW.id;
END;


time_start: 2019-05-23T15:29:55.176Z
time_end: 2019-05-23T15:29:55.191Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsDelete
after UPDATE on edges
FOR EACH ROW
WHEN NEW.c < -2
BEGIN
DELETE FROM fingerprints WHERE poleId == NEW.id OR otherId == NEW.id;
DELETE FROM fingerprintsWalls WHERE id == NEW.id OR otherId == NEW.id;
DELETE FROM edges WHERE id = NEW.id;
END;


time_start: 2019-05-23T15:30:25.470Z
time_end: 2019-05-23T15:30:25.492Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), 0, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), 0, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))
	UNION ALL
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, 0, MakePoint(NEW.x,NEW.y,32633)
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-05-23T15:30:34.728Z
time_end: 2019-05-23T15:30:34.753Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsUpdate
after UPDATE on poles
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprints 
 SET dist = SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), angle = ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x)
 WHERE otherId = NEW.id;
UPDATE fingerprints 
 SET x = NEW.x, y = NEW.y,
    dist = 
		(SELECT SQRT(POWER(o.x-NEW.x,2)+POWER(o.y-NEW.y, 2))
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	angle = 
		(SELECT ACOS((o.y-NEW.y)/SQRT(POWER(o.x-NEW.x,2) + POWER(o.y-NEW.y, 2))) * SIGN(o.x-NEW.x)
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	Geometry = MakePoint(NEW.x, NEW.y, 32633)
 WHERE poleId = NEW.id;
UPDATE fingerprints
  SET x = NEW.x, y = NEW.y,
	dist=(SELECT DISTINCT ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
	Geometry = MakePoint(NEW.x,NEW.y,32633)
  WHERE poleid = NEW.id;
UPDATE fingerprintsWalls
  SET
    dist=ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2))
  WHERE otherId = NEW.id;
END;


time_start: 2019-05-23T15:30:43.657Z
time_end: 2019-05-23T15:30:43.686Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsDelete
after UPDATE on poles
FOR EACH ROW
WHEN NEW.c < -2
BEGIN
DELETE FROM fingerprints WHERE poleId == NEW.id OR otherId == NEW.id;
DELETE FROM poles WHERE id = NEW.id;
DELETE FROM fingerprintsWalls WHERE id == NEW.id OR otherId == NEW.id;
END;


time_start: 2019-05-24T12:07:39.055Z
time_end: 2019-05-24T12:07:39.068Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), NEW.type, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), type, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y, type 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))
	UNION ALL
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, NEW.type, MakePoint(NEW.x,NEW.y,32633)
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-05-24T12:08:38.415Z
time_end: 2019-05-24T12:08:38.441Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, type, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y, type
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, 2, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-07-02T14:10:02.661Z
time_end: 2019-07-02T14:10:02.689Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), NEW.angle, type, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y, type
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, type, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle, type
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-07-30T15:57:55.120Z
time_end: 2019-07-30T15:57:55.151Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcPointWallAngle(NEW.x1,NEW.x2,NEW.y1,NEW.y2,x,y), x, y, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcReversePointWallAngle(NEW.x1,NEW.x2,NEW.y1,NEW.y2,x,y), type, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y, type
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, 0, 0, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, 0, 0, type, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle, type
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-07-30T15:58:08.193Z
time_end: 2019-07-30T15:58:08.223Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsUpdate
after UPDATE on edges
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprintsWalls 
 SET dist = ABS(angle - NEW.angle)
 WHERE otherId = NEW.id;
UPDATE fingerprintsWalls 
 SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
    dist = 
		(SELECT ABS(NEW.angle - o.angle)
		FROM fingerprintsWalls o
		INNER JOIN fingerprintsWalls u on u.otherId = o.id 
			WHERE o.otherId = u.id AND u.id = NEW.id AND u.otherId=fingerprintsWalls.otherId),
	angle = NEW.angle,
	Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
 WHERE id = NEW.id;
UPDATE fingerprintsWalls
  SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
	dist=(SELECT DISTINCT ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
	angle = (SELECT DISTINCT calcPointWallAngle(NEW.x1,NEW.x2,NEW.y1,NEW.y2,x,y) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
    Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
  WHERE id = NEW.id;
UPDATE fingerprints
  SET
    dist=ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)),
    angle=calcReversePointWallAngle(NEW.x1,NEW.x2,NEW.y1,NEW.y2,x,y)
  WHERE otherId = NEW.id;
END;


time_start: 2019-07-30T15:58:41.368Z
time_end: 2019-07-30T15:58:41.392Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), NEW.type, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), type, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y, type 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))
	UNION ALL
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, NEW.type, MakePoint(NEW.x,NEW.y,32633)
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), calcPointWallAngle(x1,x2,y1,y2,NEW.x,NEW.y), NEW.x, NEW.y, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-07-30T15:58:52.032Z
time_end: 2019-07-30T15:58:52.060Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsUpdate
after UPDATE on poles
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprints 
 SET dist = SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), angle = ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x)
 WHERE otherId = NEW.id;
UPDATE fingerprints 
 SET x = NEW.x, y = NEW.y,
    dist = 
		(SELECT SQRT(POWER(o.x-NEW.x,2)+POWER(o.y-NEW.y, 2))
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	angle = 
		(SELECT ACOS((o.y-NEW.y)/SQRT(POWER(o.x-NEW.x,2) + POWER(o.y-NEW.y, 2))) * SIGN(o.x-NEW.x)
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	Geometry = MakePoint(NEW.x, NEW.y, 32633)
 WHERE poleId = NEW.id;
UPDATE fingerprints
  SET x = NEW.x, y = NEW.y,
	dist=(SELECT DISTINCT ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
    angle=(SELECT calcReversePointWallAngle(x1,x2,y1,y2,NEW.x,NEW.y) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
	Geometry = MakePoint(NEW.x,NEW.y,32633)
  WHERE poleid = NEW.id;
UPDATE fingerprintsWalls
  SET
    dist=ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)),
    angle=calcPointWallAngle(x1,x2,y1,y2,NEW.x,NEW.y),
    oX=NEW.x,
    oY=NEW.y
  WHERE otherId = NEW.id;
END;


time_start: 2019-07-30T16:49:37.571Z
time_end: 2019-07-30T16:49:37.588Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcPointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y), x, y, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcReversePointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y), type, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y, type
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, 0, 0, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, 0, 0, type, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle, type
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-07-30T16:49:45.936Z
time_end: 2019-07-30T16:49:45.970Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsUpdate
after UPDATE on edges
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprintsWalls 
 SET dist = ABS(angle - NEW.angle)
 WHERE otherId = NEW.id;
UPDATE fingerprintsWalls 
 SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
    dist = 
		(SELECT ABS(NEW.angle - o.angle)
		FROM fingerprintsWalls o
		INNER JOIN fingerprintsWalls u on u.otherId = o.id 
			WHERE o.otherId = u.id AND u.id = NEW.id AND u.otherId=fingerprintsWalls.otherId),
	angle = NEW.angle,
	Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
 WHERE id = NEW.id;
UPDATE fingerprintsWalls
  SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
	dist=(SELECT DISTINCT ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
	angle = (SELECT DISTINCT calcPointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
    Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
  WHERE id = NEW.id;
UPDATE fingerprints
  SET
    dist=ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)),
    angle=calcReversePointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y)
  WHERE otherId = NEW.id;
END;


time_start: 2019-07-30T16:50:10.899Z
time_end: 2019-07-30T16:50:10.926Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), NEW.type, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), type, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y, type 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))
	UNION ALL
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), angle, NEW.type, MakePoint(NEW.x,NEW.y,32633)
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), calcPointWallAngle(x1,y1,x2,y2,NEW.x,NEW.y), NEW.x, NEW.y, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-07-30T16:50:19.916Z
time_end: 2019-07-30T16:50:19.950Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsUpdate
after UPDATE on poles
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprints 
 SET dist = SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), angle = ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x)
 WHERE otherId = NEW.id;
UPDATE fingerprints 
 SET x = NEW.x, y = NEW.y,
    dist = 
		(SELECT SQRT(POWER(o.x-NEW.x,2)+POWER(o.y-NEW.y, 2))
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	angle = 
		(SELECT ACOS((o.y-NEW.y)/SQRT(POWER(o.x-NEW.x,2) + POWER(o.y-NEW.y, 2))) * SIGN(o.x-NEW.x)
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	Geometry = MakePoint(NEW.x, NEW.y, 32633)
 WHERE poleId = NEW.id;
UPDATE fingerprints
  SET x = NEW.x, y = NEW.y,
	dist=(SELECT DISTINCT ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
    angle=(SELECT calcReversePointWallAngle(x1,x2,y1,y2,NEW.x,NEW.y) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
	Geometry = MakePoint(NEW.x,NEW.y,32633)
  WHERE poleid = NEW.id;
UPDATE fingerprintsWalls
  SET
    dist=ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)),
    angle=calcPointWallAngle(x1,y1,x2,y2,NEW.x,NEW.y),
    oX=NEW.x,
    oY=NEW.y
  WHERE otherId = NEW.id;
END;


time_start: 2019-07-30T17:24:01.412Z
time_end: 2019-07-30T17:24:01.440Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsInsert
after INSERT on edges
FOR EACH ROW
BEGIN
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcReversePointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y), x, y, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprints (poleid, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT id, x, y, 0, NEW.id, ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)), calcPointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y), type, MakePoint(x,y,32633)
	FROM (SELECT DISTINCT id, x, y, type
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT NEW.id, NEW.x1, NEW.y1, NEW.x2, NEW.y2, id, ABS(NEW.angle - angle), NEW.angle, 0, 0, NEW.type, MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS(angle - NEW.angle), angle, 0, 0, type, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle, type
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr((NEW.x1+NEW.x2)/2+80,(NEW.y1+NEW.y2)/2+80,(NEW.x1+NEW.x2)/2-80,(NEW.y1+NEW.y2)/2-80,32633)));
END;


time_start: 2019-07-30T17:24:12.860Z
time_end: 2019-07-30T17:24:12.891Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsWallsUpdate
after UPDATE on edges
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprintsWalls 
 SET dist = ABS(angle - NEW.angle)
 WHERE otherId = NEW.id;
UPDATE fingerprintsWalls 
 SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
    dist = 
		(SELECT ABS(NEW.angle - o.angle)
		FROM fingerprintsWalls o
		INNER JOIN fingerprintsWalls u on u.otherId = o.id 
			WHERE o.otherId = u.id AND u.id = NEW.id AND u.otherId=fingerprintsWalls.otherId),
	angle = NEW.angle,
	Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
 WHERE id = NEW.id;
UPDATE fingerprintsWalls
  SET x1 = NEW.x1, y1 = NEW.y1, x2 = NEW.x2, y2 = NEW.y2,
	dist=(SELECT DISTINCT ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
	angle = (SELECT DISTINCT calcReversePointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y) 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr((OLD.x1+OLD.x2)/2+80,(OLD.y1+OLD.y2)/2+80,(OLD.x1+OLD.x2)/2-80,(OLD.y1+OLD.y2)/2-80,32633))),
    Geometry = MakeLine(MakePoint(NEW.x1,NEW.y1,32633),MakePoint(NEW.x2,NEW.y2,32633))
  WHERE id = NEW.id;
UPDATE fingerprints
  SET
    dist=ABS((NEW.x1-NEW.x2)*(NEW.y2-y) - (NEW.y1-NEW.y2)*(NEW.x2-x))/SQRT(POWER(NEW.x1-NEW.x2,2) + POWER(NEW.y1-NEW.y2,2)),
    angle=calcPointWallAngle(NEW.x1,NEW.y1,NEW.x2,NEW.y2,x,y)
  WHERE otherId = NEW.id;
END;


time_start: 2019-07-30T17:24:38.764Z
time_end: 2019-07-30T17:24:38.793Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsInsert
after INSERT on poles
FOR EACH ROW
BEGIN
 INSERT INTO fingerprints (poleId, x, y, z, otherId, dist, angle, type, Geometry) 
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((y-NEW.y)/SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2))) * SIGN(x-NEW.x), NEW.type, MakePoint(NEW.x,NEW.y,32633) 
	FROM (SELECT DISTINCT id, x, y 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))	
    UNION ALL
 	SELECT id, x, y, 0, NEW.id, SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x), type, MakePoint(x,y,32633) 
	FROM (SELECT DISTINCT id, x, y, type 
		FROM poles 
		WHERE poles.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='poles' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)))
	UNION ALL
 	SELECT NEW.id, NEW.x, NEW.y, 0, id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), calcPointWallAngle(x1,y1,x2,y2,NEW.x,NEW.y), NEW.type, MakePoint(NEW.x,NEW.y,32633)
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
 INSERT INTO fingerprintsWalls (id, x1, y1, x2, y2, otherId, dist, angle, oX, oY, type, Geometry) 
 	SELECT id, x1, y1, x2, y2, NEW.id, ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)), calcReversePointWallAngle(x1,y1,x2,y2,NEW.x,NEW.y), NEW.x, NEW.y, 2, MakeLine(MakePoint(x1,y1,32633),MakePoint(x2,y2,32633))
	FROM (SELECT DISTINCT id, x1, y1, x2, y2, angle
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(NEW.x+80,NEW.y+80,NEW.x-80,NEW.y-80,32633)));
END;


time_start: 2019-07-30T17:24:45.804Z
time_end: 2019-07-30T17:24:45.820Z
user_agent: spatialite_gui
error_cause: success
sql_statement:
CREATE TRIGGER fingerprintsUpdate
after UPDATE on poles
FOR EACH ROW
WHEN OLD.c > NEW.c
BEGIN
UPDATE fingerprints 
 SET dist = SQRT(POWER(x-NEW.x,2) + POWER(y-NEW.y, 2)), angle = ACOS((NEW.y-y)/SQRT(POWER(NEW.x-x,2) + POWER(NEW.y-y, 2))) * SIGN(NEW.x-x)
 WHERE otherId = NEW.id;
UPDATE fingerprints 
 SET x = NEW.x, y = NEW.y,
    dist = 
		(SELECT SQRT(POWER(o.x-NEW.x,2)+POWER(o.y-NEW.y, 2))
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	angle = 
		(SELECT ACOS((o.y-NEW.y)/SQRT(POWER(o.x-NEW.x,2) + POWER(o.y-NEW.y, 2))) * SIGN(o.x-NEW.x)
		FROM fingerprints o
		INNER JOIN fingerprints u on u.otherId = o.poleId 
			WHERE o.otherId = u.poleId AND u.poleId = NEW.id AND u.otherId=fingerprints.otherId),
	Geometry = MakePoint(NEW.x, NEW.y, 32633)
 WHERE poleId = NEW.id;
UPDATE fingerprints
  SET x = NEW.x, y = NEW.y,
	dist=(SELECT DISTINCT ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
    angle=(SELECT calcPointWallAngle(x1,x2,y1,y2,NEW.x,NEW.y) 
		FROM edges 
		WHERE edges.ROWID IN 
			(SELECT ROWID 
			FROM SpatialIndex 
			WHERE f_table_name='edges' AND search_frame=BuildMbr(OLD.x+80,OLD.y+80,OLD.x-80,OLD.y-80,32633))),
	Geometry = MakePoint(NEW.x,NEW.y,32633)
  WHERE poleid = NEW.id;
UPDATE fingerprintsWalls
  SET
    dist=ABS((x1-x2)*(y2-NEW.y) - (y1-y2)*(x2-NEW.x))/SQRT(POWER(x1-x2,2) + POWER(y1-y2,2)),
    angle=calcReversePointWallAngle(x1,y1,x2,y2,NEW.x,NEW.y),
    oX=NEW.x,
    oY=NEW.y
  WHERE otherId = NEW.id;
END;


