mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
depend on spatialite_init_ex() for 'new' spatialite initialization (followup 252aaab)
This commit is contained in:
parent
f67a08aa7e
commit
d4b72a2d7b
@ -220,6 +220,9 @@ ENDIF(SPATIALITE_VERSION_GE_4_0_0)
|
|||||||
IF(SPATIALITE_VERSION_G_4_1_1)
|
IF(SPATIALITE_VERSION_G_4_1_1)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPATIALITE_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)
|
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)
|
IF (NOT PROJ_FOUND OR NOT GEOS_FOUND OR NOT GDAL_FOUND)
|
||||||
MESSAGE (SEND_ERROR "Some dependencies were not found!")
|
MESSAGE (SEND_ERROR "Some dependencies were not found!")
|
||||||
|
@ -70,6 +70,7 @@ IF (SPATIALITE_FOUND)
|
|||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
check_library_exists("${SPATIALITE_LIBRARY}" gaiaDropTable "" SPATIALITE_VERSION_GE_4_0_0)
|
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}" gaiaStatisticsInvalidate "" SPATIALITE_VERSION_G_4_1_1)
|
||||||
|
check_library_exists("${SPATIALITE_LIBRARY}" spatialite_init_ex "" SPATIALITE_HAS_INIT_EX)
|
||||||
|
|
||||||
ELSE (SPATIALITE_FOUND)
|
ELSE (SPATIALITE_FOUND)
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ QHash<sqlite3 *, void *> QgsSLConnect::mSLconns;
|
|||||||
|
|
||||||
int QgsSLConnect::sqlite3_open( const char *filename, sqlite3 **ppDb )
|
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();
|
void *conn = spatialite_alloc_connection();
|
||||||
#else
|
#else
|
||||||
spatialite_init( 0 );
|
spatialite_init( 0 );
|
||||||
@ -32,7 +32,7 @@ int QgsSLConnect::sqlite3_open( const char *filename, sqlite3 **ppDb )
|
|||||||
|
|
||||||
int res = ::sqlite3_open( filename, 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 )
|
if ( res == SQLITE_OK )
|
||||||
{
|
{
|
||||||
spatialite_init_ex( *ppDb, conn, 0 );
|
spatialite_init_ex( *ppDb, conn, 0 );
|
||||||
@ -47,7 +47,7 @@ int QgsSLConnect::sqlite3_close( sqlite3 *db )
|
|||||||
{
|
{
|
||||||
int res = ::sqlite3_close( db );
|
int res = ::sqlite3_close( db );
|
||||||
|
|
||||||
#if defined(SPATIALITE_VERSION_GE_4_0_0)
|
#if defined(SPATIALITE_HAS_INIT_EX)
|
||||||
if ( mSLconns.contains( db ) )
|
if ( mSLconns.contains( db ) )
|
||||||
spatialite_cleanup_ex( mSLconns.take( db ) );
|
spatialite_cleanup_ex( mSLconns.take( db ) );
|
||||||
#endif
|
#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 )
|
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();
|
void *conn = spatialite_alloc_connection();
|
||||||
#else
|
#else
|
||||||
spatialite_init( 0 );
|
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 );
|
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 )
|
if ( res == SQLITE_OK )
|
||||||
{
|
{
|
||||||
spatialite_init_ex( *ppDb, conn, 0 );
|
spatialite_init_ex( *ppDb, conn, 0 );
|
||||||
@ -80,7 +80,7 @@ int QgsSLConnect::sqlite3_close_v2( sqlite3 *db )
|
|||||||
{
|
{
|
||||||
int res = ::sqlite3_close( db );
|
int res = ::sqlite3_close( db );
|
||||||
|
|
||||||
#if defined(SPATIALITE_VERSION_GE_4_0_0)
|
#if defined(SPATIALITE_HAS_INIT_EX)
|
||||||
if ( mSLconns.contains( db ) )
|
if ( mSLconns.contains( db ) )
|
||||||
spatialite_cleanup_ex( mSLconns.take( db ) );
|
spatialite_cleanup_ex( mSLconns.take( db ) );
|
||||||
#endif
|
#endif
|
||||||
|
@ -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_open_v2( const char *filename, sqlite3 **ppDb, int flags, const char *zVfs );
|
||||||
static int sqlite3_close_v2( sqlite3* );
|
static int sqlite3_close_v2( sqlite3* );
|
||||||
|
|
||||||
#if defined(SPATIALITE_VERSION_GE_4_0_0)
|
#if defined(SPATIALITE_HAS_INIT_EX)
|
||||||
private:
|
private:
|
||||||
static QHash<sqlite3 *, void *> mSLconns;
|
static QHash<sqlite3 *, void *> mSLconns;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user