Created
January 9, 2018 10:43
-
-
Save pigreco/e98cb9e3bea2002f4b344309d9967b1c to your computer and use it in GitHub Desktop.
Trigger suggerito da Furieri che migliora notevolmente le prestazioni.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER ins_punti AFTER INSERT ON punti | |
BEGIN | |
INSERT OR REPLACE INTO punti (pk_p, nome_strada, data_ins, distanza, geom) | |
SELECT NEW.ROWID, s.nome_strada, DateTime('now'), k.distance, NEW.geom | |
FROM knn AS k | |
LEFT JOIN strade AS s ON (k.fid = s.pk_l) | |
WHERE k.f_table_name = 'strade' | |
AND ref_geometry = NEW.geom | |
AND k.max_items = 1; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment