Skip to content
Permalink
Browse files

[MSSQL] Remove Z/M from WKT type name on insert/update

SQL Server doesn't follow OGC standard of LINESTRINGZ so we have
to remove it. SQL support LINESTRING(x y z) but not LINESTRINGZ(x y z)
  • Loading branch information
NathanW2 committed Jun 22, 2017
1 parent f196246 commit c793a922e9c29a64c27b3af6794bfa605d27317d
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/providers/mssql/qgsmssqlprovider.cpp
@@ -995,7 +995,13 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags )
{
QString wkt;
if ( !geom.isNull() )
{
// Z and M on the end of a WKT string isn't valid for
// SQL Server so we have to remove it first.
wkt = geom.exportToWkt();
wkt = wkt.replace( "Z", "" );
wkt = wkt.replace( "M", "" );
}
query.addBindValue( wkt );
}
}
@@ -1328,6 +1334,11 @@ bool QgsMssqlProvider::changeGeometryValues( const QgsGeometryMap &geometry_map
else
{
QString wkt = it->exportToWkt();
// Z and M on the end of a WKT string isn't valid for
// SQL Server so we have to remove it first.
wkt = wkt.replace( "Z", "" );
wkt = wkt.replace( "M", "" );
QgsDebugMsg( wkt );
query.addBindValue( wkt );
}

0 comments on commit c793a92

Please sign in to comment.
You can’t perform that action at this time.