Skip to content

Commit 612d41d

Browse files
author
jef
committed
postgres support: include application_name in connections
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15280 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 58c1711 commit 612d41d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/app/postgres/qgspgnewconnection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void QgsPgNewConnection::testConnection()
178178
QString conninfo = uri.connectionInfo();
179179
QgsDebugMsg( "PQconnectdb(\"" + conninfo + "\");" );
180180

181-
PGconn *pd = PQconnectdb( conninfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
181+
PGconn *pd = PQconnectdb(( conninfo + " application_name='Quantum GIS'" ).toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
182182
// check the connection status
183183
if ( PQstatus( pd ) != CONNECTION_OK )
184184
{
@@ -205,7 +205,7 @@ void QgsPgNewConnection::testConnection()
205205
uri.setPassword( password );
206206

207207
QgsDebugMsg( "PQconnectdb(\"" + uri.connectionInfo() + "\");" );
208-
pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() );
208+
pd = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toLocal8Bit() );
209209
}
210210

211211
if ( PQstatus( pd ) == CONNECTION_OK )

src/app/postgres/qgspgsourceselect.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ void QgsPgSourceSelect::saveClicked()
164164

165165
void QgsPgSourceSelect::loadClicked()
166166
{
167-
QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections )" ), ".",
168-
tr( "XML files (*.xml *XML)" ) );
167+
QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections" ), ".",
168+
tr( "XML files (*.xml *XML)" ) );
169169
if ( fileName.isEmpty() )
170170
{
171171
return;
@@ -458,7 +458,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
458458

459459
m_privConnInfo = m_connInfo;
460460

461-
pd = PQconnectdb( m_privConnInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
461+
pd = PQconnectdb(( m_privConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
462462
// check the connection status
463463
if ( PQstatus( pd ) != CONNECTION_OK )
464464
{
@@ -479,7 +479,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
479479

480480
m_privConnInfo = uri.connectionInfo();
481481
QgsDebugMsg( "connecting " + m_privConnInfo );
482-
pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );
482+
pd = PQconnectdb(( m_privConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() );
483483
}
484484

485485
if ( PQstatus( pd ) == CONNECTION_OK )
@@ -949,7 +949,7 @@ void QgsGeomColumnTypeThread::getLayerTypes()
949949
{
950950
mStopped = false;
951951

952-
PGconn *pd = PQconnectdb( mConnInfo.toLocal8Bit() );
952+
PGconn *pd = PQconnectdb(( mConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() );
953953
if ( PQstatus( pd ) == CONNECTION_OK )
954954
{
955955
PQsetClientEncoding( pd, QString( "UNICODE" ).toLocal8Bit() );

src/plugins/spit/qgsspit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ void QgsSpit::dbConnect()
410410
password,
411411
( QgsDataSourceURI::SSLmode ) settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() );
412412

413-
conn = PQconnectdb( uri.connectionInfo().toUtf8() );
413+
conn = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toUtf8() );
414414
}
415415

416416
if ( conn == NULL || PQstatus( conn ) != CONNECTION_OK )

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ QgsPostgresProvider::Conn *QgsPostgresProvider::Conn::connectDb( const QString &
213213

214214
QgsDebugMsg( QString( "New postgres connection for " ) + conninfo );
215215

216-
PGconn *pd = PQconnectdb( conninfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
216+
PGconn *pd = PQconnectdb(( conninfo + " application_name='Quantum GIS'" ).toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
217217
// check the connection status
218218
if ( PQstatus( pd ) != CONNECTION_OK )
219219
{
@@ -236,7 +236,7 @@ QgsPostgresProvider::Conn *QgsPostgresProvider::Conn::connectDb( const QString &
236236
uri.setPassword( password );
237237

238238
QgsDebugMsg( "Connecting to " + uri.connectionInfo() );
239-
pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() );
239+
pd = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toLocal8Bit() );
240240
}
241241

242242
if ( PQstatus( pd ) == CONNECTION_OK )

0 commit comments

Comments
 (0)