Skip to content

Commit b2cfe0b

Browse files
committedFeb 8, 2015
postgres provider: show notices
1 parent a264a27 commit b2cfe0b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ QgsPostgresConn *QgsPostgresConn::connectDb( QString conninfo, bool readonly, bo
164164
return conn;
165165
}
166166

167+
static void noticeProcessor( void *arg, const char *message )
168+
{
169+
Q_UNUSED( arg );
170+
QString msg( QString::fromUtf8( message ) );
171+
msg.chop( 1 );
172+
QgsMessageLog::logMessage( QObject::tr( "NOTICE: %1" ).arg( msg ), QObject::tr( "PostGIS" ) );
173+
}
174+
167175
QgsPostgresConn::QgsPostgresConn( QString conninfo, bool readOnly, bool shared, bool transaction )
168176
: mRef( 1 )
169177
, mOpenCursors( 0 )
@@ -268,6 +276,8 @@ QgsPostgresConn::QgsPostgresConn( QString conninfo, bool readOnly, bool shared,
268276
{
269277
QgsDebugMsg( "Topology support available!" );
270278
}
279+
280+
PQsetNoticeProcessor( mConn, noticeProcessor, 0 );
271281
}
272282

273283
QgsPostgresConn::~QgsPostgresConn()

0 commit comments

Comments
 (0)
Please sign in to comment.