Skip to content

Commit

Permalink
postgres provider: fix b85af12
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 14, 2013
1 parent 38d63d1 commit 0caf665
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2640,8 +2640,13 @@ bool QgsPostgresProvider::getGeometryDetails()
}
}

if ( QgsPostgresConn::wkbTypeFromPostgis( detectedType ) == QGis::WKBUnknown )
mDetectedGeomType = QgsPostgresConn::wkbTypeFromPostgis( detectedType );
mDetectedSrid = detectedSrid;

if ( mDetectedGeomType == QGis::WKBUnknown )
{
mDetectedSrid = "";

QgsPostgresLayerProperty layerProperty;
if ( !mIsQuery )
{
Expand Down Expand Up @@ -2675,9 +2680,6 @@ bool QgsPostgresProvider::getGeometryDetails()
{
QgsMessageLog::logMessage( tr( "Geometry type and srid for empty column %1 of %2 undefined." ).arg( mGeometryColumn ).arg( mQuery ) );
}

detectedType = "";
detectedSrid = "";
}
else
{
Expand All @@ -2697,29 +2699,18 @@ bool QgsPostgresProvider::getGeometryDetails()
if ( layerProperty.size() == 1 )
{
// only what we requested is available
detectedType = layerProperty.types[ 0 ];
detectedSrid = layerProperty.srids[ 0 ];
}
else
{
// we need to filter
detectedType = "";
detectedSrid = "";
mDetectedGeomType = layerProperty.types[ 0 ];
mDetectedSrid = QString::number( layerProperty.srids[ 0 ] );
}
}
else
{
// geometry type undetermined or not unrequested
QgsMessageLog::logMessage( tr( "Feature type or srid for %1 of %2 could not be determined or was not requested." ).arg( mGeometryColumn ).arg( mQuery ) );
detectedType = "";
detectedSrid = "";
}
}
}

mDetectedGeomType = QgsPostgresConn::wkbTypeFromPostgis( detectedType );
mDetectedSrid = detectedSrid;

QgsDebugMsg( QString( "Detected SRID is %1" ).arg( mDetectedSrid ) );
QgsDebugMsg( QString( "Requested SRID is %1" ).arg( mRequestedSrid ) );
QgsDebugMsg( QString( "Detected type is %1" ).arg( mDetectedGeomType ) );
Expand Down

0 comments on commit 0caf665

Please sign in to comment.