Skip to content
Permalink
Browse files

fix MSSQL extent in geometry table (#42684)

  • Loading branch information
vcloarec authored and nyalldawson committed Apr 7, 2021
1 parent 1277b17 commit 36c34734760061f2bc9d5b5aff24fc825a8c5d65
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/providers/mssql/qgsmssqlprovider.cpp
@@ -2973,8 +2973,11 @@ bool QgsMssqlProvider::getExtentFromGeometryColumns( QgsRectangle &extent ) cons
QSqlQuery query = createQuery();
query.setForwardOnly( true );

QString sql = QStringLiteral( "SELECT qgis_xmin,qgis_xmax,qgis_ymin,qgis_ymax FROM geometry_columns WHERE f_table_name = '%1' AND NOT (qgis_xmin IS NULL OR qgis_xmax IS NULL OR qgis_ymin IS NULL OR qgis_ymax IS NULL)" );
QString statement = sql.arg( mTableName );
QString sql = QStringLiteral( "SELECT qgis_xmin,qgis_xmax,qgis_ymin,qgis_ymax "
"FROM geometry_columns WHERE f_table_name = %1 AND f_table_schema = %2 "
"AND NOT (qgis_xmin IS NULL OR qgis_xmax IS NULL OR qgis_ymin IS NULL OR qgis_ymax IS NULL)" );

QString statement = sql.arg( quotedValue( mTableName ), quotedValue( mSchemaName ) );
if ( query.exec( statement ) && query.isActive() )
{
query.next();

0 comments on commit 36c3473

Please sign in to comment.