Skip to content

Commit

Permalink
fix MSSQL extent in geometry table (#42684)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and nyalldawson committed Apr 7, 2021
1 parent 1277b17 commit 36c3473
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 36c3473

Please sign in to comment.