depend on spatialite_init_ex() for 'new' spatialite initialization (followup 252aaab)

This commit is contained in:
Juergen E. Fischer 2015-05-27 20:45:06 +02:00
parent f67a08aa7e
commit d4b72a2d7b
4 changed files with 11 additions and 7 deletions

View File

@ -220,6 +220,9 @@ ENDIF(SPATIALITE_VERSION_GE_4_0_0)
IF(SPATIALITE_VERSION_G_4_1_1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPATIALITE_VERSION_G_4_1_1")
ENDIF(SPATIALITE_VERSION_G_4_1_1)
IF(SPATIALITE_HAS_INIT_EX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPATIALITE_HAS_INIT_EX")
ENDIF(SPATIALITE_HAS_INIT_EX)
IF (NOT PROJ_FOUND OR NOT GEOS_FOUND OR NOT GDAL_FOUND)
MESSAGE (SEND_ERROR "Some dependencies were not found!")

View File

@ -70,6 +70,7 @@ IF (SPATIALITE_FOUND)
ENDIF(APPLE)
check_library_exists("${SPATIALITE_LIBRARY}" gaiaDropTable "" SPATIALITE_VERSION_GE_4_0_0)
check_library_exists("${SPATIALITE_LIBRARY}" gaiaStatisticsInvalidate "" SPATIALITE_VERSION_G_4_1_1)
check_library_exists("${SPATIALITE_LIBRARY}" spatialite_init_ex "" SPATIALITE_HAS_INIT_EX)
ELSE (SPATIALITE_FOUND)

View File

@ -24,7 +24,7 @@ QHash<sqlite3 *, void *> QgsSLConnect::mSLconns;
int QgsSLConnect::sqlite3_open( const char *filename, sqlite3 **ppDb )
{
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
void *conn = spatialite_alloc_connection();
#else
spatialite_init( 0 );
@ -32,7 +32,7 @@ int QgsSLConnect::sqlite3_open( const char *filename, sqlite3 **ppDb )
int res = ::sqlite3_open( filename, ppDb );
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
if ( res == SQLITE_OK )
{
spatialite_init_ex( *ppDb, conn, 0 );
@ -47,7 +47,7 @@ int QgsSLConnect::sqlite3_close( sqlite3 *db )
{
int res = ::sqlite3_close( db );
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
if ( mSLconns.contains( db ) )
spatialite_cleanup_ex( mSLconns.take( db ) );
#endif
@ -57,7 +57,7 @@ int QgsSLConnect::sqlite3_close( sqlite3 *db )
int QgsSLConnect::sqlite3_open_v2( const char *filename, sqlite3 **ppDb, int flags, const char *zVfs )
{
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
void *conn = spatialite_alloc_connection();
#else
spatialite_init( 0 );
@ -65,7 +65,7 @@ int QgsSLConnect::sqlite3_open_v2( const char *filename, sqlite3 **ppDb, int fla
int res = ::sqlite3_open_v2( filename, ppDb, flags, zVfs );
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
if ( res == SQLITE_OK )
{
spatialite_init_ex( *ppDb, conn, 0 );
@ -80,7 +80,7 @@ int QgsSLConnect::sqlite3_close_v2( sqlite3 *db )
{
int res = ::sqlite3_close( db );
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
if ( mSLconns.contains( db ) )
spatialite_cleanup_ex( mSLconns.take( db ) );
#endif

View File

@ -29,7 +29,7 @@ class CORE_EXPORT QgsSLConnect
static int sqlite3_open_v2( const char *filename, sqlite3 **ppDb, int flags, const char *zVfs );
static int sqlite3_close_v2( sqlite3* );
#if defined(SPATIALITE_VERSION_GE_4_0_0)
#if defined(SPATIALITE_HAS_INIT_EX)
private:
static QHash<sqlite3 *, void *> mSLconns;
#endif