Skip to content

Commit

Permalink
postgres provider: restore behaviour to keep 3d wkb (refs #9651,
Browse files Browse the repository at this point in the history
followup bd311c8)
  • Loading branch information
jef-n authored and Sandro Santilli committed Mar 4, 2015
1 parent c5ce267 commit c7234ce
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -454,13 +454,15 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
srid = INT_MIN; srid = INT_MIN;
} }


/*QgsDebugMsg( QString( "%1 : %2.%3.%4: %5 %6 %7 %8" ) #if 0
QgsDebugMsg( QString( "%1 : %2.%3.%4: %5 %6 %7 %8" )
.arg( gtableName ) .arg( gtableName )
.arg( schemaName ).arg( tableName ).arg( column ) .arg( schemaName ).arg( tableName ).arg( column )
.arg( type ) .arg( type )
.arg( srid ) .arg( srid )
.arg( relkind ) .arg( relkind )
.arg( dim ) );*/ .arg( dim ) );
#endif


layerProperty.schemaName = schemaName; layerProperty.schemaName = schemaName;
layerProperty.tableName = tableName; layerProperty.tableName = tableName;
Expand All @@ -470,11 +472,11 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
layerProperty.srids = QList<int>() << srid; layerProperty.srids = QList<int>() << srid;
layerProperty.sql = ""; layerProperty.sql = "";
/* /*
* NOTE: force2d may get a false negative value * force2d may get a false negative value
* (dim == 2 but is not really constrained) * (dim == 2 but is not really constrained)
* http://trac.osgeo.org/postgis/ticket/3068 * http://trac.osgeo.org/postgis/ticket/3068
*/ */
layerProperty.force2d = dim > 2; layerProperty.force2d = dim > 3;
addColumnInfo( layerProperty, schemaName, tableName, isView ); addColumnInfo( layerProperty, schemaName, tableName, isView );


if ( isView && layerProperty.pkCols.empty() ) if ( isView && layerProperty.pkCols.empty() )
Expand Down Expand Up @@ -1304,10 +1306,9 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
query += QString::number( srid ); query += QString::number( srid );
} }


if ( ! layerProperty.force2d ) if ( !layerProperty.force2d )
{ {
query += ","; query += QString( ",%1(%2%3)" )
query += QString( "%1(%2%3)" )
.arg( majorVersion() < 2 ? "ndims" : "st_ndims" ) .arg( majorVersion() < 2 ? "ndims" : "st_ndims" )
.arg( quotedIdentifier( layerProperty.geometryColName ) ) .arg( quotedIdentifier( layerProperty.geometryColName ) )
.arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" ); .arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" );
Expand All @@ -1326,10 +1327,9 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
QString type = gresult.PQgetvalue( i, 0 ); QString type = gresult.PQgetvalue( i, 0 );
QString srid = gresult.PQgetvalue( i, 1 ); QString srid = gresult.PQgetvalue( i, 1 );


if ( ! layerProperty.force2d ) if ( !layerProperty.force2d && gresult.PQgetvalue( i, 2 ).toInt() > 3 )
{ {
QString ndims = gresult.PQgetvalue( i, 2 ); layerProperty.force2d = true;
if ( ndims.toInt() > 2 ) layerProperty.force2d = true;
} }


if ( type.isEmpty() ) if ( type.isEmpty() )
Expand Down

0 comments on commit c7234ce

Please sign in to comment.