SELECT DateTime('now'),'clone.berlin_admin_db.sql [begin] -with "BEGIN" and "COMMIT"';
SELECT DateTime('now'),'sample: rm berlin_polygons_minimal.db ; spatialite berlin_polygons_minimal.db < clone.berlin_polygons.sql';
SELECT DateTime('now'),'sample: rm berlin_polygons_compressed.db ; spatialite berlin_polygons_compressed.db < clone.berlin_polygons.sql';
---
SELECT DateTime('now'),'Goals of this script is to:"';
SELECT DateTime('now'),'--> clone the TABLE/VIEWs created with [MULTILINESTRINGs, MULTIPOLYGONs and a POINT].';
---
SELECT DateTime('now'),'ATTACH DATABASE ''berlin_admin_geometries.db'' AS db_import';
ATTACH DATABASE 'berlin_admin_geometries.db' AS db_import;
SELECT DateTime('now'),'--> cloning the TABLEs "';
SELECT DateTime('now'),'--> 631 complicated borders MULTIPOLYGON''S, with (MULTI) LINESTRING representative, RING and center POINT';
SELECT CloneTable('db_import','berlin_polygons','berlin_polygons',1,"::with-foreign-keys::","::with-triggers::");
---
SELECT DateTime('now'),'DETACH DATABASE ''berlin_admin_geometries.db'' AS db_import';
DETACH DATABASE db_import;
SELECT DateTime('now'),'size of berlin_polygons_minimal.db [no compression]: 20544512 bytes [20.5 MB]';
---
SELECT DateTime('now'),'calling CompressGeometry on:';
SELECT DateTime('now'),'- (MULTI)- POLYGON and LINESTRING Geometries';
SELECT DateTime('now'),'-> with the exception of the first and last POINTs ';
SELECT DateTime('now'),'--> each POINT will be stored as a 32-bit float, instead of a 64-bit double ';
SELECT DateTime('now'),'---> reducing each X/X[Z/M] value by 4 bytes';
---
UPDATE berlin_polygons SET
soldner_polygon=CompressGeometry(soldner_polygon),
soldner_linestring=CompressGeometry(soldner_linestring),
soldner_ring=CompressGeometry(soldner_ring);
---
VACUUM;
SELECT DateTime('now'),'size of berlin_polygons_minimal.db [with compression]: 13933568 bytes [13.9 MB] [difference: 6610944 bytes ca. 33%]';
--
SELECT DateTime('now'),'-I-> [clone.berlin_polygons.sql] [end]';
---