[Qgis-developer] Update to the SpatiaLite provider

a.furieri at lqt.it a.furieri at lqt.it
Fri Nov 30 08:49:52 PST 2012

On Fri, 30 Nov 2012 16:58:44 +0100, Giuseppe Sucameli wrote:
> Hi devs, hi all,
> Alessandro Furieri has sent to me a patch to support the features
> available from the newest SpatiaLite v4 into the provider, mostly
> the intensive use of statistics to improve performaces.

Giuseppe, thanks a lot for your precious collaboration.

> @Alessandro: please, could you tell us what's new in
> the provider? I know some details, but I'm sure devs would
> like to know more.

surely yes:

a) spatialite v4 is now strictly conformant to the most recent
    OGC-SFS and ISO SQL/MM standard requirements.
    unhappily this necessarily implies few compatibility breakages.

b) any recent version of libspatialite starting since 4.0.0 has
    the capability to handle any DB created using any possible
    previous version of the library.
    this happens in a completely transparent way, and the user is
    not required to apply any special precaution at all.
    the full library support is available both on reading and writing,
    and obviously covers the Spatial Index capabilities as well.
    (see below for further details).

c) the opposite isn't true; it's absolutely impossible connecting
    any new DB created using the most recent libspatialite 4.0.0 if
    the underlying library is obsolete (any version < 4.0.0)
    the revised QGIS data-provider will emit an appropriate error
    message in this case (when linked against an obsolete library
    version and attempting to open a DB-file created by a recenter

d) a new CLI tool is make available in spatialite-tools-4.0.0:
    "spatialite_convert" makes possible safely converting any DB-file
    back and forward between v.2.3.x, v.3.0.x and v.4.0.x
    it doesn't requires a full DB conversions, simply the metadata
    tables are affected, so converting from a version to the the other
    is a really fast process just requiring few seconds even when the
    DB-file is a really huge and complex one.

e) the most recent DB layout supported by v.4.0.0 now supports a full
    set of statistic infos; this is specially useful for QGIS, because
    now the data provider can avoid at all to loose time by "sniffing"
    each layer before connecting.
    and this is obviously useful while connecting to some layer 
    many million feature; the time required by any previous version of
    the QGIS data-provider could require several minutes in this case.
    now, when full v.4.0.0 support is available, just few seconds are
    enough to connect such "huge layers".

f) last but not least: libspatialite v.4.0.0 now supports several API
    methods taking full care to internally handle any metadata table
    (e.g. the ones supporting the internal statistics).
    such "abstract" methods are mainly intended to avoid any direct 
    access from the data-provider itself.
    so the data-provider can now completely ignore any fine-grained 
    about the version-dependent DB layout; these "abstract API methods" 
    always implement the most appropriate access strategy to the 
    tables for any possible DB layout.
    a strong commitment exist to fully preserve all these "abstract API
    methods": so any future major change affecting the DB layout will be
    completely transparent to the QGIS data-provider, and simply 
    the underlaying libspatialite will be enough to keep anything 

g) just a final note: a further "abstract" API method will now support
    full deletion of any Geometry table, taking care to remove any 
    metadata reference and any Spatial Index eventually defined.
    as a rule-of-the-thumb, the revised data-provider will continue to 
    exactly as before when linked against any libspatialite prior to 
    but will take full profit of the new "abstract" methods if linked to
    libspatialite v.4.0.0 (or any subsequent).

if you are interested to learn more about these topics, here you can 
the appropriate documentation:

bye Sandro

Il messaggio e' stato analizzato alla ricerca di virus o
contenuti pericolosi da MailScanner, ed e'
risultato non infetto.

More information about the Qgis-developer mailing list