Geopackage try to remove optional entries + fix build warnings

This commit is contained in:
Alessandro Pasotti 2017-08-17 20:42:34 +02:00
parent bcd495c693
commit 0eb302d5e8
2 changed files with 20 additions and 2 deletions

View File

@ -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;

View File

@ -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
@ -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();