Skip to content

Commit c8aa777

Browse files
committedMay 12, 2015
postgres provider: avoid point cloud error
1 parent 74f10b9 commit c8aa777

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed
 

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
393393
}
394394
else if ( i == sctTopoGeometry )
395395
{
396-
if ( ! hasTopology() ) continue;
396+
if ( !hasTopology() )
397+
continue;
397398

398399
schemaName = "l.schema_name";
399400
tableName = "l.table_name";
@@ -411,7 +412,8 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
411412
}
412413
else if ( i == sctPcPatch )
413414
{
414-
if ( ! hasPointcloud() ) continue;
415+
if ( !hasPointcloud() )
416+
continue;
415417

416418
tableName = "l.\"table\"";
417419
schemaName = "l.\"schema\"";
@@ -757,7 +759,6 @@ bool QgsPostgresConn::hasGEOS()
757759
{
758760
// make sure info is up to date for the current connection
759761
postgisVersion();
760-
// get geos capability
761762
return mGeosAvailable;
762763
}
763764

@@ -768,7 +769,6 @@ bool QgsPostgresConn::hasTopology()
768769
{
769770
// make sure info is up to date for the current connection
770771
postgisVersion();
771-
// get topology capability
772772
return mTopologyAvailable;
773773
}
774774

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

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

867867
mGotPostgisVersion = true;
868868

869+
result = PQexec( "SELECT 'pointcloud_columns'::regclass", false );
870+
mPointcloudAvailable = result.PQntuples() == 1;
871+
869872
return mPostgisVersionInfo;
870873
}
871874

‎src/providers/postgres/qgspostgresconn.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ class QgsPostgresConn : public QObject
359359
//! PROJ4 capability
360360
bool mProjAvailable;
361361

362+
//! pointcloud support available
363+
bool mPointcloudAvailable;
364+
362365
//! encode wkb in hex
363366
bool mUseWkbHex;
364367

0 commit comments

Comments
 (0)
Please sign in to comment.