Skip to content

Commit dfd0d1f

Browse files
committedJun 23, 2017
[MSSQL] Better fix to removing MZ. Thanks to Nyall ;)
1 parent 53305a8 commit dfd0d1f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎src/providers/mssql/qgsmssqlprovider.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -989,8 +989,7 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
989989
// Z and M on the end of a WKT string isn't valid for
990990
// SQL Server so we have to remove it first.
991991
wkt = geom.exportToWkt();
992-
wkt = wkt.replace( "Z", "" );
993-
wkt = wkt.replace( "M", "" );
992+
wkt.replace(QRegExp("[mzMZ]+\\s*\\("), "(");
994993
}
995994
query.addBindValue( wkt );
996995
}
@@ -1317,9 +1316,7 @@ bool QgsMssqlProvider::changeGeometryValues( const QgsGeometryMap &geometry_map
13171316
QString wkt = it->exportToWkt();
13181317
// Z and M on the end of a WKT string isn't valid for
13191318
// SQL Server so we have to remove it first.
1320-
wkt = wkt.replace( "Z", "" );
1321-
wkt = wkt.replace( "M", "" );
1322-
QgsDebugMsg( wkt );
1319+
wkt.replace(QRegExp("[mzMZ]+\\s*\\("), "(");
13231320
query.addBindValue( wkt );
13241321
}
13251322

0 commit comments

Comments
 (0)
Please sign in to comment.