mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
fix SL provider (follow 90972db78a):
fix build linking SL < v4, fix SL4 database version check, rename SPATIALITE_RECENT_VERSION macro to the more significant SPATIALITE_VERSION_GE_4_0_0,
This commit is contained in:
parent
de3ea74ab6
commit
ce31f37d8e
@ -64,7 +64,7 @@ IF (SPATIALITE_FOUND)
|
||||
ENDIF (NOT SPATIALITE_FIND_QUIETLY)
|
||||
|
||||
# Check for symbol gaiaDropTable
|
||||
check_library_exists("${SPATIALITE_LIBRARY}" gaiaDropTable "" SPATIALITE_RECENT_VERSION)
|
||||
check_library_exists("${SPATIALITE_LIBRARY}" gaiaDropTable "" SPATIALITE_VERSION_GE_4_0_0)
|
||||
|
||||
ELSE (SPATIALITE_FOUND)
|
||||
|
||||
|
@ -24,9 +24,9 @@ SET(SPATIALITE_MOC_HDRS
|
||||
|
||||
QT4_WRAP_CPP(SPATIALITE_MOC_SRCS ${SPATIALITE_MOC_HDRS})
|
||||
|
||||
IF(SPATIALITE_RECENT_VERSION)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPATIALITE_RECENT_VERSION")
|
||||
ENDIF(SPATIALITE_RECENT_VERSION)
|
||||
IF(SPATIALITE_VERSION_GE_4_0_0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPATIALITE_VERSION_GE_4_0_0")
|
||||
ENDIF(SPATIALITE_VERSION_GE_4_0_0)
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
@ -79,7 +79,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
|
||||
}
|
||||
|
||||
bool recentVersion = false;
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
recentVersion = true;
|
||||
#endif
|
||||
@ -91,7 +91,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
|
||||
return FailedToCheckMetadata;
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
// using v.4.0 Abstract Interface
|
||||
if ( !getTableInfoAbstractInterface( handle, loadGeometrylessTables ) )
|
||||
@ -114,6 +114,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
|
||||
|
||||
bool QgsSpatiaLiteConnection::updateStatistics()
|
||||
{
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
QFileInfo fi( mPath );
|
||||
if ( !fi.exists() )
|
||||
{
|
||||
@ -126,17 +127,14 @@ bool QgsSpatiaLiteConnection::updateStatistics()
|
||||
return false;
|
||||
}
|
||||
|
||||
// checking the library version
|
||||
bool recentVersion = false;
|
||||
const char *version = spatialite_version();
|
||||
if ( isdigit( *version ) && *version >= '4' )
|
||||
recentVersion = true;
|
||||
|
||||
bool ret = update_layer_statistics( handle, NULL, NULL );
|
||||
|
||||
closeSpatiaLiteDb( handle );
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
sqlite3 *QgsSpatiaLiteConnection::openSpatiaLiteDb( QString path )
|
||||
@ -251,7 +249,7 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle )
|
||||
sqlite3_free_table( results );
|
||||
if ( srsSrid && authName && authSrid && refSysName && proj4text )
|
||||
rsSpatiaLite = true;
|
||||
if ( srsSrid && authName && authSrid && refSysName && proj4text )
|
||||
if ( srsSrid && authName && authSrid && refSysName && proj4text && srtext )
|
||||
rsSpatiaLite4 = true;
|
||||
|
||||
// OK, this one seems to be a valid SpatiaLite DB
|
||||
@ -274,7 +272,7 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, bool loadGeometrylessTables )
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ class QgsSpatiaLiteConnection : public QObject
|
||||
/**Inserts information about the spatial tables into mTables*/
|
||||
bool getTableInfo( sqlite3 * handle, bool loadGeometrylessTables );
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
/**
|
||||
Inserts information about the spatial tables into mTables
|
||||
|
@ -437,7 +437,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
|
||||
bool alreadyDone = false;
|
||||
bool ret;
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
gaiaVectorLayersListPtr list = NULL;
|
||||
gaiaVectorLayerPtr lyr = NULL;
|
||||
@ -497,7 +497,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
|
||||
|
||||
alreadyDone = false;
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
if ( lyr != NULL )
|
||||
{
|
||||
// using the v.4.0 AbstractInterface
|
||||
@ -571,7 +571,7 @@ QgsSpatiaLiteProvider::~QgsSpatiaLiteProvider()
|
||||
closeDb();
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr )
|
||||
{
|
||||
@ -4362,7 +4362,7 @@ QString QgsSpatiaLiteProvider::quotedValue( QString value )
|
||||
return value.prepend( "'" ).append( "'" );
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr lyr )
|
||||
{
|
||||
@ -4589,7 +4589,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
|
||||
return count == 1;
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
bool QgsSpatiaLiteProvider::getGeometryDetailsAbstractInterface( gaiaVectorLayerPtr lyr )
|
||||
{
|
||||
@ -5125,7 +5125,7 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
bool QgsSpatiaLiteProvider::getTableSummaryAbstractInterface( gaiaVectorLayerPtr lyr )
|
||||
{
|
||||
@ -5363,7 +5363,7 @@ QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QS
|
||||
}
|
||||
sqlite3* sqlite_handle = hndl->handle();
|
||||
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
{
|
||||
// if libspatialite is v.4.0 (or higher) using the internal library
|
||||
|
@ -409,7 +409,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
|
||||
bool getQueryGeometryDetails();
|
||||
bool getSridDetails();
|
||||
bool getTableSummary();
|
||||
#ifdef SPATIALITE_RECENT_VERSION
|
||||
#ifdef SPATIALITE_VERSION_GE_4_0_0
|
||||
// only if libspatialite version is >= 4.0.0
|
||||
bool checkLayerTypeAbstractInterface( gaiaVectorLayerPtr lyr );
|
||||
bool getGeometryDetailsAbstractInterface( gaiaVectorLayerPtr lyr );
|
||||
|
Loading…
x
Reference in New Issue
Block a user