giovedì 22 maggio 2014

Enumerate all the domains from a set of datasets

The need is to retrieve the list of all the used domains from all fields of a set of dataset.

Load all DXF on a DB using the GUI in a Spatialite DB
I choose this options:

mixed-mode
epsg::2832
use the unlinked-ring
force all to 2D.


after load all DXF

I have 4 tables.

prefix_line_layer_2d
prefix_point_layer_2d
prefix_polyg_layer_2d
prefix_text_layer_2d

I run this command:

SELECT CreateMetaCatalogTables(1);

After the command, I have a table named "splite_metacatalog "
It has all the descriptions of the tables of DB. It say if are PKsingle or composite, if are NULL, and so on...

Now I can launch the
UpdateMetaCatalogStatistics(transaction TRUE|FALSE, table, column)

To have the list for all the tables (exclude PK) this is the call:

SELECT UpdateMetaCatalogStatistics(1, table_name, column_name)
FROM splite_metacatalog;

after i run this to see all column names

SELECT DISTINCT column_name from splite_metacatalog order by column_name;

 and I choose to accept only these columns: "layer" , "label", "rotation"

After I create the new table "freq" I run again the

drop  table if exists splite_metacatalog_statistics;
drop  table if exists splite_metacatalog;
SELECT CreateMetaCatalogTables(1);
SELECT UpdateMetaCatalogStatistics(1, 'freq', 'table_name', 'column_name');

now in the  "splite_metacatalog_statistics" I have the list or distinct values in the columns choosed and theis numerosity.

now I export in dbf:
. dumpdbf splite_metacatalog_statistics stats.dbf CP1252

et-voila.

Nessun commento:

Posta un commento