Skip to content

Commit 0eb302d

Browse files
committed
Geopackage try to remove optional entries + fix build warnings
1 parent bcd495c commit 0eb302d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/providers/ogr/qgsgeopackagedataitems.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,24 @@ bool QgsGeoPackageRasterLayerItem::executeDeleteLayer( QString &errCause )
595595
&errmsg /* Error msg written here */
596596
);
597597
sqlite3_free( sql );
598+
// Remove from optional tables, may silently fail
599+
for ( const auto tableName : QStringList()
600+
<< QStringLiteral( "gpkg_extensions" )
601+
<< QStringLiteral( "gpkg_metadata" )
602+
<< QStringLiteral( "gpkg_metadata_reference" ) )
603+
{
604+
char *sql = sqlite3_mprintf( "DELETE FROM table %w WHERE table_name = '%q",
605+
tableName.toUtf8().constData(),
606+
layerName.toUtf8().constData() );
607+
status = sqlite3_exec(
608+
handle, /* An open database */
609+
sql, /* SQL to be evaluated */
610+
NULL, /* Callback function */
611+
NULL, /* 1st argument to callback */
612+
NULL /* Error msg written here */
613+
);
614+
sqlite3_free( sql );
615+
}
598616
if ( status == SQLITE_OK )
599617
{
600618
result = true;

src/providers/ogr/qgsgeopackagedataitems.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class QgsGeoPackageConnectionItem : public QgsDataCollectionItem
7676
#ifdef HAVE_GUI
7777
virtual bool acceptDrop() override { return true; }
7878
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
79-
QList<QAction *> actions();
79+
QList<QAction *> actions() override;
8080
#endif
8181

8282
//! Return the layer type from \a geometryType
@@ -106,7 +106,7 @@ class QgsGeoPackageRootItem : public QgsDataCollectionItem
106106

107107
#ifdef HAVE_GUI
108108
virtual QWidget *paramWidget() override;
109-
QList<QAction *> actions();
109+
QList<QAction *> actions() override;
110110

111111
public slots:
112112
void newConnection();

0 commit comments

Comments
 (0)