On Mon, 29 Apr 2019 23:36:01 -0700 (MST), pigreco wrote:
a.furieri wrote

Ci riesco con questa, ma sembra bruttina:

SELECT tbl_name,
       eval('select count(*) from ' || tbl_name ) AS nro_righe
FROM sqlite_master
where type='table'
and name not like '%geom%'
and name not like '%spatial%'
and name not like '%sql%'
and name not like '%raster%'
and name not like '%SE%'
and name not like '%vector_%'
and sql not like '%geom%';


SELECT tbl_name,
eval('SELECT count(*) FROM "' || tbl_name || '"') AS nro_righe
FROM sqlite_master
WHERE type='table'
AND name NOT IN (SELECT f_table_name FROM geometry_columns)
ORDER BY tbl_name;

ciao Sandro

Buongiorno e grazie per la risposta,
la query proposta ottiene tutte le tabelle del database tranne quelle con geometry e quindi prende anche quelle tabelle del database che non ho creato
direttamente io, es: prende le tabelle idx..., SE.... ecc...
il mio intendo era quello di 'acchiappare' solo le tabelle che ho creato e
popolato io.


SELECT tbl_name,
eval('SELECT count(*) FROM "' || tbl_name || '"') AS nro_righe
FROM sqlite_master
WHERE type = 'table' AND sql NOT LIKE 'CREATE VIRTUAL TABLE %'
AND name NOT IN (SELECT f_table_name FROM geometry_columns)
AND name NOT IN (SELECT 'idx_' || f_table_name || '_' || f_geometry_column
         FROM geometry_columns WHERE spatial_index_enabled = 1)
AND name NOT IN (SELECT 'idx_' || f_table_name || '_' || f_geometry_column || '_node'
         FROM geometry_columns WHERE spatial_index_enabled = 1)
AND name NOT IN (SELECT 'idx_' || f_table_name || '_' || f_geometry_column || '_parent'
         FROM geometry_columns WHERE spatial_index_enabled = 1)
AND name NOT IN (SELECT 'idx_' || f_table_name || '_' || f_geometry_column || '_rowid'
         FROM geometry_columns WHERE spatial_index_enabled = 1)
AND name NOT IN ('geometry_columns', 'geometry_columns_auth', 'geometry_columns_time')
ORDER BY tbl_name;

Note:
===========================
1. con queste modifiche filtra automaticamente qualsiasi
   SpatialIndex e tutte le VirtualTables
2. l'ultima lista (geometry_columns etc) va espansa fino
   a definire l'elenco completo di tutte le meta-tavole
   utilizzate internamente da SpatiaLite.
   lavoro noiosetto ma per nulla difficoltoso, basta solo
   un pizzico di pazienza.
3. non copre eventuali TopoGeometry, TopoNetworks e
   RasterCoverages, ma non credo che ti interessino.
   nal caso, il problema e' facilmente risolvibile
   ricalcando lo schema applicato agli Spatial Index;
   occorre fare una subquery sulla metatavola madre
   per ricavare tutti i nomi delle tavole figlie.

ciao Sandro
_______________________________________________
Gfoss@lists.gfoss.it
http://lists.gfoss.it/cgi-bin/mailman/listinfo/gfoss
Questa e' una lista di discussione pubblica aperta a tutti.
I messaggi di questa lista non hanno relazione diretta con le posizioni 
dell'Associazione GFOSS.it.
796 iscritti al 28/12/2017

Rispondere a