Skip to content

Commit 8fab37c

Browse files
committed
fix vc warnings
1 parent 343696a commit 8fab37c

File tree

2 files changed

+14
-31
lines changed

2 files changed

+14
-31
lines changed

src/providers/spatialite/qgsspatialiteconnection.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,10 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
9595
// only if libspatialite version is >= 4.0.0
9696
// using v.4.0 Abstract Interface
9797
if ( !getTableInfoAbstractInterface( handle, loadGeometrylessTables ) )
98-
{
99-
return FailedToGetTables;
100-
}
101-
closeSpatiaLiteDb( handle );
102-
return NoError;
103-
#endif
104-
105-
// obsolete library: still using the traditional approach
98+
#else
99+
// obsolete library: still using the traditional approach
106100
if ( !getTableInfo( handle, loadGeometrylessTables ) )
101+
#endif
107102
{
108103
return FailedToGetTables;
109104
}

src/providers/spatialite/qgsspatialiteprovider.cpp

+11-23
Original file line numberDiff line numberDiff line change
@@ -5182,36 +5182,24 @@ QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QS
51825182
return false;
51835183
}
51845184
sqlite3* sqlite_handle = hndl->handle();
5185-
5185+
int ret;
51865186
#ifdef SPATIALITE_VERSION_GE_4_0_0
51875187
// only if libspatialite version is >= 4.0.0
5188+
// if libspatialite is v.4.0 (or higher) using the internal library
5189+
// method is highly recommended
5190+
if ( !gaiaDropTable( sqlite_handle, tableName.toUtf8().constData() ) )
51885191
{
5189-
// if libspatialite is v.4.0 (or higher) using the internal library
5190-
// method is highly recommended
5191-
if ( !gaiaDropTable( sqlite_handle, tableName.toUtf8().constData() ) )
5192-
{
5193-
// unexpected error
5194-
errCause = QObject::tr( "Unable to delete table %1\n" ).arg( tableName );
5195-
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
5196-
return false;
5197-
}
5198-
// run VACUUM to free unused space and compact the database
5199-
int ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, NULL );
5200-
if ( ret != SQLITE_OK )
5201-
{
5202-
QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath );
5203-
}
5192+
// unexpected error
5193+
errCause = QObject::tr( "Unable to delete table %1\n" ).arg( tableName );
52045194
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
5205-
return true;
5195+
return false;
52065196
}
5207-
#endif
5208-
5197+
#else
52095198
// drop the table
5210-
52115199
QString sql = QString( "DROP TABLE " ) + QgsSpatiaLiteProvider::quotedIdentifier( tableName );
52125200
QgsDebugMsg( sql );
52135201
char *errMsg = NULL;
5214-
int ret = sqlite3_exec( sqlite_handle, sql.toUtf8().constData(), NULL, NULL, &errMsg );
5202+
ret = sqlite3_exec( sqlite_handle, sql.toUtf8().constData(), NULL, NULL, &errMsg );
52155203
if ( ret != SQLITE_OK )
52165204
{
52175205
errCause = QObject::tr( "Unable to delete table %1:\n" ).arg( tableName );
@@ -5229,11 +5217,11 @@ QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QS
52295217
{
52305218
QgsDebugMsg( "sqlite error: " + QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) ) );
52315219
}
5220+
#endif
52325221

52335222
// TODO: remove spatial indexes?
5234-
52355223
// run VACUUM to free unused space and compact the database
5236-
ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, &errMsg );
5224+
ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, NULL );
52375225
if ( ret != SQLITE_OK )
52385226
{
52395227
QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath );

0 commit comments

Comments
 (0)