Skip to content
Permalink
Browse files

fix MSSQL extent in geometry table (#42684)

  • Loading branch information
vcloarec committed Apr 7, 2021
1 parent e58a8c6 commit 1c2bac0becce007dbdc91f6f1a91c943c8593764
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 1c2bac0

Please sign in to comment.