Skip to content

Commit b698612

Browse files
committed
[MSSQL] Better fix to removing MZ. Thanks to Nyall ;)
1 parent c793a92 commit b698612

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
@@ -999,8 +999,7 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags )
999999
// Z and M on the end of a WKT string isn't valid for
10001000
// SQL Server so we have to remove it first.
10011001
wkt = geom.exportToWkt();
1002-
wkt = wkt.replace( "Z", "" );
1003-
wkt = wkt.replace( "M", "" );
1002+
wkt.replace(QRegExp("[mzMZ]+\\s*\\("), "(");
10041003
}
10051004
query.addBindValue( wkt );
10061005
}
@@ -1336,9 +1335,7 @@ bool QgsMssqlProvider::changeGeometryValues( const QgsGeometryMap &geometry_map
13361335
QString wkt = it->exportToWkt();
13371336
// Z and M on the end of a WKT string isn't valid for
13381337
// SQL Server so we have to remove it first.
1339-
wkt = wkt.replace( "Z", "" );
1340-
wkt = wkt.replace( "M", "" );
1341-
QgsDebugMsg( wkt );
1338+
wkt.replace(QRegExp("[mzMZ]+\\s*\\("), "(");
13421339
query.addBindValue( wkt );
13431340
}
13441341

0 commit comments

Comments
 (0)