[QGIS Commit] r15280 - in trunk/qgis/src: app/postgres plugins/spit providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Feb 27 14:48:46 EST 2011


Author: jef
Date: 2011-02-27 11:48:46 -0800 (Sun, 27 Feb 2011)
New Revision: 15280

Modified:
   trunk/qgis/src/app/postgres/qgspgnewconnection.cpp
   trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
   trunk/qgis/src/plugins/spit/qgsspit.cpp
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
postgres support: include application_name in connections

Modified: trunk/qgis/src/app/postgres/qgspgnewconnection.cpp
===================================================================
--- trunk/qgis/src/app/postgres/qgspgnewconnection.cpp	2011-02-27 19:46:41 UTC (rev 15279)
+++ trunk/qgis/src/app/postgres/qgspgnewconnection.cpp	2011-02-27 19:48:46 UTC (rev 15280)
@@ -178,7 +178,7 @@
   QString conninfo = uri.connectionInfo();
   QgsDebugMsg( "PQconnectdb(\"" + conninfo + "\");" );
 
-  PGconn *pd = PQconnectdb( conninfo.toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
+  PGconn *pd = PQconnectdb(( conninfo + " application_name='Quantum GIS'" ).toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
   // check the connection status
   if ( PQstatus( pd ) != CONNECTION_OK )
   {
@@ -205,7 +205,7 @@
         uri.setPassword( password );
 
       QgsDebugMsg( "PQconnectdb(\"" + uri.connectionInfo() + "\");" );
-      pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() );
+      pd = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toLocal8Bit() );
     }
 
     if ( PQstatus( pd ) == CONNECTION_OK )

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2011-02-27 19:46:41 UTC (rev 15279)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2011-02-27 19:48:46 UTC (rev 15280)
@@ -164,8 +164,8 @@
 
 void QgsPgSourceSelect::loadClicked()
 {
-  QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections )" ), ".",
-                                                   tr( "XML files (*.xml *XML)" ) );
+  QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections" ), ".",
+                     tr( "XML files (*.xml *XML)" ) );
   if ( fileName.isEmpty() )
   {
     return;
@@ -458,7 +458,7 @@
 
   m_privConnInfo = m_connInfo;
 
-  pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
+  pd = PQconnectdb(( m_privConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() );   // use what is set based on locale; after connecting, use Utf8
   // check the connection status
   if ( PQstatus( pd ) != CONNECTION_OK )
   {
@@ -479,7 +479,7 @@
 
       m_privConnInfo = uri.connectionInfo();
       QgsDebugMsg( "connecting " + m_privConnInfo );
-      pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );
+      pd = PQconnectdb(( m_privConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() );
     }
 
     if ( PQstatus( pd ) == CONNECTION_OK )
@@ -949,7 +949,7 @@
 {
   mStopped = false;
 
-  PGconn *pd = PQconnectdb( mConnInfo.toLocal8Bit() );
+  PGconn *pd = PQconnectdb(( mConnInfo + " application_name='Quantum GIS'" ).toLocal8Bit() );
   if ( PQstatus( pd ) == CONNECTION_OK )
   {
     PQsetClientEncoding( pd, QString( "UNICODE" ).toLocal8Bit() );

Modified: trunk/qgis/src/plugins/spit/qgsspit.cpp
===================================================================
--- trunk/qgis/src/plugins/spit/qgsspit.cpp	2011-02-27 19:46:41 UTC (rev 15279)
+++ trunk/qgis/src/plugins/spit/qgsspit.cpp	2011-02-27 19:48:46 UTC (rev 15280)
@@ -410,7 +410,7 @@
                        password,
                        ( QgsDataSourceURI::SSLmode ) settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() );
 
-    conn = PQconnectdb( uri.connectionInfo().toUtf8() );
+    conn = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toUtf8() );
   }
 
   if ( conn == NULL || PQstatus( conn ) != CONNECTION_OK )

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2011-02-27 19:46:41 UTC (rev 15279)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2011-02-27 19:48:46 UTC (rev 15280)
@@ -213,7 +213,7 @@
 
   QgsDebugMsg( QString( "New postgres connection for " ) + conninfo );
 
-  PGconn *pd = PQconnectdb( conninfo.toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
+  PGconn *pd = PQconnectdb(( conninfo + " application_name='Quantum GIS'" ).toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
   // check the connection status
   if ( PQstatus( pd ) != CONNECTION_OK )
   {
@@ -236,7 +236,7 @@
         uri.setPassword( password );
 
       QgsDebugMsg( "Connecting to " + uri.connectionInfo() );
-      pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() );
+      pd = PQconnectdb(( uri.connectionInfo() + " application_name='Quantum GIS'" ).toLocal8Bit() );
     }
 
     if ( PQstatus( pd ) == CONNECTION_OK )



More information about the QGIS-commit mailing list