[QGIS Commit] r12795 - trunk/qgis/src/app/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jan 19 07:43:17 EST 2010


Author: jef
Date: 2010-01-19 07:43:17 -0500 (Tue, 19 Jan 2010)
New Revision: 12795

Modified:
   trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
   trunk/qgis/src/app/postgres/qgspgsourceselect.h
Log:
pass password on to geometry type detection thread

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2010-01-18 22:42:17 UTC (rev 12794)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2010-01-19 12:43:17 UTC (rev 12795)
@@ -321,7 +321,7 @@
     }
   }
 
-  QString uri = m_connectionInfo;
+  QString uri = m_connInfo;
 
   if ( !pkColumnName.isEmpty() )
   {
@@ -400,13 +400,15 @@
 
   QgsDebugMsg( "Connection info: " + uri.connectionInfo() );
 
-  m_connectionInfo = uri.connectionInfo();
-  //qDebug(m_connectionInfo);
+  m_connInfo = uri.connectionInfo();
+
   // Tidy up an existing connection if one exists.
   if ( pd != 0 )
     PQfinish( pd );
 
-  pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
+  m_privConnInfo = m_connInfo;
+
+  pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );  // use what is set based on locale; after connecting, use Utf8
   // check the connection status
   if ( PQstatus( pd ) != CONNECTION_OK && QString::fromUtf8( PQerrorMessage( pd ) ) == PQnoPasswordSupplied )
   {
@@ -419,7 +421,7 @@
                                         tr( "Enter password" ),
                                         tr( "Error: %1Enter password for %2" )
                                         .arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
-                                        .arg( uri.connectionInfo() ),
+                                        .arg( m_connInfo ),
                                         QLineEdit::Password,
                                         password,
                                         &ok );
@@ -429,7 +431,8 @@
       if ( !ok )
         break;
 
-      pd = PQconnectdb( QString( "%1 password='%2'" ).arg( uri.connectionInfo() ).arg( password ).toLocal8Bit() );
+      m_privConnInfo = QString( "%1 password='%2'" ).arg( m_connInfo ).arg( password );
+      pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );
     }
   }
 
@@ -497,7 +500,7 @@
 
 QString QgsPgSourceSelect::connectionInfo()
 {
-  return m_connectionInfo;
+  return m_connInfo;
 }
 
 void QgsPgSourceSelect::setSql( const QModelIndex &index )
@@ -533,7 +536,7 @@
   if ( mColumnTypeThread == NULL )
   {
     mColumnTypeThread = new QgsGeomColumnTypeThread();
-    mColumnTypeThread->setConnInfo( m_connectionInfo );
+    mColumnTypeThread->setConnInfo( m_privConnInfo );
   }
   mColumnTypeThread->addGeometryColumn( schema, table, column );
 }

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.h
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.h	2010-01-18 22:42:17 UTC (rev 12794)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.h	2010-01-19 12:43:17 UTC (rev 12795)
@@ -175,7 +175,8 @@
     QStringList mColumnLabels;
     // Our thread for doing long running queries
     QgsGeomColumnTypeThread* mColumnTypeThread;
-    QString m_connectionInfo;
+    QString m_connInfo;
+    QString m_privConnInfo;
     QStringList m_selectedTables;
     // Storage for the range of layer type icons
     QMap<QString, QPair<QString, QIcon> > mLayerIcons;



More information about the QGIS-commit mailing list