@@ -86,7 +86,7 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Ca
86
86
87
87
if ( !mShared ->mURI .sql ().isEmpty () )
88
88
{
89
- if ( !processSQL ( mShared ->mURI .sql (), mProcessSQLErrorMsg ) )
89
+ if ( !processSQL ( mShared ->mURI .sql (), mProcessSQLErrorMsg , mProcessSQLWarningMsg ) )
90
90
{
91
91
QgsMessageLog::logMessage ( mProcessSQLErrorMsg , tr ( " WFS" ) );
92
92
mValid = false ;
@@ -270,10 +270,11 @@ void QgsWFSProviderSQLColumnRefValidator::visit( const QgsSQLStatement::NodeColu
270
270
}
271
271
272
272
273
- bool QgsWFSProvider::processSQL ( const QString& sqlString, QString& errorMsg )
273
+ bool QgsWFSProvider::processSQL ( const QString& sqlString, QString& errorMsg, QString& warningMsg )
274
274
{
275
275
QgsDebugMsg ( QString ( " Processing SQL: %1" ).arg ( sqlString ) );
276
276
errorMsg.clear ();
277
+ warningMsg.clear ();
277
278
QgsSQLStatement sql ( sqlString );
278
279
if ( sql.hasParserError () )
279
280
{
@@ -557,8 +558,17 @@ bool QgsWFSProvider::processSQL( const QString& sqlString, QString& errorMsg )
557
558
}
558
559
}
559
560
}
561
+ // Geometry field
562
+ else if ( mapTypenameToGeometryAttribute[columnTableTypename] == columnRef->name () )
563
+ {
564
+ if ( columnTableTypename != mShared ->mURI .typeName () )
565
+ {
566
+ warningMsg = tr ( " The geometry field of a typename that is not the main typename is ignored in the selected fields" );
567
+ QgsDebugMsg ( warningMsg );
568
+ }
569
+ }
560
570
// Regular field
561
- else if ( mapTypenameToGeometryAttribute[columnTableTypename] != columnRef-> name () )
571
+ else
562
572
{
563
573
const QgsFields tableFields = mapTypenameToFields[columnTableTypename];
564
574
int idx = tableFields.fieldNameIndex ( columnRef->name () );
@@ -633,8 +643,8 @@ bool QgsWFSProvider::setSubsetString( const QString& theSQL, bool updateFeatureC
633
643
mShared ->mDistinctSelect = false ;
634
644
if ( theSQL.startsWith ( " SELECT " , Qt::CaseInsensitive ) )
635
645
{
636
- QString errorMsg;
637
- if ( !processSQL ( theSQL, errorMsg ) )
646
+ QString errorMsg, warningMsg ;
647
+ if ( !processSQL ( theSQL, errorMsg, warningMsg ) )
638
648
{
639
649
QgsMessageLog::logMessage ( errorMsg, tr ( " WFS" ) );
640
650
return false ;
0 commit comments