vector_metadata_table.sql 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --#############################################################################
  2. -- This SQL script generates the vector table to store
  3. -- metadata for SQL queries and temporal GIS support.
  4. --
  5. -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
  6. --#############################################################################
  7. --PRAGMA foreign_keys = ON;
  8. -- The metadata table
  9. CREATE TABLE vector_metadata (
  10. id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name@mapset) and is used as primary foreign key
  11. stvds_register VARCHAR, -- The name of the table storing all space-time vector datasets in which this map is registered
  12. is_3d BOOLEAN, -- This is 1 if the vector map is 3d and 0 otherwise
  13. points INTEGER, -- The number of points
  14. lines INTEGER, -- The number of lines
  15. boundaries INTEGER, -- The number of boundaries
  16. centroids INTEGER, -- The number of centroids
  17. faces INTEGER, -- The number of faces
  18. kernels INTEGER, -- The number of kernels
  19. primitives INTEGER, -- All primitives accumulated (points, lines,boundaries,centroids,faces,kernels)
  20. nodes INTEGER, -- Number of nodes (topological information)
  21. areas INTEGER, -- The number of areas (topological information)
  22. islands INTEGER, -- The number of islands (topological information)
  23. holes INTEGER, -- The number of holes (topological information)
  24. volumes INTEGER, -- The number of volumes (topological information)
  25. PRIMARY KEY (id),
  26. FOREIGN KEY (id) REFERENCES vector_base (id) ON DELETE CASCADE
  27. );
  28. -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
  29. -- Uncommented due to performance issues
  30. --CREATE TRIGGER update_vector_metadata AFTER UPDATE ON vector_metadata
  31. -- BEGIN
  32. -- UPDATE vector_base SET modification_time = datetime("NOW") WHERE id = old.id;
  33. -- UPDATE vector_base SET revision = (revision + 1) WHERE id = old.id;
  34. -- END;