Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
postgres provider: avoid point cloud error
  • Loading branch information
jef-n committed May 12, 2015
1 parent 74f10b9 commit c8aa777
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -393,7 +393,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
}
else if ( i == sctTopoGeometry )
{
if ( ! hasTopology() ) continue;
if ( !hasTopology() )
continue;

schemaName = "l.schema_name";
tableName = "l.table_name";
Expand All @@ -411,7 +412,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
}
else if ( i == sctPcPatch )
{
if ( ! hasPointcloud() ) continue;
if ( !hasPointcloud() )
continue;

tableName = "l.\"table\"";
schemaName = "l.\"schema\"";
Expand Down Expand Up @@ -757,7 +759,6 @@ bool QgsPostgresConn::hasGEOS()
{
// make sure info is up to date for the current connection
postgisVersion();
// get geos capability
return mGeosAvailable;
}

Expand All @@ -768,7 +769,6 @@ bool QgsPostgresConn::hasTopology()
{
// make sure info is up to date for the current connection
postgisVersion();
// get topology capability
return mTopologyAvailable;
}

Expand All @@ -777,9 +777,9 @@ bool QgsPostgresConn::hasTopology()
*/
bool QgsPostgresConn::hasPointcloud()
{
// TODO: use mPointcloudAvailable function instead
QgsPostgresResult result = PQexec( "SELECT 'pointcloud_columns'::regclass" );
return result.PQntuples() == 1;
// make sure info is up to date for the current connection
postgisVersion();
return mPointcloudAvailable;
}

/* Functions for determining available features in postGIS */
Expand Down Expand Up @@ -866,6 +866,9 @@ QString QgsPostgresConn::postgisVersion()

mGotPostgisVersion = true;

result = PQexec( "SELECT 'pointcloud_columns'::regclass", false );
mPointcloudAvailable = result.PQntuples() == 1;

return mPostgisVersionInfo;
}

Expand Down
3 changes: 3 additions & 0 deletions src/providers/postgres/qgspostgresconn.h
Expand Up @@ -359,6 +359,9 @@ class QgsPostgresConn : public QObject
//! PROJ4 capability
bool mProjAvailable;

//! pointcloud support available
bool mPointcloudAvailable;

//! encode wkb in hex
bool mUseWkbHex;

Expand Down

0 comments on commit c8aa777

Please sign in to comment.