[Qgis-developer] SpatiaLite data provider - fixup

Alessandro Furieri a.furieri at lqt.it
Sat Apr 11 16:20:25 EDT 2009


Hi,

I've just fixed a couple of  issues related to the SpatiaLite data provider:

a) I've fixed a stupid bug in libspatialite-2.3.0, causing a total
   failure for any Spatial Index based on MbrCache; consequently
   I've updated the QGis' INTERNAL spatialite.c

b) in the meanwhile I was performing some testing about the previous
   issue, then I found a second issue this time causing total failure 
for any
   Spatial Index based on RTree. I noticed this using the OSgeo4W qgis-dev.
   After some debugging I discovered that the problem wasn't any SpatiaLite
   bug, but the cause was in CMake definitions QGis applies to build 
INTERNAL
   spatialite, and so I've modified -/src/core/CMakeLists.txt
    
=========================================================================

sqlite3.c / spatialite.c require some extra CFLAGS to be set:

 > ADD_DEFINITIONS(-D_LARGE_FILE=1 -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE=1)
is required to support database files > 2 GB on 32 bits systems

 > ADD_DEFINITIONS(-DSQLITE_ENABLE_RTREE=1)
is absolutely required in order to enable RTrees

and I've fixed too:

< INCLUDE_DIRECTORIES(spatialite/headers)
 > INCLUDE_DIRECTORIES(spatialite/headers/spatialite)

in order to avoid any further need to manually adapt
#include "sqlite3ext.h" into the spatialite.c source

----------------
I noticed a second (unneeded ?) manual adaption in the previous
version of the INTERNAL spatialite.c source:

< #ifndef _MSC_VER
#include <localcharset.h>
< #endif

this sounds quite strange to me, because localcharset.h is strictly
required for ICONV-Windows; this header is easily available at:
http://gnuwin32.sourceforge.net/packages/libiconv.htm

The _MSC_VER macro is a typical MSVC marker, so it looks like
some problem arises from this header while compiling on MSVC,
may be in the OSgeo4W build ???
Any further explanationion on this point is welcome.

Anyway I believe it would be by far better avoiding to
introduce any "manual adaption" in the INTERNAL QGis
spatialite.c source,  so to make easier updating this latter
simply replacing the current 'amalgamation' source just as it is.

bye,
Sandro


More information about the Qgis-developer mailing list