Skip to content

Commit

Permalink
Geopackage try to remove optional entries + fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 17, 2017
1 parent bcd495c commit 0eb302d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/providers/ogr/qgsgeopackagedataitems.cpp
Expand Up @@ -595,6 +595,24 @@ bool QgsGeoPackageRasterLayerItem::executeDeleteLayer( QString &errCause )
&errmsg /* Error msg written here */
);
sqlite3_free( sql );
// Remove from optional tables, may silently fail
for ( const auto tableName : QStringList()
<< QStringLiteral( "gpkg_extensions" )
<< QStringLiteral( "gpkg_metadata" )
<< QStringLiteral( "gpkg_metadata_reference" ) )
{
char *sql = sqlite3_mprintf( "DELETE FROM table %w WHERE table_name = '%q",
tableName.toUtf8().constData(),
layerName.toUtf8().constData() );
status = sqlite3_exec(
handle, /* An open database */
sql, /* SQL to be evaluated */
NULL, /* Callback function */
NULL, /* 1st argument to callback */
NULL /* Error msg written here */
);
sqlite3_free( sql );
}
if ( status == SQLITE_OK )
{
result = true;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/ogr/qgsgeopackagedataitems.h
Expand Up @@ -76,7 +76,7 @@ class QgsGeoPackageConnectionItem : public QgsDataCollectionItem
#ifdef HAVE_GUI
virtual bool acceptDrop() override { return true; }
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
QList<QAction *> actions();
QList<QAction *> actions() override;
#endif

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

#ifdef HAVE_GUI
virtual QWidget *paramWidget() override;
QList<QAction *> actions();
QList<QAction *> actions() override;

public slots:
void newConnection();
Expand Down

0 comments on commit 0eb302d

Please sign in to comment.